* added message subject to all those tiny messages
authorWilfried Göesgens <willi@citadel.org>
Wed, 1 Nov 2006 17:38:20 +0000 (17:38 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 1 Nov 2006 17:38:20 +0000 (17:38 +0000)
* paste descriptive message into aide room, if we fail to open ports or sockets
* completed managesieve server, enable it by setup with port 2020

17 files changed:
citadel/config.sub
citadel/control.c
citadel/database_sleepycat.c
citadel/debian/citadel-client.substvars
citadel/debian/citadel-mta.substvars
citadel/debian/citadel-server.substvars
citadel/msgbase.c
citadel/msgbase.h
citadel/room_ops.c
citadel/serv_expire.c
citadel/serv_extensions.c
citadel/serv_managesieve.c
citadel/serv_vcard.c
citadel/setup.c
citadel/sysdep.c
citadel/sysdep_decls.h
citadel/user_ops.c

index 387c18d1a135c2e33cb9f911c198efdf7b12b96c..fab0aa3556632a4aec253b77804270a096c11c3e 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
 #   Inc.
 
-timestamp='2006-07-02'
+timestamp='2006-09-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -276,6 +276,7 @@ case $basic_machine in
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
        | pyramid \
+       | score \
        | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
@@ -284,7 +285,7 @@ case $basic_machine in
        | tahoe | thumb | tic4x | tic80 | tron \
        | v850 | v850e \
        | we32k \
-       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
        | z8k)
                basic_machine=$basic_machine-unknown
                ;;
@@ -367,7 +368,7 @@ case $basic_machine in
        | tron-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
-       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
        | xstormy16-* | xtensa-* \
        | ymp-* \
        | z8k-*)
@@ -909,6 +910,10 @@ case $basic_machine in
        sb1el)
                basic_machine=mipsisa64sb1el-unknown
                ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
        sei)
                basic_machine=mips-sei
                os=-seiux
@@ -1366,6 +1371,9 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
+        score-*)
+               os=-elf
+               ;;
         spu-*)
                os=-elf
                ;;
index 7e01f13b1b5b983ce4342a1389fc6b93eee22286..f2268d8fa2f06c655e71ea313675a8992d2c5efa 100644 (file)
@@ -436,7 +436,7 @@ void cmd_conf(char *argbuf)
                snprintf(buf, sizeof buf,
                         "The global system configuration has been edited by %s.\n",
                         CC->curr_user);
-               aide_message(buf);
+               aide_message(buf,"Citadel Configuration Manager Message");
 
                if (strlen(config.c_logpages) > 0)
                        create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
index 8293dc8991f0050d806bf498377a6530ee96dcfc..0573ae5de032cfce2ac565ba0e96768a3459caf5 100644 (file)
@@ -244,7 +244,7 @@ static void cdb_cull_logs(void)
                                         " This log file is no longer in use "
                                         "and may be safely deleted.\n",
                                         *file, strerror(errno));
-                               aide_message(errmsg);
+                               aide_message(errmsg, "Database Warning Message");
                        }
                }
                free(list);
index 9cd3474faca0c5ffbc681f7ca6345f6df03c30d9..511d113dbe0b4c59aaae8f9347c7e1e4da033ad4 100644 (file)
@@ -1 +1 @@
-shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8b-1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8c-1)
index 9cd3474faca0c5ffbc681f7ca6345f6df03c30d9..511d113dbe0b4c59aaae8f9347c7e1e4da033ad4 100644 (file)
@@ -1 +1 @@
-shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8b-1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8c-1)
index 7dbe5f8efae722248df006b69f186b51c00e512d..3c6c9728301bcce24ff59702d7bd31f226b06824 100644 (file)
@@ -1,2 +1,2 @@
 misc:Depends=debconf (>= 0.5) | debconf-2.0
