2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Set the warn/fatal locale helper function in sudoers_policy_init()

so warning messages during sudoers loading are displayed in the
user's own locale.
This commit is contained in:
Todd C. Miller
2016-07-20 15:52:32 -06:00
parent b5c2ca2fe5
commit e257f2c9e3

View File

@@ -187,6 +187,7 @@ sudoers_policy_init(void *info, char * const envp[])
* Uses the C locale unless another is specified in sudoers.
*/
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
sudo_warn_set_locale_func(sudoers_warn_setlocale);
TAILQ_FOREACH_SAFE(nss, snl, entries, nss_next) {
if (nss->open(nss) == 0 && nss->parse(nss) == 0) {
sources++;
@@ -246,6 +247,7 @@ cleanup:
rval = -1;
/* Restore user's locale. */
sudo_warn_set_locale_func(NULL);
sudoers_setlocale(oldlocale, NULL);
debug_return_int(rval);