syslog(LOG_DEBUG,
"Rebuilding EUID index for <%s>\n",
rplist->name);
- CtdlUserGoto(rplist->name, 0, 0, NULL, NULL);
+ CtdlUserGoto(rplist->name, 0, 0, NULL, NULL, NULL, NULL);
CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL,
rebuild_euid_index_for_msg, NULL);
}
int CtdlGetRoom(struct ctdlroom *qrbuf, const char *room_name);
int CtdlGetRoomLock(struct ctdlroom *qrbuf, char *room_name);
int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr);
-void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
- int *result, int *view);
+void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, int *result, int *view);
void CtdlPutRoomLock(struct ctdlroom *qrbuf);
typedef void (*ForEachRoomCallBack)(struct ctdlroom *EachRoom, void *out_data);
void CtdlForEachRoom(ForEachRoomCallBack CB, void *in_data);
typedef void (*ForEachRoomNetCfgCallBack)(struct ctdlroom *EachRoom, void *out_data, OneRoomNetCfg *OneRNCFG);
-void CtdlForEachNetCfgRoom(ForEachRoomNetCfgCallBack CB,
- void *in_data,
- RoomNetCfg filter);
+void CtdlForEachNetCfgRoom(ForEachRoomNetCfgCallBack CB, void *in_data, RoomNetCfg filter);
void SaveChangedConfigs(void);
-
void CtdlDeleteRoom(struct ctdlroom *qrbuf);
int CtdlRenameRoom(char *old_name, char *new_name, int new_floor);
-void CtdlUserGoto (char *where, int display_result, int transiently,
- int *msgs, int *new);
+void CtdlUserGoto (char *where, int display_result, int transiently, int *msgs, int *new, long *oldest, long *newest);
struct floor *CtdlGetCachedFloor(int floor_num);
void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf);
void CtdlGetFloor (struct floor *flbuf, int floor_num);
if (CC->internal_pgm) {
memcpy(&CC->room, &QRscratch,
sizeof(struct ctdlroom));
- CtdlUserGoto(NULL, 1, transiently, NULL, NULL);
+ CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
return;
}
((ra & UA_GOTOALLOWED))) {
memcpy(&CC->room, &QRscratch,
sizeof(struct ctdlroom));
- CtdlUserGoto(NULL, 1, transiently, NULL, NULL);
+ CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
return;
} else if ((QRscratch.QRflags & QR_PASSWORDED) &&
((ra & UA_KNOWN) == 0) &&
} else {
memcpy(&CC->room, &QRscratch,
sizeof(struct ctdlroom));
- CtdlUserGoto(NULL, 1, transiently, NULL, NULL);
+ CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
return;
}
}
CtdlScheduleRoomForDeletion(&CC->room);
/* Return to the Lobby */
- CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
+ CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
/* tell the world what we did */
snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
IAPuts("* ACL ");
IPutCParamStr(2);
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
IReply("OK GETACL completed");
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
/*
* Now output the list of rights
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
IReply("OK LISTRIGHTS completed");
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
CtdlRoomAccess(&CC->room, &CC->user, &ra, NULL);
rights = NewStrBuf();
* If a different folder was previously selected, return there now.
*/
if ( (IMAP->selected) && (strcasecmp(roomname, savedroom)) ) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
IReply("OK MYRIGHTS completed");
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
/*
* Always set the per-user view to the requested one.
* If a different folder was previously selected, return there now.
*/
if ( (IMAP->selected) && (strcasecmp(roomname, savedroom)) ) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
return;
}
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
IAPuts("* METADATA ");
IPutCParamStr(2);
* If a different folder was previously selected, return there now.
*/
if ( (IMAP->selected) && (strcasecmp(roomname, savedroom)) ) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
IReply("OK GETMETADATA complete");
if (Imap->selected) {
strcpy(savedroom, CCC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
/* If the user is locally authenticated, FORCE the From: header to
* show up as the real sender. FIXME do we really want to do this?
* our happy day without violent explosions.
*/
if (Imap->selected) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
/* We don't need this buffer anymore */
char user[256] = "";
char pass[256] = "";
int result;
- long len;
+ long decoded_len;
+ long len = 0;
+ long plen = 0;
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_len -= 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;
+ }
+
+ if (decoded_len > 0)
+ {
+ plen = safestrncpy(pass, decoded_authstring, sizeof pass);
- len = safestrncpy(pass, decoded_authstring, sizeof pass);
- if (len < 0)
- len = sizeof(pass) - 1;
+ if (plen < 0)
+ plen = sizeof(pass) - 1;
+ }
}
Imap->authstate = imap_as_normal;
}
if (result == login_ok) {
- if (CtdlTryPassword(pass, len) == pass_ok) {
+ if (CtdlTryPassword(pass, plen) == pass_ok) {
IAPrintf("%s OK authentication succeeded\r\n", Imap->authseq);
return;
}
* the number of messages and number of new messages.
*/
memcpy(&CC->room, &QRscratch, sizeof(struct ctdlroom));
- CtdlUserGoto(NULL, 0, 0, &msgs, &new);
+ CtdlUserGoto(NULL, 0, 0, &msgs, &new, NULL, NULL);
Imap->selected = 1;
if (!strcasecmp(Params[1].Key, "EXAMINE")) {
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
/*
* Tell the client what it wants to know. In fact, tell it *more* than
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
/*
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
/*
* If another folder is selected, go back to that room so we can resume
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
IReply("OK SUBSCRIBE completed");
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
/*
* Now make the API call to zap the room
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
}
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- CtdlUserGoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
/*
* Now delete the room.
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
}
}
}
/* Yes, we actually have to go there */
- CtdlUserGoto(NULL, 0, 0, NULL, NULL);
+ CtdlUserGoto(NULL, 0, 0, NULL, NULL, NULL, NULL);
c = CtdlSaveMsgPointersInRoom(NULL, &cs->msgnum, 1, 0, NULL, 0);
/* Go back to the room we came from */
if (strcasecmp(original_room_name, CC->room.QRname)) {
- CtdlUserGoto(original_room_name, 0, 0, NULL, NULL);
+ CtdlUserGoto(original_room_name, 0, 0, NULL, NULL, NULL, NULL);
}
if (c == 0) {
char user[256] = "";
char pass[256] = "";
int result;
- long len;
- len = StrBufDecodeBase64(sSMTP->Cmd);
- if (len > 0)
+ long decoded_len;
+ long len = 0;
+ long plen = 0;
+
+ memset(pass, 0, sizeof(pass));
+ decoded_len = StrBufDecodeBase64(sSMTP->Cmd);
+
+ if (decoded_len > 0)
{
decoded_authstring = ChrPtr(sSMTP->Cmd);
len = safestrncpy(ident, decoded_authstring, sizeof ident);
+ decoded_len -= 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;
+ }
+
+ if (decoded_len > 0)
+ {
+ plen = safestrncpy(pass, decoded_authstring, sizeof pass);
- len = safestrncpy(pass, decoded_authstring, sizeof pass);
- if (len < 0)
- len = sizeof(pass) - 1;
+ if (plen < 0)
+ plen = sizeof(pass) - 1;
+ }
}
sSMTP->command_state = smtp_command;
}
if (result == login_ok) {
- if (CtdlTryPassword(pass, len) == pass_ok) {
+ if (CtdlTryPassword(pass, plen) == pass_ok) {
smtp_webcit_preferences_hack();
smtp_auth_greeting(offset, Flags);
return;
int i;
/* First remove any addresses we already have in the address book */
- CtdlUserGoto(aptr->roomname, 0, 0, NULL, NULL);
+ CtdlUserGoto(aptr->roomname, 0, 0, NULL, NULL, NULL, NULL);
CtdlForEachMessage(MSGS_ALL, 0, NULL, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$", NULL,
strip_addresses_already_have, aptr->collected_addresses);
MSG_syslog(LOG_INFO, "Final selection: %s (%s)\n", actual_rm, room);
if (strcasecmp(actual_rm, CCC->room.QRname)) {
/* CtdlGetRoom(&CCC->room, actual_rm); */
- CtdlUserGoto(actual_rm, 0, 1, NULL, NULL);
+ CtdlUserGoto(actual_rm, 0, 1, NULL, NULL, NULL, NULL);
}
/*
/* Go back to the room we started from */
MSG_syslog(LOG_DEBUG, "Returning to original room %s\n", hold_rm);
if (strcasecmp(hold_rm, CCC->room.QRname))
- CtdlUserGoto(hold_rm, 0, 1, NULL, NULL);
+ CtdlUserGoto(hold_rm, 0, 1, NULL, NULL, NULL, NULL);
/*
* Any addresses to harvest for someone's address book?
* specified room exists and is ok to access.
*/
void CtdlUserGoto(char *where, int display_result, int transiently,
- int *retmsgs, int *retnew)
+ int *retmsgs, int *retnew, long *retoldest, long *retnewest)
{
struct CitContext *CCC = CC;
int a;
int new_messages = 0;
int old_messages = 0;
int total_messages = 0;
+ long oldest_message = 0;
+ long newest_message = 0;
int info = 0;
int rmailflag;
int raideflag;
if (msglist[a] > 0L) ++total_messages;
}
+ if (total_messages > 0) {
+ oldest_message = msglist[0];
+ newest_message = msglist[num_msgs - 1];
+ }
+
num_sets = num_tokens(vbuf.v_seen, ',');
for (s=0; s<num_sets; ++s) {
extract_token(setstr, vbuf.v_seen, s, ',', sizeof setstr);
if (retmsgs != NULL) *retmsgs = total_messages;
if (retnew != NULL) *retnew = new_messages;
- MSG_syslog(LOG_INFO, "<%s> %d new of %d total messages\n",
- CCC->room.QRname,
- new_messages, total_messages
- );
+ if (retoldest != NULL) *retoldest = oldest_message;
+ if (retnewest != NULL) *retnewest = newest_message;
+ MSG_syslog(LOG_INFO, "<%s> %d new of %d total messages, oldest=%ld, newest=%ld\n",
+ CCC->room.QRname, new_messages, total_messages, oldest_message, newest_message
+ );
CCC->curr_view = (int)vbuf.v_view;
PerformSessionHooks(EVT_LOGIN);
/* Enter the lobby */
- CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
+ CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
}
CtdlPutUserLock(&CC->user);
/* Return to the Lobby, so we don't end up in an undefined room */
- CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
+ CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
return(0);
}
free(Buf->buf);
Buf->buf = xferbuf;
Buf->BufUsed = siz;
+
+ Buf->buf[Buf->BufUsed] = '\0';
return siz;
}