When SMTP client can't connect and errno = 0, set
authorArt Cancro <ajc@citadel.org>
Fri, 27 Oct 2006 18:04:22 +0000 (18:04 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 27 Oct 2006 18:04:22 +0000 (18:04 +0000)
the DSN to 'Unable to connect to...' instead of 'Success'

citadel/serv_smtp.c

index ba8ae9959a3d884fbb12416dcc0a1acae1b32442..54363c9e84d2f413ccdfaa4c1d8519804c10d415 100644 (file)
@@ -1079,13 +1079,20 @@ void smtp_try(const char *key, const char *addr, int *status,
                if (!mx_port[0]) {
                        strcpy(mx_port, "25");
                }
-               lprintf(CTDL_DEBUG, "FIXME user<%s> pass<%s> host<%s> port<%s>\n",
-                       mx_user, mx_pass, mx_host, mx_port);
+               /* lprintf(CTDL_DEBUG, "FIXME user<%s> pass<%s> host<%s> port<%s>\n",
+                       mx_user, mx_pass, mx_host, mx_port); */
                lprintf(CTDL_DEBUG, "Trying %s : %s ...\n", mx_host, mx_port);
                sock = sock_connect(mx_host, mx_port, "tcp");
                snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno));
                if (sock >= 0) lprintf(CTDL_DEBUG, "Connected!\n");
-               if (sock < 0) snprintf(dsn, SIZ, "%s", strerror(errno));
+               if (sock < 0) {
+                       if (errno > 0) {
+                               snprintf(dsn, SIZ, "%s", strerror(errno));
+                       }
+                       else {
+                               snprintf(dsn, SIZ, "Unable to connect to %s : %s\n", mx_host, mx_port);
+                       }
+               }
        }
 
        if (sock < 0) {