Skip to content

Commit 467839d

Browse files
committed
Handle threading in two more gethostbyname calls.
1 parent a16a031 commit 467839d

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/interfaces/libpq/fe-secure.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.24 2003/06/14 17:49:54 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.25 2003/06/14 18:20:32 momjian Exp $
1515
*
1616
* NOTES
1717
* The client *requires* a valid server certificate. Since
@@ -453,8 +453,17 @@ verify_peer(PGconn *conn)
453453
if (addr.sa_family == AF_UNIX)
454454
return 0;
455455

456+
{
457+
struct hostent hpstr;
458+
char buf[BUFSIZ];
459+
int herrno = 0;
460+
461+
pqGethostbyname(conn->peer_cn, &hpstr, buf, sizeof(buf),
462+
&h, &herrno);
463+
}
464+
456465
/* what do we know about the peer's common name? */
457-
if ((h = gethostbyname(conn->peer_cn)) == NULL)
466+
if ((h == NULL)
458467
{
459468
printfPQExpBuffer(&conn->errorMessage,
460469
libpq_gettext("could not get information about host (%s): %s\n"),

src/port/getaddrinfo.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.7 2003/06/12 08:15:29 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.8 2003/06/14 18:20:33 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -84,8 +84,16 @@ getaddrinfo(const char *node, const char *service,
8484
else
8585
{
8686
struct hostent *hp;
87-
87+
#ifdef FRONTEND
88+
struct hostent hpstr;
89+
char buf[BUFSIZ];
90+
int herrno = 0;
91+
92+
pqGethostbyname(node, &hpstr, buf, sizeof(buf),
93+
&hp, &herrno);
94+
#else
8895
hp = gethostbyname(node);
96+
#endif
8997
if (hp == NULL)
9098
{
9199
switch (h_errno)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy