- CtdlDecodeBase64(buf, cmd, SIZ);
- CtdlLoginExistingUser(NULL, buf);
- CtdlEncodeBase64(buf, "Password:", 9, 0);
- cprintf("+ %s\r\n", buf);
- IMAP->authstate = imap_as_expecting_password;
- return;
+ switch (state){
+ case imap_as_expecting_username:
+ CtdlDecodeBase64(buf, cmd, SIZ);
+ CtdlLoginExistingUser(NULL, buf);
+ CtdlEncodeBase64(buf, "Password:", 9, 0);
+ cprintf("+ %s\r\n", buf);
+
+ IMAP->authstate = imap_as_expecting_password;
+ return;
+ case imap_as_expecting_multilineusername:
+ extract_token(buf, cmd, 1, ' ', sizeof(buf));
+ CtdlLoginExistingUser(NULL, cmd);
+ cprintf("+ go ahead\r\n");
+ IMAP->authstate = imap_as_expecting_multilinepassword;
+ return;
+ }