commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. mu-1-2-90-separate-argp-cfg


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. mu-1-2-90-separate-argp-cfg-239-g5b1a540
Date: Thu, 12 Mar 2009 16:17:55 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=5b1a5402662d6685f0216a528c1c19536a7d421a

The branch, master has been updated
       via  5b1a5402662d6685f0216a528c1c19536a7d421a (commit)
      from  fef67bbdc7399fb7b2820057431bd4d703686c73 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5b1a5402662d6685f0216a528c1c19536a7d421a
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Mar 12 17:38:02 2009 +0200

    Bugfixes.
    
    * imap4d/bye.c: Discern between input and output errors.
    * imap4d/imap4d.h (ERR_NO_IFILE): New error code.
    * imap4d/util.c: Discern between input and output errors.
    Improve trace output.
    (imap4d_getline): Signal ERR_NO_IFILE on EOF.
    * movemail/movemail.c: Fix include statements.

-----------------------------------------------------------------------

Summary of changes:
 imap4d/bye.c        |    7 +++++-
 imap4d/imap4d.h     |   11 +++++----
 imap4d/util.c       |   56 +++++++++++++++++++++++++++++++++++++++++---------
 movemail/movemail.c |    2 +-
 4 files changed, 59 insertions(+), 17 deletions(-)

diff --git a/imap4d/bye.c b/imap4d/bye.c
index 85dc43a..801644c 100644
--- a/imap4d/bye.c
+++ b/imap4d/bye.c
@@ -65,7 +65,12 @@ imap4d_bye0 (int reason, struct imap4d_command *command)
 
     case ERR_NO_OFILE:
       status = EX_IOERR;
-      mu_diag_output (MU_DIAG_INFO, _("No socket to send to"));
+      mu_diag_output (MU_DIAG_INFO, _("Write error on control stream"));
+      break;
+
+    case ERR_NO_IFILE:
+      status = EX_IOERR;
+      mu_diag_output (MU_DIAG_INFO, _("Read error on control stream"));
       break;
 
     case ERR_MAILBOX_CORRUPTED:
diff --git a/imap4d/imap4d.h b/imap4d/imap4d.h
index 8a6e8e4..c054884 100644
--- a/imap4d/imap4d.h
+++ b/imap4d/imap4d.h
@@ -145,11 +145,12 @@ struct imap4d_command
 #define OK                    0
 #define ERR_NO_MEM            1
 #define ERR_NO_OFILE          2
-#define ERR_TIMEOUT           3
-#define ERR_SIGNAL            4
-#define ERR_TLS               5
-#define ERR_MAILBOX_CORRUPTED 6
-#define ERR_TERMINATE         7
+#define ERR_NO_IFILE          3
+#define ERR_TIMEOUT           4
+#define ERR_SIGNAL            5
+#define ERR_TLS               6
+#define ERR_MAILBOX_CORRUPTED 7
+#define ERR_TERMINATE         8
   
 /* Namespace numbers */
 #define NS_PRIVATE 0
diff --git a/imap4d/util.c b/imap4d/util.c
index f70e0a3..47b1f08 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -340,7 +340,10 @@ util_out (int rc, const char *format, ...)
     imap4d_bye (ERR_NO_MEM);
 
   if (imap4d_transcript)
-    mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
+    {
+      int len = strcspn (buf, "\r\n");
+      mu_diag_output (MU_DIAG_DEBUG, "sent: %*.*s", len, len, buf);
+    }
 
   status = mu_stream_sequential_write (ostream, buf, strlen (buf));
   free (buf);
@@ -381,7 +384,7 @@ util_finish (struct imap4d_command *command, int rc, const 
char *format, ...)
   free (tempbuf);
 
   if (imap4d_transcript)
-    mu_diag_output (MU_DIAG_DEBUG, "sent: %s\r\n", buf);
+    mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
 
   mu_stream_sequential_write (ostream, buf, strlen (buf));
   free (buf);
