lists.arthurdejong.org
RSS feed

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

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

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



Author: arthur
Date: Fri Jun 18 22:26:26 2010
New Revision: 1149
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1149

Log:
make SASL binding code a little earier to read

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

Modified: nss-pam-ldapd/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.c        Fri Jun 18 22:20:12 2010        (r1148)
+++ nss-pam-ldapd/nslcd/myldap.c        Fri Jun 18 22:26:26 2010        (r1149)
@@ -395,22 +395,10 @@
                       (session->bindpw[0]!='\0')?"\"***\"":"\"\"",uri);
     return ldap_simple_bind_s(session->ld,session->binddn,session->bindpw);
   }
+  /* perform SASL bind if requested and available on platform */
 #ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
   /* TODO: store this information in the session */
-  if (nslcd_cfg->ldc_sasl_mech==NULL)
-  {
-#endif /* HAVE_LDAP_SASL_INTERACTIVE_BIND_S */
-    /* do a simple bind */
-    if (nslcd_cfg->ldc_binddn)
-      log_log(LOG_DEBUG,"ldap_simple_bind_s(\"%s\",%s) 
(uri=\"%s\")",nslcd_cfg->ldc_binddn,
-                        nslcd_cfg->ldc_bindpw?"\"***\"":"NULL",uri);
-    else
-      log_log(LOG_DEBUG,"ldap_simple_bind_s(NULL,%s) (uri=\"%s\")",
-                        nslcd_cfg->ldc_bindpw?"\"***\"":"NULL",uri);
-    return 
ldap_simple_bind_s(session->ld,nslcd_cfg->ldc_binddn,nslcd_cfg->ldc_bindpw);
-#ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
-  }
-  else
+  if (nslcd_cfg->ldc_sasl_mech!=NULL)
   {
     /* do a SASL bind */
     log_log(LOG_DEBUG,"SASL bind to %s as %s",uri,nslcd_cfg->ldc_binddn);
@@ -422,8 +410,8 @@
 #ifdef HAVE_SASL_INTERACT_T
     
log_log(LOG_DEBUG,"ldap_sasl_interactive_bind_s(\"%s\",\"%s\")",nslcd_cfg->ldc_binddn,nslcd_cfg->ldc_sasl_mech);
     return 
ldap_sasl_interactive_bind_s(session->ld,nslcd_cfg->ldc_binddn,nslcd_cfg->ldc_sasl_mech,NULL,NULL,
-                                    LDAP_SASL_QUIET,
-                                    do_sasl_interact,(void *)nslcd_cfg);
+                                        LDAP_SASL_QUIET,
+                                        do_sasl_interact,(void *)nslcd_cfg);
 #else /* HAVE_SASL_INTERACT_T */
     if (nslcd_cfg->ldc_bindpw!=NULL)
     {
@@ -441,6 +429,14 @@
 #endif /* not HAVE_SASL_INTERACT_T */
   }
 #endif /* HAVE_LDAP_SASL_INTERACTIVE_BIND_S */
+  /* do a simple bind */
+  if (nslcd_cfg->ldc_binddn)
+    log_log(LOG_DEBUG,"ldap_simple_bind_s(\"%s\",%s) 
(uri=\"%s\")",nslcd_cfg->ldc_binddn,
+                      nslcd_cfg->ldc_bindpw?"\"***\"":"NULL",uri);
+  else
+    log_log(LOG_DEBUG,"ldap_simple_bind_s(NULL,%s) (uri=\"%s\")",
+                      nslcd_cfg->ldc_bindpw?"\"***\"":"NULL",uri);
+  return 
ldap_simple_bind_s(session->ld,nslcd_cfg->ldc_binddn,nslcd_cfg->ldc_bindpw);
 }
 
 #ifdef HAVE_LDAP_SET_REBIND_PROC
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits