Fix the APOP check to not crash on servers that don't return any
authorDan Winship <danw@src.gnome.org>
Wed, 27 Dec 2000 19:10:06 +0000 (19:10 +0000)
committerDan Winship <danw@src.gnome.org>
Wed, 27 Dec 2000 19:10:06 +0000 (19:10 +0000)
* providers/pop3/camel-pop3-store.c (connect_to_server): Fix the
APOP check to not crash on servers that don't return any
information on the +OK greeting line.

camel/ChangeLog
camel/providers/pop3/camel-pop3-store.c

index def6d5d..dee6af3 100644 (file)
@@ -1,3 +1,9 @@
+2000-12-27  Dan Winship  <danw@helixcode.com>
+
+       * providers/pop3/camel-pop3-store.c (connect_to_server): Fix the
+       APOP check to not crash on servers that don't return any
+       information on the +OK greeting line.
+
 2000-12-24  Not Zed  <NotZed@HelixCode.com>
 
        * providers/imap/camel-imap-search.c (imap_body_contains): Lock
index 2f23bf0..6fc56fc 100644 (file)
@@ -230,14 +230,16 @@ connect_to_server (CamelService *service, /*gboolean real, */CamelException *ex)
        if (status != CAMEL_POP3_OK)
                return FALSE;
 
-       apoptime = strchr (buf, '<');
-       apopend = apoptime ? strchr (apoptime, '>') : NULL;
-       if (apopend) {
-               store->apop_timestamp = g_strndup (apoptime,
-                                                  apopend - apoptime + 1);
-               memmove (apoptime, apopend + 1, strlen (apopend + 1));
+       if (buf) {
+               apoptime = strchr (buf, '<');
+               apopend = apoptime ? strchr (apoptime, '>') : NULL;
+               if (apopend) {
+                       store->apop_timestamp =
+                               g_strndup (apoptime, apopend - apoptime + 1);
+                       memmove (apoptime, apopend + 1, strlen (apopend + 1));
+               }
+               store->implementation = buf;
        }
-       store->implementation = buf;
 
        /* Check extensions */
        store->login_delay = -1;