/* get initial (empty) challenge */
if (challenge = (*challenger) (stream,&clen)) {
fs_give ((void **) &challenge);
- if (clen) { /* abort if challenge non-empty */
- mm_log ("auth_plain_client : Server bug: non-empty initial PLAIN challenge 1",WARN);
- (*responder) (stream,NIL,0);
- ret = LONGT; /* will get a BAD response back */
- }
pwd[0] = NIL; /* prompt user if empty challenge */
mm_login (mb,user,pwd,*trial);
*trial = 0; /* cancel subsequent attempts */
ret = LONGT; /* will get a BAD response back */
}
+
+ else if ((*responder) (stream,user,strlen (user)) &&
+ (challenge = (*challenger) (stream,&clen))) {
+ fs_give ((void **) &challenge);
+ /* send password */
+ if ((*responder) (stream,pwd,strlen (pwd))) {
+ if (challenge = (*challenger) (stream,&clen))
+ fs_give ((void **) &challenge);
+ else {
+ ++*trial; /* can try again if necessary */
+ ret = LONGT; /* check the authentication */
+ }
+ }
+ }
+
else {
unsigned long rlen =
strlen (mb->authuser) + strlen (user) + strlen (pwd) + 2;
fs_give ((void **) &response);
}
}
- else // [ Written by Kyuho Jo for AOL 2010/02/16
+ else
{
mm_log ("Enter section for handling emtpy challenge",WARN);
- if (clen)
- { /* abort if challenge non-empty */
- mm_log ("auth_plain_client : Server bug: non-empty initial PLAIN challenge 2",WARN);
- (*responder) (stream,NIL,0);
- ret = LONGT; /* will get a BAD response back */
- }
pwd[0] = NIL; /* prompt user if empty challenge */
mm_login (mb,user,pwd,*trial);
fs_give ((void **) &challenge);
else
{
- mm_log ("Second emtpy challege ",WARN);
+ mm_log ("Second empty challege ",WARN);
++*trial; /* can try again if necessary */
ret = LONGT; /* check the authentication */
}
fs_give ((void **) &response);
}
- } // ] Written by Kyuho Jo for AOL 2010/02/16
+ }
memset (pwd,0,MAILTMPLEN); /* erase password */
if (!ret) *trial = 65535; /* don't retry if bad protocol */