lists.arthurdejong.org
RSS feed

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

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

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



Author: arthur
Date: Sun May  9 12:20:23 2010
New Revision: 1093
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1093

Log:
don't log errno if it is not set (make error less confusing)

Modified:
   nss-pam-ldapd/nslcd/myldap.c

Modified: nss-pam-ldapd/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.c        Sun May  9 12:08:03 2010        (r1092)
+++ nss-pam-ldapd/nslcd/myldap.c        Sun May  9 12:20:23 2010        (r1093)
@@ -380,8 +380,9 @@
     rc=ldap_start_tls_s(session->ld,NULL,NULL);
     if (rc!=LDAP_SUCCESS)
     {
-      log_log(LOG_WARNING,"ldap_start_tls_s() failed: %s: %s (uri=\"%s\")",
-                          ldap_err2string(rc),strerror(errno),uri);
+      log_log(LOG_WARNING,"ldap_start_tls_s() failed: %s%s%s (uri=\"%s\")",
+                          ldap_err2string(rc),(errno==0)?"":": ",
+                          (errno==0)?"":strerror(errno),uri);
       return rc;
     }
   }
@@ -620,9 +621,10 @@
   
rc=ldap_initialize(&(session->ld),nslcd_cfg->ldc_uris[session->current_uri].uri);
   if (rc!=LDAP_SUCCESS)
   {
-    log_log(LOG_WARNING,"ldap_initialize(%s) failed: %s: %s",
+    log_log(LOG_WARNING,"ldap_initialize(%s) failed: %s%s%s",
                         nslcd_cfg->ldc_uris[session->current_uri].uri,
-                        ldap_err2string(rc),strerror(errno));
+                        ldap_err2string(rc),(errno==0)?"":": ",
+                        (errno==0)?"":strerror(errno));
     if (session->ld!=NULL)
     {
       log_log(LOG_DEBUG,"ldap_unbind()");
@@ -655,9 +657,10 @@
   {
     /* log actual LDAP error code */
     log_log((session->binddn[0]=='\0')?LOG_WARNING:LOG_DEBUG,
-                        "failed to bind to LDAP server %s: %s: %s",
+                        "failed to bind to LDAP server %s: %s%s%s",
                         nslcd_cfg->ldc_uris[session->current_uri].uri,
-                        ldap_err2string(rc),strerror(errno));
+                        ldap_err2string(rc),(errno==0)?"":": ",
+                        (errno==0)?"":strerror(errno));
     rc2=ldap_unbind(session->ld);
     session->ld=NULL;
     if (rc2!=LDAP_SUCCESS)
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits