summaryrefslogtreecommitdiffstats
path: root/source/smbd/chgpasswd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-30 21:05:58 +0000
committerJeremy Allison <jra@samba.org>2001-04-30 21:05:58 +0000
commit1648ac64a75de74d1a1575eb49cccc4f75488bfa (patch)
treefcc176107476d9dfdbc8b21406fbaa858136653c /source/smbd/chgpasswd.c
parent783728fa8c6527e1dfc4434a587d5753886ad8ec (diff)
downloadsamba-1648ac64a75de74d1a1575eb49cccc4f75488bfa.tar.gz
samba-1648ac64a75de74d1a1575eb49cccc4f75488bfa.tar.xz
samba-1648ac64a75de74d1a1575eb49cccc4f75488bfa.zip
Based on an original PAM patch by Andrew Bartlett, re-written by me to
remove global static PAM variables, and to tidy up the PAM internals code. Now looks like the rest of Samba. Still needs testing. Jeremy.
Diffstat (limited to 'source/smbd/chgpasswd.c')
-rw-r--r--source/smbd/chgpasswd.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/smbd/chgpasswd.c b/source/smbd/chgpasswd.c
index 21b77223070..72e97abc3b9 100644
--- a/source/smbd/chgpasswd.c
+++ b/source/smbd/chgpasswd.c
@@ -54,6 +54,24 @@ extern struct passdb_ops pdb_ops;
#if ALLOW_CHANGE_PASSWORD
+#ifdef WITH_PAM
+BOOL chgpasswd(char *name, char *oldpass, char *newpass, BOOL as_root)
+{
+ BOOL ret;
+
+ if (as_root)
+ become_root();
+
+ ret = smb_pam_passchange(name, oldpass, newpass);
+
+ if (as_root)
+ unbecome_root();
+
+ return ret;
+}
+
+#else /* WITH_PAM */
+
static int findpty(char **slave)
{
int master;
@@ -527,7 +545,10 @@ BOOL chgpasswd(char *name, char *oldpass, char *newpass, BOOL as_root)
(passwordprogram, name, chatsequence, as_root));
}
+#endif /* WITH_PAM */
+
#else /* ALLOW_CHANGE_PASSWORD */
+
BOOL chgpasswd(char *name, char *oldpass, char *newpass, BOOL as_root)
{
DEBUG(0, ("Password changing not compiled in (user=%s)\n", name));