return ret ;
}
+
+/*
+ * shut down LDAP connection
+ */
+void
+sudo_ldap_close(v)
+VOID *v;
+{
+ if (v)
+ ldap_unbind_s((LDAP *)v);
+}
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
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
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));