mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-01 10:52:17 +01:00
code cleanup
This commit is contained in:
parent
1d62bec277
commit
ff87bf0ac4
18
util.c
18
util.c
@ -293,8 +293,8 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user,
|
|||||||
int len;
|
int len;
|
||||||
int r;
|
int r;
|
||||||
int ret = AUTH_NOT_FOUND;
|
int ret = AUTH_NOT_FOUND;
|
||||||
char *userfile;
|
char *userfile = NULL;
|
||||||
char *userfile_pattern;
|
char *userfile_pattern = NULL;
|
||||||
glob_t userfile_glob;
|
glob_t userfile_glob;
|
||||||
const char *filename = NULL;
|
const char *filename = NULL;
|
||||||
|
|
||||||
@ -312,12 +312,12 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user,
|
|||||||
|
|
||||||
if (!access(userfile, F_OK)) {
|
if (!access(userfile, F_OK)) {
|
||||||
ret = AUTH_FOUND;
|
ret = AUTH_FOUND;
|
||||||
goto clean_userfile;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(userfile) + 2 + 1;
|
len = strlen(userfile) + 2 + 1;
|
||||||
if ((userfile_pattern = malloc(len)) == NULL) {
|
if ((userfile_pattern = malloc(len)) == NULL) {
|
||||||
goto clean_userfile;
|
goto out;
|
||||||
}
|
}
|
||||||
snprintf(userfile_pattern, len, "%s-*", userfile);
|
snprintf(userfile_pattern, len, "%s-*", userfile);
|
||||||
|
|
||||||
@ -326,19 +326,17 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user,
|
|||||||
switch (r) {
|
switch (r) {
|
||||||
case 0:
|
case 0:
|
||||||
ret = AUTH_FOUND;
|
ret = AUTH_FOUND;
|
||||||
goto clean_userfile_pattern;
|
goto out;
|
||||||
case GLOB_NOMATCH:
|
case GLOB_NOMATCH:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = AUTH_ERROR;
|
ret = AUTH_ERROR;
|
||||||
goto clean_userfile_pattern;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_userfile_pattern:
|
|
||||||
free(userfile_pattern);
|
|
||||||
clean_userfile:
|
|
||||||
free(userfile);
|
|
||||||
out:
|
out:
|
||||||
|
free(userfile_pattern);
|
||||||
|
free(userfile);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user