-shlibs:Depends=libc6 (>= 2.3.6-6), libdb4.3 (>= 4.3.28-1), libldap2 (>= 2.1.17-1), libncurses5 (>= 5.4-5), libssl0.9.8 (>= 0.9.8b-1), zlib1g (>= 1:1.2.1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libdb4.4, libldap2 (>= 2.1.17-1), libncurses5 (>= 5.4-5), libsieve2-1, libssl0.9.8 (>= 0.9.8c-1), zlib1g (>= 1:1.2.1)
index 2a6b775c8a0efa1e6e48058793796efcf5b6458c..36c5fbb2ded471f7da741d669f94e79e68dd5dd0 100644 (file)
@@ -3009,8 +3009,9 @@ int CtdlCheckInternetMailPermission(struct ctdluser *who) {
 /*
  * Validate recipients, count delivery types and errors, and handle aliasing
  * FIXME check for dupes!!!!!
- * Returns 0 if all addresses are ok, -1 if no addresses were specified,
- * or the number of addresses found invalid.
+ * Returns 0 if all addresses are ok, ret->num_error = -1 if no addresses 
+ * were specified, or the number of addresses found invalid.
+ * caller needs to free the result.
  */
 struct recptypes *validate_recipients(char *supplied_recipients) {
        struct recptypes *ret;
index d06c6398a8fe310e513f89b9d5de0833e8d9a2e4..33f67b9efa50e5b7f9282ca6b0c2d28d3983e0a4 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$ */
 
-#define aide_message(text)      quickie_message("Citadel",NULL,NULL,AIDEROOM,text,0,NULL)
+#define aide_message(text, subject)      quickie_message("Citadel",NULL,NULL,AIDEROOM,text,0,subject)
 
 enum {
        MSGS_ALL,
index 240cb55dc77a9cdadf862c76953541505117bf8d..d6ec55e4a43e64757a1b2ebe76bf51f0b904c708 100644 (file)
@@ -1449,7 +1449,7 @@ void cmd_setr(char *args)
        }
        snprintf(buf, sizeof buf, "The room \"%s\" has been edited by %s.\n",
                CC->room.QRname, CC->curr_user);
-       aide_message(buf);
+       aide_message(buf, "Room modification Message");
        cprintf("%d Ok\n", CIT_OK);
 }
 
@@ -1511,7 +1511,7 @@ void cmd_seta(char *new_ra)
                        snprintf(buf, sizeof buf,
                                "There is now no room aide for \"%s\".\n",
                                CC->room.QRname);
-               aide_message(buf);
+               aide_message(buf, "Aide Room Modification");
        }
        cprintf("%d Ok\n", CIT_OK);
 }
@@ -1694,7 +1694,7 @@ void cmd_kill(char *argbuf)
                /* tell the world what we did */
                snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
                         deleted_room_name, CC->curr_user);
-               aide_message(msg);
+               aide_message(msg, "Room Purger Message");
                cprintf("%d '%s' deleted.\n", CIT_OK, deleted_room_name);
        } else {
                cprintf("%d ok to delete.\n", CIT_OK);
@@ -1908,7 +1908,7 @@ void cmd_cre8(char *args)
                ((newflags & QR_PASSWORDED) ? " Password: " : ""),
                ((newflags & QR_PASSWORDED) ? new_room_pass : "")
        );
-       aide_message(notification_message);
+       aide_message(notification_message, "Room Creation Message");
        free(notification_message);
 
        cprintf("%d '%s' has been created.\n", CIT_OK, new_room_name);
index 6927a6509dbf5112935bcc1ca884a42d1d5494ff..84482b90708fbbcfd5225d40bec1710e0d1ef703 100644 (file)
@@ -350,7 +350,7 @@ int PurgeRooms(void) {
                ++num_rooms_purged;
        }
 
-       if (num_rooms_purged > 0) aide_message(transcript);
+       if (num_rooms_purged > 0) aide_message(transcript, "Room Autopurger Message");
        free(transcript);
 
        lprintf(CTDL_DEBUG, "Purged %d rooms.\n", num_rooms_purged);
@@ -482,7 +482,7 @@ int PurgeUsers(void) {
                ++num_users_purged;
        }
 
-       if (num_users_purged > 0) aide_message(transcript);
+       if (num_users_purged > 0) aide_message(transcript,"User Purge Message");
        free(transcript);
 
        lprintf(CTDL_DEBUG, "Purged %d users.\n", num_users_purged);
index 6f72457d3c9f5e15dacacf197a600c947bc4112a..1934e0de008fe53a29b4410ce3774cae3a8404bc 100644 (file)
@@ -45,6 +45,109 @@ struct ProtoFunctionHook {
        struct ProtoFunctionHook *next;
 } *ProtoHookList = NULL;
 
+
+#define ERR_PORT (1 << 1)
+
+
+static char *portlist = NULL;
+static size_t nSizPort = 0;
+
+static char *errormessages = NULL;
+static size_t nSizErrmsg = 0;
+
+
+static long   DetailErrorFlags;
+
+
+char *ErrSubject = "Startup Problems";
+char *ErrGeneral = "Citadel had trouble on starting up. %s This means, citadel won't be the service provider for a specific service you configured it to.\n\n"
+"If you don't want citadel to provide these services, turn them off in WebCit via %s%s\n\n%s\n\n"
+"To make both ways actualy take place restart the citserver with \"sendcommand down\"\n\n"
+"The errors returned by the system were:\n%s\n";
+
+
+char *ErrPortShort = "We couldn't bind all ports you configured to be provided by citadel server.";
+char *ErrPortWhere = "Admin->System Preferences->Network.\n\nThe failed ports and sockets are: ";
+char *ErrPortHint = "If you want citadel to provide you with that functionality, "
+"check the output of \"netstat -lnp\" on linux Servers or \"netstat -na\" on *BSD"
+" and stop the programm, that binds these ports. You should eventually remove "
+" their initscripts in /etc/init.d so that you won't get this trouble once more.\n";
+
+
+void LogPrintMessages(long err)
+{
+       char *List, *DetailList, *Short, *Where, *Hint, *Message; 
+       int n = nSizPort + nSizErrmsg + 5;
+
+       Message = (char*) malloc(n * SIZ);
+
+       switch (err)
+       {
+       case ERR_PORT:
+               Short = ErrPortShort;
+               Where = ErrPortWhere;
+               Hint  = ErrPortHint;
+               List  = portlist;
+               DetailList = errormessages;
+               break;
+       default:
+               Short = "";
+               Where = "";
+               Hint  = "";
+               List  = "";
+               DetailList = "";
+       }
+
+
+       snprintf(Message, n * SIZ, ErrGeneral, Short, Where, List, Hint, DetailList);
+
+       quickie_message("Citadel", NULL, NULL, AIDEROOM, Message, FMT_FIXED, ErrSubject);
+       free(Message);
+}
+
+
+
+void AppendString(char **target, char *append, size_t *len, size_t rate)
+{
+       size_t oLen = 0;
+       long AddLen;
+       long RelPtr = 0;
+
+       AddLen = strlen(append);
+
+       if (*len == 0)
+       {
+               *len = rate;
+
+               *target = (char*)malloc (*len * SIZ);
+       }
+       else 
+       {
+               oLen = strlen(*target);
+               RelPtr = strlen(*target);
+               if (oLen + AddLen + 2 > *len * SIZ)
+               {
+                       char *Buff = *target;
+                       size_t NewSiz = *len + 10;
+                       *target = malloc (NewSiz * SIZ);
+                       memcpy (*target, Buff, NewSiz * SIZ);
+                       *len = NewSiz;
+               }
+       }
+       memcpy (*target + oLen, append, AddLen);
+       (*target)[AddLen + 1] = '\n';
+       (*target)[AddLen + 2] = '\0';
+}
+
+void AddPortError(char *Port, char *ErrorMessage)
+{
+       DetailErrorFlags |= ERR_PORT;
+
+       AppendString(&errormessages, ErrorMessage, &nSizErrmsg, 10);
+       AppendString(&portlist, Port, &nSizPort, 2);
+}
+
+
 void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc)
 {
        struct ProtoFunctionHook *p;
@@ -102,6 +205,8 @@ int DLoader_Exec_Cmd(char *cmdbuf)
 
 void initialize_server_extensions(void)
 {
+       long filter;
+
        lprintf(CTDL_INFO, "%s\n", serv_bio_init());
        lprintf(CTDL_INFO, "%s\n", serv_calendar_init());
        lprintf(CTDL_INFO, "%s\n", serv_notes_init());
@@ -117,9 +222,9 @@ void initialize_server_extensions(void)
        lprintf(CTDL_INFO, "%s\n", serv_network_init());
        lprintf(CTDL_INFO, "%s\n", serv_newuser_init());
        lprintf(CTDL_INFO, "%s\n", serv_pas2_init());
+       lprintf(CTDL_INFO, "%s\n", serv_smtp_init());
        lprintf(CTDL_INFO, "%s\n", serv_pop3_init());
        lprintf(CTDL_INFO, "%s\n", serv_rwho_init());
-       lprintf(CTDL_INFO, "%s\n", serv_smtp_init());
        lprintf(CTDL_INFO, "%s\n", serv_spam_init());
        /* lprintf(CTDL_INFO, "%s\n", serv_test_init()); */
        lprintf(CTDL_INFO, "%s\n", serv_vandelay_init());
@@ -129,6 +234,10 @@ void initialize_server_extensions(void)
        lprintf(CTDL_INFO, "%s\n", serv_postfix_tcpdict());
        lprintf(CTDL_INFO, "%s\n", serv_sieve_init());
        lprintf(CTDL_INFO, "%s\n", serv_managesieve_init());
+
+       for (filter = 1; filter != 0; filter = filter << 1)
+               if ((filter & DetailErrorFlags) != 0)
+                       LogPrintMessages(filter);
 }
 
 
@@ -453,10 +562,13 @@ void CtdlRegisterServiceHook(int tcp_port,
                        )
 {
        struct ServiceFunctionHook *newfcn;
-       char message[SIZ];
+       char *message;
+       char *error;
 
        newfcn = (struct ServiceFunctionHook *)
            malloc(sizeof(struct ServiceFunctionHook));
+       message = (char*) malloc (SIZ);
+       
        newfcn->next = ServiceHookTable;
        newfcn->tcp_port = tcp_port;
        newfcn->sockpath = sockpath;
@@ -465,8 +577,8 @@ void CtdlRegisterServiceHook(int tcp_port,
        newfcn->h_async_function = h_async_function;
 
        if (sockpath != NULL) {
-               newfcn->msock = ig_uds_server(sockpath, config.c_maxsessions);
-               snprintf(message, sizeof message, "Unix domain socket '%s': ", sockpath);
+               newfcn->msock = ig_uds_server(sockpath, config.c_maxsessions, &error);
+               snprintf(message, SIZ, "Unix domain socket '%s': ", sockpath);
        }
        else if (tcp_port <= 0) {       /* port -1 to disable */
                lprintf(CTDL_INFO, "Service has been manually disabled, skipping\n");
@@ -475,9 +587,10 @@ void CtdlRegisterServiceHook(int tcp_port,
        }
        else {
                newfcn->msock = ig_tcp_server(config.c_ip_addr,
-                                       tcp_port,
-                                       config.c_maxsessions);
-               snprintf(message, sizeof message, "TCP port %d: ", tcp_port);
+                                             tcp_port,
+                                             config.c_maxsessions, 
+                                             &error);
+               snprintf(message, SIZ, "TCP port %d: ", tcp_port);
        }
 
        if (newfcn->msock > 0) {
@@ -486,10 +599,13 @@ void CtdlRegisterServiceHook(int tcp_port,
                lprintf(CTDL_INFO, "%s\n", message);
        }
        else {
+               AddPortError(message, error);
                strcat(message, "FAILED.");
                lprintf(CTDL_CRIT, "%s\n", message);
+               free(error);
                free(newfcn);
        }
+       free(message);
 }
 
 
index f93e20942d1d2c056d0e4888cfa0760401975c1c..608318fb6e8148231a043524951ea7faa3d30ca7 100644 (file)
@@ -131,8 +131,8 @@ void cmd_mgsve_caps(void)
 /* if TLS is already there, should we say that again? */
                "\"STARTTLS\"\r\n"
 #endif
-               "\"SIEVE\" \"FILEINTO VACATION\"\r\n" /* TODO: print sieve extensions here. */
-               "OK\r\n");
+               "\"SIEVE\" \"%s\"\r\n"
+               "OK\r\n", msiv_extensions);
 }
 
 
