Add calls to bindtextdomain() and textdomain()
Currently there are two domains, one for the sudo front-end and one for the sudoers plugin and its associated utilities.
This commit is contained in:
7
configure
vendored
7
configure
vendored
@@ -680,6 +680,7 @@ password_timeout
|
|||||||
timeout
|
timeout
|
||||||
timedir
|
timedir
|
||||||
iolog_dir
|
iolog_dir
|
||||||
|
LIBINTL
|
||||||
LT_STATIC
|
LT_STATIC
|
||||||
LIBDL
|
LIBDL
|
||||||
CONFIGURE_ARGS
|
CONFIGURE_ARGS
|
||||||
@@ -2841,6 +2842,7 @@ $as_echo "$as_me: Configuring Sudo version $PACKAGE_VERSION" >&6;}
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2898,6 +2900,7 @@ LDAP="#"
|
|||||||
BAMAN=0
|
BAMAN=0
|
||||||
LCMAN=0
|
LCMAN=0
|
||||||
SEMAN=0
|
SEMAN=0
|
||||||
|
LIBINTL=
|
||||||
ZLIB=
|
ZLIB=
|
||||||
ZLIB_SRC=
|
ZLIB_SRC=
|
||||||
AUTH_OBJS=
|
AUTH_OBJS=
|
||||||
@@ -16781,7 +16784,7 @@ fi
|
|||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_gettext" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_gettext" >&5
|
||||||
$as_echo "$ac_cv_lib_intl_gettext" >&6; }
|
$as_echo "$ac_cv_lib_intl_gettext" >&6; }
|
||||||
if test "x$ac_cv_lib_intl_gettext" = x""yes; then :
|
if test "x$ac_cv_lib_intl_gettext" = x""yes; then :
|
||||||
LIBS="${LIBS} -lintl"
|
LIBINTL="-lintl"
|
||||||
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -16823,7 +16826,7 @@ fi
|
|||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_gettext_liconv" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_gettext_liconv" >&5
|
||||||
$as_echo "$ac_cv_lib_intl_gettext_liconv" >&6; }
|
$as_echo "$ac_cv_lib_intl_gettext_liconv" >&6; }
|
||||||
if test "x$ac_cv_lib_intl_gettext_liconv" = x""yes; then :
|
if test "x$ac_cv_lib_intl_gettext_liconv" = x""yes; then :
|
||||||
LIBS="${LIBS} -lintl -liconv"
|
LIBINTL="-lintl -liconv"
|
||||||
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@@ -64,6 +64,7 @@ AC_SUBST([ac_config_libobj_dir])
|
|||||||
AC_SUBST([CONFIGURE_ARGS])
|
AC_SUBST([CONFIGURE_ARGS])
|
||||||
AC_SUBST([LIBDL])
|
AC_SUBST([LIBDL])
|
||||||
AC_SUBST([LT_STATIC])
|
AC_SUBST([LT_STATIC])
|
||||||
|
AC_SUBST([LIBINTL])
|
||||||
dnl
|
dnl
|
||||||
dnl Variables that get substituted in docs (not overridden by environment)
|
dnl Variables that get substituted in docs (not overridden by environment)
|
||||||
dnl
|
dnl
|
||||||
@@ -161,6 +162,7 @@ LDAP="#"
|
|||||||
BAMAN=0
|
BAMAN=0
|
||||||
LCMAN=0
|
LCMAN=0
|
||||||
SEMAN=0
|
SEMAN=0
|
||||||
|
LIBINTL=
|
||||||
ZLIB=
|
ZLIB=
|
||||||
ZLIB_SRC=
|
ZLIB_SRC=
|
||||||
AUTH_OBJS=
|
AUTH_OBJS=
|
||||||
@@ -2163,10 +2165,10 @@ if test "$enable_nls" = "yes"; then
|
|||||||
AC_DEFINE(HAVE_LIBINTL_H)
|
AC_DEFINE(HAVE_LIBINTL_H)
|
||||||
else
|
else
|
||||||
AC_CHECK_LIB(intl, gettext,
|
AC_CHECK_LIB(intl, gettext,
|
||||||
[LIBS="${LIBS} -lintl"]
|
[LIBINTL="-lintl"]
|
||||||
[AC_DEFINE(HAVE_LIBINTL_H)],
|
[AC_DEFINE(HAVE_LIBINTL_H)],
|
||||||
[
|
[
|
||||||
AC_CHECK_LIB(intl, gettext, [LIBS="${LIBS} -lintl -liconv"]
|
AC_CHECK_LIB(intl, gettext, [LIBINTL="-lintl -liconv"]
|
||||||
AC_DEFINE(HAVE_LIBINTL_H), [], [-liconv])
|
AC_DEFINE(HAVE_LIBINTL_H), [], [-liconv])
|
||||||
])
|
])
|
||||||
fi
|
fi
|
||||||
|
@@ -43,7 +43,7 @@ YACC = @YACC@
|
|||||||
INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
|
INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
LIBS = $(top_builddir)/common/libcommon.la $(top_builddir)/@ac_config_libobj_dir@/libreplace.la
|
LIBS = $(top_builddir)/common/libcommon.la $(top_builddir)/@ac_config_libobj_dir@/libreplace.la @LIBINTL@
|
||||||
NET_LIBS = @NET_LIBS@
|
NET_LIBS = @NET_LIBS@
|
||||||
SUDOERS_LIBS = @SUDOERS_LIBS@ @AFS_LIBS@ @GETGROUPS_LIB@ $(LIBS) $(NET_LIBS) @ZLIB@
|
SUDOERS_LIBS = @SUDOERS_LIBS@ @AFS_LIBS@ @GETGROUPS_LIB@ $(LIBS) $(NET_LIBS) @ZLIB@
|
||||||
REPLAY_LIBS = @REPLAY_LIBS@ @ZLIB@
|
REPLAY_LIBS = @REPLAY_LIBS@ @ZLIB@
|
||||||
@@ -67,6 +67,7 @@ sbindir = @sbindir@
|
|||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
libexecdir = @libexecdir@
|
libexecdir = @libexecdir@
|
||||||
datarootdir = @datarootdir@
|
datarootdir = @datarootdir@
|
||||||
|
localedir = @localedir@
|
||||||
localstatedir = @localstatedir@
|
localstatedir = @localstatedir@
|
||||||
|
|
||||||
# File extension for shared objects
|
# File extension for shared objects
|
||||||
@@ -94,7 +95,9 @@ sudoers_gid = @SUDOERS_GID@
|
|||||||
sudoers_mode = @SUDOERS_MODE@
|
sudoers_mode = @SUDOERS_MODE@
|
||||||
|
|
||||||
# Pass in paths and uid/gid + OS dependent defines
|
# Pass in paths and uid/gid + OS dependent defines
|
||||||
DEFS = @OSDEFS@ -D_PATH_SUDOERS=\"$(sudoersdir)/sudoers\" -DSUDOERS_UID=$(sudoers_uid) -DSUDOERS_GID=$(sudoers_gid) -DSUDOERS_MODE=$(sudoers_mode)
|
DEFS = @OSDEFS@ -D_PATH_SUDOERS=\"$(sudoersdir)/sudoers\" \
|
||||||
|
-DSUDOERS_UID=$(sudoers_uid) -DSUDOERS_GID=$(sudoers_gid) \
|
||||||
|
-DSUDOERS_MODE=$(sudoers_mode) -DLOCALEDIR=\"$(localedir)\"
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
|
|
||||||
|
@@ -433,6 +433,10 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
bindtextdomain("sudoers", LOCALEDIR);
|
||||||
|
#endif
|
||||||
|
|
||||||
sudo_setpwent();
|
sudo_setpwent();
|
||||||
sudo_setgrent();
|
sudo_setgrent();
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#ifdef HAVE_LIBINTL_H
|
#ifdef HAVE_LIBINTL_H
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
|
# undef _
|
||||||
|
# define _(String) dgettext("sudoers", String)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "missing.h"
|
#include "missing.h"
|
||||||
|
@@ -163,6 +163,10 @@ sudoers_policy_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
bindtextdomain("sudoers", LOCALEDIR);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Signal setup:
|
* Signal setup:
|
||||||
* Ignore keyboard-generated signals so the user cannot interrupt
|
* Ignore keyboard-generated signals so the user cannot interrupt
|
||||||
|
@@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
#ifdef HAVE_LIBINTL_H
|
#ifdef HAVE_LIBINTL_H
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
|
# undef _
|
||||||
|
# define _(String) dgettext("sudoers", String)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -245,6 +245,10 @@ main(int argc, char *argv[])
|
|||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
decimal = localeconv()->decimal_point;
|
decimal = localeconv()->decimal_point;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have sudoreplay domain */
|
||||||
|
textdomain("sudoers");
|
||||||
|
#endif
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "d:f:hlm:s:V")) != -1) {
|
while ((ch = getopt(argc, argv, "d:f:hlm:s:V")) != -1) {
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
|
@@ -58,6 +58,7 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif /* HAVE_UNISTD_H */
|
#endif /* HAVE_UNISTD_H */
|
||||||
|
#include <stdarg.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
@@ -70,10 +71,11 @@
|
|||||||
#if TIME_WITH_SYS_TIME
|
#if TIME_WITH_SYS_TIME
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __STDC__
|
#ifdef HAVE_SETLOCALE
|
||||||
# include <stdarg.h>
|
# include <locale.h>
|
||||||
#else
|
#endif
|
||||||
# include <varargs.h>
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
# include <libintl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "sudoers.h"
|
#include "sudoers.h"
|
||||||
@@ -152,6 +154,14 @@ main(int argc, char *argv[])
|
|||||||
malloc_options = "AFGJPR";
|
malloc_options = "AFGJPR";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SETLOCALE
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */
|
||||||
|
textdomain("sudoers");
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_GETPROGNAME) && !defined(HAVE___PROGNAME)
|
#if !defined(HAVE_GETPROGNAME) && !defined(HAVE___PROGNAME)
|
||||||
setprogname(argc > 0 ? argv[0] : "visudo");
|
setprogname(argc > 0 ? argv[0] : "visudo");
|
||||||
#endif
|
#endif
|
||||||
|
@@ -34,7 +34,7 @@ INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
|
|||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
LT_LIBS = $(top_builddir)/common/libcommon.la $(LIBOBJDIR)libreplace.la
|
LT_LIBS = $(top_builddir)/common/libcommon.la $(LIBOBJDIR)libreplace.la
|
||||||
LIBS = @LIBS@ @SUDO_LIBS@ @GETGROUPS_LIB@ @NET_LIBS@ $(LT_LIBS)
|
LIBS = @LIBS@ @SUDO_LIBS@ @GETGROUPS_LIB@ @NET_LIBS@ @LIBINTL@ $(LT_LIBS)
|
||||||
|
|
||||||
# C preprocessor flags
|
# C preprocessor flags
|
||||||
CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(srcdir) -I. @CPPFLAGS@
|
CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(srcdir) -I. @CPPFLAGS@
|
||||||
@@ -53,6 +53,7 @@ sbindir = @sbindir@
|
|||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
libexecdir = @libexecdir@
|
libexecdir = @libexecdir@
|
||||||
datarootdir = @datarootdir@
|
datarootdir = @datarootdir@
|
||||||
|
localedir = @localedir@
|
||||||
localstatedir = @localstatedir@
|
localstatedir = @localstatedir@
|
||||||
noexecfile = @NOEXECFILE@
|
noexecfile = @NOEXECFILE@
|
||||||
noexecdir = @NOEXECDIR@
|
noexecdir = @NOEXECDIR@
|
||||||
@@ -62,7 +63,8 @@ install_uid = 0
|
|||||||
install_gid = 0
|
install_gid = 0
|
||||||
|
|
||||||
# OS dependent defines
|
# OS dependent defines
|
||||||
DEFS = @OSDEFS@ -D_PATH_SUDO_CONF=\"$(sysconfdir)/sudo.conf\"
|
DEFS = @OSDEFS@ -D_PATH_SUDO_CONF=\"$(sysconfdir)/sudo.conf\" \
|
||||||
|
-DLOCALEDIR=\"$(localedir)\"
|
||||||
|
|
||||||
#### End of system configuration section. ####
|
#### End of system configuration section. ####
|
||||||
|
|
||||||
|
11
src/sesh.c
11
src/sesh.c
@@ -26,6 +26,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#ifdef HAVE_SETLOCALE
|
||||||
|
# include <locale.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_LIBINTL_H
|
#ifdef HAVE_LIBINTL_H
|
||||||
# include <libintl.h>
|
# include <libintl.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -37,6 +40,14 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
char *cp, *cmnd;
|
char *cp, *cmnd;
|
||||||
|
|
||||||
|
#ifdef HAVE_SETLOCALE
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
bindtextdomain("sudo", LOCALEDIR);
|
||||||
|
textdomain("sudo");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
errx(EXIT_FAILURE, _("requires at least one argument"));
|
errx(EXIT_FAILURE, _("requires at least one argument"));
|
||||||
|
|
||||||
|
@@ -178,6 +178,11 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
setprogname(argv[0]);
|
setprogname(argv[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
bindtextdomain("sudo", LOCALEDIR);
|
||||||
|
textdomain("sudo");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Must be done before we do any password lookups */
|
/* Must be done before we do any password lookups */
|
||||||
#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS)
|
#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS)
|
||||||
(void) set_auth_parameters(argc, argv);
|
(void) set_auth_parameters(argc, argv);
|
||||||
|
Reference in New Issue
Block a user