lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1476 - nss-pam-ldapd/nslcd

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

nss-pam-ldapd commit: r1476 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sat Jul  2 23:20:39 2011
New Revision: 1476
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1476

Log:
make buffer sizes consistent, grow gidNumber buffer to hold larger numbers and 
small consistence improvements

Modified:
   nss-pam-ldapd/nslcd/group.c
   nss-pam-ldapd/nslcd/host.c
   nss-pam-ldapd/nslcd/network.c
   nss-pam-ldapd/nslcd/passwd.c
   nss-pam-ldapd/nslcd/shadow.c

Modified: nss-pam-ldapd/nslcd/group.c
==============================================================================
--- nss-pam-ldapd/nslcd/group.c Fri Jun 10 10:49:07 2011        (r1475)
+++ nss-pam-ldapd/nslcd/group.c Sat Jul  2 23:20:39 2011        (r1476)
@@ -1,7 +1,7 @@
 /*
    group.c - group entry lookup routines
-   Parts of this file were part of the nss_ldap library (as ldap-grp.c) which
-   has been forked into the nss-pam-ldapd library.
+   Parts of this file were part of the nss_ldap library (as ldap-grp.c)
+   which has been forked into the nss-pam-ldapd library.
 
    Copyright (C) 1997-2006 Luke Howard
    Copyright (C) 2006 West Consulting
@@ -205,7 +205,7 @@
 /* return the list of members */
 static const char **getmembers(MYLDAP_ENTRY *entry,MYLDAP_SESSION *session)
 {
-  char buf[20];
+  char buf[256];
   int i;
   const char **values;
   SET *set;
@@ -249,7 +249,7 @@
   gid_t gids[MAXGIDS_PER_ENTRY];
   int numgids;
   char *tmp;
-  char passbuffer[80];
+  char passbuffer[64];
   int rc;
   /* get group name (cn) */
   names=myldap_get_values(entry,attmap_group_cn);
@@ -274,7 +274,7 @@
                           myldap_get_dn(entry),attmap_group_gidNumber);
       return 0;
     }
-    for 
(numgids=0;(gidvalues[numgids]!=NULL)&&(numgids<MAXGIDS_PER_ENTRY);numgids++)
+    for 
(numgids=0;(numgids<MAXGIDS_PER_ENTRY)&&(gidvalues[numgids]!=NULL);numgids++)
     {
       if (gidSid!=NULL)
         gids[numgids]=(gid_t)binsid2id(gidvalues[numgids]);

Modified: nss-pam-ldapd/nslcd/host.c
==============================================================================
--- nss-pam-ldapd/nslcd/host.c  Fri Jun 10 10:49:07 2011        (r1475)
+++ nss-pam-ldapd/nslcd/host.c  Sat Jul  2 23:20:39 2011        (r1476)
@@ -5,7 +5,7 @@
 
    Copyright (C) 1997-2005 Luke Howard
    Copyright (C) 2006 West Consulting
-   Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong
+   Copyright (C) 2006, 2007, 2009, 2010, 2011 Arthur de Jong
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -78,18 +78,18 @@
                     attmap_host_cn,safename);
 }
 
-static int mkfilter_host_byaddr(const char *name,
+static int mkfilter_host_byaddr(const char *addrname,
                                 char *buffer,size_t buflen)
 {
-  char safename[64];
+  char safeaddr[64];
   /* escape attribute */
-  if (myldap_escape(name,safename,sizeof(safename)))
+  if (myldap_escape(addrname,safeaddr,sizeof(safeaddr)))
     return -1;
   /* build filter */
   return mysnprintf(buffer,buflen,
                     "(&%s(%s=%s))",
                     host_filter,
-                    attmap_host_ipHostNumber,safename);
+                    attmap_host_ipHostNumber,safeaddr);
 }
 
 void host_init(void)
@@ -167,18 +167,18 @@
   int af;
   char addr[64];
   int len=sizeof(addr);
-  char name[64];
+  char addrname[64];
   char filter[1024];
   READ_ADDRESS(fp,addr,len,af);
   /* translate the address to a string */
-  if (inet_ntop(af,addr,name,sizeof(name))==NULL)
+  if (inet_ntop(af,addr,addrname,sizeof(addrname))==NULL)
   {
     log_log(LOG_WARNING,"unable to convert address to string");
     return -1;
   }
-  log_setrequest("host=%s",name);,
+  log_setrequest("host=%s",addrname);,
   NSLCD_ACTION_HOST_BYADDR,
-  mkfilter_host_byaddr(name,filter,sizeof(filter)),
+  mkfilter_host_byaddr(addrname,filter,sizeof(filter)),
   write_host(fp,entry)
 )
 

