* $Id$
*
* IMAP server for the Citadel system
- * Copyright (C) 2000-2007 by Art Cancro and others.
+ * Copyright (C) 2000-2009 by Art Cancro and others.
* This code is released under the terms of the GNU General Public License.
*
* WARNING: the IMAP protocol is badly designed. No implementation of it
* is perfect. Indeed, with so much gratuitous complexity, *all* IMAP
* implementations have bugs.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdep.h"
/* We are building a partial implementation of METADATA for the sole purpose
* of interoperating with the ical/vcard version of the Bynari Insight Connector.
- * If you were expecting something else, comment out one or both of these
- * extension advertisements.
+ * It is not a full RFC5464 implementation, but it should refuse non-Bynari
+ * metadata in a compatible and graceful way.
*/
cprintf(" METADATA");
- /* cprintf(" LIST-EXTENDED"); */
+
+ /*
+ * LIST-EXTENDED was originally going to be required by the METADATA extension.
+ * It was mercifully removed prior to the finalization of RFC5464. We started
+ * implementing this but stopped when we learned that it would not be needed.
+ * If you uncomment this declaration you are responsible for writing a lot of new
+ * code.
+ *
+ * cprintf(" LIST-EXTENDED")
+ */
}
/*
char pass[256];
int result;
+ memset(pass, 0, sizeof(pass));
CtdlDecodeBase64(decoded_authstring, cmd, strlen(cmd));
safestrncpy(ident, decoded_authstring, sizeof ident);
safestrncpy(user, &decoded_authstring[strlen(ident) + 1], sizeof user);
{
char buf[SIZ];
+ memset(buf, 0, sizeof(buf));
CtdlDecodeBase64(buf, cmd, SIZ);
if (CtdlTryPassword(buf) == pass_ok) {
cprintf("%s OK authentication succeeded\r\n", IMAP->authseq);
*
* Unfortunately, omitting \Deleted as a PERMANENTFLAGS flag causes
* some clients (particularly Thunderbird) to misbehave -- they simply
- * electing not to transmit the flag at all. So we have to advertise
+ * elect not to transmit the flag at all. So we have to advertise
* \Deleted as a PERMANENTFLAGS flag, even though it technically isn't.
*/
cprintf("* FLAGS (\\Deleted \\Seen \\Answered)\r\n");
int newroomview = 0;
char *notification_message = NULL;
+ if (num_parms < 3) {
+ cprintf("%s NO A foder name must be specified\r\n", parms[0]);
+ return;
+ }
+
if (strchr(parms[2], '\\') != NULL) {
- cprintf("%s NO Invalid character in folder name\r\n",
- parms[0]);
+ cprintf("%s NO Invalid character in folder name\r\n", parms[0]);
CtdlLogPrintf(CTDL_DEBUG, "invalid character in folder name\n");
return;
}
char savedroom[ROOMNAMELEN];
int msgs, new;
- ret = imap_grabroom(roomname, parms[2], 0);
+ ret = imap_grabroom(roomname, parms[2], 1);
if (ret != 0) {
cprintf
("%s NO Invalid mailbox name or location, or access denied\r\n",
char savedroom[ROOMNAMELEN];
int msgs, new;
- ret = imap_grabroom(roomname, parms[2], 0);
+ ret = imap_grabroom(roomname, parms[2], 1);
if (ret != 0) {
cprintf
("%s NO Invalid mailbox name or location, or access denied\r\n",
}
if (untagged_ok) {
- imap_print_instant_messages();
-
+
+ /* we can put any additional untagged stuff right here in the future */
+
/*
* Before processing the command that was just entered... if we happen
* to have a folder selected, we'd like to rescan that folder for new
* messages, and for deletions/changes of existing messages. This
- * could probably be optimized somehow, but IMAP sucks...
+ * could probably be optimized better with some deep thought...
*/
if (IMAP->selected) {
imap_rescan_msgids();
else if (!strcasecmp(parms[1], "LOGOUT")) {
if (IMAP->selected) {
- imap_do_expunge(); /* yes, we auto-expunge */
+ imap_do_expunge(); /* yes, we auto-expunge at logout */
}
cprintf("* BYE %s logging out\r\n", config.c_fqdn);
cprintf("%s OK Citadel IMAP session ended.\r\n",
gettimeofday(&tv2, NULL);
total_time = (tv2.tv_usec + (tv2.tv_sec * 1000000)) - (tv1.tv_usec + (tv1.tv_sec * 1000000));
+ CtdlLogPrintf(CTDL_INFO, "IMAP: %s\n", cmdbuf); // FIXME FIXME FIXME REMOVE THIS NOW
CtdlLogPrintf(CTDL_DEBUG, "IMAP command completed in %ld.%ld seconds\n",
(total_time / 1000000),
(total_time % 1000000)