@@ -882,13 +885,16 @@ util_uidvalidity (mu_mailbox_t smbox, unsigned long 
*uidvp)
 void
 util_setio (FILE *in, FILE *out)
 {
-  if (!out || !in)
+  if (!in)
+    imap4d_bye (ERR_NO_IFILE);
+  if (!out)
     imap4d_bye (ERR_NO_OFILE);
 
   setvbuf (in, NULL, _IOLBF, 0);
   setvbuf (out, NULL, _IOLBF, 0);
-  if (mu_stdio_stream_create (&istream, in, MU_STREAM_NO_CLOSE)
-      || mu_stdio_stream_create (&ostream, out, MU_STREAM_NO_CLOSE))
+  if (mu_stdio_stream_create (&istream, in, MU_STREAM_NO_CLOSE))
+    imap4d_bye (ERR_NO_IFILE);
+  if (mu_stdio_stream_create (&ostream, out, MU_STREAM_NO_CLOSE))
     imap4d_bye (ERR_NO_OFILE);
 }
 
@@ -1312,12 +1318,12 @@ check_input_err (int rc, size_t sz)
       
       mu_diag_output (MU_DIAG_INFO,
                      _("Error reading from input file: %s"), p);
-      imap4d_bye (ERR_NO_OFILE);
+      imap4d_bye (ERR_NO_IFILE);
     }
   else if (sz == 0)
     {
       mu_diag_output (MU_DIAG_INFO, _("Unexpected eof on input"));
-      imap4d_bye (ERR_NO_OFILE);
+      imap4d_bye (ERR_NO_IFILE);
     }
 }
 
@@ -1358,10 +1364,30 @@ imap4d_readline (struct imap4d_tokbuf *tok)
       char *last_arg;
       size_t off = imap4d_tokbuf_getline (tok);
       if (transcript)
-        mu_diag_output (MU_DIAG_DEBUG, "recv: %s", tok->buffer);
+        {
+          int len;
+          char *p = strcasestr (tok->buffer, "LOGIN");
+          if (p && p > tok->buffer && isspace(p[-1]))
+            {
+              char *q = p + 5;
+              while (*q && isspace (*q))
+                q++;
+              while (*q && !isspace (*q))
+                q++;
+              len = q - tok->buffer; 
+              mu_diag_output (MU_DIAG_DEBUG, "recv: %*.*s {censored}", len, 
len,
+                              tok->buffer);
+             }
+           else
+             {
+               len = strcspn (tok->buffer, "\r\n");
+               mu_diag_output (MU_DIAG_DEBUG, "recv: %*.*s", 
+                               len, len, tok->buffer);
+             }
+        }
       imap4d_tokbuf_tokenize (tok, off);
       if (tok->argc == 0)
-       break;
+        break;  
       last_arg = tok->buffer + tok->argp[tok->argc - 1];
       if (last_arg[0] == '{' && last_arg[strlen(last_arg)-1] == '}')
        {
@@ -1439,7 +1465,17 @@ imap4d_getline (char **pbuf, size_t *psize, size_t 
*pnbytes)
       char *s = *pbuf;
       len = util_trim_nl (s, len);
       if (imap4d_transcript)
-        mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s);
+        {
+          if (len)
+            mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s);
+          else
+            mu_diag_output (MU_DIAG_DEBUG, "got EOF");
+        }
+      if (len == 0)
+        {
+          imap4d_bye (ERR_NO_IFILE);
+          /*FIXME rc = ECONNABORTED;*/
+        }
       if (pnbytes)
        *pnbytes = len;
     }
diff --git a/movemail/movemail.c b/movemail/movemail.c
index b2674e0..f3004ca 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -29,7 +29,7 @@
 #include <mailutils/tls.h>
 #include <mu_asprintf.h>
 #include "mailutils/libargp.h"
-#include <lib/muaux.h>
+#include <muaux.h>
 
 const char *program_version = "movemail (" PACKAGE_STRING ")";
 static char doc[] = N_("GNU movemail");


hooks/post-receive
--
GNU Mailutils




reply via email to

[Prev in Thread] Current Thread [Next in Thread]