# HG changeset patch # User markus schnalke # Date 1329835495 -3600 # Node ID 6500db550a030f5e7e343def08a39f1b8947bf14 # Parent c7cc3c03193ce88ee5ddee0276f3f550757b4c0a resolve_ip() appeared to be broken, in connect.c. I fixed it. In any case, NULL was returned, but if it is a valid IP address, a list should have been returned. This is fixed now. diff -r c7cc3c03193c -r 6500db550a03 src/connect.c --- a/src/connect.c Tue Feb 21 15:02:07 2012 +0100 +++ b/src/connect.c Tue Feb 21 15:44:55 2012 +0100 @@ -19,19 +19,19 @@ #include "masqmail.h" static GList* -resolve_ip(GList *list, gchar *ip) +resolve_ip(gchar *ip) { struct in_addr ia; - if (inet_aton(ip, &ia)) { - mxip_addr mxip; + mxip_addr mxip; - mxip.name = g_strdup(ip); - mxip.pref = 0; - mxip.ip = (guint32) * (guint32 *) (&ia); - list = g_list_append(list, g_memdup(&mxip, sizeof(mxip))); + if (!inet_aton(ip, &ia)) { + /* No dots-and-numbers notation. */ + return NULL; } - /* logwrite(LOG_ALERT, "invalid address '%s': inet_aton() failed\n", ip); */ - return NULL; + mxip.name = g_strdup(ip); + mxip.pref = 0; + mxip.ip = (guint32) * (guint32 *) (&ia); + return g_list_append(NULL, g_memdup(&mxip, sizeof(mxip))); } mxip_addr* @@ -96,19 +96,17 @@ h_errno = 0; - if (isdigit(host[0])) { + if (isdigit(*host)) { mxip_addr *addr; - addr_list = resolve_ip(NULL, host); - if (addr_list) { + if ((addr_list = resolve_ip(host))) { addr = connect_hostlist(psockfd, host, port, addr_list); g_list_free(addr_list); return addr; } /* - ** previous versions complained, until someone tried - ** to use a hostname out there that begins with a - ** digit. eg. '3dwars.de'. + ** Probably a hostname that begins with a digit. + ** E.g. '3dwars.de'. Thus fall ... */ }