]> granicus.if.org Git - sudo/commitdiff
add sudo_ldap_close
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 3 Dec 2004 18:57:48 +0000 (18:57 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 3 Dec 2004 18:57:48 +0000 (18:57 +0000)
ldap.c
mon_systrace.c
sudo.c
sudo.h

diff --git a/ldap.c b/ldap.c
index 1ec93456ab71920bbd7d9b2cfbbb74233a0ec4de..bee2562919b6d988dfd09ec69b954de33cb051a6 100644 (file)
--- a/ldap.c
+++ b/ldap.c
@@ -979,3 +979,14 @@ int pwflag;
 
   return ret ;
 }
+
+/*
+ * shut down LDAP connection
+ */
+void
+sudo_ldap_close(v)
+VOID *v;
+{
+  if (v)
+    ldap_unbind_s((LDAP *)v);
+}
index 21dce6b4ff25e7c258a6caf6fbe344e6e63c7737..ddb45b2c00656856c43781778236e5c86fb7afe3 100644 (file)
@@ -879,6 +879,7 @@ check_execv(fd, pid, seqnr, askp, cookie, policyp, errorp)
     if ((ld = sudo_ldap_open()) != NULL) {
        sudo_ldap_update_defaults(ld);
        validated = sudo_ldap_check(ld, 0);
+       sudo_ldap_close(ld);
     }
     if (!def_ignore_local_sudoers && !ISSET(validated, VALIDATE_OK))
 #endif
diff --git a/sudo.c b/sudo.c
index 126c1e62bf5cf08e1f9c605eb7c829bdb80b157f..8bebd53ffee0675c3650ba3af1db9c7a98531c60 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -283,8 +283,10 @@ main(argc, argv, envp)
     cmnd_status = set_cmnd(sudo_mode);
 
 #ifdef HAVE_LDAP
-    if (ld != NULL)
+    if (ld != NULL) {
        validated = sudo_ldap_check(ld, pwflag);
+       sudo_ldap_close(ld);
+    }
     /* Fallback to sudoers if we are allowed to and we aren't validated. */
     if (!def_ignore_local_sudoers && !ISSET(validated, VALIDATE_OK))
 #endif
diff --git a/sudo.h b/sudo.h
index ab1577cc9a053e7b98d7fe36c50aa872525c90ea..f04a2a0278c8e4e26521ca6b91c14c665ec033e5 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -215,6 +215,7 @@ int sudo_ldap_check __P((VOID *, int));
 void sudo_ldap_display_privs __P((void));
 void sudo_ldap_update_defaults __P((VOID *));
 VOID *sudo_ldap_open   __P((void));
+void sudo_ldap_close   __P((VOID *));
 #endif
 void set_perms         __P((int));
 void remove_timestamp  __P((int));