>Synopsis: ypldap is unable to connect to IPv6 ldap server
>Category: Repeatable problems with source fixes
>Environment:
System : OpenBSD 5.6
Details : OpenBSD 5.6 (GENERIC) #310: Fri Aug 8 00:14:24 MDT 2014
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
Architecture: OpenBSD.amd64
Machine : amd64
>Description:
ypldap fail to connect to IPv6 ldap server because it creates
socket using hardcoded AF_INET address family.
>How-To-Repeat:
Configure ypldap to any IPv6 hostname and run ypldap -dv.
ypldap: connect to <your ldap IPv6 address> port 389 (tcp)
failed: Network is unreachable
>Fix:
--- src/usr.sbin/ypldap/ldapclient.c Mon Nov 17 01:46:15 2014
+++ src/usr.sbin/ypldap/ldapclient.c Mon Nov 17 02:49:42 2014
@@ -74,7 +74,7 @@
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV))
errx(1, "could not get numeric hostname");
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+ if ((fd = socket(sa->sa_family, SOCK_STREAM, 0)) < 0)
return NULL;
if (connect(fd, sa, SA_LEN(sa)) == 0)