@@ -209,17 +209,14 @@ char *ReadString(long size, char *command)
 /* AUTHENTICATE command; 2.1 */
 void cmd_mgsve_auth(int num_parms, char **parms, struct sdm_userdata *u)
 {
-/* TODO: compare "digest-md5" or "gssapi" and answer with "NO" */
        if ((num_parms == 3) && !strncasecmp(parms[1], "PLAIN", 5))
                /* todo, check length*/
        {
                char auth[SIZ];
                int retval;
-               
-               /* todo: how to do plain auth? */
                char *message = ReadString(GetSizeToken(parms[2]), parms[0]);
                
-               if (message != NULL) {/* do we have tokenized login? */
+               if (message != NULL) {/**< do we have tokenized login? */
                        retval = CtdlDecodeBase64(auth, MGSVE->transmitted_message, SIZ);
                }
                else 
@@ -241,15 +238,17 @@ void cmd_mgsve_auth(int num_parms, char **parms, struct sdm_userdata *u)
                }
        }
        
-       cprintf("NO\r\n");/* we just support auth plain. */
+       cprintf("NO \"Authentication Failure.\"\r\n");/* we just support auth plain. */
        CC->kill_me = 1;
 }
 
 
 #ifdef HAVE_OPENSSL
-/* STARTTLS command chapter 2.2 */
+/**
+ * STARTTLS command chapter 2.2 
+ */
 void cmd_mgsve_starttls(void)
