mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-01-18 22:52:11 +01:00
add a second successful ldap test
with two valid yubiKeyId
This commit is contained in:
parent
c2eec8d69a
commit
c5489c93c5
@ -43,7 +43,8 @@ use constant RESULT_OK => {
|
||||
};
|
||||
|
||||
my %objects = (
|
||||
'uid=foo,ou=users,dc=example,dc=com' => 'vvincredible',
|
||||
'uid=foo,ou=users,dc=example,dc=com' => ['vvincredible'],
|
||||
'uid=test,ou=users,dc=example,dc=com' =>['cccccccfhcbe', 'ccccccbchvth'],
|
||||
);
|
||||
|
||||
sub bind {
|
||||
@ -62,7 +63,7 @@ sub search {
|
||||
my $entry = Net::LDAP::Entry->new;
|
||||
$entry->dn($base);
|
||||
$entry->add(objectClass => [ "person" ]);
|
||||
$entry->add(yubiKeyId => [ $id ]);
|
||||
$entry->add(yubiKeyId => $id);
|
||||
push @entries, $entry;
|
||||
}
|
||||
return RESULT_OK, @entries;
|
||||
|
@ -35,6 +35,7 @@ use warnings;
|
||||
my %otps = (
|
||||
'vvincredibletrerdegkkrkkneieultcjdghrejjbckh' => 'OK',
|
||||
'vvincrediblltrerdegkkrkkneieultcjdghrejjbckh' => 'OK',
|
||||
'ccccccbchvthlivuitriujjifivbvtrjkjfirllluurj' => 'OK',
|
||||
);
|
||||
|
||||
my $port = shift;
|
||||
|
@ -51,6 +51,7 @@ static struct data {
|
||||
{"bar", "vvincredibletrerdegkkrkkneieultcjdghrejjbckh"},
|
||||
{"foo", "vvincrediblltrerdegkkrkkneieultcjdghrejjbckh"},
|
||||
{"foo", "vvincredibletrerdegkkrkkneieultcjdghrejjbckl"},
|
||||
{"test", "ccccccbchvthlivuitriujjifivbvtrjkjfirllluurj"},
|
||||
};
|
||||
|
||||
|
||||
@ -192,6 +193,10 @@ static int test_authenticate_ldap_fail2(void) {
|
||||
return pam_sm_authenticate(2, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
|
||||
}
|
||||
|
||||
static int test_authenticate_ldap2(void) {
|
||||
return pam_sm_authenticate(4, 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) {
|
||||
@ -245,6 +250,10 @@ int main(void) {
|
||||
ret = 8;
|
||||
goto out;
|
||||
}
|
||||
if(test_authenticate_ldap2() != PAM_SUCCESS) {
|
||||
ret = 9;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
out:
|
||||
|
Loading…
x
Reference in New Issue
Block a user