else
{
/* Copy to a safe place */
-
+ // TODO: len -> cm_fields?
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);
}
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);
}
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;
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;
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;
/* 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;
}
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;
}
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);
Msg->pCurrRelay->User,
strlen(Msg->pCurrRelay->User),
0);
+ if (encoded[encodedlen - 1] == '\n') {
+ encodedlen --;
+ encoded[encodedlen] = '\0';
+ }
StrBufPlain(Msg->IO.SendBuf.Buf,
encoded,
strlen(Msg->pCurrRelay->Pass),
0);
+ if (encoded[encodedlen - 1] == '\n') {
+ encodedlen --;
+ encoded[encodedlen] = '\0';
+ }
+
StrBufPlain(Msg->IO.SendBuf.Buf,
encoded,
encodedlen);
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);