-{ /* answer with OK, and fire off tls session. */
+{ /** answer with OK, and fire off tls session. */
        cprintf("OK\r\n");
        CtdlStartTLS(NULL, NULL, NULL);
        cmd_mgsve_caps();
@@ -258,19 +257,22 @@ void cmd_mgsve_starttls(void)
 
 
 
-/* LOGOUT command, see chapter 2.3 */
+/**
+ *LOGOUT command, see chapter 2.3 
+ */
 void cmd_mgsve_logout(struct sdm_userdata *u)
-{/* send "OK" and terminate the connection. */
+{
        cprintf("OK\r\n");
        lprintf(CTDL_NOTICE, "MgSve bye.");
        CC->kill_me = 1;
 }
 
 
-/* HAVESPACE command. see chapter 2.5 */
+/**
+ * HAVESPACE command. see chapter 2.5 
+ */
 void cmd_mgsve_havespace(void)
 {
-/* TODO answer NO in any case if auth is missing. */
 /* as we don't have quotas in citadel we should always answer with OK; 
  * pherhaps we should have a max-scriptsize. 
  */
@@ -287,11 +289,12 @@ void cmd_mgsve_havespace(void)
        }
 }
 
-/* PUTSCRIPT command, see chapter 2.6 */
+/**
+ * PUTSCRIPT command, see chapter 2.6 
+ */
 void cmd_mgsve_putscript(int num_parms, char **parms, struct sdm_userdata *u)
 {
 /* "scriptname" {nnn+} */
-/* TODO: answer with "NO" instant, if we're unauthorized. */
 /* AFTER we have the whole script overwrite existing scripts */
 /* spellcheck the script before overwrite old ones, and reply with "no" */
        if (num_parms == 3)
@@ -331,7 +334,9 @@ void cmd_mgsve_putscript(int num_parms, char **parms, struct sdm_userdata *u)
 
 
 
-/* LISTSCRIPT command. see chapter 2.7 */
+/**
+ * LISTSCRIPT command. see chapter 2.7 
+ */
 void cmd_mgsve_listscript(int num_parms, char **parms, struct sdm_userdata *u)
 {
 
@@ -347,22 +352,15 @@ void cmd_mgsve_listscript(int num_parms, char **parms, struct sdm_userdata *u)
                        nScripts++;
                }
        }
-
-       //      if (nScripts > 0)
-               cprintf("OK\r\n");
-               //      else
-               //cprintf("NO \"No scripts found.\"\r\n");
+       cprintf("OK\r\n");
 }
 
 
-/* SETACTIVE command. see chapter 2.8 */
+/**
+ * \brief SETACTIVE command. see chapter 2.8 
+ */
 void cmd_mgsve_setactive(int num_parms, char **parms, struct sdm_userdata *u)
 {
-/* TODO: check auth, if not, answer with "no" */
-/* search our room for subjects with that scriptname, 
- * if the scriptname is empty, use the default flag.
- * if the script is not there answer "No "there is no script by that name "
- */
        if (num_parms == 2)
        {
                if (msiv_setactive(u, parms[1]) == 0) {
@@ -377,13 +375,11 @@ void cmd_mgsve_setactive(int num_parms, char **parms, struct sdm_userdata *u)
 }
 
 
-/* GETSCRIPT command. see chapter 2.9 */
+/**
+ * \brief GETSCRIPT command. see chapter 2.9 
+ */
 void cmd_mgsve_getscript(int num_parms, char **parms, struct sdm_userdata *u)
 {
-/* check first param, this is the name. look up that in the folder.
- * answer with the size {nnn+}and spill it out, one blank line and OK
- */
-
        if (num_parms == 2){
                char *script_content;
                long  slen;
@@ -405,10 +401,11 @@ void cmd_mgsve_getscript(int num_parms, char **parms, struct sdm_userdata *u)
 }
 
 
-/* DELETESCRIPT command. see chapter 2.10 */
+/**
+ * \brief DELETESCRIPT command. see chapter 2.10 
+ */
 void cmd_mgsve_deletescript(int num_parms, char **parms, struct sdm_userdata *u)
 {
-/* TODO: check auth, if not, answer with "no" */
        int i=-1;
 
        if (num_parms == 2)
@@ -431,77 +428,8 @@ void cmd_mgsve_deletescript(int num_parms, char **parms, struct sdm_userdata *u)
 }
 
 
-
-/*
- *
-void mgsve_get_user(char *argbuf) {
-       char buf[SIZ];
-       char username[SIZ];
-
-       CtdlDecodeBase64(username, argbuf, SIZ);
-       / * lprintf(CTDL_DEBUG, "Trying <%s>\n", username); * /
-       if (CtdlLoginExistingUser(username) == login_ok) {
-               CtdlEncodeBase64(buf, "Password:", 9);
-               cprintf("334 %s\r\n", buf);
-               MGSVE->command_state = mgsve_password;
-       }
-       else {
-               cprintf("500 5.7.0 No such user.\r\n");
-               MGSVE->command_state = mgsve_command;
-       }
-}
- */
-
-
-/*
- *
-void mgsve_get_pass(char *argbuf) {
-       char password[SIZ];
-
-       CtdlDecodeBase64(password, argbuf, SIZ);
-       / * lprintf(CTDL_DEBUG, "Trying <%s>\n", password); * /
-       if (CtdlTryPassword(password) == pass_ok) {
-               mgsve_auth_greeting();
-       }
-       else {
-               cprintf("535 5.7.0 Authentication failed.\r\n");
-       }
-       MGSVE->command_state = mgsve_command;
-}
- */
-
-
-/*
- * Back end for PLAIN auth method (either inline or multistate)
- */
-void mgsve_try_plain(char *encoded_authstring) {
-       char decoded_authstring[1024];
-       char ident[256];
-       char user[256];
-       char pass[256];
-
-       CtdlDecodeBase64(decoded_authstring,
-                       encoded_authstring,
-                       strlen(encoded_authstring) );
-       safestrncpy(ident, decoded_authstring, sizeof ident);
-       safestrncpy(user, &decoded_authstring[strlen(ident) + 1], sizeof user);
-       safestrncpy(pass, &decoded_authstring[strlen(ident) + strlen(user) + 2], sizeof pass);
-
-//     MGSVE->command_state = mgsve_command;
-/*
-       if (CtdlLoginExistingUser(user) == login_ok) {
-               if (CtdlTryPassword(pass) == pass_ok) {
-                       mgsve_auth_greeting();
-                       return;
-               }
-       }
-*/
-       cprintf("504 5.7.4 Authentication failed.\r\n");
-}
-
-
-/*
- * Attempt to perform authenticated managesieve
+/**
+ * \brief Attempt to perform authenticated managesieve
  */
 void mgsve_auth(char *argbuf) {
        char username_prompt[64];
@@ -509,7 +437,7 @@ void mgsve_auth(char *argbuf) {
        char encoded_authstring[1024];
 
        if (CC->logged_in) {
-               cprintf("504 5.7.4 Already logged in.\r\n");
+               cprintf("NO \"Already logged in.\"\r\n");
                return;
        }
 
@@ -517,12 +445,10 @@ void mgsve_auth(char *argbuf) {
 
        if (!strncasecmp(method, "login", 5) ) {
                if (strlen(argbuf) >= 7) {
-//                     mgsve_get_user(&argbuf[6]);
                }
                else {
                        CtdlEncodeBase64(username_prompt, "Username:", 9);
                        cprintf("334 %s\r\n", username_prompt);
-//                     MGSVE->command_state = mgsve_user;
                }
                return;
        }
@@ -530,18 +456,14 @@ void mgsve_auth(char *argbuf) {
        if (!strncasecmp(method, "plain", 5) ) {
                if (num_tokens(argbuf, ' ') < 2) {
                        cprintf("334 \r\n");
-//                     MGSVE->command_state = mgsve_plain;
                        return;
                }
-
                extract_token(encoded_authstring, argbuf, 1, ' ', sizeof encoded_authstring);
-
-///            mgsve_try_plain(encoded_authstring);
                return;
        }
 
        if (strncasecmp(method, "login", 5) ) {
-               cprintf("504 5.7.4 Unknown authentication method.\r\n");
+               cprintf("NO \"Unknown authentication method.\"\r\n");
                return;
        }
 
@@ -588,7 +510,6 @@ void managesieve_command_loop(void) {
        length = client_getln(cmdbuf, sizeof cmdbuf);
        if (length >= 1) {
                num_parms = imap_parameterize(parms, cmdbuf);
-               ///             length = client_getln(parms[0], sizeof parms[0]);
                if (num_parms == 0) return;
                length = strlen(parms[0]);
        }
@@ -598,7 +519,6 @@ void managesieve_command_loop(void) {
                return;
        }
        lprintf(CTDL_INFO, "MANAGESIEVE: %s\n", cmdbuf);
-//// we have different lengths while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
        if ((length>= 12) && (!strncasecmp(parms[0], "AUTHENTICATE", 12))){
                cmd_mgsve_auth(num_parms, parms, &u);
        }
@@ -613,7 +533,8 @@ void managesieve_command_loop(void) {
        }
        else if ((length>= 6) && (!strncasecmp(parms[0], "CAPABILITY", 10))){
                cmd_mgsve_caps();
-       } /* these commands need to be authenticated. throw it out if it tries. */
+       } 
+       /** these commands need to be authenticated. throw it out if it tries. */
        else if (!CtdlAccessCheck(ac_logged_in))
        {
                msiv_load(&u);
@@ -641,8 +562,8 @@ void managesieve_command_loop(void) {
                msiv_store(&u, changes_made);
        }
        else {
-               /// todo: log this.
                cprintf("No\r\n");
+               lprintf(CTDL_INFO, "illegal Managesieve command: %s", parms[0]);
                CC->kill_me = 1;
        }
 
index ff0bff91805076b752fb4f3c74562a691e8928a8..f2205b687b6d26177f05f621ccc39a32c6d8bd24 100644 (file)
@@ -917,6 +917,7 @@ void check_get(void) {
                        
                        lprintf(CTDL_INFO, "sending 500 REJECT noone here by that name: %s\n", internet_addr);
                }
+               if (rcpt != NULL) free (rcpt);
        }
 ///    CC->kill_me = 1;
 }
index e2c6e644c48775f8d83f4a3ee629dae114a0e853..8a178efeec6b81abc32e807b96efecf3b4ccd090 100644 (file)
@@ -1300,7 +1300,7 @@ int main(int argc, char *argv[])
        if (config.c_pop3s_port == 0) config.c_pop3s_port = 995;
        if (config.c_imaps_port == 0) config.c_imaps_port = 993;
        if (config.c_pftcpdict_port == 0) config.c_pftcpdict_port = -1;
-       if (config.c_managesieve_port == 0) config.c_managesieve_port = -1;
+       if (config.c_managesieve_port == 0) config.c_managesieve_port = 2020;
 
        /* Go through a series of dialogs prompting for config info */
        if (setup_type != UI_SILENT) {
index 3e3e2cff6419d554f64dfbdda8c0caae4fd7c1ac..f4e20d72ebb3c6bda71acff9ecad6fce5d95f1e9 100644 (file)
@@ -270,7 +270,7 @@ void end_critical_section(int which_one)
  * a TCP port.  The server shuts down if the bind fails.
  *
  */
-int ig_tcp_server(char *ip_addr, int port_number, int queue_len)
+int ig_tcp_server(char *ip_addr, int port_number, int queue_len, char **errormessage)
 {
        struct sockaddr_in sin;
        int s, i;
@@ -296,8 +296,11 @@ int ig_tcp_server(char *ip_addr, int port_number, int queue_len)
        s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 
        if (s < 0) {
-               lprintf(CTDL_EMERG, "citserver: Can't create a socket: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                                "citserver: Can't create a socket: %s",
+                                strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                return(-1);
        }
 
@@ -305,24 +308,32 @@ int ig_tcp_server(char *ip_addr, int port_number, int queue_len)
        setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));
 
        if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
-               lprintf(CTDL_EMERG, "citserver: Can't bind: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                                "citserver: Can't bind: %s",
+                                strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                close(s);
                return(-1);
        }
 
        /* set to nonblock - we need this for some obscure situations */
        if (fcntl(s, F_SETFL, O_NONBLOCK) < 0) {
-               lprintf(CTDL_EMERG,
-                       "citserver: Can't set socket to non-blocking: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                                "citserver: Can't set socket to non-blocking: %s",
+                                strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                close(s);
                return(-1);
        }
 
        if (listen(s, actual_queue_len) < 0) {
-               lprintf(CTDL_EMERG, "citserver: Can't listen: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                                "citserver: Can't listen: %s",
+                                strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                close(s);
                return(-1);
        }
@@ -335,7 +346,7 @@ int ig_tcp_server(char *ip_addr, int port_number, int queue_len)
 /*
  * Create a Unix domain socket and listen on it
  */
-int ig_uds_server(char *sockpath, int queue_len)
+int ig_uds_server(char *sockpath, int queue_len, char **errormessage)
 {
        struct sockaddr_un addr;
        int s;
@@ -347,8 +358,10 @@ int ig_uds_server(char *sockpath, int queue_len)
 
        i = unlink(sockpath);
        if (i != 0) if (errno != ENOENT) {
-               lprintf(CTDL_EMERG, "citserver: can't unlink %s: %s\n",
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, "citserver: can't unlink %s: %s",
                        sockpath, strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                return(-1);
        }
 
@@ -358,29 +371,40 @@ int ig_uds_server(char *sockpath, int queue_len)
 
        s = socket(AF_UNIX, SOCK_STREAM, 0);
        if (s < 0) {
-               lprintf(CTDL_EMERG, "citserver: Can't create a socket: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                        "citserver: Can't create a socket: %s",
+                        strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                return(-1);
        }
 
        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-               lprintf(CTDL_EMERG, "citserver: Can't bind: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                        "citserver: Can't bind: %s",
+                        strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                return(-1);
        }
 
        /* set to nonblock - we need this for some obscure situations */
        if (fcntl(s, F_SETFL, O_NONBLOCK) < 0) {
-               lprintf(CTDL_EMERG,
-                       "citserver: Can't set socket to non-blocking: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                        "citserver: Can't set socket to non-blocking: %s",
+                        strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                close(s);
                return(-1);
        }
 
        if (listen(s, actual_queue_len) < 0) {
-               lprintf(CTDL_EMERG, "citserver: Can't listen: %s\n",
-                       strerror(errno));
+               *errormessage = (char*) malloc(SIZ + 1);
+               snprintf(*errormessage, SIZ, 
+                        "citserver: Can't listen: %s",
+                        strerror(errno));
+               lprintf(CTDL_EMERG, "%s\n", *errormessage);
                return(-1);
        }
 
index d92d28e5710c96fc205c9679d6db48b7a37e87a7..40e43081962012896160bdf897865b47d3c4aec7 100644 (file)
@@ -48,8 +48,8 @@ extern int enable_syslog;
 void init_sysdep (void);
 void begin_critical_section (int which_one);
 void end_critical_section (int which_one);
-int ig_tcp_server (char *ip_addr, int port_number, int queue_len);
-int ig_uds_server(char *sockpath, int queue_len);
+int ig_tcp_server (char *ip_addr, int port_number, int queue_len,char **errormessage);
+int ig_uds_server(char *sockpath, int queue_len, char **errormessage);
 struct CitContext *MyContext (void);
 struct CitContext *CreateNewContext (void);
 void InitMyContext (struct CitContext *con);
index 39cd139de031473a197525ee1b8b25169a18f7a0..ff56484ca016121f1f2fc7bab6be967f0fd3d679 100644 (file)
@@ -1181,7 +1181,7 @@ int CtdlInvtKick(char *iuser, int op) {
                ((op == 1) ? "invited to" : "kicked out of"),
                CC->room.QRname,
                CC->user.fullname);
-       aide_message(bbb);
+       aide_message(bbb,"User Admin Message");
 
        return(0);
 }
@@ -1557,7 +1557,7 @@ void cmd_asup(char *cmdbuf)
        if (deleted) {
                sprintf(notify, "User \"%s\" has been deleted by %s.\n",
                        usbuf.fullname, CC->user.fullname);
-               aide_message(notify);
+               aide_message(notify, "User Deletion Message");
        }
 
        cprintf("%d Ok", CIT_OK);