#unifdef HAVE_SETLOCALE, it is C89 so no need to check for it.
This commit is contained in:
@@ -294,14 +294,11 @@ sudo_conf_read(void)
|
|||||||
struct sudo_conf_table *cur;
|
struct sudo_conf_table *cur;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *cp;
|
char *cp, *prev_locale = estrdup(setlocale(LC_ALL, NULL));
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
char *prev_locale = estrdup(setlocale(LC_ALL, NULL));
|
|
||||||
|
|
||||||
/* Parse sudo.conf in the "C" locale. */
|
/* Parse sudo.conf in the "C" locale. */
|
||||||
if (prev_locale[0] != 'C' || prev_locale[1] != '\0')
|
if (prev_locale[0] != 'C' || prev_locale[1] != '\0')
|
||||||
setlocale(LC_ALL, "C");
|
setlocale(LC_ALL, "C");
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (sudo_secure_file(_PATH_SUDO_CONF, ROOT_UID, -1, &sb)) {
|
switch (sudo_secure_file(_PATH_SUDO_CONF, ROOT_UID, -1, &sb)) {
|
||||||
case SUDO_PATH_SECURE:
|
case SUDO_PATH_SECURE:
|
||||||
@@ -353,11 +350,9 @@ sudo_conf_read(void)
|
|||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
done:
|
done:
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
/* Restore locale if needed. */
|
/* Restore locale if needed. */
|
||||||
if (prev_locale[0] != 'C' || prev_locale[1] != '\0')
|
if (prev_locale[0] != 'C' || prev_locale[1] != '\0')
|
||||||
setlocale(LC_ALL, prev_locale);
|
setlocale(LC_ALL, prev_locale);
|
||||||
efree(prev_locale);
|
efree(prev_locale);
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -470,9 +470,6 @@
|
|||||||
/* Define to 1 if you have the `setkeycreatecon' function. */
|
/* Define to 1 if you have the `setkeycreatecon' function. */
|
||||||
#undef HAVE_SETKEYCREATECON
|
#undef HAVE_SETKEYCREATECON
|
||||||
|
|
||||||
/* Define to 1 if you have the `setlocale' function. */
|
|
||||||
#undef HAVE_SETLOCALE
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `setresuid' function. */
|
/* Define to 1 if you have the `setresuid' function. */
|
||||||
#undef HAVE_SETRESUID
|
#undef HAVE_SETRESUID
|
||||||
|
|
||||||
|
2
configure
vendored
2
configure
vendored
@@ -16630,7 +16630,7 @@ fi
|
|||||||
LIBS=$ac_save_LIBS
|
LIBS=$ac_save_LIBS
|
||||||
|
|
||||||
for ac_func in glob strrchr sysconf tzset strftime setenv \
|
for ac_func in glob strrchr sysconf tzset strftime setenv \
|
||||||
regcomp setlocale nl_langinfo mbr_check_membership \
|
regcomp nl_langinfo mbr_check_membership \
|
||||||
setrlimit64
|
setrlimit64
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
|
@@ -2216,7 +2216,7 @@ dnl Function checks
|
|||||||
dnl
|
dnl
|
||||||
AC_FUNC_GETGROUPS
|
AC_FUNC_GETGROUPS
|
||||||
AC_CHECK_FUNCS(glob strrchr sysconf tzset strftime setenv \
|
AC_CHECK_FUNCS(glob strrchr sysconf tzset strftime setenv \
|
||||||
regcomp setlocale nl_langinfo mbr_check_membership \
|
regcomp nl_langinfo mbr_check_membership \
|
||||||
setrlimit64)
|
setrlimit64)
|
||||||
AC_REPLACE_FUNCS(getgrouplist)
|
AC_REPLACE_FUNCS(getgrouplist)
|
||||||
AC_CHECK_FUNCS(getline, [], [
|
AC_CHECK_FUNCS(getline, [], [
|
||||||
|
@@ -21,9 +21,7 @@
|
|||||||
* Solaris locale.h includes libintl.h which causes problems when we
|
* Solaris locale.h includes libintl.h which causes problems when we
|
||||||
* redefine the gettext functions. We include it first to avoid this.
|
* redefine the gettext functions. We include it first to avoid this.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_SETLOCALE)
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBINTL_H
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
|
||||||
|
@@ -49,7 +49,6 @@ sudoers_getlocale(void)
|
|||||||
* If prevlocale is non-NULL it will be filled in with the
|
* If prevlocale is non-NULL it will be filled in with the
|
||||||
* old SUDOERS_LOCALE_* value.
|
* old SUDOERS_LOCALE_* value.
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
bool
|
bool
|
||||||
sudoers_setlocale(int newlocale, int *prevlocale)
|
sudoers_setlocale(int newlocale, int *prevlocale)
|
||||||
{
|
{
|
||||||
@@ -82,19 +81,3 @@ sudoers_setlocale(int newlocale, int *prevlocale)
|
|||||||
}
|
}
|
||||||
return res ? true : false;
|
return res ? true : false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
bool
|
|
||||||
sudoers_setlocale(int newlocale, int *prevlocale)
|
|
||||||
{
|
|
||||||
switch (newlocale) {
|
|
||||||
case SUDOERS_LOCALE_USER:
|
|
||||||
case SUDOERS_LOCALE_SUDOERS:
|
|
||||||
if (prevlocale)
|
|
||||||
*prevlocale = current_locale;
|
|
||||||
current_locale = newlocale;
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* HAVE_SETLOCALE */
|
|
||||||
|
@@ -552,9 +552,7 @@ init_vars(char * const envp[])
|
|||||||
(void) tzset(); /* set the timezone if applicable */
|
(void) tzset(); /* set the timezone if applicable */
|
||||||
#endif /* HAVE_TZSET */
|
#endif /* HAVE_TZSET */
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
user_locale = estrdup(setlocale(LC_ALL, NULL));
|
user_locale = estrdup(setlocale(LC_ALL, NULL));
|
||||||
#endif
|
|
||||||
|
|
||||||
for (ep = envp; *ep; ep++) {
|
for (ep = envp; *ep; ep++) {
|
||||||
/* XXX - don't fill in if empty string */
|
/* XXX - don't fill in if empty string */
|
||||||
|
@@ -242,7 +242,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int ch, idx, plen, exitcode = 0, rows = 0, cols = 0;
|
int ch, idx, plen, exitcode = 0, rows = 0, cols = 0;
|
||||||
bool interactive = false, listonly = false, need_nlcr = false;
|
bool interactive = false, listonly = false, need_nlcr = false;
|
||||||
const char *id, *user = NULL, *pattern = NULL, *tty = NULL, *decimal = ".";
|
const char *decimal, *id, *user = NULL, *pattern = NULL, *tty = NULL;
|
||||||
char path[PATH_MAX], buf[LINE_MAX], *cp, *ep;
|
char path[PATH_MAX], buf[LINE_MAX], *cp, *ep;
|
||||||
double seconds, to_wait, speed = 1.0, max_wait = 0;
|
double seconds, to_wait, speed = 1.0, max_wait = 0;
|
||||||
sigaction_t sa;
|
sigaction_t sa;
|
||||||
@@ -263,10 +263,8 @@ main(int argc, char *argv[])
|
|||||||
setprogname(argc > 0 ? argv[0] : "sudoreplay");
|
setprogname(argc > 0 ? argv[0] : "sudoreplay");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
decimal = localeconv()->decimal_point;
|
decimal = localeconv()->decimal_point;
|
||||||
#endif
|
|
||||||
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have sudoreplay domain */
|
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have sudoreplay domain */
|
||||||
textdomain("sudoers");
|
textdomain("sudoers");
|
||||||
|
|
||||||
|
@@ -148,9 +148,7 @@ main(int argc, char *argv[])
|
|||||||
setprogname(argc > 0 ? argv[0] : "testsudoers");
|
setprogname(argc > 0 ? argv[0] : "testsudoers");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
#endif
|
|
||||||
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have own domain */
|
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have own domain */
|
||||||
textdomain("sudoers");
|
textdomain("sudoers");
|
||||||
|
|
||||||
|
@@ -161,9 +161,7 @@ main(int argc, char *argv[])
|
|||||||
setprogname(argc > 0 ? argv[0] : "visudo");
|
setprogname(argc > 0 ? argv[0] : "visudo");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
#endif
|
|
||||||
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */
|
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */
|
||||||
textdomain("sudoers");
|
textdomain("sudoers");
|
||||||
|
|
||||||
|
@@ -105,13 +105,11 @@ static void
|
|||||||
_warning(int use_errno, const char *fmt, va_list ap)
|
_warning(int use_errno, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
int serrno = errno;
|
int serrno = errno;
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
char *prev_locale = estrdup(setlocale(LC_ALL, NULL));
|
char *prev_locale = estrdup(setlocale(LC_ALL, NULL));
|
||||||
|
|
||||||
/* Set locale to user's if different. */
|
/* Set locale to user's if different. */
|
||||||
if (*prev_locale != '\0')
|
if (*prev_locale != '\0')
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
#endif
|
|
||||||
|
|
||||||
fputs(getprogname(), stderr);
|
fputs(getprogname(), stderr);
|
||||||
if (fmt != NULL) {
|
if (fmt != NULL) {
|
||||||
@@ -124,10 +122,8 @@ _warning(int use_errno, const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
/* Restore locale if needed. */
|
/* Restore locale if needed. */
|
||||||
if (*prev_locale != '\0')
|
if (*prev_locale != '\0')
|
||||||
setlocale(LC_ALL, prev_locale);
|
setlocale(LC_ALL, prev_locale);
|
||||||
efree(prev_locale);
|
efree(prev_locale);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@@ -346,13 +346,11 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
|
|||||||
if (ISSET(details->flags, CD_SET_TIMEOUT))
|
if (ISSET(details->flags, CD_SET_TIMEOUT))
|
||||||
alarm(details->timeout);
|
alarm(details->timeout);
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
/*
|
/*
|
||||||
* I/O logging must be in the C locale for floating point numbers
|
* I/O logging must be in the C locale for floating point numbers
|
||||||
* to be logged consistently.
|
* to be logged consistently.
|
||||||
*/
|
*/
|
||||||
setlocale(LC_ALL, "C");
|
setlocale(LC_ALL, "C");
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In the event loop we pass input from user tty to master
|
* In the event loop we pass input from user tty to master
|
||||||
|
@@ -60,9 +60,7 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
int noexec = 0;
|
int noexec = 0;
|
||||||
debug_decl(main, SUDO_DEBUG_MAIN)
|
debug_decl(main, SUDO_DEBUG_MAIN)
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
#endif
|
|
||||||
bindtextdomain(PACKAGE_NAME, LOCALEDIR);
|
bindtextdomain(PACKAGE_NAME, LOCALEDIR);
|
||||||
textdomain(PACKAGE_NAME);
|
textdomain(PACKAGE_NAME);
|
||||||
|
|
||||||
|
@@ -153,9 +153,7 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
|
|
||||||
os_init(argc, argv, envp);
|
os_init(argc, argv, envp);
|
||||||
|
|
||||||
#ifdef HAVE_SETLOCALE
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
#endif
|
|
||||||
bindtextdomain(PACKAGE_NAME, LOCALEDIR);
|
bindtextdomain(PACKAGE_NAME, LOCALEDIR);
|
||||||
textdomain(PACKAGE_NAME);
|
textdomain(PACKAGE_NAME);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user