]> granicus.if.org Git - pgbouncer/commitdiff
pga_pton: parse '*' as INADDR_ANY
authorMarko Kreen <markokr@gmail.com>
Wed, 7 Dec 2011 14:11:04 +0000 (16:11 +0200)
committerMarko Kreen <markokr@gmail.com>
Wed, 7 Dec 2011 14:11:04 +0000 (16:11 +0200)
src/util.c

index 285d34b00a6d83baadb7d22f3d0ccd3ad712dd59..8095c1567918cca0355e466978983670798d1b0e 100644 (file)
@@ -394,12 +394,13 @@ const char *pga_ntop(const PgAddr *a, char *dst, int dstlen)
 /* parse address from string */
 bool pga_pton(PgAddr *a, const char *s, int port)
 {
-       int res;
+       int res = 1;
        if (strcmp(s, "unix") == 0) {
                pga_set(a, AF_UNIX, port);
-               return true;
-       }
-       if (strchr(s, ':')) {
+       } else if (strcmp(s, "*") == 0) {
+               pga_set(a, AF_INET, port);
+               a->sin.sin_addr.s_addr = htonl(INADDR_ANY);
+       } else if (strchr(s, ':')) {
                pga_set(a, AF_INET6, port);
                res = inet_pton(AF_INET6, s, &a->sin6.sin6_addr);
        } else {