commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-2.2-100-g3c21c65


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-100-g3c21c65
Date: Tue, 21 Sep 2010 18:59:01 +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=3c21c6583253be9edfd9e4c1e1fc6c07726be499

The branch, master has been updated
       via  3c21c6583253be9edfd9e4c1e1fc6c07726be499 (commit)
      from  5984fc0cd9f8841e574991ba8155cb1448389af3 (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 3c21c6583253be9edfd9e4c1e1fc6c07726be499
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Sep 21 21:59:25 2010 +0300

    Various SMTP improvements.
    
    * Makefile.am: Shut up cmp's stderr.
    * libmailutils/body.c (_body_get_stream): Set full buffering
    mode on the body stream.
    * libmailutils/errors (MU_ERR_AUTH_NO_CRED): New error code.
    * libproto/mailer/smtp.c (smtp_open): Do not treat
    ENOSYS or MU_ERR_AUTH_NO_CRED (returned by mu_smtp_auth) as errors.
    (smtp_send_message): Do not try to submit the message if it is
    bigger than the maximum imposed by the server.
    * libproto/mailer/smtp_auth.c (mu_smtp_auth): Return MU_ERR_AUTH_NO_CRED
    if neither user name nor password are supplied.
    * mail/send.c (mail_send0): Issue diagnostics if
    sending attempt has failed.

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

Summary of changes:
 Makefile.am                 |    6 ++++--
 libmailutils/body.c         |    1 +
 libmailutils/errors         |    1 +
 libproto/mailer/smtp.c      |   39 +++++++++++++++++++++++++++++----------
 libproto/mailer/smtp_auth.c |    2 ++
 mail/send.c                 |    9 +++++++--
 6 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 78196e2..e8f8e94 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -162,7 +162,8 @@ git-describe:
                test -n "$$dirty" && dirty="-dirty"; \
                descr=`git describe`; \
                echo $${descr}$$dirty > git-describe.tmp; \
-               test -f git-describe && cmp git-describe.tmp git-describe || \
+               test -f git-describe && \
+                  cmp git-describe.tmp git-describe >/dev/null || \
                  cp git-describe.tmp git-describe; \
                rm git-describe.tmp; \
        fi
@@ -183,7 +184,8 @@ git-describe.h: git-describe
        else \
           echo "/* No git tag */"; \
        fi > git-describe.h.tmp; \
-       test -f git-describe.h && cmp git-describe.h.tmp git-describe.h || \
+       test -f git-describe.h && \
+          cmp git-describe.h.tmp git-describe.h >/dev/null || \
           cp git-describe.h.tmp git-describe.h; \
        rm git-describe.h.tmp
 
diff --git a/libmailutils/body.c b/libmailutils/body.c
index 513ad01..f076e4a 100644
--- a/libmailutils/body.c
+++ b/libmailutils/body.c
@@ -183,6 +183,7 @@ _body_get_stream (mu_body_t body, mu_stream_t *pstream, int 
ref)
                                          body->filename, MU_STREAM_RDWR);
          if (status != 0)
            return status;
+         mu_stream_set_buffer (body->fstream, mu_buffer_full, 0);
          status = mu_stream_open (body->fstream);
          if (status != 0)
            return status;
