mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-03-21 13:29:37 +01:00
Don't segfault on unset LDAP parameters.
When ldapserver / ldap_uri was specified, but not for example user_attr, authorize_user_token_ldap() used to cause a segmentation fault.
This commit is contained in:
parent
01897ebb9e
commit
bfd8efd682
13
pam_yubico.c
13
pam_yubico.c
@ -230,6 +230,19 @@ authorize_user_token_ldap (const char *ldap_uri,
|
||||
struct berval **vals;
|
||||
int i, rc;
|
||||
|
||||
if (user_attr == NULL) {
|
||||
D (("Trying to look up user to YubiKey mapping in LDAP, but user_attr not set!"));
|
||||
return 0;
|
||||
}
|
||||
if (yubi_attr == NULL) {
|
||||
D (("Trying to look up user to YubiKey mapping in LDAP, but yubi_attr not set!"));
|
||||
return 0;
|
||||
}
|
||||
if (ldapdn == NULL) {
|
||||
D (("Trying to look up user to YubiKey mapping in LDAP, but ldapdn not set!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Allocation of memory for search strings depending on input size */
|
||||
char *find = malloc((strlen(user_attr)+strlen(ldapdn)+strlen(user)+3)*sizeof(char));
|
||||
char *sr = malloc((strlen(yubi_attr)+4)*sizeof(char));
|
||||
|
Loading…
x
Reference in New Issue
Block a user