diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2024-01-03 18:28:06 +0100 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2024-01-03 17:28:06 +0000 |
commit | 9893308eb4be8baadf94c347eaf04610018d9223 (patch) | |
tree | 4f377747fbf07bf41bf52d5b322e6c6f196d8976 /modules/pam_listfile | |
parent | 73d009e9ea8edafc18c7fe3650b25dd6bdce88c1 (diff) | |
download | pam-9893308eb4be8baadf94c347eaf04610018d9223.tar.gz pam-9893308eb4be8baadf94c347eaf04610018d9223.tar.bz2 pam-9893308eb4be8baadf94c347eaf04610018d9223.zip |
pam_listfile: use getline
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'modules/pam_listfile')
-rw-r--r-- | modules/pam_listfile/pam_listfile.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/pam_listfile/pam_listfile.c b/modules/pam_listfile/pam_listfile.c index 6c86d199..f8abc35a 100644 --- a/modules/pam_listfile/pam_listfile.c +++ b/modules/pam_listfile/pam_listfile.c @@ -52,11 +52,12 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, const void *void_citemp; const char *citemp; const char *ifname=NULL; - char aline[256]; + char *aline=NULL; const char *apply_val; struct stat fileinfo; FILE *inf; int apply_type; + size_t n=0; /* Stuff for "extended" items */ struct passwd *userinfo; @@ -280,8 +281,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, assert(PAM_SUCCESS == 0); assert(PAM_AUTH_ERR != 0); #endif - while((fgets(aline,sizeof(aline),inf) != NULL) - && retval) { + while(getline(&aline,&n,inf) != -1 && retval) { const char *a = aline; if(strlen(aline) == 0) @@ -305,6 +305,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, } } + free(aline); fclose(inf); if ((sense && retval) || (!sense && !retval)) { #ifdef PAM_DEBUG |