1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-02-01 10:52:17 +01:00

Add test for LDAP entries with empty token list

This commit is contained in:
Mickaël Thomas 2017-02-26 20:38:33 +01:00
parent fc3b1e0076
commit d048a4a6e2
2 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,7 @@ use constant RESULT_OK => {
my %objects = (
'base=uid=foo,ou=users,dc=example,dc=com' => {keys => ['vvincredible']},
'base=uid=test,ou=users,dc=example,dc=com' => {keys => ['cccccccfhcbe', 'ccccccbchvth']},
'base=uid=nokeys,ou=users,dc=example,dc=com' => {keys => []},
'sub:base=:(uid=test)' => {keys => ['cccccccfhcbe', 'ccccccbchvth'], dn => 'uid=test,out=users,dc=example,dc=com'},
);

View File

@ -66,6 +66,7 @@ static struct data {
{"test", "ccccccbchvthlivuitriujjifivbvtrjkjfirllluurj"},
{"foo", ""},
{"bar", ""},
{"nokeys", ""},
};
@ -274,6 +275,10 @@ static int test_authenticate_ldap5(void) {
return pam_sm_authenticate(6, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}
static int test_authenticate_ldap6(void) {
return pam_sm_authenticate(7, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}
static pid_t run_mock(const char *port, const char *type) {
pid_t pid = fork();
if(pid == 0) {
@ -354,6 +359,10 @@ int main(void) {
ret = 1007;
goto out;
}
if(test_authenticate_ldap6() != PAM_USER_UNKNOWN) {
ret = 1008;
goto out;
}
#endif
out: