Set locale to system default except for during sudoers parse.

This commit is contained in:
Todd C. Miller
2008-09-13 18:09:28 +00:00
parent 65bce65551
commit 508295b1f6

10
sudo.c
View File

@@ -178,7 +178,7 @@ main(argc, argv, envp)
struct sudo_nss *nss;
#ifdef HAVE_SETLOCALE
setlocale(LC_ALL, "C");
setlocale(LC_ALL, "");
#endif
Argv = argv;
@@ -325,6 +325,10 @@ main(argc, argv, envp)
cmnd_status = set_cmnd(sudo_mode);
#ifdef HAVE_SETLOCALE
setlocale(LC_ALL, "C");
#endif
validated = FLAG_NO_USER | FLAG_NO_HOST;
tq_foreach_fwd(snl, nss) {
validated = nss->lookup(nss, validated, pwflag);
@@ -336,6 +340,10 @@ main(argc, argv, envp)
if (safe_cmnd == NULL)
safe_cmnd = estrdup(user_cmnd);
#ifdef HAVE_SETLOCALE
setlocale(LC_ALL, "");
#endif
/* If only a group was specified, set runas_pw based on invoking user. */
if (runas_pw == NULL)
set_runaspw(user_name);