projects
/
citadel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
AUTH PLAIN: second try.
[citadel.git]
/
citadel
/
modules
/
imap
/
serv_imap.c
diff --git
a/citadel/modules/imap/serv_imap.c
b/citadel/modules/imap/serv_imap.c
index 4b3e146cef6f40ef696311400cf4627811fe8f28..d33e66ee65ef2ce885e7a4338b2bb5d0a317834c 100644
(file)
--- a/
citadel/modules/imap/serv_imap.c
+++ b/
citadel/modules/imap/serv_imap.c
@@
-708,26
+708,36
@@
void imap_auth_plain(void)
char user[256] = "";
char pass[256] = "";
int result;
char user[256] = "";
char pass[256] = "";
int result;
+ long decoded_len;
long len;
memset(pass, 0, sizeof(pass));
long len;
memset(pass, 0, sizeof(pass));
- len = StrBufDecodeBase64(Imap->Cmd.CmdBuf);
+
decoded_
len = StrBufDecodeBase64(Imap->Cmd.CmdBuf);
- if (len > 0)
+ if (
decoded_
len > 0)
{
decoded_authstring = ChrPtr(Imap->Cmd.CmdBuf);
len = safestrncpy(ident, decoded_authstring, sizeof ident);
{
decoded_authstring = ChrPtr(Imap->Cmd.CmdBuf);
len = safestrncpy(ident, decoded_authstring, sizeof ident);
+ decoded_len -= len - 1;
decoded_authstring += len + 1;
decoded_authstring += len + 1;
- len = safestrncpy(user, decoded_authstring, sizeof user);
+ if (decoded_len > 0)
+ {
+ len = safestrncpy(user, decoded_authstring, sizeof user);
- decoded_authstring += len + 1;
+ decoded_authstring += len + 1;
+ decoded_len -= len - 1;
+ }
- len = safestrncpy(pass, decoded_authstring, sizeof pass);
- if (len < 0)
- len = sizeof(pass) - 1;
+ if (decoded_len > 0)
+ {
+ len = safestrncpy(pass, decoded_authstring, sizeof pass);
+
+ if (len < 0)
+ len = sizeof(pass) - 1;
+ }
}
Imap->authstate = imap_as_normal;
}
Imap->authstate = imap_as_normal;