bug-mailutils
[Top][All Lists]
Advanced

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

[bug-mailutils] Segmentation Fault in gnu-mh part of mailutils


From: d.henman
Subject: [bug-mailutils] Segmentation Fault in gnu-mh part of mailutils
Date: Mon, 03 Jun 2013 01:13:39 +0900

Sergy,
   I reported that the patch you made worked.  But apparently it doesn't.  I 
didn't test it well enough.  The problem was that a ISP still uses old mail 
handingle and the newer something (see the patch you made below.)

  I thought it was strange that I wasn't getting any mail from my isp (I 
usually use gmail, but SPAM would come in over my ISP account.   I noticed its 
absense, and also then noticed   "nc.exe.stackdump"  files being created about

  This does not show yp in MH-E in emacs.  It was just reporting "no mail".  I 
know that you didn't have time to test the code, etc.  It's 1:10 A.M. and I'm 
going to bed.  I'll take a lot at it tomorrow.  If you have any ideas while I', 
sleeping please let me know.

Regards,
  Darel






-------------------------------- patch 
diff --git a/include/mailutils/pop3.h b/include/mailutils/pop3.h
index 5e16b5d..1a8199d 100644
--- a/include/mailutils/pop3.h
+++ b/include/mailutils/pop3.h
@@ -55,7 +55,7 @@ int  mu_pop3_apop (mu_pop3_t pop3, const char *name, const 
char *digest);
 
 int  mu_pop3_stls (mu_pop3_t pop3);
 
-/* It is the responsability of the caller to call mu_iterator_destroy() when
+/* It is the responsibility of the caller to call mu_iterator_destroy() when
    done with the iterator.  The items returned by the iterator are of type
    "const char *", no processing is done on the item except the removal of
    the trailing newline.  */
@@ -82,7 +82,7 @@ int  mu_pop3_pass (mu_pop3_t pop3, const char *pass);
 
 int  mu_pop3_quit (mu_pop3_t pop3);
 
-/* A stream is returned with the multi-line answer.  It is the responsability
+/* A stream is returned with the multi-line answer.  It is the responsibility
    of the caller to call mu_stream_destroy() to dipose of the stream.  */
 int  mu_pop3_retr (mu_pop3_t pop3, unsigned int mesgno,
                   mu_stream_t *pstream);
@@ -91,12 +91,12 @@ int  mu_pop3_rset (mu_pop3_t pop3);
 
 int  mu_pop3_stat (mu_pop3_t pop3, size_t *count, mu_off_t *octets);
 
-/* A stream is returned with the multi-line answer.  It is the responsability
+/* A stream is returned with the multi-line answer.  It is the responsibility
    of the caller to call mu_stream_destroy() to dipose of the stream.  */
 int  mu_pop3_top (mu_pop3_t pop3, unsigned int mesgno,
                  unsigned int lines, mu_stream_t *pstream);
 
-/* The uidl is malloc'ed and returned in puidl; it is the responsability of
+/* The uidl is malloc'ed and returned in puidl; it is the responsibility of
    the caller to free() the uild when done.  */
 int  mu_pop3_uidl (mu_pop3_t pop3, unsigned int mesgno, char **puidl);
 
@@ -116,7 +116,11 @@ int mu_pop3_user (mu_pop3_t pop3, const char *user);
    the message could be retrieved, but it is up to the caller to do the
    parsing.  */
 int  mu_pop3_response (mu_pop3_t pop3, size_t *nread);
-
+const char *mu_pop3_strresp (mu_pop3_t pop3);
+int mu_pop3_sget_response (mu_pop3_t pop3, const char **sptr);
+int mu_pop3_aget_response (mu_pop3_t pop3, char **sptr);
+int mu_pop3_get_response (mu_pop3_t pop3, char *buf, size_t len, size_t *plen);
+  
 int  mu_pop3_writeline (mu_pop3_t pop3, const char *format, ...)
                                   MU_PRINTFLIKE(2,3);
 
