diff options
author | Bruce Momjian | 2003-06-14 18:20:33 +0000 |
---|---|---|
committer | Bruce Momjian | 2003-06-14 18:20:33 +0000 |
commit | 467839df26a128bbc19b12dd4e54c3db50462661 (patch) | |
tree | e80d305d76d714ae7de0cdd89edbf36bd90b29cb | |
parent | a16a0314114f7e6e4414d11f6ff2744496952bda (diff) |
Handle threading in two more gethostbyname calls.
-rw-r--r-- | src/interfaces/libpq/fe-secure.c | 13 | ||||
-rw-r--r-- | src/port/getaddrinfo.c | 12 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 1771d8bb7dd..216528efe07 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.24 2003/06/14 17:49:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.25 2003/06/14 18:20:32 momjian Exp $ * * NOTES * The client *requires* a valid server certificate. Since @@ -453,8 +453,17 @@ verify_peer(PGconn *conn) if (addr.sa_family == AF_UNIX) return 0; + { + struct hostent hpstr; + char buf[BUFSIZ]; + int herrno = 0; + + pqGethostbyname(conn->peer_cn, &hpstr, buf, sizeof(buf), + &h, &herrno); + } + /* what do we know about the peer's common name? */ - if ((h = gethostbyname(conn->peer_cn)) == NULL) + if ((h == NULL) { printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not get information about host (%s): %s\n"), diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c index 2f2449629b6..1cfee0485bd 100644 --- a/src/port/getaddrinfo.c +++ b/src/port/getaddrinfo.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.7 2003/06/12 08:15:29 momjian Exp $ + * $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.8 2003/06/14 18:20:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -84,8 +84,16 @@ getaddrinfo(const char *node, const char *service, else { struct hostent *hp; - +#ifdef FRONTEND + struct hostent hpstr; + char buf[BUFSIZ]; + int herrno = 0; + + pqGethostbyname(node, &hpstr, buf, sizeof(buf), + &hp, &herrno); +#else hp = gethostbyname(node); +#endif if (hp == NULL) { switch (h_errno) |