projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
128563f
)
more places to fix the new linebreak behaviour of the base64 encoder.
author
Wilfried Goesgens
<dothebart@citadel.org>
Mon, 22 Dec 2014 19:15:48 +0000
(20:15 +0100)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Mon, 22 Dec 2014 19:15:48 +0000
(20:15 +0100)
citadel/modules/dspam/serv_dspam.c
patch
|
blob
|
history
citadel/modules/imap/serv_imap.c
patch
|
blob
|
history
citadel/modules/managesieve/serv_managesieve.c
patch
|
blob
|
history
citadel/modules/smtp/serv_smtp.c
patch
|
blob
|
history
citadel/modules/smtp/smtp_clienthandlers.c
patch
|
blob
|
history
webcit/sieve.c
patch
|
blob
|
history
diff --git
a/citadel/modules/dspam/serv_dspam.c
b/citadel/modules/dspam/serv_dspam.c
index 28a9a8d742804f510ced72809e1986581d768237..7454634f780cd040d428ae9e9543fa9da0d41aa7 100644
(file)
--- a/
citadel/modules/dspam/serv_dspam.c
+++ b/
citadel/modules/dspam/serv_dspam.c
@@
-167,9
+167,13
@@
void dspam_do_msg(long msgnum, void *userdata)
else
{
/* Copy to a safe place */
else
{
/* Copy to a safe place */
-
+ // TODO: len -> cm_fields?
msg->cm_fields[eErrorMsg] = malloc (CTX->signature->length * 2);
msg->cm_fields[eErrorMsg] = malloc (CTX->signature->length * 2);
- CtdlEncodeBase64(msg->cm_fields[eErrorMsg], CTX->signature->data, CTX->signature->length, 0);
+ size_t len = CtdlEncodeBase64(msg->cm_fields[eErrorMsg], CTX->signature->data, CTX->signature->length, 0);
+
+ if (msg->cm_fields[eErrorMsg][len - 1] == '\n') {
+ msg->cm_fields[eErrorMsg][len - 1] = '\0';
+ }
}
free(msgtext);
}
free(msgtext);
diff --git
a/citadel/modules/imap/serv_imap.c
b/citadel/modules/imap/serv_imap.c
index d49b8d85403a475907b781d5fb146bdd6a078fe7..278cc73323392b3883c08ff8ee58b75d1b8fa163 100644
(file)
--- a/
citadel/modules/imap/serv_imap.c
+++ b/
citadel/modules/imap/serv_imap.c
@@
-677,7
+677,11
@@
void imap_authenticate(int num_parms, ConstStr *Params)
}
if (!strcasecmp(Params[2].Key, "LOGIN")) {
}
if (!strcasecmp(Params[2].Key, "LOGIN")) {
- CtdlEncodeBase64(UsrBuf, "Username:", 9, 0);
+ size_t len = CtdlEncodeBase64(UsrBuf, "Username:", 9, 0);
+ if (UsrBuf[len - 1] == '\n') {
+ UsrBuf[len - 1] = '\0';
+ }
+
IAPrintf("+ %s\r\n", UsrBuf);
IMAP->authstate = imap_as_expecting_username;
strcpy(IMAP->authseq, Params[0].Key);
IAPrintf("+ %s\r\n", UsrBuf);
IMAP->authstate = imap_as_expecting_username;
strcpy(IMAP->authseq, Params[0].Key);
@@
-685,7
+689,10
@@
void imap_authenticate(int num_parms, ConstStr *Params)
}
if (!strcasecmp(Params[2].Key, "PLAIN")) {
}
if (!strcasecmp(Params[2].Key, "PLAIN")) {
- // CtdlEncodeBase64(UsrBuf, "Username:", 9, 0);
+ // size_t len = CtdlEncodeBase64(UsrBuf, "Username:", 9, 0);
+ // if (UsrBuf[len - 1] == '\n') {
+ // UsrBuf[len - 1] = '\0';
+ // }
// IAPuts("+ %s\r\n", UsrBuf);
IAPuts("+ \r\n");
IMAP->authstate = imap_as_expecting_plainauth;
// IAPuts("+ %s\r\n", UsrBuf);
IAPuts("+ \r\n");
IMAP->authstate = imap_as_expecting_plainauth;
@@
-768,7
+775,11
@@
void imap_auth_login_user(long state)
case imap_as_expecting_username:
StrBufDecodeBase64(Imap->Cmd.CmdBuf);
CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
case imap_as_expecting_username:
StrBufDecodeBase64(Imap->Cmd.CmdBuf);
CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
- CtdlEncodeBase64(PWBuf, "Password:", 9, 0);
+ size_t len = CtdlEncodeBase64(PWBuf, "Password:", 9, 0);
+ if (PWBuf[len - 1] == '\n') {
+ PWBuf[len - 1] = '\0';
+ }
+
IAPrintf("+ %s\r\n", PWBuf);
Imap->authstate = imap_as_expecting_password;
IAPrintf("+ %s\r\n", PWBuf);
Imap->authstate = imap_as_expecting_password;
diff --git
a/citadel/modules/managesieve/serv_managesieve.c
b/citadel/modules/managesieve/serv_managesieve.c
index 7158f4c009543ed5b613f5da446c99703ad2c2d7..23f5f263c614b67b8db4ea489c3ff841bc33fae8 100644
(file)
--- a/
citadel/modules/managesieve/serv_managesieve.c
+++ b/
citadel/modules/managesieve/serv_managesieve.c
@@
-507,7
+507,10
@@
void mgsve_auth(char *argbuf) {
if (strlen(argbuf) >= 7) {
}
else {
if (strlen(argbuf) >= 7) {
}
else {
- CtdlEncodeBase64(username_prompt, "Username:", 9, 0);
+ size_t len = CtdlEncodeBase64(username_prompt, "Username:", 9, 0);
+ if (username_prompt[len - 1] == '\n') {
+ username_prompt[len - 1] = '\0';
+ }
cprintf("334 %s\r\n", username_prompt);
}
return;
cprintf("334 %s\r\n", username_prompt);
}
return;
diff --git
a/citadel/modules/smtp/serv_smtp.c
b/citadel/modules/smtp/serv_smtp.c
index 4abb0a3fe0694c68f276a5d15f90b02444692625..a93bb438e384231052681d5ac4346aba074e8feb 100644
(file)
--- a/
citadel/modules/smtp/serv_smtp.c
+++ b/
citadel/modules/smtp/serv_smtp.c
@@
-400,7
+400,11
@@
void smtp_get_user(long offset)
/* syslog(LOG_DEBUG, "Trying <%s>\n", username); */
if (CtdlLoginExistingUser(NULL, ChrPtr(sSMTP->Cmd)) == login_ok) {
/* syslog(LOG_DEBUG, "Trying <%s>\n", username); */
if (CtdlLoginExistingUser(NULL, ChrPtr(sSMTP->Cmd)) == login_ok) {
- CtdlEncodeBase64(buf, "Password:", 9, 0);
+ size_t len = CtdlEncodeBase64(buf, "Password:", 9, 0);
+
+ if (buf[len - 1] == '\n') {
+ buf[len - 1] = '\0';
+ }
cprintf("334 %s\r\n", buf);
sSMTP->command_state = smtp_password;
}
cprintf("334 %s\r\n", buf);
sSMTP->command_state = smtp_password;
}
@@
-519,7
+523,10
@@
void smtp_auth(long offset, long Flags)
smtp_get_user(6);
}
else {
smtp_get_user(6);
}
else {
- CtdlEncodeBase64(username_prompt, "Username:", 9, 0);
+ size_t len = CtdlEncodeBase64(username_prompt, "Username:", 9, 0);
+ if (username_prompt[len - 1] == '\n') {
+ username_prompt[len - 1] = '\0';
+ }
cprintf("334 %s\r\n", username_prompt);
sSMTP->command_state = smtp_user;
}
cprintf("334 %s\r\n", username_prompt);
sSMTP->command_state = smtp_user;
}
diff --git
a/citadel/modules/smtp/smtp_clienthandlers.c
b/citadel/modules/smtp/smtp_clienthandlers.c
index bbdbc4684f95131d5e3fa992828ef35da34722ef..198649e1f2c00522b2f738b7ee04cbf15e1840ef 100644
(file)
--- a/
citadel/modules/smtp/smtp_clienthandlers.c
+++ b/
citadel/modules/smtp/smtp_clienthandlers.c
@@
-234,10
+234,14
@@
eNextState SMTPC_send_auth(SmtpOutMsg *Msg)
Msg->pCurrRelay->User, '\0',
Msg->pCurrRelay->Pass);
Msg->pCurrRelay->User, '\0',
Msg->pCurrRelay->Pass);
- CtdlEncodeBase64(encoded, buf,
- strlen(Msg->pCurrRelay->User) * 2 +
- strlen(Msg->pCurrRelay->Pass) + 2, 0);
-
+ size_t len = CtdlEncodeBase64(encoded, buf,
+ strlen(Msg->pCurrRelay->User) * 2 +
+ strlen(Msg->pCurrRelay->Pass) + 2, 0);
+
+ if (buf[len - 1] == '\n') {
+ buf[len - 1] = '\0';
+ }
+
StrBufPrintf(Msg->IO.SendBuf.Buf,
"AUTH PLAIN %s\r\n",
encoded);
StrBufPrintf(Msg->IO.SendBuf.Buf,
"AUTH PLAIN %s\r\n",
encoded);
@@
-289,6
+293,10
@@
eNextState SMTPC_send_authplain_1(SmtpOutMsg *Msg)
Msg->pCurrRelay->User,
strlen(Msg->pCurrRelay->User),
0);
Msg->pCurrRelay->User,
strlen(Msg->pCurrRelay->User),
0);
+ if (encoded[encodedlen - 1] == '\n') {
+ encodedlen --;
+ encoded[encodedlen] = '\0';
+ }
StrBufPlain(Msg->IO.SendBuf.Buf,
encoded,
StrBufPlain(Msg->IO.SendBuf.Buf,
encoded,
@@
-330,6
+338,11
@@
eNextState SMTPC_send_authplain_2(SmtpOutMsg *Msg)
strlen(Msg->pCurrRelay->Pass),
0);
strlen(Msg->pCurrRelay->Pass),
0);
+ if (encoded[encodedlen - 1] == '\n') {
+ encodedlen --;
+ encoded[encodedlen] = '\0';
+ }
+
StrBufPlain(Msg->IO.SendBuf.Buf,
encoded,
encodedlen);
StrBufPlain(Msg->IO.SendBuf.Buf,
encoded,
encodedlen);
diff --git
a/webcit/sieve.c
b/webcit/sieve.c
index ee6bcec9e4afa0240ca803485592501d987e09c6..cce70574ae927c451f165af0488e47215e27ac8c 100644
(file)
--- a/
webcit/sieve.c
+++ b/
webcit/sieve.c
@@
-337,7
+337,10
@@
void parse_fields_from_rule_editor(void) {
redirect, automsg, final
);
redirect, automsg, final
);
- CtdlEncodeBase64(encoded_rule, rule, strlen(rule)+1, 0);
+ size_t len = CtdlEncodeBase64(encoded_rule, rule, strlen(rule)+1, 0);
+ if (encoded_rule[len - 1] == '\n') {
+ encoded_rule[len - 1] = '\0';
+ }
serv_printf("# WEBCIT_RULE|%d|%s|", i, encoded_rule);
output_sieve_rule(hfield, compare, htext, sizecomp, sizeval,
action, fileinto, redirect, automsg, final, my_addresses);
serv_printf("# WEBCIT_RULE|%d|%s|", i, encoded_rule);
output_sieve_rule(hfield, compare, htext, sizecomp, sizeval,
action, fileinto, redirect, automsg, final, my_addresses);