diff --git a/libmailutils/errors b/libmailutils/errors
index b0a56b1..7828f20 100644
--- a/libmailutils/errors
+++ b/libmailutils/errors
@@ -93,3 +93,4 @@ MU_ERR_BAD_FILENAME         _("Badly formed file or directory 
name")
 MU_ERR_READ                 _("Read error")
 
 MU_ERR_NO_TRANSPORT         _("Transport stream not set")
+MU_ERR_AUTH_NO_CRED         _("No credentials supplied")
diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index e3da784..742f95d 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -124,9 +124,11 @@ smtp_open (mu_mailer_t mailer, int flags)
   if (mu_debug_check_level (mailer->debug, MU_DEBUG_PROT))
     mu_smtp_trace (smtp_mailer->smtp, MU_SMTP_TRACE_SET);
   if (mu_debug_check_level (mailer->debug, MU_DEBUG_TRACE6))
-    mu_smtp_trace_mask (smtp_mailer->smtp, MU_SMTP_TRACE_SET, 
MU_XSCRIPT_SECURE);
+    mu_smtp_trace_mask (smtp_mailer->smtp, MU_SMTP_TRACE_SET,
+                       MU_XSCRIPT_SECURE);
   if (mu_debug_check_level (mailer->debug, MU_DEBUG_TRACE7))
-    mu_smtp_trace_mask (smtp_mailer->smtp, MU_SMTP_TRACE_SET, 
MU_XSCRIPT_PAYLOAD);
+    mu_smtp_trace_mask (smtp_mailer->smtp, MU_SMTP_TRACE_SET,
+                       MU_XSCRIPT_PAYLOAD);
   
   mu_smtp_set_param (smtp_mailer->smtp, MU_SMTP_PARAM_URL,
                     mu_url_to_string (mailer->url));
@@ -203,9 +205,19 @@ smtp_open (mu_mailer_t mailer, int flags)
   if (!noauth && mu_smtp_capa_test (smtp_mailer->smtp, "AUTH", NULL) == 0)
     {
       rc = mu_smtp_auth (smtp_mailer->smtp);
-      if (rc)
-       return rc;
-      rc = mu_smtp_ehlo (smtp_mailer->smtp);
+      switch (rc)
+       {
+       case 0:
+         rc = mu_smtp_ehlo (smtp_mailer->smtp);
+         break;
+         
+       case ENOSYS:
+       case MU_ERR_AUTH_NO_CRED:
+         mu_diag_output (MU_DIAG_NOTICE, "authentication disabled: %s",
+                         mu_strerror (rc));
+         rc = 0; /* Continue anyway */
+         break;
+       }
       if (rc)
        return rc;
     }
@@ -377,7 +389,7 @@ smtp_send_message (mu_mailer_t mailer, mu_message_t msg,
   mu_smtp_t smtp = smp->smtp;
   int status;
   size_t size, lines, count;
-  const char *mail_from;
+  const char *mail_from, *size_str;
   mu_header_t     header;
       
   if (mailer == NULL)
@@ -398,12 +410,19 @@ smtp_send_message (mu_mailer_t mailer, mu_message_t msg,
   if (status)
     return status;
   
-  if (mu_smtp_capa_test (smp->smtp, "SIZE", NULL) == 0 &&
+  if (mu_smtp_capa_test (smp->smtp, "SIZE", &size_str) == 0 &&
       mu_message_size (msg, &size) == 0 &&
       mu_message_lines (msg, &lines) == 0)
-    status = mu_smtp_mail_basic (smp->smtp, mail_from,
-                                "SIZE=%lu",
-                                (unsigned long) (size + lines));
+    {
+      size_t msgsize = size + lines;
+      size_t maxsize = strtoul (size_str + 5, NULL, 10);
+
+      if (msgsize && msgsize > maxsize)
+       return EFBIG;
+      status = mu_smtp_mail_basic (smp->smtp, mail_from,
+                                  "SIZE=%lu",
+                                  (unsigned long) msgsize);
+    }
   else
     status = mu_smtp_mail_basic (smp->smtp, mail_from, NULL);
   if (status)
diff --git a/libproto/mailer/smtp_auth.c b/libproto/mailer/smtp_auth.c
index 364f033..b31943c 100644
--- a/libproto/mailer/smtp_auth.c
+++ b/libproto/mailer/smtp_auth.c
@@ -141,6 +141,8 @@ mu_smtp_auth (mu_smtp_t smtp)
      default it does that on tty, which obviously will not suite
      GUI applications). */
   _mu_smtp_fixup_params (smtp);
+  if (!smtp->param[MU_SMTP_PARAM_USERNAME] && !smtp->secret)
+    return MU_ERR_AUTH_NO_CRED;
 #if defined(WITH_GSASL)
   return _mu_smtp_gsasl_auth (smtp);
 #else
diff --git a/mail/send.c b/mail/send.c
index 89a3f2d..b5becf2 100644
--- a/mail/send.c
+++ b/mail/send.c
@@ -308,9 +308,10 @@ fill_body (mu_message_t msg, FILE *file)
   mu_stream_t stream = NULL;
   char *buf = NULL;
   size_t n = 0;
+  int nullbody = 1;
+
   mu_message_get_body (msg, &body);
   mu_body_get_streamref (body, &stream);
-  int nullbody = 1;
   
   while (getline (&buf, &n, file) >= 0)
     {
@@ -651,7 +652,11 @@ mail_send0 (compose_env_t * env, int save_to)
                  env->header = NULL;
                  status = send_message (msg);
                  if (status)
-                   save_dead_message (env);
+                   {
+                     mu_error (_("cannot send message: %s"),
+                               mu_strerror (status));
+                     save_dead_message (env);
+                   }
                }
            }
          fclose (env->file);


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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