diff options
author | Steve Langasek <vorlon@debian.org> | 2019-02-11 16:13:42 -0800 |
---|---|---|
committer | Steve Langasek <vorlon@debian.org> | 2019-02-12 06:07:57 +0000 |
commit | 668b13da8f830c38388cecac45539972e80cb246 (patch) | |
tree | ba3a4e02ed5ec62fe645dfa810c01d26decf591f /modules/pam_ftp | |
parent | f00afb1ef201b2eef7f9ddbe5a0c6ca802cf49bb (diff) | |
parent | 3b77a78d575b8ab56bb0e828499df328d55c925f (diff) |
New upstream version 1.3.1
Diffstat (limited to 'modules/pam_ftp')
-rw-r--r-- | modules/pam_ftp/pam_ftp.8 | 4 | ||||
-rw-r--r-- | modules/pam_ftp/pam_ftp.c | 21 |
2 files changed, 14 insertions, 11 deletions
diff --git a/modules/pam_ftp/pam_ftp.8 b/modules/pam_ftp/pam_ftp.8 index 6561985c..1d5c9b7b 100644 --- a/modules/pam_ftp/pam_ftp.8 +++ b/modules/pam_ftp/pam_ftp.8 @@ -2,12 +2,12 @@ .\" Title: pam_ftp .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> -.\" Date: 04/01/2016 +.\" Date: 05/18/2017 .\" Manual: Linux-PAM Manual .\" Source: Linux-PAM Manual .\" Language: English .\" -.TH "PAM_FTP" "8" "04/01/2016" "Linux-PAM Manual" "Linux\-PAM Manual" +.TH "PAM_FTP" "8" "05/18/2017" "Linux-PAM Manual" "Linux\-PAM Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/modules/pam_ftp/pam_ftp.c b/modules/pam_ftp/pam_ftp.c index 6b6cf2a0..1c2f1456 100644 --- a/modules/pam_ftp/pam_ftp.c +++ b/modules/pam_ftp/pam_ftp.c @@ -71,11 +71,10 @@ _pam_parse(pam_handle_t *pamh, int argc, const char **argv, const char **users) * return 1 if listed 0 if not. */ -static int lookup(const char *name, const char *list, const char **_user) +static int lookup(const char *name, const char *list, char **_user) { int anon = 0; - *_user = name; /* this is the default */ if (list && *list) { const char *l; char *list_copy, *x; @@ -86,12 +85,14 @@ static int lookup(const char *name, const char *list, const char **_user) while (list_copy && (l = strtok_r(x, ",", &sptr))) { x = NULL; if (!strcmp(name, l)) { - *_user = list; + *_user = list_copy; anon = 1; + break; } } - _pam_overwrite(list_copy); - _pam_drop(list_copy); + if (*_user != list_copy) { + free(list_copy); + } } else { #define MAX_L 2 static const char *l[MAX_L] = { "ftp", "anonymous" }; @@ -99,7 +100,7 @@ static int lookup(const char *name, const char *list, const char **_user) for (i=0; i<MAX_L; ++i) { if (!strcmp(l[i], name)) { - *_user = l[0]; + *_user = strdup(l[0]); anon = 1; break; } @@ -117,6 +118,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, { int retval, anon=0, ctrl; const char *user; + char *anon_user = NULL; const char *users = NULL; /* @@ -134,15 +136,16 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, } if (!(ctrl & PAM_NO_ANON)) { - anon = lookup(user, users, &user); + anon = lookup(user, users, &anon_user); } if (anon) { - retval = pam_set_item(pamh, PAM_USER, (const void *)user); - if (retval != PAM_SUCCESS || user == NULL) { + retval = pam_set_item(pamh, PAM_USER, (const void *)anon_user); + if (retval != PAM_SUCCESS || anon_user == NULL) { pam_syslog(pamh, LOG_ERR, "user resetting failed"); return PAM_USER_UNKNOWN; } + free(anon_user); } /* |