diff --git a/libmu_auth/ldap.c b/libmu_auth/ldap.c
index c454910..2b7aff2 100644
--- a/libmu_auth/ldap.c
+++ b/libmu_auth/ldap.c
@@ -534,7 +534,7 @@ _mu_ldap_search (LDAP *ld, const char *filter_pat, const 
char *key,
 
   env[0] = "user";
   env[1] = key;
-  env[3] = NULL;
+  env[2] = NULL;
 
   ws.ws_env = env;
   if (mu_wordsplit (filter_pat, &ws,
diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index d85c38e..2e7b6a1 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -179,8 +179,13 @@ pop_open (mu_mailbox_t mbox, int flags)
        break;
 
       status = mu_pop3_capa (mpd->pop3, 1, NULL);
-      if (status)
-       break;
+      if (status == MU_ERR_REPLY) {
+         mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR, 
+                   ("server rejected the CAPA command: %s",
+                    mu_pop3_strresp (mpd->pop3)));
+         /* try to continue anyway */
+      } else if (status)
+       return status;
 
 #ifdef WITH_TLS      
       if (!mpd->pops &&
diff --git a/libproto/pop/pop3_response.c b/libproto/pop/pop3_response.c
index 87f9897..9b03a48 100644
--- a/libproto/pop/pop3_response.c
+++ b/libproto/pop/pop3_response.c
@@ -25,8 +25,7 @@
 #include <mailutils/cctype.h>
 #include <mailutils/cstr.h>
 #include <mailutils/sys/pop3.h>
-
-#define POP3_DEFERR "-ERR POP3 IO ERROR"
+#include <mailutils/util.h>
 
 /* If we did not grap the ack already, call pop3_readline() but handle
    Nonblocking also.  */
@@ -48,21 +47,6 @@ mu_pop3_response (mu_pop3_t pop3, size_t *pnread)
          n = mu_rtrim_class (pop3->ackbuf, MU_CTYPE_SPACE);
          MU_POP3_FSET (pop3, MU_POP3_ACK); /* Flag that we have the ack.  */
        }
-      else
-       {
-         /* Provide them with an error.  */
-         if (pop3->acksize < sizeof (POP3_DEFERR))
-           {
-             char *p = realloc (pop3->ackbuf, sizeof (POP3_DEFERR));
-             if (p)
-               {
-                 pop3->ackbuf = p;
-                 pop3->acksize = sizeof (POP3_DEFERR);
-               }
-           }
-         if (pop3->ackbuf)
-           strncpy (pop3->ackbuf, POP3_DEFERR, pop3->acksize);
-       }
     }
   else if (pop3->ackbuf)
     n = strlen (pop3->ackbuf);
@@ -78,3 +62,57 @@ mu_pop3_response (mu_pop3_t pop3, size_t *pnread)
     *pnread = n;
   return status;
 }
+
+const char *
+mu_pop3_strresp (mu_pop3_t pop3)
+{
+    if (pop3 == NULL)
+      return NULL;
+    if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+      return NULL;
+    return pop3->ackbuf;
+}
+
+int
+mu_pop3_sget_response (mu_pop3_t pop3, const char **sptr)
+{
+  if (pop3 == NULL)
+    return EINVAL;
+  if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+    return MU_ERR_NOENT;
+  *sptr = pop3->ackbuf;
+  return 0;
+}
+
+int
+mu_pop3_aget_response (mu_pop3_t pop3, char **sptr)
+{
+  char *p;
+  
+  if (pop3 == NULL)
+    return EINVAL;
+  if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+    return MU_ERR_NOENT;
+  p = strdup (pop3->ackbuf);
+  if (!p)
+    return ENOMEM;
+  *sptr = p;
+  return 0;
+}
+
+int
+mu_pop3_get_response (mu_pop3_t pop3, char *buf, size_t len, size_t *plen)
+{
+  size_t size;
+  
+  if (pop3 == NULL)
+    return EINVAL;
+  if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
+    return MU_ERR_NOENT;
+  
+  if (buf)
+    size = mu_cpystr (buf, pop3->ackbuf, len);
+  if (plen)
+    *plen = size;
+  return 0;
+}



reply via email to

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