mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-01-20 10:52:16 +01:00
clear check_user_challenge_file
This commit is contained in:
parent
ff87bf0ac4
commit
d3f50c43ac
13
util.c
13
util.c
@ -290,7 +290,7 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user,
|
||||
*
|
||||
* Returns one of AUTH_FOUND, AUTH_NOT_FOUND, AUTH_ERROR
|
||||
*/
|
||||
int len;
|
||||
size_t len;
|
||||
int r;
|
||||
int ret = AUTH_NOT_FOUND;
|
||||
char *userfile = NULL;
|
||||
@ -304,8 +304,10 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user,
|
||||
filename = user->pw_name;
|
||||
}
|
||||
|
||||
/* check for userfile challenge files */
|
||||
r = get_user_cfgfile_path(chalresp_path, filename, user, &userfile);
|
||||
if (!r) {
|
||||
D (debug_file, "Failed to get user cfgfile path");
|
||||
ret = AUTH_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@ -315,8 +317,11 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user,
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* check for userfile-* challenge files */
|
||||
len = strlen(userfile) + 2 + 1;
|
||||
if ((userfile_pattern = malloc(len)) == NULL) {
|
||||
D (debug_file, "Failed to allocate memory for userfile pattern: %s", strerror(errno));
|
||||
ret = AUTH_ERROR;
|
||||
goto out;
|
||||
}
|
||||
snprintf(userfile_pattern, len, "%s-*", userfile);
|
||||
@ -324,12 +329,14 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user,
|
||||
r = glob(userfile_pattern, 0, NULL, &userfile_glob);
|
||||
globfree(&userfile_glob);
|
||||
switch (r) {
|
||||
case GLOB_NOMATCH:
|
||||
/* No matches found, so continue */
|
||||
break;
|
||||
case 0:
|
||||
ret = AUTH_FOUND;
|
||||
goto out;
|
||||
case GLOB_NOMATCH:
|
||||
break;
|
||||
default:
|
||||
D (debug_file, "Error while checking for %s challenge files: %s", userfile_pattern, strerror(errno));
|
||||
ret = AUTH_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user