summaryrefslogtreecommitdiff
path: root/modules/pam_ftp
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2005-10-04 11:35:18 +0000
committerDmitry V. Levin <ldv@altlinux.org>2005-10-04 11:35:18 +0000
commit447b7fc84b8a47884d758fa5145b1bbfb043d466 (patch)
tree7a23ae0ae278b223ee4b442afd4621b3cccf5c49 /modules/pam_ftp
parent21ee1936c230da8c2304cc366c79c4f3ab20b0d9 (diff)
2005-10-02 Dmitry V. Levin <ldv@altlinux.org>
Steve Langasek <vorlon@debian.org> Cleanup gratuitous use of strdup(). Fix "missing argument" checks. * modules/pam_env/pam_env.c (_pam_parse): Add const qualifier to conffile and envfile arguments. Do not use x_strdup() for conffile and envfile initialization. Fix "missing argument" checks. (_parse_config_file): Take conffile argument of type "const char *" instead of "char **". Do not free conffile. (_parse_env_file): Take env_file argument of type "const char *" instead of "char **". Do not free env_file. (pam_sm_setcred): Add const qualifier to conf_file and env_file. Pass conf_file and env_file to _parse_config_file() and _parse_env_file() by value. (pam_sm_open_session): Likewise. * modules/pam_ftp/pam_ftp.c (_pam_parse): Add const qualifier to users argument. Do not use x_strdup() for users initialization. (lookup): Add const qualifier to list argument. (pam_sm_authenticate): Add const qualifier to users argument. * modules/pam_mail/pam_mail.c (_pam_parse): Add const qualifier to maildir argument. Do not use x_strdup() for maildir initialization. Fix "missing argument" check. (get_folder): Take path_mail argument of type "const char *" instead of "char **". Do not free path_mail. (_do_mail): Add const qualifier to path_mail argument. Pass path_mail to get_folder() by value. * modules/pam_motd/pam_motd.c: Include <syslog.h>. (pam_sm_open_session): Add const qualifier to motd_path. Do not use x_strdup() for motd_path initialization. Do not free motd_path. Fix "missing argument" check. Add "unknown option" warning. * modules/pam_userdb/pam_userdb.c (_pam_parse): Add const qualifier to database and cryptmode arguments. Fix "missing argument" checks. (pam_sm_authenticate): Add const qualifier to database and cryptmode. (pam_sm_acct_mgmt): Likewise.
Diffstat (limited to 'modules/pam_ftp')
-rw-r--r--modules/pam_ftp/pam_ftp.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/modules/pam_ftp/pam_ftp.c b/modules/pam_ftp/pam_ftp.c
index 37056767..4f4231c2 100644
--- a/modules/pam_ftp/pam_ftp.c
+++ b/modules/pam_ftp/pam_ftp.c
@@ -43,7 +43,7 @@
#define PAM_NO_ANON 04
static int
-_pam_parse(pam_handle_t *pamh, int argc, const char **argv, char **users)
+_pam_parse(pam_handle_t *pamh, int argc, const char **argv, const char **users)
{
int ctrl=0;
@@ -55,12 +55,7 @@ _pam_parse(pam_handle_t *pamh, int argc, const char **argv, char **users)
if (!strcmp(*argv,"debug"))
ctrl |= PAM_DEBUG_ARG;
else if (!strncmp(*argv,"users=",6)) {
- *users = x_strdup(6+*argv);
- if (*users == NULL) {
- ctrl |= PAM_NO_ANON;
- pam_syslog(pamh, LOG_CRIT,
- "failed to duplicate user list - anon off");
- }
+ *users = 6 + *argv;
} else if (!strcmp(*argv,"ignore")) {
ctrl |= PAM_IGNORE_EMAIL;
} else {
@@ -76,23 +71,26 @@ _pam_parse(pam_handle_t *pamh, int argc, const char **argv, char **users)
* return 1 if listed 0 if not.
*/
-static int lookup(const char *name, char *list, const char **_user)
+static int lookup(const char *name, const char *list, const char **_user)
{
int anon = 0;
*_user = name; /* this is the default */
- if (list) {
+ if (list && *list) {
const char *l;
- char *x;
+ char *list_copy, *x;
- x = list;
- while ((l = strtok(x, ","))) {
+ list_copy = x_strdup(list);
+ x = list_copy;
+ while (list_copy && (l = strtok(x, ","))) {
x = NULL;
if (!strcmp(name, l)) {
*_user = list;
anon = 1;
}
}
+ _pam_overwrite(list_copy);
+ _pam_drop(list_copy);
} else {
#define MAX_L 2
static const char *l[MAX_L] = { "ftp", "anonymous" };
@@ -118,7 +116,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
{
int retval, anon=0, ctrl;
const char *user;
- char *users=NULL;
+ const char *users = NULL;
/*
* this module checks if the user name is ftp or annonymous. If