Modified: nss-pam-ldapd/nslcd/network.c
==============================================================================
--- nss-pam-ldapd/nslcd/network.c       Fri Jun 10 10:49:07 2011        (r1475)
+++ nss-pam-ldapd/nslcd/network.c       Sat Jul  2 23:20:39 2011        (r1476)
@@ -5,7 +5,7 @@
 
    Copyright (C) 1997-2005 Luke Howard
    Copyright (C) 2006 West Consulting
-   Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong
+   Copyright (C) 2006, 2007, 2009, 2010, 2011 Arthur de Jong
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -76,18 +76,18 @@
                     attmap_network_cn,safename);
 }
 
-static int mkfilter_network_byaddr(const char *name,
+static int mkfilter_network_byaddr(const char *addrname,
                                    char *buffer,size_t buflen)
 {
-  char safename[64];
+  char safeaddr[64];
   /* escape attribute */
-  if (myldap_escape(name,safename,sizeof(safename)))
+  if (myldap_escape(addrname,safeaddr,sizeof(safeaddr)))
     return -1;
   /* build filter */
   return mysnprintf(buffer,buflen,
                     "(&%s(%s=%s))",
                     network_filter,
-                    attmap_network_ipNetworkNumber,safename);
+                    attmap_network_ipNetworkNumber,safeaddr);
 }
 
 void network_init(void)
@@ -165,18 +165,18 @@
   int af;
   char addr[64];
   int len=sizeof(addr);
-  char name[64];
+  char addrname[64];
   char filter[1024];
   READ_ADDRESS(fp,addr,len,af);
   /* translate the address to a string */
-  if (inet_ntop(af,addr,name,sizeof(name))==NULL)
+  if (inet_ntop(af,addr,addrname,sizeof(addrname))==NULL)
   {
     log_log(LOG_WARNING,"unable to convert address to string");
     return -1;
   }
-  log_setrequest("network=%s",name);,
+  log_setrequest("network=%s",addrname);,
   NSLCD_ACTION_NETWORK_BYADDR,
-  mkfilter_network_byaddr(name,filter,sizeof(filter)),
+  mkfilter_network_byaddr(addrname,filter,sizeof(filter)),
   write_network(fp,entry)
 )
 

Modified: nss-pam-ldapd/nslcd/passwd.c
==============================================================================
--- nss-pam-ldapd/nslcd/passwd.c        Fri Jun 10 10:49:07 2011        (r1475)
+++ nss-pam-ldapd/nslcd/passwd.c        Sat Jul  2 23:20:39 2011        (r1476)
@@ -390,12 +390,12 @@
   const char *passwd;
   uid_t uids[MAXUIDS_PER_ENTRY];
   int numuids;
-  char gidbuf[10];
+  char gidbuf[32];
   gid_t gid;
   char gecos[100];
   char homedir[100];
   char shell[100];
-  char passbuffer[80];
+  char passbuffer[64];
   int i,j;
   /* get the usernames for this entry */
   usernames=myldap_get_values(entry,attmap_passwd_uid);

Modified: nss-pam-ldapd/nslcd/shadow.c
==============================================================================
--- nss-pam-ldapd/nslcd/shadow.c        Fri Jun 10 10:49:07 2011        (r1475)
+++ nss-pam-ldapd/nslcd/shadow.c        Sat Jul  2 23:20:39 2011        (r1476)
@@ -112,7 +112,7 @@
 
 static long to_date(const char *date,const char *attr)
 {
-  char buffer[8];
+  char buffer[32];
   long value;
   char *tmp;
   size_t l;
@@ -168,7 +168,7 @@
                            long *mindays,long *maxdays,long *warndays,
                            long *inactdays,long *expiredate,unsigned long 
*flag)
 {
-  char buffer[80];
+  char buffer[64];
   const char *tmpvalue;
   char *tmp;
   /* get lastchange date */
@@ -202,7 +202,7 @@
   int rc;
   const char **values;
   LDAPMod mod,*mods[2];
-  char buffer[80],*strvals[2];
+  char buffer[64],*strvals[2];
   /* find the name of the attribute to use */
   if ( (attmap_shadow_shadowLastChange==NULL) || 
(attmap_shadow_shadowLastChange[0]=='\0') )
     return LDAP_LOCAL_ERROR; /* attribute not mapped at all */
@@ -270,7 +270,7 @@
   long expiredate;
   unsigned long flag;
   int i;
-  char passbuffer[80];
+  char passbuffer[64];
   /* get username */
   usernames=myldap_get_values(entry,attmap_shadow_uid);
   if ((usernames==NULL)||(usernames[0]==NULL))
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits