mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
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 commit is contained in:
parent
56251f7852
commit
bc13e93954
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user