]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/smtp/serv_smtp.c
* be more paranoid about the previous content of passvoid buffers
[citadel.git] / citadel / modules / smtp / serv_smtp.c
index 5d520ae2bf5489603cf37fff3e153af3d77aee51..2532307399cc1155b2c9db313428f1cda639c050 100644 (file)
@@ -316,6 +316,7 @@ void smtp_get_user(char *argbuf) {
 void smtp_get_pass(char *argbuf) {
        char password[SIZ];
 
+       memset(password, 0, sizeof(password));  
        CtdlDecodeBase64(password, argbuf, SIZ);
        /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", password); */
        if (CtdlTryPassword(password) == pass_ok) {
@@ -659,15 +660,27 @@ void smtp_data(void) {
        datestring(nowstamp, sizeof nowstamp, time(NULL), DATESTRING_RFC822);
        body = malloc(4096);
 
-       if (body != NULL) snprintf(body, 4096,
-               "Received: from %s (%s [%s])\n"
-               "       by %s; %s\n",
-                       SMTP->helo_node,
-                       CC->cs_host,
-                       CC->cs_addr,
-                       config.c_fqdn,
-                       nowstamp);
-       
+       if (body != NULL) {
+               if (SMTP->is_lmtp && (CC->cs_UDSclientUID != -1)) {
+                       snprintf(body, 4096,
+                                "Received: from %s (Citadel from userid %ld)\n"
+                                "      by %s; %s\n",
+                                SMTP->helo_node,
+                                CC->cs_UDSclientUID,
+                                config.c_fqdn,
+                                nowstamp);
+               }
+               else {
+                       snprintf(body, 4096,
+                                "Received: from %s (%s [%s])\n"
+                                "      by %s; %s\n",
+                                SMTP->helo_node,
+                                CC->cs_host,
+                                CC->cs_addr,
+                                config.c_fqdn,
+                                nowstamp);
+               }
+       }
        body = CtdlReadMessageBody(".", config.c_maxmsglen, body, 1, 0);
        if (body == NULL) {
                cprintf("550 Unable to save message: internal error.\r\n");
@@ -1696,6 +1709,7 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
  */
 void smtp_do_queue(void) {
        static int doing_queue = 0;
+       int num_processed = 0;
 
        /*
         * This is a simple concurrency check to make sure only one queue run
@@ -1715,10 +1729,9 @@ void smtp_do_queue(void) {
                CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
                return;
        }
-       CtdlForEachMessage(MSGS_ALL, 0L, NULL,
-               SPOOLMIME, NULL, smtp_do_procmsg, NULL);
+       num_processed = CtdlForEachMessage(MSGS_ALL, 0L, NULL, SPOOLMIME, NULL, smtp_do_procmsg, NULL);
 
-       CtdlLogPrintf(CTDL_INFO, "SMTP client: queue run completed\n");
+       CtdlLogPrintf(CTDL_INFO, "SMTP client: queue run completed; %d messages processed\n", num_processed);
        run_queue_now = 0;
        doing_queue = 0;
 }