summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-14 17:02:50 -0800
committerJeremy Allison <jra@samba.org>2007-12-14 17:02:50 -0800
commit3cdd8da3ca8466f19e440f0e46e52b53dae6dd45 (patch)
tree6b096b792480772bc001b27e8bd4e1125ec3eac6 /source3/smbd
parent9f2490c251991da316fb888947edf78024e5638a (diff)
downloadsamba-3cdd8da3ca8466f19e440f0e46e52b53dae6dd45.tar.gz
samba-3cdd8da3ca8466f19e440f0e46e52b53dae6dd45.tar.bz2
samba-3cdd8da3ca8466f19e440f0e46e52b53dae6dd45.zip
Fix for bug #5082 from Mathias Gug <mathiaz@ubuntu.com>, Steve Langasek <vorlon@debian.org>.
Recent versions of Linux-PAM support localization of user prompts, so Samba must use the C locale when invoking PAM (directly or via /usr/bin/passwd) to ensure that password chat values match the prompts in a locale-invariant fashion. Jeremy. (This used to be commit bc13e939546a5bcb78925a6b117e89fde20f6451)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/chgpasswd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 5a1d71d2af..58b67a58cd 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -125,6 +125,7 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass,
struct termios stermios;
gid_t gid;
uid_t uid;
+ char * const eptrs[1] = { NULL };
if (pass == NULL)
{
@@ -221,7 +222,7 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass,
passwordprogram));
/* execl() password-change application */
- if (execl("/bin/sh", "sh", "-c", passwordprogram, NULL) < 0)
+ if (execle("/bin/sh", "sh", "-c", passwordprogram, NULL, eptrs) < 0)
{
DEBUG(3, ("Bad status returned from %s\n", passwordprogram));
return (False);
@@ -518,6 +519,9 @@ bool chgpasswd(const char *name, const struct passwd *pass,
#ifdef WITH_PAM
if (lp_pam_password_change()) {
bool ret;
+#ifdef HAVE_SETLOCALE
+ const char *prevlocale = setlocale(LC_MESSAGES, "C");
+#endif
if (as_root)
become_root();
@@ -531,6 +535,10 @@ bool chgpasswd(const char *name, const struct passwd *pass,
if (as_root)
unbecome_root();
+#ifdef HAVE_SETLOCALE
+ setlocale(LC_MESSAGES, prevlocale);
+#endif
+
return ret;
}
#endif