lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1295 - in nss-pam-ldapd: common nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1295 - in nss-pam-ldapd: common nslcd



Author: arthur
Date: Thu Nov  4 21:31:01 2010
New Revision: 1295
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1295

Log:
pass the actual size of the address family and the path length to bind() and 
connect() for named sockets

Modified:
   nss-pam-ldapd/common/nslcd-prot.c
   nss-pam-ldapd/nslcd/nslcd.c

Modified: nss-pam-ldapd/common/nslcd-prot.c
==============================================================================
--- nss-pam-ldapd/common/nslcd-prot.c   Wed Nov  3 21:55:02 2010        (r1294)
+++ nss-pam-ldapd/common/nslcd-prot.c   Thu Nov  4 21:31:01 2010        (r1295)
@@ -66,7 +66,7 @@
   strncpy(addr.sun_path,NSLCD_SOCKET,sizeof(addr.sun_path));
   addr.sun_path[sizeof(addr.sun_path)-1]='\0';
   /* connect to the socket */
-  if (connect(sock,(struct sockaddr *)&addr,(socklen_t)sizeof(struct 
sockaddr_un))<0)
+  if (connect(sock,(struct sockaddr 
*)&addr,(socklen_t)(sizeof(addr.sun_family)+strlen(addr.sun_path)))<0)
   {
     (void)close(sock);
     return NULL;

Modified: nss-pam-ldapd/nslcd/nslcd.c
==============================================================================
--- nss-pam-ldapd/nslcd/nslcd.c Wed Nov  3 21:55:02 2010        (r1294)
+++ nss-pam-ldapd/nslcd/nslcd.c Thu Nov  4 21:31:01 2010        (r1295)
@@ -293,7 +293,7 @@
   strncpy(addr.sun_path,NSLCD_SOCKET,sizeof(addr.sun_path));
   addr.sun_path[sizeof(addr.sun_path)-1]='\0';
   /* bind to the named socket */
-  if (bind(sock,(struct sockaddr *)&addr,sizeof(struct sockaddr_un)))
+  if (bind(sock,(struct sockaddr 
*)&addr,(sizeof(addr.sun_family)+strlen(addr.sun_path))))
   {
     log_log(LOG_ERR,"bind() to "NSLCD_SOCKET" failed: %s",
             strerror(errno));
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits