mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-04 16:25:25 +00:00
add sudo_ldap_close
This commit is contained in:
11
ldap.c
11
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);
|
||||
}
|
||||
|
@@ -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
|
||||
|
4
sudo.c
4
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
|
||||
|
1
sudo.h
1
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));
|
||||
|
Reference in New Issue
Block a user