2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-03 15:55:40 +00:00

add sudo_ldap_close

This commit is contained in:
Todd C. Miller
2004-12-03 18:57:48 +00:00
parent 7d488657f0
commit 1936aeb299
4 changed files with 16 additions and 1 deletions

11
ldap.c
View File

@@ -979,3 +979,14 @@ int pwflag;
return ret ; return ret ;
} }
/*
* shut down LDAP connection
*/
void
sudo_ldap_close(v)
VOID *v;
{
if (v)
ldap_unbind_s((LDAP *)v);
}

View File

@@ -879,6 +879,7 @@ check_execv(fd, pid, seqnr, askp, cookie, policyp, errorp)
if ((ld = sudo_ldap_open()) != NULL) { if ((ld = sudo_ldap_open()) != NULL) {
sudo_ldap_update_defaults(ld); sudo_ldap_update_defaults(ld);
validated = sudo_ldap_check(ld, 0); validated = sudo_ldap_check(ld, 0);
sudo_ldap_close(ld);
} }
if (!def_ignore_local_sudoers && !ISSET(validated, VALIDATE_OK)) if (!def_ignore_local_sudoers && !ISSET(validated, VALIDATE_OK))
#endif #endif

4
sudo.c
View File

@@ -283,8 +283,10 @@ main(argc, argv, envp)
cmnd_status = set_cmnd(sudo_mode); cmnd_status = set_cmnd(sudo_mode);
#ifdef HAVE_LDAP #ifdef HAVE_LDAP
if (ld != NULL) if (ld != NULL) {
validated = sudo_ldap_check(ld, pwflag); validated = sudo_ldap_check(ld, pwflag);
sudo_ldap_close(ld);
}
/* Fallback to sudoers if we are allowed to and we aren't validated. */ /* Fallback to sudoers if we are allowed to and we aren't validated. */
if (!def_ignore_local_sudoers && !ISSET(validated, VALIDATE_OK)) if (!def_ignore_local_sudoers && !ISSET(validated, VALIDATE_OK))
#endif #endif

1
sudo.h
View File

@@ -215,6 +215,7 @@ int sudo_ldap_check __P((VOID *, int));
void sudo_ldap_display_privs __P((void)); void sudo_ldap_display_privs __P((void));
void sudo_ldap_update_defaults __P((VOID *)); void sudo_ldap_update_defaults __P((VOID *));
VOID *sudo_ldap_open __P((void)); VOID *sudo_ldap_open __P((void));
void sudo_ldap_close __P((VOID *));
#endif #endif
void set_perms __P((int)); void set_perms __P((int));
void remove_timestamp __P((int)); void remove_timestamp __P((int));