Added protocol names to all 'client disconnected' syslogs
authorArt Cancro <ajc@uncensored.citadel.org>
Mon, 14 Mar 2011 16:59:46 +0000 (12:59 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 15:07:43 +0000 (15:07 +0000)
15 files changed:
citadel/citserver.c
citadel/modules/imap/imap_acl.c
citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_list.c
citadel/modules/imap/imap_metadata.c
citadel/modules/imap/imap_misc.c
citadel/modules/imap/imap_search.c
citadel/modules/imap/imap_store.c
citadel/modules/imap/imap_tools.c
citadel/modules/imap/serv_imap.c
citadel/modules/managesieve/serv_managesieve.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/vcard/serv_vcard.c
citadel/modules/xmpp/serv_xmpp.c

index 42fb045a49665adde0c52e2381cc996de92f3def..13791feee871199425f8cf465916853da8654ad9 100644 (file)
@@ -1042,7 +1042,7 @@ void do_command_loop(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               syslog(LOG_ERR, "Client disconnected: ending session.\n");
+               syslog(LOG_ERR, "Citadel client disconnected: ending session.\n");
                CC->kill_me = KILLME_CLIENT_DISCONNECTED;
                CtdlThreadName(old_name);
                return;
index 48aae83c032b9636e25e04b95944368a4dd53584..0ca96dfc85b7de6d1c0007eded07ffefa0a9dc51 100644 (file)
@@ -2,9 +2,9 @@
  * Functions which implement RFC2086 (and maybe RFC4314) (IMAP ACL extension)
  *
  *
- * Copyright (c) 2007-2009 by the citadel.org team
+ * Copyright (c) 2007-2011 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  This program is open source 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.
index db0fbeae83aa1c04260dc11f0c13468aa5c1ab76..862f587570c373212b07207fb00cab5a62d6dc98 100644 (file)
@@ -2,9 +2,9 @@
  * Implements the FETCH command in IMAP.
  * This is a good example of the protocol's gratuitous complexity.
  *
- * Copyright (c) 2001-2009 by the citadel.org team
+ * Copyright (c) 2001-2011 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  This program is open source 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.
index 49c19a6666407eae59206ed5af5e7a28165b3ed5..f66f121339f778cae5fcfbf3da642df731d6e188 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2009 by Art Cancro and others.
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  This program is open source 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.
index 73a2f71a3064b64eaf670ff4ed20dacfdbd2f30a..cfbc10370675609cf5bbd8d953baaae9879e8e73 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 2007-2009 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  This program is open source 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.
index 203b75c3ece620fc6732610e76f475ca6efffa1f..3392c71bc113027136690b0de10c86a0ef2276fa 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1987-2010 by the citadel.org team
+ * Copyright (c) 1987-2011 by the citadel.org team
  *
- * This program is free software; you can redistribute it and/or modify
+ * This program is open source 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.
index 8a8673e6afdd44c704bd07fff484a211a454d82f..af9865f14ae0ca4ec0a1609e95728dc64f0ea55a 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * Implements IMAP's gratuitously complex SEARCH command.
  *
- *
- * Copyright (c) 2001-2009 by the citadel.org team
+ * Copyright (c) 2001-2011 by the citadel.org team
  *
  *  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
index dceefbbbe18a911b10cab9bc6a43579e24e41227..959e1235d783391abf8f6758fd872fccf82f55fb 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2001-2009 by the citadel.org team
  *
- * This program is free software; you can redistribute it and/or modify
+ * This program is open source 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.
index cb99d7a671406407ebc5e1fceea7f75be059f4c5..67cd1bcc58d89d690b27f277df7bec48539c3744 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 2001-2009 by the citadel.org team and others, except for
  * most of the UTF7 and UTF8 handling code which was lifted from Evolution.
  *
- * This program is free software; you can redistribute it and/or modify
+ * This program is open source 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.
index 29ab6536b579436f1115c485ac5545241a166aa4..785d6e53c052236a971ec083daf9bfefe0125139 100644 (file)
@@ -1,13 +1,14 @@
 /*
  * IMAP server for the Citadel system
- * Copyright (C) 2000-2009 by Art Cancro and others.
+ *
+ * Copyright (C) 2000-2011 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
+ * This program is open source 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.
@@ -115,14 +116,14 @@ const imap_handler_hook *imap_lookup(int num_parms, ConstStr *Params)
                      ChrPtr(Imap->Reply));
        if (GetHash(ImapCmds, SKEY(Imap->Reply), &v))
        {
-               syslog(LOG_DEBUG, "Found. \n"); 
+               syslog(LOG_DEBUG, "Found."); 
                FlushStrBuf(Imap->Reply);
                return (imap_handler_hook *) v;
        }
 
        if (num_parms == 1)
        {
-               syslog(LOG_DEBUG, "NOT Found. \n"); 
+               syslog(LOG_DEBUG, "NOT Found."); 
                FlushStrBuf(Imap->Reply);
                return NULL;
        }
@@ -133,11 +134,11 @@ const imap_handler_hook *imap_lookup(int num_parms, ConstStr *Params)
        StrBufUpCase(Imap->Reply);
        if (GetHash(ImapCmds, SKEY(Imap->Reply), &v))
        {
-               syslog(LOG_DEBUG, "Found. \n"); 
+               syslog(LOG_DEBUG, "Found."); 
                FlushStrBuf(Imap->Reply);
                return (imap_handler_hook *) v;
        }
-       syslog(LOG_DEBUG, "NOT Found. \n"); 
+       syslog(LOG_DEBUG, "NOT Found."); 
        FlushStrBuf(Imap->Reply);
                return NULL;
 }
@@ -306,8 +307,7 @@ void imap_load_msgids(void)
        citimap *Imap = IMAP;
 
        if (Imap->selected == 0) {
-               syslog(LOG_ERR,
-                       "imap_load_msgids() can't run; no room selected\n");
+               syslog(LOG_ERR, "imap_load_msgids() can't run; no room selected");
                return;
        }
 
@@ -348,7 +348,7 @@ void imap_rescan_msgids(void)
        int num_recent = 0;
 
        if (Imap->selected == 0) {
-               syslog(LOG_ERR, "imap_load_msgids() can't run; no room selected\n");
+               syslog(LOG_ERR, "imap_load_msgids() can't run; no room selected");
                return;
        }
 
@@ -368,8 +368,9 @@ void imap_rescan_msgids(void)
        if (cdbfr != NULL) {
                msglist = malloc(cdbfr->len);
                if (msglist == NULL) {
-                       syslog(LOG_CRIT, "malloc() failed\n");
-                       abort();
+                       syslog(LOG_CRIT, "IMAP: malloc() failed");
+                       CC->kill_me = KILLME_MALLOC_FAILED;
+                       return;
                }
                memcpy(msglist, cdbfr->ptr, (size_t)cdbfr->len);
                num_msgs = cdbfr->len / sizeof(long);
@@ -483,7 +484,7 @@ void imap_cleanup_function(void)
                imap_do_expunge();
        }
 
-       syslog(LOG_DEBUG, "Performing IMAP cleanup hook\n");
+       syslog(LOG_DEBUG, "Performing IMAP cleanup hook");
        imap_free_msgids();
        imap_free_transmitted_message();
 
@@ -503,7 +504,7 @@ void imap_cleanup_function(void)
        FreeStrBuf(&Imap->Reply);
        if (Imap->Cmd.Params != NULL) free(Imap->Cmd.Params);
        free(Imap);
-       syslog(LOG_DEBUG, "Finished IMAP cleanup hook\n");
+       syslog(LOG_DEBUG, "Finished IMAP cleanup hook");
 }
 
 
@@ -918,7 +919,7 @@ int imap_do_expunge(void)
        long *delmsgs = NULL;
        int num_delmsgs = 0;
 
-       syslog(LOG_DEBUG, "imap_do_expunge() called\n");
+       syslog(LOG_DEBUG, "imap_do_expunge() called");
        if (Imap->selected == 0) {
                return (0);
        }
@@ -941,7 +942,7 @@ int imap_do_expunge(void)
                imap_rescan_msgids();
        }
 
-       syslog(LOG_DEBUG, "Expunged %d messages from <%s>\n", num_expunged, CC->room.QRname);
+       syslog(LOG_DEBUG, "Expunged %d messages from <%s>", num_expunged, CC->room.QRname);
        return (num_expunged);
 }
 
@@ -1036,14 +1037,14 @@ void imap_create(int num_parms, ConstStr *Params)
 
        if (strchr(Params[2].Key, '\\') != NULL) {
                IReply("NO Invalid character in folder name");
-               syslog(LOG_DEBUG, "invalid character in folder name\n");
+               syslog(LOG_DEBUG, "invalid character in folder name");
                return;
        }
 
        ret = imap_roomname(roomname, sizeof roomname, Params[2].Key);
        if (ret < 0) {
                IReply("NO Invalid mailbox name or location");
-               syslog(LOG_DEBUG, "invalid mailbox name or location\n");
+               syslog(LOG_DEBUG, "invalid mailbox name or location");
                return;
        }
        floornum = (ret & 0x00ff);      /* lower 8 bits = floor number */
@@ -1052,7 +1053,7 @@ void imap_create(int num_parms, ConstStr *Params)
        if (flags & IR_MAILBOX) {
                if (strncasecmp(Params[2].Key, "INBOX/", 6)) {
                        IReply("NO Personal folders must be created under INBOX");
-                       syslog(LOG_DEBUG, "not subordinate to inbox\n");
+                       syslog(LOG_DEBUG, "not subordinate to inbox");
                        return;
                }
        }
@@ -1065,7 +1066,7 @@ void imap_create(int num_parms, ConstStr *Params)
                newroomview = VIEW_BBS;
        }
 
-       syslog(LOG_INFO, "Create new room <%s> on floor <%d> with type <%d>\n",
+       syslog(LOG_INFO, "IMAP: Create new room <%s> on floor <%d> with type <%d>",
                roomname, floornum, newroomtype);
 
        ret = CtdlCreateRoom(roomname, newroomtype, "", floornum, 1, 0, newroomview);
@@ -1087,7 +1088,7 @@ void imap_create(int num_parms, ConstStr *Params)
                CtdlAideMessage(notification_message, "Room Creation Message");
                free(notification_message);
        }
-       syslog(LOG_DEBUG, "imap_create() completed\n");
+       syslog(LOG_DEBUG, "imap_create() completed");
 }
 
 
@@ -1450,7 +1451,7 @@ void imap_rename(int num_parms, ConstStr *Params)
                                           irl->irl_newfloor);
                        if (r != crr_ok) {
                                /* FIXME handle error returns better */
-                               syslog(LOG_ERR, "CtdlRenameRoom() error %d\n", r);
+                               syslog(LOG_ERR, "IMAP: CtdlRenameRoom() error %d", r);
                        }
                        irlp = irl;
                        irl = irl->next;
@@ -1492,23 +1493,23 @@ void imap_command_loop(void)
                FlushStrBuf(Imap->Cmd.CmdBuf);
 
        if (CtdlClientGetLine(Imap->Cmd.CmdBuf) < 1) {
-               syslog(LOG_ERR, "Client disconnected: ending session.\r\n");
+               syslog(LOG_ERR, "IMAP: client disconnected: ending session.");
                CC->kill_me = KILLME_CLIENT_DISCONNECTED;
                return;
        }
 
        if (Imap->authstate == imap_as_expecting_password) {
-               syslog(LOG_INFO, "IMAP: <password>\n");
+               syslog(LOG_INFO, "IMAP: <password>");
        }
        else if (Imap->authstate == imap_as_expecting_plainauth) {
-               syslog(LOG_INFO, "IMAP: <plain_auth>\n");
+               syslog(LOG_INFO, "IMAP: <plain_auth>");
        }
        else if ((Imap->authstate == imap_as_expecting_multilineusername) || 
                 cbmstrcasestr(ChrPtr(Imap->Cmd.CmdBuf), " LOGIN ")) {
-               syslog(LOG_INFO, "IMAP: LOGIN...\n");
+               syslog(LOG_INFO, "IMAP: LOGIN...");
        }
        else {
-               syslog(LOG_INFO, "IMAP: %s\n", ChrPtr(Imap->Cmd.CmdBuf));
+               syslog(LOG_INFO, "IMAP: %s", ChrPtr(Imap->Cmd.CmdBuf));
        }
 
        pchs = ChrPtr(Imap->Cmd.CmdBuf);
@@ -1564,17 +1565,16 @@ void imap_command_loop(void)
 /* debug output the parsed vector */
        {
                int i;
-               syslog(LOG_DEBUG, "----- %ld params \n",
-                             Imap->Cmd.num_parms);
+               syslog(LOG_DEBUG, "----- %ld params", Imap->Cmd.num_parms);
 
        for (i=0; i < Imap->Cmd.num_parms; i++) {
                if (Imap->Cmd.Params[i].len != strlen(Imap->Cmd.Params[i].Key))
-                       syslog(LOG_DEBUG, "*********** %ld != %ld : %s\n",
+                       syslog(LOG_DEBUG, "*********** %ld != %ld : %s",
                                      Imap->Cmd.Params[i].len, 
                                      strlen(Imap->Cmd.Params[i].Key),
                                      Imap->Cmd.Params[i].Key);
                else
-                       syslog(LOG_DEBUG, "%ld : %s\n",
+                       syslog(LOG_DEBUG, "%ld : %s",
                                      Imap->Cmd.Params[i].len, 
                                      Imap->Cmd.Params[i].Key);
        }}
@@ -1627,7 +1627,7 @@ BAIL:
 
        gettimeofday(&tv2, NULL);
        total_time = (tv2.tv_usec + (tv2.tv_sec * 1000000)) - (tv1.tv_usec + (tv1.tv_sec * 1000000));
-       syslog(LOG_DEBUG, "IMAP command completed in %ld.%ld seconds\n",
+       syslog(LOG_DEBUG, "IMAP command completed in %ld.%ld seconds",
                (total_time / 1000000),
                (total_time % 1000000)
        );
index db1d92ce50b9be8d1413f9103601e3c3212bf5a9..965cff9648d71169db9c7a0f862f091365d4f991 100644 (file)
@@ -585,7 +585,7 @@ void managesieve_command_loop(void) {
                length = strlen(parms[0]);
        }
        if (length < 1) {
-               syslog(LOG_CRIT, "Client disconnected: ending session.\n");
+               syslog(LOG_CRIT, "managesieve: client disconnected: ending session.\n");
                CC->kill_me = KILLME_CLIENT_DISCONNECTED;
                return;
        }
index b8f3cb0735ea2f99455420c9b246db52b047b8c6..caba331877fe9094dbe2bb01b3bae8f60b9d4f78 100644 (file)
@@ -569,7 +569,7 @@ void pop3_command_loop(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               syslog(LOG_ERR, "Client disconnected: ending session.");
+               syslog(LOG_ERR, "POP3 client disconnected: ending session.");
                CC->kill_me = KILLME_CLIENT_DISCONNECTED;
                return;
        }
index 6c7480adfa0d0fddcd0fc02601deb58e804b34d6..e2d9766a68826c900bb42f0431b26137b9c1c5bf 100644 (file)
@@ -840,7 +840,7 @@ void smtp_command_loop(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               syslog(LOG_CRIT, "Client disconnected: ending session.\n");
+               syslog(LOG_CRIT, "SMTP: client disconnected: ending session.\n");
                CC->kill_me = KILLME_CLIENT_DISCONNECTED;
                return;
        }
index 39c4017868c74a26351ab5c23297e9c385114324..8340d4eebad1a7632d5c03d3376fa6208b9d2fb3 100644 (file)
@@ -1116,7 +1116,7 @@ void check_get(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               syslog(LOG_CRIT, "Client disconnected: ending session.\n");
+               syslog(LOG_CRIT, "vcard client disconnected: ending session.\n");
                CC->kill_me = KILLME_CLIENT_DISCONNECTED;
                return;
        }
index d158b819d9b7114c623b803f3f41deca6a752de0..94d35b1d0f33ffd759456ce4394103d913fadcbf 100644 (file)
@@ -549,7 +549,7 @@ void xmpp_command_loop(void) {
                XML_Parse(XMPP->xp, ChrPtr(stream_input), rc, 0);
        }
        else {
-               syslog(LOG_ERR, "Client disconnected: ending session.\n");
+               syslog(LOG_ERR, "XMPP: client disconnected: ending session.\n");
                CC->kill_me = KILLME_CLIENT_DISCONNECTED;
        }
        FreeStrBuf(&stream_input);