Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb4cea00

Browse files
committed
IPv6 cleanups.
Kurt RoeckxAndrew Dunstan
1 parente5549a2 commitb4cea00

File tree

20 files changed

+900
-581
lines changed

20 files changed

+900
-581
lines changed

‎config/c-library.m4

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Macros that test various C library quirks
2-
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.19 2003/05/22 16:39:26 tgl Exp $
2+
# $Header: /cvsroot/pgsql/config/c-library.m4,v 1.20 2003/06/12 07:36:51 momjian Exp $
33

44

55
# PGAC_VAR_INT_TIMEZONE
@@ -87,18 +87,29 @@ AC_DEFUN([PGAC_UNION_SEMUN],
8787

8888
# PGAC_STRUCT_SOCKADDR_UN
8989
# -----------------------
90-
# If `struct sockaddr_un' exists, define HAVE_STRUCT_SOCKADDR_UN. If
91-
# it is missing then one could define it as { short int sun_family;
92-
# char sun_path[108]; }. (Requires test for <sys/un.h>!)
90+
# If `struct sockaddr_un' exists, define HAVE_UNIX_SOCKETS.
91+
# (Requires test for <sys/un.h>!)
9392
AC_DEFUN([PGAC_STRUCT_SOCKADDR_UN],
94-
[AC_CHECK_TYPES([struct sockaddr_un],[],[],
93+
[AC_CHECK_TYPES([struct sockaddr_un],[AC_DEFINE(HAVE_UNIX_SOCKETS,1,[Define to 1 if you have unix sockets.])],[],
9594
[#include <sys/types.h>
9695
#ifdef HAVE_SYS_UN_H
9796
#include <sys/un.h>
9897
#endif
9998
])])# PGAC_STRUCT_SOCKADDR_UN
10099

101100

101+
# PGAC_STRUCT_SOCKADDR_STORAGE
102+
# ----------------------------
103+
# If `struct sockaddr_storage' exists, define HAVE_STRUCT_SOCKADDR_STORAGE. If
104+
# it is missing then one could define it.
105+
AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE],
106+
[AC_CHECK_TYPES([struct sockaddr_storage],[],[],
107+
[#ifdef HAVE_SYS_SOCKET_H
108+
#include <sys/socket.h>
109+
#endif
110+
])])# PGAC_STRUCT_SOCKADDR_STORAGE
111+
112+
102113
# PGAC_STRUCT_ADDRINFO
103114
# -----------------------
104115
# If `struct addrinfo' exists, define HAVE_STRUCT_ADDRINFO.

‎configure

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9892,6 +9892,71 @@ cat >>confdefs.h <<_ACEOF
98929892
_ACEOF
98939893
98949894
9895+
cat>>confdefs.h<<\_ACEOF
9896+
#define HAVE_UNIX_SOCKETS 1
9897+
_ACEOF
9898+
9899+
fi
9900+
9901+
echo"$as_me:$LINENO: checking for struct sockaddr_storage">&5
9902+
echo$ECHO_N"checking for struct sockaddr_storage...$ECHO_C">&6
9903+
iftest"${ac_cv_type_struct_sockaddr_storage+set}" =set;then
9904+
echo$ECHO_N"(cached)$ECHO_C">&6
9905+
else
9906+
cat>conftest.$ac_ext<<_ACEOF
9907+
#line$LINENO "configure"
9908+
#include "confdefs.h"
9909+
#ifdef HAVE_SYS_SOCKET_H
9910+
#include <sys/socket.h>
9911+
#endif
9912+
9913+
9914+
#ifdef F77_DUMMY_MAIN
9915+
# ifdef __cplusplus
9916+
extern "C"
9917+
# endif
9918+
int F77_DUMMY_MAIN() { return 1; }
9919+
#endif
9920+
int
9921+
main ()
9922+
{
9923+
if ((struct sockaddr_storage *) 0)
9924+
return 0;
9925+
if (sizeof (struct sockaddr_storage))
9926+
return 0;
9927+
;
9928+
return 0;
9929+
}
9930+
_ACEOF
9931+
rm -f conftest.$ac_objext
9932+
if { (evalecho"$as_me:$LINENO:\"$ac_compile\"")>&5
9933+
(eval$ac_compile)2>&5
9934+
ac_status=$?
9935+
echo"$as_me:$LINENO:\$? =$ac_status">&5
9936+
(exit$ac_status); }&&
9937+
{ ac_try='test -s conftest.$ac_objext'
9938+
{ (evalecho"$as_me:$LINENO:\"$ac_try\"")>&5
9939+
(eval$ac_try)2>&5
9940+
ac_status=$?
9941+
echo"$as_me:$LINENO:\$? =$ac_status">&5
9942+
(exit$ac_status); }; };then
9943+
ac_cv_type_struct_sockaddr_storage=yes
9944+
else
9945+
echo"$as_me: failed program was:">&5
9946+
cat conftest.$ac_ext>&5
9947+
ac_cv_type_struct_sockaddr_storage=no
9948+
fi
9949+
rm -f conftest.$ac_objext conftest.$ac_ext
9950+
fi
9951+
echo"$as_me:$LINENO: result:$ac_cv_type_struct_sockaddr_storage">&5
9952+
echo"${ECHO_T}$ac_cv_type_struct_sockaddr_storage">&6
9953+
iftest$ac_cv_type_struct_sockaddr_storage = yes;then
9954+
9955+
cat>>confdefs.h<<_ACEOF
9956+
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
9957+
_ACEOF
9958+
9959+
98959960
fi
98969961
98979962
echo"$as_me:$LINENO: checking for struct addrinfo">&5

‎configure.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.258 2003/06/11 06:56:06 momjian Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.259 2003/06/12 07:36:50 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -789,6 +789,7 @@ PGAC_C_FUNCNAME_SUPPORT
789789
PGAC_STRUCT_TIMEZONE
790790
PGAC_UNION_SEMUN
791791
PGAC_STRUCT_SOCKADDR_UN
792+
PGAC_STRUCT_SOCKADDR_STORAGE
792793
PGAC_STRUCT_ADDRINFO
793794

794795
AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],

‎src/backend/libpq/auth.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.101 2003/04/25 03:28:55 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.102 2003/06/12 07:36:51 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -415,15 +415,13 @@ ClientAuthentication(Port *port)
415415
* out the less clueful good guys.
416416
*/
417417
{
418-
constchar*hostinfo="localhost";
419-
#ifdefHAVE_IPV6
420-
charip_hostinfo[INET6_ADDRSTRLEN];
421-
#else
422-
charip_hostinfo[INET_ADDRSTRLEN];
423-
#endif
424-
if (isAF_INETx(port->raddr.sa.sa_family) )
425-
hostinfo=SockAddr_ntop(&port->raddr,ip_hostinfo,
426-
sizeof(ip_hostinfo),1);
418+
charhostinfo[NI_MAXHOST];
419+
420+
getnameinfo(
421+
(structsockaddr*)&port->raddr.addr,
422+
port->raddr.salen,
423+
hostinfo,sizeof(hostinfo),
424+
NULL,0,NI_NUMERICHOST);
427425

428426
elog(FATAL,
429427
"No pg_hba.conf entry for host %s, user %s, database %s",
@@ -464,7 +462,7 @@ ClientAuthentication(Port *port)
464462
elog(FATAL,"pg_local_sendauth: can't do setsockopt: %m");
465463
}
466464
#endif
467-
if (port->raddr.sa.sa_family==AF_UNIX)
465+
if (port->raddr.addr.ss_family==AF_UNIX)
468466
sendAuthRequest(port,AUTH_REQ_SCM_CREDS);
469467
#endif
470468
status=authident(port);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp