/[smeserver]/rpms/sudo/sme9/sudo-1.8.6p3-sudoerslocale.patch
ViewVC logotype

Contents of /rpms/sudo/sme9/sudo-1.8.6p3-sudoerslocale.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Feb 4 19:44:45 2021 UTC (3 years, 9 months ago) by jpp
Branch: MAIN
CVS Tags: sudo-1_8_6p3-30_el6_sme, sudo-1_8_6p3-29_el6_9, HEAD
Error occurred while calculating annotation data.
Sudo

1 diff -up ./plugins/sudoers/sudoers.c.sudoerslocale ./plugins/sudoers/sudoers.c
2 --- ./plugins/sudoers/sudoers.c.sudoerslocale 2016-10-06 18:02:34.926199094 +0200
3 +++ ./plugins/sudoers/sudoers.c 2016-10-06 18:05:09.660837351 +0200
4 @@ -146,6 +146,7 @@ sudoers_policy_open(unsigned int version
5 sigaction_t sa;
6 struct sudo_nss *nss;
7 struct sudo_nss *nss_next;
8 + char *oldlocale;
9 debug_decl(sudoers_policy_open, SUDO_DEBUG_PLUGIN)
10
11 sudo_version = version;
12 @@ -201,7 +202,17 @@ sudoers_policy_open(unsigned int version
13 set_perms(PERM_INITIAL);
14 set_perms(PERM_ROOT);
15
16 - /* Open and parse sudoers, set global defaults */
17 + /*
18 + * Open and parse sudoers, set global defaults.
19 + * Uses the C locale unless another is specified in sudoers.
20 + */
21 +#ifdef HAVE_SETLOCALE
22 + if (!(oldlocale = setlocale(LC_ALL, def_sudoers_locale))) {
23 + warningx(_("unable to set locale to \"%s\", using \"C\""), def_sudoers_locale);
24 + setlocale(LC_ALL, "C");
25 + }
26 +#endif
27 +
28 for (nss = snl->first; nss != NULL; nss = nss_next) {
29 nss_next = nss->next;
30 if (nss->open(nss) == 0 && nss->parse(nss) == 0) {
31 @@ -250,6 +261,15 @@ sudoers_policy_open(unsigned int version
32
33 restore_perms();
34
35 + /* Restore user's locale. */
36 +#ifdef HAVE_SETLOCALE
37 + if (oldlocale)
38 + setlocale(LC_ALL, oldlocale);
39 + else
40 + warningx(_("unable to restore user's locale, the C locale remains"));
41 +#endif
42 +
43 +
44 debug_return_bool(true);
45 }
46

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed