projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e0a6187
)
* give static buffers either a meaningfull name or/and respect their size in write...
author
Wilfried Göesgens
<willi@citadel.org>
Fri, 19 Mar 2010 22:47:44 +0000
(22:47 +0000)
committer
Wilfried Göesgens
<willi@citadel.org>
Fri, 19 Mar 2010 22:47:44 +0000
(22:47 +0000)
citadel/modules/imap/serv_imap.c
patch
|
blob
|
history
diff --git
a/citadel/modules/imap/serv_imap.c
b/citadel/modules/imap/serv_imap.c
index ac91a75821dfb9d3a9d6cfa48f007b9e2d3155b6..3bd31dc7caab020966c0823008f4c2012e9f7e4a 100644
(file)
--- a/
citadel/modules/imap/serv_imap.c
+++ b/
citadel/modules/imap/serv_imap.c
@@
-575,7
+575,7
@@
void imap_login(int num_parms, ConstStr *Params)
*/
void imap_authenticate(int num_parms, ConstStr *Params)
{
*/
void imap_authenticate(int num_parms, ConstStr *Params)
{
- char
b
uf[SIZ];
+ char
UsrB
uf[SIZ];
if (num_parms != 3) {
cprintf("%s BAD incorrect number of parameters\r\n",
if (num_parms != 3) {
cprintf("%s BAD incorrect number of parameters\r\n",
@@
-589,16
+589,16
@@
void imap_authenticate(int num_parms, ConstStr *Params)
}
if (!strcasecmp(Params[2].Key, "LOGIN")) {
}
if (!strcasecmp(Params[2].Key, "LOGIN")) {
- CtdlEncodeBase64(
b
uf, "Username:", 9, 0);
- cprintf("+ %s\r\n",
b
uf);
+ CtdlEncodeBase64(
UsrB
uf, "Username:", 9, 0);
+ cprintf("+ %s\r\n",
UsrB
uf);
IMAP->authstate = imap_as_expecting_username;
strcpy(IMAP->authseq, Params[0].Key);
return;
}
if (!strcasecmp(Params[2].Key, "PLAIN")) {
IMAP->authstate = imap_as_expecting_username;
strcpy(IMAP->authseq, Params[0].Key);
return;
}
if (!strcasecmp(Params[2].Key, "PLAIN")) {
- // CtdlEncodeBase64(
b
uf, "Username:", 9, 0);
- // cprintf("+ %s\r\n",
b
uf);
+ // CtdlEncodeBase64(
UsrB
uf, "Username:", 9, 0);
+ // cprintf("+ %s\r\n",
UsrB
uf);
cprintf("+ \r\n");
IMAP->authstate = imap_as_expecting_plainauth;
strcpy(IMAP->authseq, Params[0].Key);
cprintf("+ \r\n");
IMAP->authstate = imap_as_expecting_plainauth;
strcpy(IMAP->authseq, Params[0].Key);
@@
-649,20
+649,20
@@
void imap_auth_plain(void)
void imap_auth_login_user(long state)
{
void imap_auth_login_user(long state)
{
- char
b
uf[SIZ];
+ char
PWB
uf[SIZ];
citimap *Imap = IMAP;
switch (state){
case imap_as_expecting_username:
StrBufDecodeBase64(Imap->Cmd.CmdBuf);
CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
citimap *Imap = IMAP;
switch (state){
case imap_as_expecting_username:
StrBufDecodeBase64(Imap->Cmd.CmdBuf);
CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
- CtdlEncodeBase64(
b
uf, "Password:", 9, 0);
- cprintf("+ %s\r\n",
b
uf);
+ CtdlEncodeBase64(
PWB
uf, "Password:", 9, 0);
+ cprintf("+ %s\r\n",
PWB
uf);
Imap->authstate = imap_as_expecting_password;
return;
case imap_as_expecting_multilineusername:
Imap->authstate = imap_as_expecting_password;
return;
case imap_as_expecting_multilineusername:
- extract_token(
buf, ChrPtr(Imap->Cmd.CmdBuf), 1, ' ', sizeof(b
uf));
+ extract_token(
PWBuf, ChrPtr(Imap->Cmd.CmdBuf), 1, ' ', sizeof(PWB
uf));
CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
cprintf("+ go ahead\r\n");
IMAP->authstate = imap_as_expecting_multilinepassword;
CtdlLoginExistingUser(NULL, ChrPtr(Imap->Cmd.CmdBuf));
cprintf("+ go ahead\r\n");
IMAP->authstate = imap_as_expecting_multilinepassword;
@@
-675,13
+675,12
@@
void imap_auth_login_pass(long state)
{
citimap *Imap = IMAP;
const char *pass = NULL;
{
citimap *Imap = IMAP;
const char *pass = NULL;
- char buf[SIZ];
switch (state) {
default:
case imap_as_expecting_password:
StrBufDecodeBase64(Imap->Cmd.CmdBuf);
switch (state) {
default:
case imap_as_expecting_password:
StrBufDecodeBase64(Imap->Cmd.CmdBuf);
- pass =
buf
;
+ pass =
ChrPtr(Imap->Cmd.CmdBuf)
;
break;
case imap_as_expecting_multilinepassword:
pass = ChrPtr(Imap->Cmd.CmdBuf);
break;
case imap_as_expecting_multilinepassword:
pass = ChrPtr(Imap->Cmd.CmdBuf);
@@
-706,9
+705,9
@@
void imap_starttls(int num_parms, ConstStr *Params)
char nosup_response[SIZ];
char error_response[SIZ];
char nosup_response[SIZ];
char error_response[SIZ];
- s
printf(ok_response,
"%s OK begin TLS negotiation now\r\n", Params[0].Key);
- s
printf(nosup_response,
"%s NO TLS not supported here\r\n", Params[0].Key);
- s
printf(error_response,
"%s BAD Internal error\r\n", Params[0].Key);
+ s
nprintf(ok_response, SIZ,
"%s OK begin TLS negotiation now\r\n", Params[0].Key);
+ s
nprintf(nosup_response, SIZ,
"%s NO TLS not supported here\r\n", Params[0].Key);
+ s
nprintf(error_response, SIZ,
"%s BAD Internal error\r\n", Params[0].Key);
CtdlModuleStartCryptoMsgs(ok_response, nosup_response, error_response);
}
CtdlModuleStartCryptoMsgs(ok_response, nosup_response, error_response);
}
@@
-718,7
+717,7
@@
void imap_starttls(int num_parms, ConstStr *Params)
*/
void imap_select(int num_parms, ConstStr *Params)
{
*/
void imap_select(int num_parms, ConstStr *Params)
{
- char towhere[
SIZ
];
+ char towhere[
ROOMNAMELEN
];
char augmented_roomname[ROOMNAMELEN];
int c = 0;
int ok = 0;
char augmented_roomname[ROOMNAMELEN];
int c = 0;
int ok = 0;
@@
-747,7
+746,7
@@
void imap_select(int num_parms, ConstStr *Params)
CtdlMailboxName(augmented_roomname, sizeof augmented_roomname, &CC->user, towhere);
c = CtdlGetRoom(&QRscratch, augmented_roomname);
if (c == 0) {
CtdlMailboxName(augmented_roomname, sizeof augmented_roomname, &CC->user, towhere);
c = CtdlGetRoom(&QRscratch, augmented_roomname);
if (c == 0) {
- s
trcpy(towhere, augmented_roomname
);
+ s
afestrncpy(towhere, augmented_roomname, sizeof(towhere)
);
}
}
}
}
@@
-906,7
+905,7
@@
void imap_namespace(int num_parms, ConstStr *Params)
if (fl->f_flags & F_INUSE) {
if (floors > 0) cprintf(" ");
cprintf("(");
if (fl->f_flags & F_INUSE) {
if (floors > 0) cprintf(" ");
cprintf("(");
- s
printf(buf
, "%s/", fl->f_name);
+ s
nprintf(buf, sizeof(buf)
, "%s/", fl->f_name);
plain_imap_strout(buf);
cprintf(" \"/\")");
++floors;
plain_imap_strout(buf);
cprintf(" \"/\")");
++floors;
@@
-1025,7
+1024,7
@@
int imap_grabroom(char *returned_roomname, const char *foldername, int zapped_ok
&CC->user, roomname);
c = CtdlGetRoom(&QRscratch, augmented_roomname);
if (c == 0)
&CC->user, roomname);
c = CtdlGetRoom(&QRscratch, augmented_roomname);
if (c == 0)
- s
trcpy(roomname, augmented_roomname
);
+ s
afestrncpy(roomname, augmented_roomname, sizeof(roomname)
);
}
/* If the room exists, check security/access */
}
/* If the room exists, check security/access */
@@
-1047,7
+1046,7
@@
int imap_grabroom(char *returned_roomname, const char *foldername, int zapped_ok
strcpy(returned_roomname, "");
return (2);
} else {
strcpy(returned_roomname, "");
return (2);
} else {
- s
trcpy(returned_roomname, QRscratch.QRname
);
+ s
afestrncpy(returned_roomname, QRscratch.QRname, ROOMNAMELEN
);
return (0);
}
}
return (0);
}
}
@@
-1061,7
+1060,7
@@
void imap_status(int num_parms, ConstStr *Params)
{
int ret;
char roomname[ROOMNAMELEN];
{
int ret;
char roomname[ROOMNAMELEN];
- char
buf
[SIZ];
+ char
imaproomname
[SIZ];
char savedroom[ROOMNAMELEN];
int msgs, new;
char savedroom[ROOMNAMELEN];
int msgs, new;
@@
-1089,9
+1088,9
@@
void imap_status(int num_parms, ConstStr *Params)
* names and simply spew all possible data items. It's far easier to
* code and probably saves us some processing time too.
*/
* names and simply spew all possible data items. It's far easier to
* code and probably saves us some processing time too.
*/
- imap_mailboxname(
buf, sizeof buf
, &CC->room);
+ imap_mailboxname(
imaproomname, sizeof imaproomname
, &CC->room);
cprintf("* STATUS ");
cprintf("* STATUS ");
- plain_imap_strout(
buf
);
+ plain_imap_strout(
imaproomname
);
cprintf(" (MESSAGES %d ", msgs);
cprintf("RECENT %d ", new); /* Initially, new==recent */
cprintf("UIDNEXT %ld ", CitControl.MMhighest + 1);
cprintf(" (MESSAGES %d ", msgs);
cprintf("RECENT %d ", new); /* Initially, new==recent */
cprintf("UIDNEXT %ld ", CitControl.MMhighest + 1);
@@
-1304,7
+1303,7
@@
void imap_rename(int num_parms, ConstStr *Params)
struct irl *irl = NULL; /* the list */
struct irl *irlp = NULL; /* scratch pointer */
struct irlparms irlparms;
struct irl *irl = NULL; /* the list */
struct irl *irlp = NULL; /* scratch pointer */
struct irlparms irlparms;
- char
buf
[1024];
+ char
aidemsg
[1024];
if (strchr(Params[3].Key, '\\') != NULL) {
cprintf("%s NO Invalid character in folder name\r\n",
if (strchr(Params[3].Key, '\\') != NULL) {
cprintf("%s NO Invalid character in folder name\r\n",
@@
-1376,12
+1375,12
@@
void imap_rename(int num_parms, ConstStr *Params)
}
}
}
}
- snprintf(
buf, sizeof buf
, "IMAP folder \"%s\" renamed to \"%s\" by %s\n",
+ snprintf(
aidemsg, sizeof aidemsg
, "IMAP folder \"%s\" renamed to \"%s\" by %s\n",
Params[2].Key,
Params[3].Key,
CC->curr_user
);
Params[2].Key,
Params[3].Key,
CC->curr_user
);
- CtdlAideMessage(
buf
, "IMAP folder rename");
+ CtdlAideMessage(
aidemsg
, "IMAP folder rename");
cprintf("%s OK RENAME completed\r\n", Params[0].Key);
}
cprintf("%s OK RENAME completed\r\n", Params[0].Key);
}