aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_ftp/pam_ftp.c
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2020-08-11 14:54:29 -0700
committerSteve Langasek <steve.langasek@canonical.com>2020-08-11 14:54:29 -0700
commitf6d08ed47a3da3c08345bce2ca366e961c52ad7c (patch)
treedcbd0efb229b17f696f7195671f05b354b4f70fc /modules/pam_ftp/pam_ftp.c
parent668b13da8f830c38388cecac45539972e80cb246 (diff)
parent9e5bea9e146dee574796259ca464ad2435be3590 (diff)
downloadpam-f6d08ed47a3da3c08345bce2ca366e961c52ad7c.tar.gz
pam-f6d08ed47a3da3c08345bce2ca366e961c52ad7c.tar.bz2
pam-f6d08ed47a3da3c08345bce2ca366e961c52ad7c.zip
New upstream version 1.4.0
Diffstat (limited to 'modules/pam_ftp/pam_ftp.c')
-rw-r--r--modules/pam_ftp/pam_ftp.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/modules/pam_ftp/pam_ftp.c b/modules/pam_ftp/pam_ftp.c
index 1c2f1456..b2c32b74 100644
--- a/modules/pam_ftp/pam_ftp.c
+++ b/modules/pam_ftp/pam_ftp.c
@@ -1,10 +1,7 @@
-/* pam_ftp module */
-
/*
- * $Id$
+ * pam_ftp module
*
* Written by Andrew Morgan <morgan@linux.kernel.org> 1996/3/11
- *
*/
#define PLEASE_ENTER_PASSWORD "Password required for %s."
@@ -23,18 +20,10 @@
#include <stdarg.h>
#include <string.h>
-/*
- * here, we make a definition for the externally accessible function
- * in this file (this definition is required for static a module
- * but strongly encouraged generally) it is used to instruct the
- * modules include file to define the function prototypes.
- */
-
-#define PAM_SM_AUTH
-
#include <security/pam_modules.h>
#include <security/_pam_macros.h>
#include <security/pam_ext.h>
+#include "pam_inline.h"
/* argument parsing */
@@ -49,18 +38,18 @@ _pam_parse(pam_handle_t *pamh, int argc, const char **argv, const char **users)
/* step through arguments */
for (ctrl=0; argc-- > 0; ++argv) {
+ const char *str;
/* generic options */
if (!strcmp(*argv,"debug"))
ctrl |= PAM_DEBUG_ARG;
- else if (!strncmp(*argv,"users=",6)) {
- *users = 6 + *argv;
- } else if (!strcmp(*argv,"ignore")) {
+ else if (!strcmp(*argv,"ignore"))
ctrl |= PAM_IGNORE_EMAIL;
- } else {
+ else if ((str = pam_str_skip_prefix(*argv, "users=")) != NULL)
+ *users = str;
+ else
pam_syslog(pamh, LOG_ERR, "unknown option: %s", *argv);
- }
}
return ctrl;
@@ -122,7 +111,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
const char *users = NULL;
/*
- * this module checks if the user name is ftp or annonymous. If
+ * this module checks if the user name is ftp or anonymous. If
* this is the case, it can set the PAM_RUSER to the entered email
* address and SUCCEEDS, otherwise it FAILS.
*/
@@ -130,8 +119,9 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
ctrl = _pam_parse(pamh, argc, argv, &users);
retval = pam_get_user(pamh, &user, NULL);
- if (retval != PAM_SUCCESS || user == NULL) {
- pam_syslog(pamh, LOG_ERR, "no user specified");
+ if (retval != PAM_SUCCESS) {
+ pam_syslog(pamh, LOG_NOTICE, "cannot determine user name: %s",
+ pam_strerror(pamh, retval));
return PAM_USER_UNKNOWN;
}
@@ -185,7 +175,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
}
}
- /* we are happy to grant annonymous access to the user */
+ /* we are happy to grant anonymous access to the user */
retval = PAM_SUCCESS;
} else {