* More license declarations
[citadel.git] / citadel / modules / imap / serv_imap.c
index 274022090ed9dea1fcd90f11350bbb6227f92dca..3d5d2ac7bb8c685ae36235295c0dccf4b4fb15dc 100644 (file)
@@ -2,12 +2,26 @@
  * $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"
@@ -602,6 +616,7 @@ void imap_auth_plain(char *cmd)
        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);
@@ -641,6 +656,7 @@ void imap_auth_login_pass(char *cmd)
 {
        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);
@@ -898,9 +914,13 @@ void imap_create(int num_parms, char *parms[])
        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;
        }