lists.arthurdejong.org
RSS feed

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

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

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



Author: arthur
Date: Fri Sep  9 18:08:44 2011
New Revision: 1542
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1542&view=revision

Log:
make validation log messages consistent

Modified:
   nss-pam-ldapd/nslcd/alias.c
   nss-pam-ldapd/nslcd/attmap.c
   nss-pam-ldapd/nslcd/common.c
   nss-pam-ldapd/nslcd/common.h
   nss-pam-ldapd/nslcd/ether.c
   nss-pam-ldapd/nslcd/group.c
   nss-pam-ldapd/nslcd/host.c
   nss-pam-ldapd/nslcd/netgroup.c
   nss-pam-ldapd/nslcd/network.c
   nss-pam-ldapd/nslcd/pam.c
   nss-pam-ldapd/nslcd/passwd.c
   nss-pam-ldapd/nslcd/protocol.c
   nss-pam-ldapd/nslcd/rpc.c
   nss-pam-ldapd/nslcd/service.c
   nss-pam-ldapd/nslcd/shadow.c

Modified: nss-pam-ldapd/nslcd/alias.c
==============================================================================
--- nss-pam-ldapd/nslcd/alias.c Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/alias.c Fri Sep  9 18:08:44 2011        (r1542)
@@ -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
@@ -100,7 +100,7 @@
   names=myldap_get_values(entry,attmap_alias_cn);
   if ((names==NULL)||(names[0]==NULL))
   {
-    log_log(LOG_WARNING,"alias entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_alias_cn);
     return 0;
   }

Modified: nss-pam-ldapd/nslcd/attmap.c
==============================================================================
--- nss-pam-ldapd/nslcd/attmap.c        Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/attmap.c        Fri Sep  9 18:08:44 2011        (r1542)
@@ -2,7 +2,7 @@
    attmap.c - attribute mapping values and functions
    This file is part of the nss-pam-ldapd library.
 
-   Copyright (C) 2007, 2008, 2009, 2010 Arthur de Jong
+   Copyright (C) 2007, 2008, 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
@@ -247,7 +247,7 @@
   /* TODO: handle userPassword attribute specially */
   if ((values[0]!=NULL)&&(values[1]!=NULL))
   {
-    log_log(LOG_WARNING,"entry %s contains multiple %s values",
+    log_log(LOG_WARNING,"%s: %s: multiple values",
                         myldap_get_dn(entry),name);
   }
   return values[0];

Modified: nss-pam-ldapd/nslcd/common.c
==============================================================================
--- nss-pam-ldapd/nslcd/common.c        Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/common.c        Fri Sep  9 18:08:44 2011        (r1542)
@@ -150,7 +150,8 @@
 }
 
 /* this writes a single address to the stream */
-int write_address(TFILE *fp,const char *addr)
+int write_address(TFILE *fp,MYLDAP_ENTRY *entry,const char *attr,
+                  const char *addr)
 {
   int32_t tmpint32;
   struct in_addr ipv4addr;
@@ -179,7 +180,8 @@
     /* failure, log but write simple invalid address
        (otherwise the address list is messed up) */
     /* TODO: have error message in correct format */
-    log_log(LOG_WARNING,"unparseble address: %s",addr);
+    log_log(LOG_WARNING,"%s: %s: \"%s\" unparseble",
+                        myldap_get_dn(entry),attmap_ether_cn,addr);
     /* write an illegal address type */
     WRITE_INT32(fp,-1);
     /* write an emtpy address */

Modified: nss-pam-ldapd/nslcd/common.h
==============================================================================
--- nss-pam-ldapd/nslcd/common.h        Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/common.h        Fri Sep  9 18:08:44 2011        (r1542)
@@ -68,11 +68,12 @@
                              char *buffer,size_t buflen);
 
 /* write out an address, parsing the addr value */
-int write_address(TFILE *fp,const char *addr);
+int write_address(TFILE *fp,MYLDAP_ENTRY *entry,const char *attr,
+                  const char *addr);
 
 /* a helper macro to write out addresses and bail out on errors */
-#define WRITE_ADDRESS(fp,addr) \
-  if (write_address(fp,addr)) \
+#define WRITE_ADDRESS(fp,entry,attr,addr) \
+  if (write_address(fp,entry,attr,addr)) \
     return -1;
 
 /* read an address from the stream */

Modified: nss-pam-ldapd/nslcd/ether.c
==============================================================================
--- nss-pam-ldapd/nslcd/ether.c Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/ether.c Fri Sep  9 18:08:44 2011        (r1542)
@@ -123,7 +123,7 @@
   names=myldap_get_values(entry,attmap_ether_cn);
   if ((names==NULL)||(names[0]==NULL))
   {
-    log_log(LOG_WARNING,"ether entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_ether_cn);
     return 0;
   }
@@ -139,7 +139,7 @@
     ethers=myldap_get_values(entry,attmap_ether_macAddress);
     if ((ethers==NULL)||(ethers[0]==NULL))
     {
-      log_log(LOG_WARNING,"ether entry %s does not contain %s value",
+      log_log(LOG_WARNING,"%s: %s: missing",
                           myldap_get_dn(entry),attmap_ether_macAddress);
       return 0;
     }

Modified: nss-pam-ldapd/nslcd/group.c
==============================================================================
--- nss-pam-ldapd/nslcd/group.c Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/group.c Fri Sep  9 18:08:44 2011        (r1542)
@@ -184,8 +184,8 @@
   {
     if (!isvalidname(names[i]))
     {
-      log_log(LOG_WARNING,"group entry %s name denied by validnames option: 
\"%s\"",
-                          myldap_get_dn(entry),names[i]);
+      log_log(LOG_WARNING,"%s: %s: denied by validnames option",
+                          myldap_get_dn(entry),attmap_group_cn);
     }
     else if ((reqname==NULL)||(strcmp(reqname,names[i])==0))
     {
@@ -255,7 +255,7 @@
   names=myldap_get_values(entry,attmap_group_cn);
   if ((names==NULL)||(names[0]==NULL))
   {
-    log_log(LOG_WARNING,"group entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_group_cn);
     return 0;
   }
@@ -270,7 +270,7 @@
     gidvalues=myldap_get_values_len(entry,attmap_group_gidNumber);
     if ((gidvalues==NULL)||(gidvalues[0]==NULL))
     {
-      log_log(LOG_WARNING,"group entry %s does not contain %s value",
+      log_log(LOG_WARNING,"%s: %s: missing",
                           myldap_get_dn(entry),attmap_group_gidNumber);
       return 0;
     }
@@ -284,13 +284,13 @@
         gids[numgids]=strtogid(gidvalues[numgids],&tmp,0);
         if ((*(gidvalues[numgids])=='\0')||(*tmp!='\0'))
         {
-          log_log(LOG_WARNING,"group entry %s contains non-numeric %s value",
+          log_log(LOG_WARNING,"%s: %s: non-numeric",
                               myldap_get_dn(entry),attmap_group_gidNumber);
           return 0;
         }
         else if (errno!=0)
         {
-          log_log(LOG_WARNING,"group entry %s contains too large %s value",
+          log_log(LOG_WARNING,"%s: %s: too large",
                               myldap_get_dn(entry),attmap_group_gidNumber);
           return 0;
         }
@@ -322,7 +322,7 @@
   READ_STRING(fp,name);
   log_setrequest("group=\"%s\"",name);
   if (!isvalidname(name)) {
-    log_log(LOG_WARNING,"\"%s\": name denied by validnames option",name);
+    log_log(LOG_WARNING,"request denied by validnames option");
     return -1;
   },
   NSLCD_ACTION_GROUP_BYNAME,
@@ -349,7 +349,7 @@
   log_setrequest("group/member=\"%s\"",name);
   if (!isvalidname(name))
   {
-    log_log(LOG_WARNING,"\"%s\": name denied by validnames option",name);
+    log_log(LOG_WARNING,"request denied by validnames option");
     return -1;
   }
   if ((nslcd_cfg->ldc_nss_initgroups_ignoreusers!=NULL)&&

Modified: nss-pam-ldapd/nslcd/host.c
==============================================================================
--- nss-pam-ldapd/nslcd/host.c  Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/host.c  Fri Sep  9 18:08:44 2011        (r1542)
@@ -122,7 +122,7 @@
   hostnames=myldap_get_values(entry,attmap_host_cn);
   if ((hostnames==NULL)||(hostnames[0]==NULL))
   {
-    log_log(LOG_WARNING,"host entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_host_cn);
     return 0;
   }
@@ -133,7 +133,7 @@
   addresses=myldap_get_values(entry,attmap_host_ipHostNumber);
   if ((addresses==NULL)||(addresses[0]==NULL))
   {
-    log_log(LOG_WARNING,"host entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_host_ipHostNumber);
     return 0;
   }
@@ -146,7 +146,7 @@
   WRITE_INT32(fp,numaddr);
   for (i=0;i<numaddr;i++)
   {
-    WRITE_ADDRESS(fp,addresses[i]);
+    WRITE_ADDRESS(fp,entry,attmap_host_ipHostNumber,addresses[i]);
   }
   return 0;
 }

Modified: nss-pam-ldapd/nslcd/netgroup.c
==============================================================================
--- nss-pam-ldapd/nslcd/netgroup.c      Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/netgroup.c      Fri Sep  9 18:08:44 2011        (r1542)
@@ -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
@@ -129,7 +129,7 @@
 #define WRITE_STRING_STRIPSPACE(fp,str) \
   WRITE_STRING_STRIPSPACE_LEN(fp,str,strlen(str))
 
-static int write_netgroup_triple(TFILE *fp,const char *triple)
+static int write_netgroup_triple(TFILE *fp,MYLDAP_ENTRY *entry,const char 
*triple)
 {
   int32_t tmpint32;
   int i;
@@ -140,7 +140,8 @@
   /* we should have a bracket now */
   if (triple[i]!='(')
   {
-    log_log(LOG_WARNING,"write_netgroup_triple(): entry does not begin with 
'(' (entry skipped)");
+    log_log(LOG_WARNING,"%s: %s: does not begin with '('",
+                        
myldap_get_dn(entry),attmap_netgroup_nisNetgroupTriple);
     return 0;
   }
   i++;
@@ -150,7 +151,8 @@
     /* nothing else to do */ ;
   if (triple[i]!=',')
   {
-    log_log(LOG_WARNING,"write_netgroup_triple(): missing ',' (entry 
skipped)");
+    log_log(LOG_WARNING,"%s: %s: missing ','",
+                        
myldap_get_dn(entry),attmap_netgroup_nisNetgroupTriple);
     return 0;
   }
   hoste=i;
@@ -161,7 +163,8 @@
     /* nothing else to do */ ;
   if (triple[i]!=',')
   {
-    log_log(LOG_WARNING,"write_netgroup_triple(): missing ',' (entry 
skipped)");
+    log_log(LOG_WARNING,"%s: %s: missing ','",
+                        
myldap_get_dn(entry),attmap_netgroup_nisNetgroupTriple);
     return 0;
   }
   usere=i;
@@ -172,7 +175,8 @@
     /* nothing else to do */ ;
   if (triple[i]!=')')
   {
-    log_log(LOG_WARNING,"write_netgroup_triple(): missing ')' (entry 
skipped)");
+    log_log(LOG_WARNING,"%s: %s: missing ')'",
+                        
myldap_get_dn(entry),attmap_netgroup_nisNetgroupTriple);
     return 0;
   }
   domaine=i;
@@ -183,7 +187,8 @@
   /* if anything is left in the string we have a problem */
   if (triple[i]!='\0')
   {
-    log_log(LOG_WARNING,"write_netgroup_triple(): string contains trailing 
data (entry skipped)");
+    log_log(LOG_WARNING,"%s: %s: contains trailing data",
+                        
myldap_get_dn(entry),attmap_netgroup_nisNetgroupTriple);
     return 0;
   }
   /* write strings */
@@ -196,11 +201,11 @@
   return 0;
 }
 
-#define WRITE_NETGROUP_TRIPLE(fp,triple) \
-  if (write_netgroup_triple(fp,triple)) \
+#define WRITE_NETGROUP_TRIPLE(fp,entry,triple) \
+  if (write_netgroup_triple(fp,entry,triple)) \
     return -1;
 
-static int write_netgroup(TFILE *fp,MYLDAP_ENTRY *entry, const char *reqname)
+static int write_netgroup(TFILE *fp,MYLDAP_ENTRY *entry,const char *reqname)
 {
   int32_t tmpint32;
   int i;
@@ -220,7 +225,7 @@
   if (triples!=NULL)
     for (i=0;triples[i]!=NULL;i++)
     {
-      WRITE_NETGROUP_TRIPLE(fp,triples[i]);
+      WRITE_NETGROUP_TRIPLE(fp,entry,triples[i]);
     }
   /* write netgroup members */
   if (members!=NULL)

Modified: nss-pam-ldapd/nslcd/network.c
==============================================================================
--- nss-pam-ldapd/nslcd/network.c       Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/network.c       Fri Sep  9 18:08:44 2011        (r1542)
@@ -120,7 +120,7 @@
   networknames=myldap_get_values(entry,attmap_network_cn);
   if ((networknames==NULL)||(networknames[0]==NULL))
   {
-    log_log(LOG_WARNING,"network entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_network_cn);
     return 0;
   }
@@ -131,7 +131,7 @@
   addresses=myldap_get_values(entry,attmap_network_ipNetworkNumber);
   if ((addresses==NULL)||(addresses[0]==NULL))
   {
-    log_log(LOG_WARNING,"network entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_network_ipNetworkNumber);
     return 0;
   }
@@ -144,7 +144,7 @@
   WRITE_INT32(fp,numaddr);
   for (i=0;i<numaddr;i++)
   {
-    WRITE_ADDRESS(fp,addresses[i]);
+    WRITE_ADDRESS(fp,entry,attmap_network_ipNetworkNumber,addresses[i]);
   }
   return 0;
 }

Modified: nss-pam-ldapd/nslcd/pam.c
==============================================================================
--- nss-pam-ldapd/nslcd/pam.c   Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/pam.c   Fri Sep  9 18:08:44 2011        (r1542)
@@ -62,7 +62,7 @@
   {
     if (rc==LDAP_SUCCESS)
       rc=LDAP_LOCAL_ERROR;
-    log_log(LOG_WARNING,"lookup of %s failed: %s",userdn,ldap_err2string(rc));
+    log_log(LOG_WARNING,"%s: lookup failed: %s",userdn,ldap_err2string(rc));
   }
   else
   {
@@ -71,7 +71,7 @@
     {
       if (rc==LDAP_SUCCESS)
         rc=LDAP_NO_RESULTS_RETURNED;
-      log_log(LOG_WARNING,"lookup of %s failed: 
%s",userdn,ldap_err2string(rc));
+      log_log(LOG_WARNING,"%s: lookup failed: %s",userdn,ldap_err2string(rc));
     }
   }
   /* close the session */
@@ -90,7 +90,7 @@
   /* check username for validity */
   if (!isvalidname(username))
   {
-    log_log(LOG_WARNING,"\"%s\": name denied by validnames option",username);
+    log_log(LOG_WARNING,"request denied by validnames option");
     *rcp=LDAP_NO_SUCH_OBJECT;
     return NULL;
   }
@@ -118,15 +118,15 @@
     /* get the username from the uid attribute */
     values=myldap_get_values(entry,attmap_passwd_uid);
     if ((values==NULL)||(values[0]==NULL))
-      log_log(LOG_WARNING,"\"%s\": DN %s is missing a %s attribute",
-                          username,myldap_get_dn(entry),attmap_passwd_uid);
+      log_log(LOG_WARNING,"%s: %s: missing",
+                          myldap_get_dn(entry),attmap_passwd_uid);
     value=values[0];
   }
   /* check the username */
   if ((value==NULL)||!isvalidname(value)||strlen(value)>=username_len)
   {
-    log_log(LOG_WARNING,"passwd entry %s name denied by validnames option: 
\"%s\"",
-                        myldap_get_dn(entry),username);
+    log_log(LOG_WARNING,"%s: %s: denied by validnames option",
+                        myldap_get_dn(entry),attmap_passwd_uid);
     return;
   }
   /* check if the username is different and update it if needed */
@@ -159,7 +159,8 @@
   {
     daysleft=today-expiredate;
     mysnprintf(authzmsg,authzmsgsz-1,"account expired %ld days ago",daysleft);
-    log_log(LOG_WARNING,"%s: %s",myldap_get_dn(entry),authzmsg);
+    log_log(LOG_WARNING,"%s: %s: %s",
+                        
myldap_get_dn(entry),attmap_shadow_shadowExpire,authzmsg);
     return NSLCD_PAM_ACCT_EXPIRED;
   }
   /* password expiration isn't interesting at this point because the user
@@ -171,11 +172,13 @@
     if (lastchangedate==0)
     {
       mysnprintf(authzmsg,authzmsgsz-1,"need a new password");
-      log_log(LOG_WARNING,"%s: %s",myldap_get_dn(entry),authzmsg);
+      log_log(LOG_WARNING,"%s: %s: %s",
+                          
myldap_get_dn(entry),attmap_shadow_shadowLastChange,authzmsg);
       return NSLCD_PAM_NEW_AUTHTOK_REQD;
     }
     else if (today<lastchangedate)
-      log_log(LOG_WARNING,"%s: password changed in the 
future",myldap_get_dn(entry));
+      log_log(LOG_WARNING,"%s: %s: password changed in the future",
+                          myldap_get_dn(entry),attmap_shadow_shadowLastChange);
     else if (maxdays!=-1)
     {
       /* check maxdays */
@@ -198,21 +201,24 @@
         {
           mysnprintf(authzmsg+strlen(authzmsg),authzmsgsz-strlen(authzmsg)-1,
                      ", account locked %ld days ago",-inactleft);
-          log_log(LOG_WARNING,"%s: %s",myldap_get_dn(entry),authzmsg);
+          log_log(LOG_WARNING,"%s: %s: %s",
+                              
myldap_get_dn(entry),attmap_shadow_shadowInactive,authzmsg);
           return NSLCD_PAM_AUTHTOK_EXPIRED;
         }
       }
       if (daysleft<=0)
       {
         /* log previously built message */
-        log_log(LOG_WARNING,"%s: %s",myldap_get_dn(entry),authzmsg);
+        log_log(LOG_WARNING,"%s: %s: %s",
+                            
myldap_get_dn(entry),attmap_shadow_shadowMax,authzmsg);
         return NSLCD_PAM_NEW_AUTHTOK_REQD;
       }
       /* check warndays */
       if ((warndays>0)&&(daysleft<=warndays))
       {
         mysnprintf(authzmsg,authzmsgsz-1,"password will expire in %ld 
days",daysleft);
-        log_log(LOG_WARNING,"%s: %s",myldap_get_dn(entry),authzmsg);
+        log_log(LOG_WARNING,"%s: %s: %s",
+                            
myldap_get_dn(entry),attmap_shadow_shadowWarning,authzmsg);
       }
     }
   }
@@ -222,7 +228,8 @@
     if ((mindays!=-1)&&(daysleft>0))
     {
       mysnprintf(authzmsg,authzmsgsz-1,"password cannot be changed for another 
%ld days",daysleft);
-      log_log(LOG_WARNING,"%s: %s",myldap_get_dn(entry),authzmsg);
+      log_log(LOG_WARNING,"%s: %s: %s",
+                          
myldap_get_dn(entry),attmap_shadow_shadowMin,authzmsg);
       return NSLCD_PAM_AUTHTOK_ERR;
     }
   }

Modified: nss-pam-ldapd/nslcd/passwd.c
==============================================================================
--- nss-pam-ldapd/nslcd/passwd.c        Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/passwd.c        Fri Sep  9 18:08:44 2011        (r1542)
@@ -183,7 +183,7 @@
   values=myldap_get_values_len(entry,attmap_passwd_uidNumber);
   if ((values==NULL)||(values[0]==NULL))
   {
-    log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_passwd_uidNumber);
     return 0;
   }
@@ -198,13 +198,13 @@
       uid=strtouid(values[i],&tmp,0);
       if ((*(values[i])=='\0')||(*tmp!='\0'))
       {
-        log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
+        log_log(LOG_WARNING,"%s: %s: non-numeric",
                             myldap_get_dn(entry),attmap_passwd_uidNumber);
         continue;
       }
       else if (errno!=0)
       {
-        log_log(LOG_WARNING,"passwd entry %s contains too large %s value",
+        log_log(LOG_WARNING,"%s: %s: too large",
                             myldap_get_dn(entry),attmap_passwd_uidNumber);
         continue;
       }
@@ -235,14 +235,14 @@
   search=myldap_search(session,dn,LDAP_SCOPE_BASE,passwd_filter,attrs,rcp);
   if (search==NULL)
   {
-    log_log(LOG_WARNING,"lookup of user %s failed: 
%s",dn,ldap_err2string(*rcp));
+    log_log(LOG_WARNING,"%s: lookup error: %s",dn,ldap_err2string(*rcp));
     return NULL;
   }
   entry=myldap_get_entry(search,rcp);
   if (entry==NULL)
   {
     if (*rcp!=LDAP_SUCCESS)
-      log_log(LOG_WARNING,"lookup of user %s failed: 
%s",dn,ldap_err2string(*rcp));
+      log_log(LOG_WARNING,"%s: lookup error: %s",dn,ldap_err2string(*rcp));
     return NULL;
   }
   /* check the uidNumber attribute if min_uid is set */
@@ -423,7 +423,10 @@
 static inline int shadow_uses_ldap(void)
 {
   if (cached_shadow_uses_ldap==CACHED_UNKNOWN)
+  {
+    log_log(LOG_INFO,"(re)loading %s",NSSWITCH_FILE); /* FIXME: check if this 
is correct */
     cached_shadow_uses_ldap=nsswitch_db_uses_ldap(NSSWITCH_FILE,"shadow");
+  }
   return cached_shadow_uses_ldap;
 }
 
@@ -451,7 +454,7 @@
   usernames=myldap_get_values(entry,attmap_passwd_uid);
   if ((usernames==NULL)||(usernames[0]==NULL))
   {
-    log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_passwd_uid);
     return 0;
   }
@@ -478,7 +481,7 @@
     tmpvalues=myldap_get_values_len(entry,attmap_passwd_uidNumber);
     if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
     {
-      log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
+      log_log(LOG_WARNING,"%s: %s: missing",
                           myldap_get_dn(entry),attmap_passwd_uidNumber);
       return 0;
     }
@@ -492,13 +495,13 @@
         uids[numuids]=strtouid(tmpvalues[numuids],&tmp,0);
         if ((*(tmpvalues[numuids])=='\0')||(*tmp!='\0'))
         {
-          log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
+          log_log(LOG_WARNING,"%s: %s: non-numeric",
                               myldap_get_dn(entry),attmap_passwd_uidNumber);
           return 0;
         }
         else if (errno!=0)
         {
-          log_log(LOG_WARNING,"passwd entry %s contains too large %s value",
+          log_log(LOG_WARNING,"%s: %s: too large",
                               myldap_get_dn(entry),attmap_passwd_uidNumber);
           return 0;
         }
@@ -511,7 +514,7 @@
     tmpvalues=myldap_get_values_len(entry,attmap_passwd_gidNumber);
     if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
     {
-      log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
+      log_log(LOG_WARNING,"%s: %s: missing",
                           myldap_get_dn(entry),attmap_passwd_gidNumber);
       return 0;
     }
@@ -522,7 +525,7 @@
     attmap_get_value(entry,attmap_passwd_gidNumber,gidbuf,sizeof(gidbuf));
     if (gidbuf[0]=='\0')
     {
-      log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
+      log_log(LOG_WARNING,"%s: %s: missing",
                           myldap_get_dn(entry),attmap_passwd_gidNumber);
       return 0;
     }
@@ -530,13 +533,13 @@
     gid=strtogid(gidbuf,&tmp,0);
     if ((gidbuf[0]=='\0')||(*tmp!='\0'))
     {
-      log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
+      log_log(LOG_WARNING,"%s: %s: non-numeric",
                           myldap_get_dn(entry),attmap_passwd_gidNumber);
       return 0;
     }
     else if (errno!=0)
     {
-      log_log(LOG_WARNING,"passwd entry %s contains too large %s value",
+      log_log(LOG_WARNING,"%s: %s: too large",
                           myldap_get_dn(entry),attmap_passwd_gidNumber);
       return 0;
     }
@@ -546,7 +549,7 @@
   /* get the home directory for this entry */
   attmap_get_value(entry,attmap_passwd_homeDirectory,homedir,sizeof(homedir));
   if (homedir[0]=='\0')
-    log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_passwd_homeDirectory);
   /* get the shell for this entry */
   attmap_get_value(entry,attmap_passwd_loginShell,shell,sizeof(shell));
@@ -556,8 +559,8 @@
     {
       if (!isvalidname(usernames[i]))
       {
-        log_log(LOG_WARNING,"passwd entry %s denied by validnames option: 
\"%s\"",
-                            myldap_get_dn(entry),usernames[i]);
+        log_log(LOG_WARNING,"%s: %s: denied by validnames option",
+                            myldap_get_dn(entry),attmap_passwd_uid);
       }
       else
       {
@@ -587,7 +590,7 @@
   READ_STRING(fp,name);
   log_setrequest("passwd=\"%s\"",name);
   if (!isvalidname(name)) {
-    log_log(LOG_WARNING,"\"%s\": name denied by validnames option",name);
+    log_log(LOG_WARNING,"request denied by validnames option");
     return -1;
   }
   check_nsswitch_reload();,

Modified: nss-pam-ldapd/nslcd/protocol.c
==============================================================================
--- nss-pam-ldapd/nslcd/protocol.c      Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/protocol.c      Fri Sep  9 18:08:44 2011        (r1542)
@@ -115,7 +115,7 @@
   aliases=myldap_get_values(entry,attmap_protocol_cn);
   if ((aliases==NULL)||(aliases[0]==NULL))
   {
-    log_log(LOG_WARNING,"protocol entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_protocol_cn);
     return 0;
   }
@@ -134,26 +134,26 @@
   protos=myldap_get_values(entry,attmap_protocol_ipProtocolNumber);
   if ((protos==NULL)||(protos[0]==NULL))
   {
-    log_log(LOG_WARNING,"protocol entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_protocol_ipProtocolNumber);
     return 0;
   }
   else if (protos[1]!=NULL)
   {
-    log_log(LOG_WARNING,"protocol entry %s contains multiple %s values",
+    log_log(LOG_WARNING,"%s: %s: multiple values",
                         myldap_get_dn(entry),attmap_protocol_ipProtocolNumber);
   }
   errno=0;
   proto=(int)strtol(protos[0],&tmp,0);
   if ((*(protos[0])=='\0')||(*tmp!='\0'))
   {
-    log_log(LOG_WARNING,"protocol entry %s contains non-numeric %s value",
+    log_log(LOG_WARNING,"%s: %s: non-numeric",
                         myldap_get_dn(entry),attmap_protocol_ipProtocolNumber);
     return 0;
   }
   else if (errno!=0)
   {
-    log_log(LOG_WARNING,"protocol entry %s contains too large %s value",
+    log_log(LOG_WARNING,"%s: %s: too large",
                         myldap_get_dn(entry),attmap_protocol_ipProtocolNumber);
     return 0;
   }

Modified: nss-pam-ldapd/nslcd/rpc.c
==============================================================================
--- nss-pam-ldapd/nslcd/rpc.c   Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/rpc.c   Fri Sep  9 18:08:44 2011        (r1542)
@@ -116,7 +116,7 @@
   aliases=myldap_get_values(entry,attmap_rpc_cn);
   if ((aliases==NULL)||(aliases[0]==NULL))
   {
-    log_log(LOG_WARNING,"rpc entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_rpc_cn);
     return 0;
   }
@@ -135,26 +135,26 @@
   numbers=myldap_get_values(entry,attmap_rpc_oncRpcNumber);
   if ((numbers==NULL)||(numbers[0]==NULL))
   {
-    log_log(LOG_WARNING,"rpc entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
     return 0;
   }
   else if (numbers[1]!=NULL)
   {
-    log_log(LOG_WARNING,"rpc entry %s contains multiple %s values",
+    log_log(LOG_WARNING,"%s: %s: multiple values",
                         myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
   }
   errno=0;
   number=(int)strtol(numbers[0],&tmp,0);
   if ((*(numbers[0])=='\0')||(*tmp!='\0'))
   {
-    log_log(LOG_WARNING,"rpc entry %s contains non-numeric %s value",
+    log_log(LOG_WARNING,"%s: %s: non-numeric",
                         myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
     return 0;
   }
   else if (errno!=0)
   {
-    log_log(LOG_WARNING,"rpc entry %s contains too large %s value",
+    log_log(LOG_WARNING,"%s: %s: too large",
                         myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
     return 0;
   }

Modified: nss-pam-ldapd/nslcd/service.c
==============================================================================
--- nss-pam-ldapd/nslcd/service.c       Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/service.c       Fri Sep  9 18:08:44 2011        (r1542)
@@ -144,7 +144,7 @@
   aliases=myldap_get_values(entry,attmap_service_cn);
   if ((aliases==NULL)||(aliases[0]==NULL))
   {
-    log_log(LOG_WARNING,"service entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_service_cn);
     return 0;
   }
@@ -163,26 +163,26 @@
   ports=myldap_get_values(entry,attmap_service_ipServicePort);
   if ((ports==NULL)||(ports[0]==NULL))
   {
-    log_log(LOG_WARNING,"service entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_service_ipServicePort);
     return 0;
   }
   else if (ports[1]!=NULL)
   {
-    log_log(LOG_WARNING,"service entry %s contains multiple %s values",
+    log_log(LOG_WARNING,"%s: %s: multiple values",
                         myldap_get_dn(entry),attmap_service_ipServicePort);
   }
   errno=0;
   port=(int)strtol(ports[0],&tmp,0);
   if ((*(ports[0])=='\0')||(*tmp!='\0'))
   {
-    log_log(LOG_WARNING,"service entry %s contains non-numeric %s value",
+    log_log(LOG_WARNING,"%s: %s: non-numeric value",
                         myldap_get_dn(entry),attmap_service_ipServicePort);
     return 0;
   }
   else if (errno!=0)
   {
-    log_log(LOG_WARNING,"service entry %s contains too large %s value",
+    log_log(LOG_WARNING,"%s: %s: too large",
                         myldap_get_dn(entry),attmap_service_ipServicePort);
     return 0;
   }
@@ -190,7 +190,7 @@
   protocols=myldap_get_values(entry,attmap_service_ipServiceProtocol);
   if ((protocols==NULL)||(protocols[0]==NULL))
   {
-    log_log(LOG_WARNING,"service entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_service_ipServiceProtocol);
     return 0;
   }

Modified: nss-pam-ldapd/nslcd/shadow.c
==============================================================================
--- nss-pam-ldapd/nslcd/shadow.c        Fri Sep  9 18:02:30 2011        (r1541)
+++ nss-pam-ldapd/nslcd/shadow.c        Fri Sep  9 18:08:44 2011        (r1542)
@@ -110,7 +110,7 @@
   set_free(set);
 }
 
-static long to_date(const char *date,const char *attr)
+static long to_date(const char *dn,const char *date,const char *attr)
 {
   char buffer[32];
   long value;
@@ -133,12 +133,12 @@
     value=strtol(date,&tmp,0);
     if ((*date=='\0')||(*tmp!='\0'))
     {
-      log_log(LOG_WARNING,"shadow entry contains non-numeric %s value",attr);
+      log_log(LOG_WARNING,"%s: %s: non-numeric",dn,attr);
       return -1;
     }
     else if (errno!=0)
     {
-      log_log(LOG_WARNING,"shadow entry contains too large %s value",attr);
+      log_log(LOG_WARNING,"%s: %s: too large",dn,attr);
       return -1;
     }
     return value/864-134774;
@@ -149,12 +149,12 @@
   value=strtol(date,&tmp,0);
   if ((*date=='\0')||(*tmp!='\0'))
   {
-    log_log(LOG_WARNING,"shadow entry contains non-numeric %s value",attr);
+    log_log(LOG_WARNING,"%s: %s: non-numeric",dn,attr);
     return -1;
   }
   else if (errno!=0)
   {
-    log_log(LOG_WARNING,"shadow entry contains too large %s value",attr);
+    log_log(LOG_WARNING,"%s: %s: too large",dn,attr);
     return -1;
   }
   return value;
@@ -172,13 +172,13 @@
   var=strtol(tmpvalue,&tmp,0); \
   if ((*(tmpvalue)=='\0')||(*tmp!='\0')) \
   { \
-    log_log(LOG_WARNING,"shadow entry %s contains non-numeric %s value", \
+    log_log(LOG_WARNING,"%s: %s: non-numeric", \
                         myldap_get_dn(entry),attmap_shadow_##att); \
     var=fallback; \
   } \
   else if (errno!=0) \
   { \
-    log_log(LOG_WARNING,"shadow entry %s contains too large %s value", \
+    log_log(LOG_WARNING,"%s: %s: too large", \
                         myldap_get_dn(entry),attmap_shadow_##att); \
     var=fallback; \
   }
@@ -194,7 +194,7 @@
   
tmpvalue=attmap_get_value(entry,attmap_shadow_shadowLastChange,buffer,sizeof(buffer));
   if (tmpvalue==NULL)
     tmpvalue="";
-  *lastchangedate=to_date(tmpvalue,attmap_shadow_shadowLastChange);
+  
*lastchangedate=to_date(myldap_get_dn(entry),tmpvalue,attmap_shadow_shadowLastChange);
   /* get other shadow properties */
   GET_OPTIONAL_LONG(*mindays,shadowMin,-1);
   GET_OPTIONAL_LONG(*maxdays,shadowMax,-1);
@@ -268,11 +268,11 @@
   mods[1]=NULL;
   rc=myldap_modify(session,userdn,mods);
   if (rc!=LDAP_SUCCESS)
-    log_log(LOG_WARNING,"modification of %s attribute of %s failed: %s",
-                        attr,userdn,ldap_err2string(rc));
+    log_log(LOG_WARNING,"%s: %s: modification failed: %s",
+                        userdn,attr,ldap_err2string(rc));
   else
-    log_log(LOG_DEBUG,"modification of %s attribute of %s succeeded",
-                     attr,userdn);
+    log_log(LOG_DEBUG,"%s: %s: modification succeeded",
+                      userdn,attr);
   return rc;
 }
 
@@ -294,7 +294,7 @@
   usernames=myldap_get_values(entry,attmap_shadow_uid);
   if ((usernames==NULL)||(usernames[0]==NULL))
   {
-    log_log(LOG_WARNING,"shadow entry %s does not contain %s value",
+    log_log(LOG_WARNING,"%s: %s: missing",
                         myldap_get_dn(entry),attmap_shadow_uid);
     return 0;
   }
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/