]> git.sur5r.net Git - openldap/commitdiff
ITS#681: Fix for problems with IPv6 and ACLs
authorKurt Zeilenga <kurt@openldap.org>
Thu, 24 Aug 2000 18:34:48 +0000 (18:34 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 24 Aug 2000 18:34:48 +0000 (18:34 +0000)
from Stig Venaas <venaas@uninett.no>
---
Copyright 2000 Stig Venaas, UNINETT
All rights reserved.

Redistribution and use in source and binary forms are permitted
without restriction or fee of any kind as long as this notice is
preserved. The name of UNINETT may not be used to endorse or promote
products derived from this software without specific prior written
permission. This software is provided ``as is'' without express or
implied warranty.

servers/slapd/daemon.c

index b6cf134bbe8f8b9ce08161ee2e33ff7b91e144b2..9c961d607d439a55ccbe16f427e5dd83ba17760c 100644 (file)
@@ -907,14 +907,22 @@ slapd_daemon_task(
 #endif /* LDAP_PF_LOCAL */
 
 #  ifdef LDAP_PF_INET6
-                       case AF_INET6: {
+                       case AF_INET6:
+                       if ( IN6_IS_ADDR_V4MAPPED(&from.sa_in6_addr.sin6_addr) ) {
+                               peeraddr = inet_ntoa( *((struct in_addr *)
+                                                       &from.sa_in6_addr.sin6_addr.s6_addr32[3]) );
+                               sprintf( peername, "IP=%s:%d",
+                                        peeraddr != NULL ? peeraddr : "unknown",
+                                        (unsigned) ntohs( from.sa_in6_addr.sin6_port ) );
+                       } else {
                                char addr[INET6_ADDRSTRLEN];
                                sprintf( peername, "IP=%s %d",
-                                       inet_ntop( AF_INET6,
-                                               &from.sa_in6_addr.sin6_addr,
-                                           addr, sizeof addr) ? addr : "unknown",
-                                       (unsigned) ntohs( from.sa_in6_addr.sin6_port ) );
-                       } break;
+                                        inet_ntop( AF_INET6,
+                                                   &from.sa_in6_addr.sin6_addr,
+                                                   addr, sizeof addr) ? addr : "unknown",
+                                        (unsigned) ntohs( from.sa_in6_addr.sin6_port ) );
+                       }
+                       break;
 #  endif /* LDAP_PF_INET6 */
 
                        case AF_INET: