summaryrefslogtreecommitdiffstats
path: root/lib/libpam
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-04-06 14:25:04 +0000
committerdes <des@FreeBSD.org>2002-04-06 14:25:04 +0000
commit78c249929bf102f61ece19425919eacd5590fcb6 (patch)
tree97b174f4a4526c3f4f9bddba83030456674b46b0 /lib/libpam
parent72f2fe98d8cd528ca29863e20352e9f3038b4123 (diff)
downloadFreeBSD-src-78c249929bf102f61ece19425919eacd5590fcb6.zip
FreeBSD-src-78c249929bf102f61ece19425919eacd5590fcb6.tar.gz
Fix some style issues, a const warning, and abuse of PAM_ABORT.
Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'lib/libpam')
-rw-r--r--lib/libpam/modules/pam_unix/pam_unix.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/libpam/modules/pam_unix/pam_unix.c b/lib/libpam/modules/pam_unix/pam_unix.c
index 7b49ec4..09910a6 100644
--- a/lib/libpam/modules/pam_unix/pam_unix.c
+++ b/lib/libpam/modules/pam_unix/pam_unix.c
@@ -377,7 +377,7 @@ pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
struct passwd *pwd;
int retval, retry, res, got;
const char *user, *pass;
- char *new_pass, *new_pass_, *encrypted;
+ char *new_pass, *new_pass_, *encrypted, *usrdup;
pam_std_option(&options, other_options, argc, argv);
@@ -487,7 +487,10 @@ pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
#ifdef YP
/* If NIS is set in the passwd database, use it */
- res = use_yp(user, 0, 0);
+ if ((usrdup = strdup(user)) == NULL)
+ PAM_RETURN(PAM_BUF_ERR);
+ res = use_yp(usrdup, 0, 0);
+ free(usrdup);
if (res == USER_YP_ONLY) {
if (!pam_test_option(&options, PAM_OPT_LOCAL_PASS,
NULL))
@@ -516,7 +519,7 @@ pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
retval = local_passwd(user, new_pass);
}
else
- retval = PAM_ABORT; /* Bad juju */
+ retval = PAM_SERVICE_ERR; /* Bad juju */
#else
retval = local_passwd(user, new_pass);
#endif
@@ -559,7 +562,7 @@ local_passwd(const char *user, const char *pass)
pwd = getpwnam(user);
if (pwd == NULL)
- return(PAM_ABORT); /* Really bad things */
+ return(PAM_SERVICE_ERR); /* Really bad things */
#ifdef YP
pwd = (struct passwd *)&local_password;
@@ -583,7 +586,7 @@ local_passwd(const char *user, const char *pass)
if (!pw_mkdb(user))
pw_error((char *)NULL, 0, 1);
- return PAM_SUCCESS;
+ return (PAM_SUCCESS);
}
#ifdef YP
@@ -614,7 +617,7 @@ yp_passwd(const char *user __unused, const char *pass)
master = get_yp_master(1);
if (master == NULL)
- return PAM_ABORT; /* Major disaster */
+ return (PAM_SERVICE_ERR); /* Major disaster */
/*
* It is presumed that by the time we get here, use_yp()
@@ -671,7 +674,7 @@ yp_passwd(const char *user __unused, const char *pass)
syslog(LOG_ERR,
"Cannot contact rpc.yppasswdd on host %s: %s",
master, clnt_spcreateerror(""));
- return PAM_ABORT;
+ return (PAM_SERVICE_ERR);
}
}
else {
@@ -680,7 +683,7 @@ yp_passwd(const char *user __unused, const char *pass)
syslog(LOG_ERR,
"Cannot contact rpc.yppasswdd on host %s: %s",
master, clnt_spcreateerror(""));
- return PAM_ABORT;
+ return (PAM_SERVICE_ERR);
}
}
/*
@@ -702,10 +705,11 @@ yp_passwd(const char *user __unused, const char *pass)
clnt_destroy(clnt);
if (err.re_status != RPC_SUCCESS || status == NULL || *status)
- return PAM_ABORT;
+ return (PAM_SERVICE_ERR);
- return (err.re_status || status == NULL || *status)
- ? PAM_ABORT : PAM_SUCCESS;
+ if (err.re_status || status == NULL || *status)
+ return (PAM_SERVICE_ERR);
+ return (PAM_SUCCESS);
}
#endif /* YP */
OpenPOWER on IntegriCloud