Instead of trying to make weak functions work on all platforms,
just use a registration function for a plugin-specific setlocale function. The sudoers version just wraps sudoers_setlocale().
This commit is contained in:
8
INSTALL
8
INSTALL
@@ -223,14 +223,6 @@ Compilation options:
|
|||||||
use the /usr/lib/tmpfiles.d directory if the file
|
use the /usr/lib/tmpfiles.d directory if the file
|
||||||
/usr/lib/tmpfiles.d/systemd.conf exists.
|
/usr/lib/tmpfiles.d/systemd.conf exists.
|
||||||
|
|
||||||
--disable-weak-symbols
|
|
||||||
Disable the use of weak symbols in the libsudo_util library.
|
|
||||||
By default, libsudo_util will provide weak symbols for the
|
|
||||||
sudo_warn_gettext() amd sudo_warn_strerror() functions which
|
|
||||||
may be overridden. If weak symbols are disabled, these
|
|
||||||
functions will be omitted from the library and must be
|
|
||||||
provided by any binary that links against libsudo_util.
|
|
||||||
|
|
||||||
--enable-zlib[=location]
|
--enable-zlib[=location]
|
||||||
Enable the use of the zlib compress library when storing
|
Enable the use of the zlib compress library when storing
|
||||||
I/O log files. If specified, location is the base directory
|
I/O log files. If specified, location is the base directory
|
||||||
|
3
MANIFEST
3
MANIFEST
@@ -101,7 +101,6 @@ lib/util/inet_pton.c
|
|||||||
lib/util/isblank.c
|
lib/util/isblank.c
|
||||||
lib/util/key_val.c
|
lib/util/key_val.c
|
||||||
lib/util/lbuf.c
|
lib/util/lbuf.c
|
||||||
lib/util/locale_weak.c
|
|
||||||
lib/util/locking.c
|
lib/util/locking.c
|
||||||
lib/util/memrchr.c
|
lib/util/memrchr.c
|
||||||
lib/util/memset_s.c
|
lib/util/memset_s.c
|
||||||
@@ -205,7 +204,6 @@ m4/ax_check_compile_flag.m4
|
|||||||
m4/ax_check_link_flag.m4
|
m4/ax_check_link_flag.m4
|
||||||
m4/ax_func_getaddrinfo.m4
|
m4/ax_func_getaddrinfo.m4
|
||||||
m4/ax_func_snprintf.m4
|
m4/ax_func_snprintf.m4
|
||||||
m4/ax_sys_weak_alias.m4
|
|
||||||
m4/libtool.m4
|
m4/libtool.m4
|
||||||
m4/ltoptions.m4
|
m4/ltoptions.m4
|
||||||
m4/ltsugar.m4
|
m4/ltsugar.m4
|
||||||
@@ -527,7 +525,6 @@ src/exec_pty.c
|
|||||||
src/get_pty.c
|
src/get_pty.c
|
||||||
src/hooks.c
|
src/hooks.c
|
||||||
src/load_plugins.c
|
src/load_plugins.c
|
||||||
src/locale_stub.c
|
|
||||||
src/net_ifs.c
|
src/net_ifs.c
|
||||||
src/openbsd.c
|
src/openbsd.c
|
||||||
src/parse_args.c
|
src/parse_args.c
|
||||||
|
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@@ -130,7 +130,6 @@ m4_include([m4/ax_check_compile_flag.m4])
|
|||||||
m4_include([m4/ax_check_link_flag.m4])
|
m4_include([m4/ax_check_link_flag.m4])
|
||||||
m4_include([m4/ax_func_getaddrinfo.m4])
|
m4_include([m4/ax_func_getaddrinfo.m4])
|
||||||
m4_include([m4/ax_func_snprintf.m4])
|
m4_include([m4/ax_func_snprintf.m4])
|
||||||
m4_include([m4/ax_sys_weak_alias.m4])
|
|
||||||
m4_include([m4/libtool.m4])
|
m4_include([m4/libtool.m4])
|
||||||
m4_include([m4/ltoptions.m4])
|
m4_include([m4/ltoptions.m4])
|
||||||
m4_include([m4/ltsugar.m4])
|
m4_include([m4/ltsugar.m4])
|
||||||
|
19
config.h.in
19
config.h.in
@@ -796,25 +796,6 @@
|
|||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
#undef HAVE_SYS_TYPES_H
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
/* Define this if your system can create weak aliases */
|
|
||||||
#undef HAVE_SYS_WEAK_ALIAS
|
|
||||||
|
|
||||||
/* Define this if weak aliases may be created with __attribute__ */
|
|
||||||
#undef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
|
|
||||||
|
|
||||||
/* Define this if weak aliases may be created with #pragma _CRI duplicate */
|
|
||||||
#undef HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE
|
|
||||||
|
|
||||||
/* Define this if weak aliases in other files are honored */
|
|
||||||
#undef HAVE_SYS_WEAK_ALIAS_CROSSFILE
|
|
||||||
|
|
||||||
/* Define this if weak aliases may be created with #pragma _HP_SECONDARY_DEF
|
|
||||||
*/
|
|
||||||
#undef HAVE_SYS_WEAK_ALIAS_HPSECONDARY
|
|
||||||
|
|
||||||
/* Define this if weak aliases may be created with #pragma weak */
|
|
||||||
#undef HAVE_SYS_WEAK_ALIAS_PRAGMA
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `ttyslot' function. */
|
/* Define to 1 if you have the `ttyslot' function. */
|
||||||
#undef HAVE_TTYSLOT
|
#undef HAVE_TTYSLOT
|
||||||
|
|
||||||
|
356
configure
vendored
356
configure
vendored
@@ -641,8 +641,6 @@ KRB5CONFIG
|
|||||||
FLEX
|
FLEX
|
||||||
YFLAGS
|
YFLAGS
|
||||||
YACC
|
YACC
|
||||||
WEAK_ALIAS_CROSSFILE
|
|
||||||
WEAK_ALIAS
|
|
||||||
LIBOBJS
|
LIBOBJS
|
||||||
NROFFPROG
|
NROFFPROG
|
||||||
MANDOCPROG
|
MANDOCPROG
|
||||||
@@ -951,7 +949,6 @@ enable_nls
|
|||||||
enable_rpath
|
enable_rpath
|
||||||
enable_static_sudoers
|
enable_static_sudoers
|
||||||
enable_shared_libutil
|
enable_shared_libutil
|
||||||
enable_weak_symbols
|
|
||||||
enable_tmpfiles_d
|
enable_tmpfiles_d
|
||||||
with_selinux
|
with_selinux
|
||||||
enable_gss_krb5_ccache_name
|
enable_gss_krb5_ccache_name
|
||||||
@@ -1628,8 +1625,6 @@ Optional Features:
|
|||||||
binary instead as a plugin
|
binary instead as a plugin
|
||||||
--disable-shared-libutil
|
--disable-shared-libutil
|
||||||
Disable use of the libsudo_util shared library.
|
Disable use of the libsudo_util shared library.
|
||||||
--disable-weak-symbols Disable use of weak symbols in the libsudo_util
|
|
||||||
shared library.
|
|
||||||
--enable-tmpfiles.d=DIR Set the path to the systemd tmpfiles.d directory.
|
--enable-tmpfiles.d=DIR Set the path to the systemd tmpfiles.d directory.
|
||||||
--enable-gss-krb5-ccache-name
|
--enable-gss-krb5-ccache-name
|
||||||
Use GSS-API to set the Kerberos V cred cache name
|
Use GSS-API to set the Kerberos V cred cache name
|
||||||
@@ -5696,14 +5691,6 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-weak_symbols was given.
|
|
||||||
if test "${enable_weak_symbols+set}" = set; then :
|
|
||||||
enableval=$enable_weak_symbols;
|
|
||||||
else
|
|
||||||
enable_weak_symbols=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-tmpfiles.d was given.
|
# Check whether --enable-tmpfiles.d was given.
|
||||||
if test "${enable_tmpfiles_d+set}" = set; then :
|
if test "${enable_tmpfiles_d+set}" = set; then :
|
||||||
enableval=$enable_tmpfiles_d; case $enableval in
|
enableval=$enable_tmpfiles_d; case $enableval in
|
||||||
@@ -15722,329 +15709,6 @@ $as_echo "#define volatile /**/" >>confdefs.h
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$enable_shared_libutil$enable_weak_symbols" = "yesyes"; then
|
|
||||||
|
|
||||||
# starting point: no aliasing scheme yet...
|
|
||||||
ax_sys_weak_alias=no
|
|
||||||
|
|
||||||
# Figure out what kind of aliasing may be supported...
|
|
||||||
# Test whether compiler accepts #pragma form of weak aliasing
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports #pragma weak" >&5
|
|
||||||
$as_echo_n "checking whether $CC supports #pragma weak... " >&6; }
|
|
||||||
if ${ax_cv_sys_weak_alias_pragma+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
|
|
||||||
extern void weakf(int c);
|
|
||||||
#pragma weak weakf = __weakf
|
|
||||||
void __weakf(int c) {}
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
weakf(0)
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
ax_cv_sys_weak_alias_pragma=yes
|
|
||||||
else
|
|
||||||
ax_cv_sys_weak_alias_pragma=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_sys_weak_alias_pragma" >&5
|
|
||||||
$as_echo "$ax_cv_sys_weak_alias_pragma" >&6; }
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
if test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_pragma = yes; then :
|
|
||||||
|
|
||||||
ax_sys_weak_alias=pragma
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_SYS_WEAK_ALIAS_PRAGMA 1" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Test whether compiler accepts _HP_SECONDARY_DEF pragma from HP...
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports #pragma _HP_SECONDARY_DEF" >&5
|
|
||||||
$as_echo_n "checking whether $CC supports #pragma _HP_SECONDARY_DEF... " >&6; }
|
|
||||||
if ${ax_cv_sys_weak_alias_hpsecondary+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
|
|
||||||
extern void weakf(int c);
|
|
||||||
#pragma _HP_SECONDARY_DEF __weakf weakf
|
|
||||||
void __weakf(int c) {}
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
weakf(0)
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
ax_cv_sys_weak_alias_hpsecondary=yes
|
|
||||||
else
|
|
||||||
ax_cv_sys_weak_alias_hpsecondary=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_sys_weak_alias_hpsecondary" >&5
|
|
||||||
$as_echo "$ax_cv_sys_weak_alias_hpsecondary" >&6; }
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
if test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_hpsecondary = yes; then :
|
|
||||||
|
|
||||||
ax_sys_weak_alias=hpsecondary
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_SYS_WEAK_ALIAS_HPSECONDARY 1" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Test whether compiler accepts "_CRI duplicate" pragma from Cray
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports #pragma _CRI duplicate" >&5
|
|
||||||
$as_echo_n "checking whether $CC supports #pragma _CRI duplicate... " >&6; }
|
|
||||||
if ${ax_cv_sys_weak_alias_criduplicate+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
|
|
||||||
extern void weakf(int c);
|
|
||||||
#pragma _CRI duplicate weakf as __weakf
|
|
||||||
void __weakf(int c) {}
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
weakf(0)
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
ax_cv_sys_weak_alias_criduplicate=yes
|
|
||||||
else
|
|
||||||
ax_cv_sys_weak_alias_criduplicate=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_sys_weak_alias_criduplicate" >&5
|
|
||||||
$as_echo "$ax_cv_sys_weak_alias_criduplicate" >&6; }
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
if test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_criduplicate = yes; then :
|
|
||||||
|
|
||||||
ax_sys_weak_alias=criduplicate
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE 1" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Test whether compiler accepts __attribute__ form of weak aliasing
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts function __attribute__((weak,alias()))" >&5
|
|
||||||
$as_echo_n "checking whether $CC accepts function __attribute__((weak,alias()))... " >&6; }
|
|
||||||
if ${ax_cv_sys_weak_alias_attribute+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
|
|
||||||
# We add -Werror if it's gcc to force an error exit if the weak attribute
|
|
||||||
# isn't understood
|
|
||||||
if test "$GCC" = yes; then :
|
|
||||||
|
|
||||||
save_CFLAGS=$CFLAGS
|
|
||||||
CFLAGS=-Werror
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
|
|
||||||
void __weakf(int c) {}
|
|
||||||
void weakf(int c) __attribute__((weak, alias("__weakf")));
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
weakf(0)
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
ax_cv_sys_weak_alias_attribute=yes
|
|
||||||
else
|
|
||||||
ax_cv_sys_weak_alias_attribute=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
|
|
||||||
# Restore original CFLAGS
|
|
||||||
if test "$GCC" = yes; then :
|
|
||||||
|
|
||||||
CFLAGS=$save_CFLAGS
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_sys_weak_alias_attribute" >&5
|
|
||||||
$as_echo "$ax_cv_sys_weak_alias_attribute" >&6; }
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
if test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_attribute = yes; then :
|
|
||||||
|
|
||||||
ax_sys_weak_alias=attribute
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_SYS_WEAK_ALIAS_ATTRIBUTE 1" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Do we actually support aliasing?
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create weak aliases with $CC" >&5
|
|
||||||
$as_echo_n "checking how to create weak aliases with $CC... " >&6; }
|
|
||||||
if ${ax_cv_sys_weak_alias+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
ax_cv_sys_weak_alias=$ax_sys_weak_alias
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_sys_weak_alias" >&5
|
|
||||||
$as_echo "$ax_cv_sys_weak_alias" >&6; }
|
|
||||||
|
|
||||||
# OK, set a #define
|
|
||||||
if test $ax_cv_sys_weak_alias != no; then :
|
|
||||||
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_SYS_WEAK_ALIAS 1" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Can aliases cross object file boundaries?
|
|
||||||
# Check to see if weak aliases can cross object file boundaries
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports weak aliases across object file boundaries" >&5
|
|
||||||
$as_echo_n "checking whether $CC supports weak aliases across object file boundaries... " >&6; }
|
|
||||||
if ${ax_cv_sys_weak_alias_crossfile+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
|
|
||||||
if test $ax_cv_sys_weak_alias = no; then :
|
|
||||||
ax_cv_sys_weak_alias_crossfile=no
|
|
||||||
else
|
|
||||||
|
|
||||||
# conftest1 contains our weak alias definition...
|
|
||||||
cat >conftest1.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
|
||||||
_ACEOF
|
|
||||||
cat confdefs.h >>conftest1.$ac_ext
|
|
||||||
cat >>conftest1.$ac_ext <<_ACEOF
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
#ifndef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
|
|
||||||
extern void weakf(int c);
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_SYS_WEAK_ALIAS_PRAGMA)
|
|
||||||
#pragma weak weakf = __weakf
|
|
||||||
#elif defined(HAVE_SYS_WEAK_ALIAS_HPSECONDARY)
|
|
||||||
#pragma _HP_SECONDARY_DEF __weakf weakf
|
|
||||||
#elif defined(HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE)
|
|
||||||
#pragma _CRI duplicate weakf as __weakf
|
|
||||||
#endif
|
|
||||||
void __weakf(int c) {}
|
|
||||||
#ifdef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
|
|
||||||
void weakf(int c) __attribute((weak, alias("__weakf")));
|
|
||||||
#endif
|
|
||||||
_ACEOF
|
|
||||||
# And conftest2 contains our main routine that calls it
|
|
||||||
cat >conftest2.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
|
||||||
_ACEOF
|
|
||||||
cat confdefs.h >> conftest2.$ac_ext
|
|
||||||
cat >>conftest2.$ac_ext <<_ACEOF
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
extern void weakf(int c);
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
weakf(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
# We must remove the object files (if any) ourselves...
|
|
||||||
rm -f conftest2.$ac_objext conftest$ac_exeext
|
|
||||||
|
|
||||||
# Change ac_link to compile *2* files together
|
|
||||||
save_aclink=$ac_link
|
|
||||||
ac_link=`echo "$ac_link" | \
|
|
||||||
sed -e 's/conftest\(\.\$ac_ext\)/conftest1\1 conftest2\1/'`
|
|
||||||
# Since we created the files ourselves, don't use SOURCE argument
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
ax_cv_sys_weak_alias_crossfile=yes
|
|
||||||
else
|
|
||||||
ax_cv_sys_weak_alias_crossfile=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext
|
|
||||||
# Restore ac_link
|
|
||||||
ac_link=$save_aclink
|
|
||||||
|
|
||||||
# We must remove the object files (if any) and C files ourselves...
|
|
||||||
rm -f conftest1.$ac_ext conftest2.$ac_ext \
|
|
||||||
conftest1.$ac_objext conftest2.$ac_objext
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_sys_weak_alias_crossfile" >&5
|
|
||||||
$as_echo "$ax_cv_sys_weak_alias_crossfile" >&6; }
|
|
||||||
|
|
||||||
# What were the results of the test?
|
|
||||||
if test $ax_cv_sys_weak_alias_crossfile = yes; then :
|
|
||||||
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_SYS_WEAK_ALIAS_CROSSFILE 1" >>confdefs.h
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# OK, remember the results
|
|
||||||
WEAK_ALIAS=$ax_cv_sys_weak_alias
|
|
||||||
|
|
||||||
WEAK_ALIAS_CROSSFILE=$ax_cv_sys_weak_alias_crossfile
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for variadic macro support in cpp" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for variadic macro support in cpp" >&5
|
||||||
$as_echo_n "checking for variadic macro support in cpp... " >&6; }
|
$as_echo_n "checking for variadic macro support in cpp... " >&6; }
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
@@ -20972,35 +20636,21 @@ done
|
|||||||
LIBS="$OLIBS"
|
LIBS="$OLIBS"
|
||||||
|
|
||||||
if test "$sudo_cv_gettext" = "yes"; then
|
if test "$sudo_cv_gettext" = "yes"; then
|
||||||
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
# For Solaris we need links from lang to lang.UTF-8 in localedir
|
# For Solaris we need links from lang to lang.UTF-8 in localedir
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
solaris2*) LOCALEDIR_SUFFIX=".UTF-8";;
|
solaris2*) LOCALEDIR_SUFFIX=".UTF-8";;
|
||||||
esac
|
esac
|
||||||
elif test "$sudo_cv_gettext_lintl" = "yes"; then
|
elif test "$sudo_cv_gettext_lintl" = "yes"; then
|
||||||
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
LIBINTL="-lintl"
|
LIBINTL="-lintl"
|
||||||
elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
|
elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
|
||||||
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
LIBINTL="-lintl -liconv"
|
LIBINTL="-lintl -liconv"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if test X"$WEAK_ALIAS" != X"no"; then
|
|
||||||
COMMON_OBJS="${COMMON_OBJS} locale_weak.lo"
|
|
||||||
|
|
||||||
for _sym in sudo_warn_strerror_v1; do
|
|
||||||
COMPAT_EXP="${COMPAT_EXP}${_sym}
|
|
||||||
"
|
|
||||||
done
|
|
||||||
|
|
||||||
if test X"$SUDO_NLS" = X"enabled"; then
|
if test X"$SUDO_NLS" = X"enabled"; then
|
||||||
|
$as_echo "#define HAVE_LIBINTL_H 1" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
for _sym in sudo_warn_gettext_v1; do
|
for _sym in sudo_warn_gettext_v1; do
|
||||||
COMPAT_EXP="${COMPAT_EXP}${_sym}
|
COMPAT_EXP="${COMPAT_EXP}${_sym}
|
||||||
@@ -23385,7 +23035,6 @@ case "$lt_cv_dlopen" in
|
|||||||
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
||||||
LT_STATIC=""
|
LT_STATIC=""
|
||||||
else
|
else
|
||||||
SUDO_OBJS="$SUDO_OBJS locale_stub.o"
|
|
||||||
LT_STATIC="--tag=disable-static"
|
LT_STATIC="--tag=disable-static"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -23400,7 +23049,6 @@ case "$lt_cv_dlopen" in
|
|||||||
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
||||||
LT_STATIC=""
|
LT_STATIC=""
|
||||||
else
|
else
|
||||||
SUDO_OBJS="$SUDO_OBJS locale_stub.o"
|
|
||||||
LT_STATIC="--tag=disable-static"
|
LT_STATIC="--tag=disable-static"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
22
configure.ac
22
configure.ac
@@ -1476,10 +1476,6 @@ AC_ARG_ENABLE(shared_libutil,
|
|||||||
[AS_HELP_STRING([--disable-shared-libutil], [Disable use of the libsudo_util shared library.])],
|
[AS_HELP_STRING([--disable-shared-libutil], [Disable use of the libsudo_util shared library.])],
|
||||||
[], [enable_shared_libutil=yes])
|
[], [enable_shared_libutil=yes])
|
||||||
|
|
||||||
AC_ARG_ENABLE(weak_symbols,
|
|
||||||
[AS_HELP_STRING([--disable-weak-symbols], [Disable use of weak symbols in the libsudo_util shared library.])],
|
|
||||||
[], [enable_weak_symbols=yes])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(tmpfiles.d,
|
AC_ARG_ENABLE(tmpfiles.d,
|
||||||
[AS_HELP_STRING([--enable-tmpfiles.d=DIR], [Set the path to the systemd tmpfiles.d directory.])],
|
[AS_HELP_STRING([--enable-tmpfiles.d=DIR], [Set the path to the systemd tmpfiles.d directory.])],
|
||||||
[case $enableval in
|
[case $enableval in
|
||||||
@@ -2202,9 +2198,6 @@ dnl
|
|||||||
AC_PROG_CC_STDC
|
AC_PROG_CC_STDC
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_VOLATILE
|
AC_C_VOLATILE
|
||||||
if test "$enable_shared_libutil$enable_weak_symbols" = "yesyes"; then
|
|
||||||
AX_SYS_WEAK_ALIAS
|
|
||||||
fi
|
|
||||||
AC_MSG_CHECKING([for variadic macro support in cpp])
|
AC_MSG_CHECKING([for variadic macro support in cpp])
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||||
AC_INCLUDES_DEFAULT
|
AC_INCLUDES_DEFAULT
|
||||||
@@ -2967,31 +2960,20 @@ if test "$enable_nls" != "no"; then
|
|||||||
LIBS="$OLIBS"
|
LIBS="$OLIBS"
|
||||||
|
|
||||||
if test "$sudo_cv_gettext" = "yes"; then
|
if test "$sudo_cv_gettext" = "yes"; then
|
||||||
AC_DEFINE(HAVE_LIBINTL_H)
|
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
# For Solaris we need links from lang to lang.UTF-8 in localedir
|
# For Solaris we need links from lang to lang.UTF-8 in localedir
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
solaris2*) LOCALEDIR_SUFFIX=".UTF-8";;
|
solaris2*) LOCALEDIR_SUFFIX=".UTF-8";;
|
||||||
esac
|
esac
|
||||||
elif test "$sudo_cv_gettext_lintl" = "yes"; then
|
elif test "$sudo_cv_gettext_lintl" = "yes"; then
|
||||||
AC_DEFINE(HAVE_LIBINTL_H)
|
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
LIBINTL="-lintl"
|
LIBINTL="-lintl"
|
||||||
elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
|
elif test "$sudo_cv_gettext_lintl_liconv" = "yes"; then
|
||||||
AC_DEFINE(HAVE_LIBINTL_H)
|
|
||||||
SUDO_NLS=enabled
|
SUDO_NLS=enabled
|
||||||
LIBINTL="-lintl -liconv"
|
LIBINTL="-lintl -liconv"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl If the system has weak symbol support, use it for
|
|
||||||
dnl sudo_warn_strerror_v1() and sudo_warn_gettext_v1().
|
|
||||||
dnl
|
|
||||||
if test X"$WEAK_ALIAS" != X"no"; then
|
|
||||||
COMMON_OBJS="${COMMON_OBJS} locale_weak.lo"
|
|
||||||
SUDO_APPEND_COMPAT_EXP(sudo_warn_strerror_v1)
|
|
||||||
if test X"$SUDO_NLS" = X"enabled"; then
|
if test X"$SUDO_NLS" = X"enabled"; then
|
||||||
|
AC_DEFINE(HAVE_LIBINTL_H)
|
||||||
SUDO_APPEND_COMPAT_EXP(sudo_warn_gettext_v1)
|
SUDO_APPEND_COMPAT_EXP(sudo_warn_gettext_v1)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -3763,7 +3745,6 @@ case "$lt_cv_dlopen" in
|
|||||||
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
||||||
LT_STATIC=""
|
LT_STATIC=""
|
||||||
else
|
else
|
||||||
SUDO_OBJS="$SUDO_OBJS locale_stub.o"
|
|
||||||
LT_STATIC="--tag=disable-static"
|
LT_STATIC="--tag=disable-static"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -3776,7 +3757,6 @@ case "$lt_cv_dlopen" in
|
|||||||
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS} --tag=disable-shared -static"
|
||||||
LT_STATIC=""
|
LT_STATIC=""
|
||||||
else
|
else
|
||||||
SUDO_OBJS="$SUDO_OBJS locale_stub.o"
|
|
||||||
LT_STATIC="--tag=disable-static"
|
LT_STATIC="--tag=disable-static"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@@ -18,6 +18,11 @@
|
|||||||
#define _SUDO_FATAL_H_
|
#define _SUDO_FATAL_H_
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#ifdef HAVE_STDBOOL_H
|
||||||
|
# include <stdbool.h>
|
||||||
|
#else
|
||||||
|
# include "compat/stdbool.h"
|
||||||
|
#endif /* HAVE_STDBOOL_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We wrap fatal/fatalx and warn/warnx so that the same output can
|
* We wrap fatal/fatalx and warn/warnx so that the same output can
|
||||||
@@ -120,7 +125,7 @@ struct sudo_conv_reply;
|
|||||||
__dso_public int sudo_fatal_callback_deregister_v1(sudo_fatal_callback_t func);
|
__dso_public int sudo_fatal_callback_deregister_v1(sudo_fatal_callback_t func);
|
||||||
__dso_public int sudo_fatal_callback_register_v1(sudo_fatal_callback_t func);
|
__dso_public int sudo_fatal_callback_register_v1(sudo_fatal_callback_t func);
|
||||||
__dso_public char *sudo_warn_gettext_v1(const char *msgid) __format_arg(1);
|
__dso_public char *sudo_warn_gettext_v1(const char *msgid) __format_arg(1);
|
||||||
__dso_public char *sudo_warn_strerror_v1(int errnum);
|
__dso_public void sudo_warn_set_locale_func_v1(bool (*func)(bool, int *));
|
||||||
__dso_public void sudo_fatal_nodebug_v1(const char *fmt, ...) __printf0like(1, 2) __attribute__((__noreturn__));
|
__dso_public void sudo_fatal_nodebug_v1(const char *fmt, ...) __printf0like(1, 2) __attribute__((__noreturn__));
|
||||||
__dso_public void sudo_fatalx_nodebug_v1(const char *fmt, ...) __printflike(1, 2) __attribute__((__noreturn__));
|
__dso_public void sudo_fatalx_nodebug_v1(const char *fmt, ...) __printflike(1, 2) __attribute__((__noreturn__));
|
||||||
__dso_public void sudo_vfatal_nodebug_v1(const char *fmt, va_list ap) __printf0like(1, 0) __attribute__((__noreturn__));
|
__dso_public void sudo_vfatal_nodebug_v1(const char *fmt, va_list ap) __printf0like(1, 0) __attribute__((__noreturn__));
|
||||||
@@ -134,7 +139,7 @@ __dso_public void sudo_warn_set_conversation_v1(int (*conv)(int num_msgs, const
|
|||||||
#define sudo_fatal_callback_deregister(_a) sudo_fatal_callback_deregister_v1((_a))
|
#define sudo_fatal_callback_deregister(_a) sudo_fatal_callback_deregister_v1((_a))
|
||||||
#define sudo_fatal_callback_register(_a) sudo_fatal_callback_register_v1((_a))
|
#define sudo_fatal_callback_register(_a) sudo_fatal_callback_register_v1((_a))
|
||||||
#define sudo_warn_gettext(_a) sudo_warn_gettext_v1((_a))
|
#define sudo_warn_gettext(_a) sudo_warn_gettext_v1((_a))
|
||||||
#define sudo_warn_strerror(_a) sudo_warn_strerror_v1((_a))
|
#define sudo_warn_set_locale_func(_a) sudo_warn_set_locale_func_v1((_a))
|
||||||
#define sudo_fatal_nodebug sudo_fatal_nodebug_v1
|
#define sudo_fatal_nodebug sudo_fatal_nodebug_v1
|
||||||
#define sudo_fatalx_nodebug sudo_fatalx_nodebug_v1
|
#define sudo_fatalx_nodebug sudo_fatalx_nodebug_v1
|
||||||
#define sudo_vfatal_nodebug(_a, _b) sudo_vfatal_nodebug_v1((_a), (_b))
|
#define sudo_vfatal_nodebug(_a, _b) sudo_vfatal_nodebug_v1((_a), (_b))
|
||||||
@@ -144,5 +149,6 @@ __dso_public void sudo_warn_set_conversation_v1(int (*conv)(int num_msgs, const
|
|||||||
#define sudo_vwarn_nodebug(_a, _b) sudo_vwarn_nodebug_v1((_a), (_b))
|
#define sudo_vwarn_nodebug(_a, _b) sudo_vwarn_nodebug_v1((_a), (_b))
|
||||||
#define sudo_vwarnx_nodebug(_a, _b) sudo_vwarnx_nodebug_v1((_a), (_b))
|
#define sudo_vwarnx_nodebug(_a, _b) sudo_vwarnx_nodebug_v1((_a), (_b))
|
||||||
#define sudo_warn_set_conversation(_a) sudo_warn_set_conversation_v1(_a)
|
#define sudo_warn_set_conversation(_a) sudo_warn_set_conversation_v1(_a)
|
||||||
|
#define sudo_warn_set_conversation(_a) sudo_warn_set_conversation_v1(_a)
|
||||||
|
|
||||||
#endif /* _SUDO_FATAL_H_ */
|
#endif /* _SUDO_FATAL_H_ */
|
||||||
|
@@ -101,21 +101,21 @@ LTOBJS = alloc.lo event.lo fatal.lo key_val.lo gethostname.lo gettime.lo \
|
|||||||
setgroups.lo strtobool.lo strtoid.lo strtomode.lo sudo_conf.lo \
|
setgroups.lo strtobool.lo strtoid.lo strtomode.lo sudo_conf.lo \
|
||||||
sudo_debug.lo sudo_dso.lo term.lo ttysize.lo @COMMON_OBJS@ @LTLIBOBJS@
|
sudo_debug.lo sudo_dso.lo term.lo ttysize.lo @COMMON_OBJS@ @LTLIBOBJS@
|
||||||
|
|
||||||
ATOFOO_TEST_OBJS = atofoo_test.lo locale_stub.lo
|
ATOFOO_TEST_OBJS = atofoo_test.lo
|
||||||
|
|
||||||
MKTEMP_TEST_OBJS = mktemp_test.lo locale_stub.lo
|
MKTEMP_TEST_OBJS = mktemp_test.lo
|
||||||
|
|
||||||
PARSELN_TEST_OBJS = parseln_test.lo locale_stub.lo
|
PARSELN_TEST_OBJS = parseln_test.lo
|
||||||
|
|
||||||
PROGNAME_TEST_OBJS = progname_test.lo progname.lo
|
PROGNAME_TEST_OBJS = progname_test.lo progname.lo
|
||||||
|
|
||||||
CONF_TEST_OBJS = conf_test.lo locale_stub.lo
|
CONF_TEST_OBJS = conf_test.lo
|
||||||
|
|
||||||
HLTQ_TEST_OBJS = hltq_test.lo locale_stub.lo
|
HLTQ_TEST_OBJS = hltq_test.lo
|
||||||
|
|
||||||
FNM_TEST_OBJS = fnm_test.lo locale_stub.lo
|
FNM_TEST_OBJS = fnm_test.lo
|
||||||
|
|
||||||
GLOBTEST_OBJS = globtest.lo locale_stub.lo
|
GLOBTEST_OBJS = globtest.lo
|
||||||
|
|
||||||
all: libsudo_util.la
|
all: libsudo_util.la
|
||||||
|
|
||||||
@@ -309,9 +309,9 @@ aix.lo: $(srcdir)/aix.c $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
|
|||||||
$(incdir)/sudo_gettext.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
|
$(incdir)/sudo_gettext.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
|
||||||
$(top_builddir)/config.h
|
$(top_builddir)/config.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/aix.c
|
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/aix.c
|
||||||
alloc.lo: $(srcdir)/alloc.c $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
|
alloc.lo: $(srcdir)/alloc.c $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
|
||||||
$(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
|
$(incdir)/sudo_compat.h $(incdir)/sudo_fatal.h \
|
||||||
$(top_builddir)/config.h
|
$(incdir)/sudo_gettext.h $(top_builddir)/config.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/alloc.c
|
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/alloc.c
|
||||||
atofoo_test.lo: $(srcdir)/regress/atofoo/atofoo_test.c \
|
atofoo_test.lo: $(srcdir)/regress/atofoo/atofoo_test.c \
|
||||||
$(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
|
$(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
|
||||||
@@ -372,8 +372,8 @@ gethostname.lo: $(srcdir)/gethostname.c $(incdir)/compat/stdbool.h \
|
|||||||
getline.lo: $(srcdir)/getline.c $(incdir)/sudo_compat.h $(top_builddir)/config.h
|
getline.lo: $(srcdir)/getline.c $(incdir)/sudo_compat.h $(top_builddir)/config.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/getline.c
|
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/getline.c
|
||||||
getopt_long.lo: $(srcdir)/getopt_long.c $(incdir)/compat/getopt.h \
|
getopt_long.lo: $(srcdir)/getopt_long.c $(incdir)/compat/getopt.h \
|
||||||
$(incdir)/sudo_compat.h $(incdir)/sudo_fatal.h \
|
$(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
|
||||||
$(top_builddir)/config.h
|
$(incdir)/sudo_fatal.h $(top_builddir)/config.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/getopt_long.c
|
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/getopt_long.c
|
||||||
gettime.lo: $(srcdir)/gettime.c $(incdir)/compat/stdbool.h \
|
gettime.lo: $(srcdir)/gettime.c $(incdir)/compat/stdbool.h \
|
||||||
$(incdir)/compat/timespec.h $(incdir)/sudo_compat.h \
|
$(incdir)/compat/timespec.h $(incdir)/sudo_compat.h \
|
||||||
@@ -407,18 +407,10 @@ key_val.lo: $(srcdir)/key_val.c $(incdir)/compat/stdbool.h \
|
|||||||
$(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
|
$(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
|
||||||
$(top_builddir)/config.h
|
$(top_builddir)/config.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/key_val.c
|
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/key_val.c
|
||||||
lbuf.lo: $(srcdir)/lbuf.c $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
|
lbuf.lo: $(srcdir)/lbuf.c $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
|
||||||
$(incdir)/sudo_debug.h $(incdir)/sudo_lbuf.h $(incdir)/sudo_queue.h \
|
$(incdir)/sudo_compat.h $(incdir)/sudo_debug.h $(incdir)/sudo_lbuf.h \
|
||||||
$(top_builddir)/config.h
|
$(incdir)/sudo_queue.h $(top_builddir)/config.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/lbuf.c
|
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/lbuf.c
|
||||||
locale_stub.lo: $(top_srcdir)/src/locale_stub.c $(incdir)/sudo_compat.h \
|
|
||||||
$(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
|
|
||||||
$(top_builddir)/config.h
|
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(top_srcdir)/src/locale_stub.c
|
|
||||||
locale_weak.lo: $(srcdir)/locale_weak.c $(incdir)/sudo_compat.h \
|
|
||||||
$(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
|
|
||||||
$(top_builddir)/config.h
|
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/locale_weak.c
|
|
||||||
locking.lo: $(srcdir)/locking.c $(incdir)/compat/stdbool.h \
|
locking.lo: $(srcdir)/locking.c $(incdir)/compat/stdbool.h \
|
||||||
$(incdir)/sudo_compat.h $(incdir)/sudo_debug.h \
|
$(incdir)/sudo_compat.h $(incdir)/sudo_debug.h \
|
||||||
$(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
|
$(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
|
||||||
|
@@ -46,6 +46,8 @@ SLIST_HEAD(sudo_fatal_callback_list, sudo_fatal_callback);
|
|||||||
|
|
||||||
static struct sudo_fatal_callback_list callbacks = SLIST_HEAD_INITIALIZER(&callbacks);
|
static struct sudo_fatal_callback_list callbacks = SLIST_HEAD_INITIALIZER(&callbacks);
|
||||||
static sudo_conv_t sudo_warn_conversation;
|
static sudo_conv_t sudo_warn_conversation;
|
||||||
|
static bool (*sudo_warn_setlocale)(bool, int *);
|
||||||
|
static bool (*sudo_warn_setlocale_prev)(bool, int *);
|
||||||
|
|
||||||
static void _warning(int errnum, const char *fmt, va_list ap);
|
static void _warning(int errnum, const char *fmt, va_list ap);
|
||||||
|
|
||||||
@@ -136,6 +138,12 @@ sudo_vwarnx_nodebug_v1(const char *fmt, va_list ap)
|
|||||||
static void
|
static void
|
||||||
_warning(int errnum, const char *fmt, va_list ap)
|
_warning(int errnum, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
|
int cookie;
|
||||||
|
|
||||||
|
/* Set user locale if setter was specified. */
|
||||||
|
if (sudo_warn_setlocale != NULL)
|
||||||
|
sudo_warn_setlocale(false, &cookie);
|
||||||
|
|
||||||
if (sudo_warn_conversation != NULL) {
|
if (sudo_warn_conversation != NULL) {
|
||||||
struct sudo_conv_message msgs[6];
|
struct sudo_conv_message msgs[6];
|
||||||
int nmsgs = 0;
|
int nmsgs = 0;
|
||||||
@@ -155,7 +163,7 @@ _warning(int errnum, const char *fmt, va_list ap)
|
|||||||
msgs[nmsgs].msg_type = SUDO_CONV_ERROR_MSG;
|
msgs[nmsgs].msg_type = SUDO_CONV_ERROR_MSG;
|
||||||
msgs[nmsgs++].msg = ": ";
|
msgs[nmsgs++].msg = ": ";
|
||||||
msgs[nmsgs].msg_type = SUDO_CONV_ERROR_MSG;
|
msgs[nmsgs].msg_type = SUDO_CONV_ERROR_MSG;
|
||||||
msgs[nmsgs++].msg = sudo_warn_strerror(errnum);
|
msgs[nmsgs++].msg = strerror(errnum);
|
||||||
}
|
}
|
||||||
msgs[nmsgs].msg_type = SUDO_CONV_ERROR_MSG;
|
msgs[nmsgs].msg_type = SUDO_CONV_ERROR_MSG;
|
||||||
msgs[nmsgs++].msg = "\n";
|
msgs[nmsgs++].msg = "\n";
|
||||||
@@ -170,10 +178,14 @@ _warning(int errnum, const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
if (errnum) {
|
if (errnum) {
|
||||||
fputs(": ", stderr);
|
fputs(": ", stderr);
|
||||||
fputs(sudo_warn_strerror(errnum), stderr);
|
fputs(strerror(errnum), stderr);
|
||||||
}
|
}
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Restore old locale as needed. */
|
||||||
|
if (sudo_warn_setlocale != NULL)
|
||||||
|
sudo_warn_setlocale(true, &cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -232,3 +244,35 @@ sudo_warn_set_conversation_v1(sudo_conv_t conv)
|
|||||||
{
|
{
|
||||||
sudo_warn_conversation = conv;
|
sudo_warn_conversation = conv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the locale function so the plugin can use a non-default
|
||||||
|
* locale for user warnings.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
sudo_warn_set_locale_func_v1(bool (*func)(bool, int *))
|
||||||
|
{
|
||||||
|
sudo_warn_setlocale_prev = sudo_warn_setlocale;
|
||||||
|
sudo_warn_setlocale = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
char *
|
||||||
|
sudo_warn_gettext_v1(const char *msgid)
|
||||||
|
{
|
||||||
|
int cookie;
|
||||||
|
char *msg;
|
||||||
|
|
||||||
|
/* Set user locale if setter was specified. */
|
||||||
|
if (sudo_warn_setlocale != NULL)
|
||||||
|
sudo_warn_setlocale(false, &cookie);
|
||||||
|
|
||||||
|
msg = gettext(msgid);
|
||||||
|
|
||||||
|
/* Restore old locale as needed. */
|
||||||
|
if (sudo_warn_setlocale != NULL)
|
||||||
|
sudo_warn_setlocale(true, &cookie);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_LIBINTL_H */
|
||||||
|
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013-2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_WEAK_ALIAS
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef HAVE_STRING_H
|
|
||||||
# include <string.h>
|
|
||||||
#endif /* HAVE_STRING_H */
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif /* HAVE_STRINGS_H */
|
|
||||||
|
|
||||||
#define DEFAULT_TEXT_DOMAIN "sudo"
|
|
||||||
#include "sudo_gettext.h" /* must be included before sudo_compat.h */
|
|
||||||
|
|
||||||
#include "sudo_compat.h"
|
|
||||||
#include "sudo_fatal.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Weak symbols for sudo_warn_gettext_v1() and sudo_warn_strerror_v1().
|
|
||||||
* These stubs are provided to make libsudo_util link with no undefined
|
|
||||||
* symbols.
|
|
||||||
*/
|
|
||||||
|
|
||||||
# ifdef HAVE_LIBINTL_H
|
|
||||||
/* We only need to swap locales in the plugin. */
|
|
||||||
char *
|
|
||||||
sudo_warn_gettext_weak(const char *msgid)
|
|
||||||
{
|
|
||||||
return gettext(msgid);
|
|
||||||
}
|
|
||||||
# if defined(HAVE_SYS_WEAK_ALIAS_ATTRIBUTE)
|
|
||||||
char *sudo_warn_gettext_v1(const char *msgid)
|
|
||||||
__attribute__((weak, alias("sudo_warn_gettext_weak")));
|
|
||||||
# elif defined(HAVE_SYS_WEAK_ALIAS_PRAGMA)
|
|
||||||
# pragma weak sudo_warn_gettext_v1 = sudo_warn_gettext_weak
|
|
||||||
# elif defined(HAVE_SYS_WEAK_ALIAS_HPSECONDARY)
|
|
||||||
# pragma _HP_SECONDARY_DEF sudo_warn_gettext_weak sudo_warn_gettext_v1
|
|
||||||
# elif defined(HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE)
|
|
||||||
# pragma _CRI duplicate sudo_warn_gettext_v1 as sudo_warn_gettext_weak
|
|
||||||
# endif
|
|
||||||
# endif /* HAVE_LIBINTL_H */
|
|
||||||
|
|
||||||
/* We only need to swap locales in the plugin. */
|
|
||||||
char *
|
|
||||||
sudo_warn_strerror_weak(int errnum)
|
|
||||||
{
|
|
||||||
return strerror(errnum);
|
|
||||||
}
|
|
||||||
# if defined(HAVE_SYS_WEAK_ALIAS_ATTRIBUTE)
|
|
||||||
char *sudo_warn_strerror_v1(int errnum)
|
|
||||||
__attribute__((weak, alias("sudo_warn_strerror_weak")));
|
|
||||||
# elif defined(HAVE_SYS_WEAK_ALIAS_PRAGMA)
|
|
||||||
# pragma weak sudo_warn_strerror_v1 = sudo_warn_strerror_weak
|
|
||||||
# elif defined(HAVE_SYS_WEAK_ALIAS_HPSECONDARY)
|
|
||||||
# pragma _HP_SECONDARY_DEF sudo_warn_strerror_weak sudo_warn_strerror_v1
|
|
||||||
# elif defined(HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE)
|
|
||||||
# pragma _CRI duplicate sudo_warn_strerror_v1 as sudo_warn_strerror_weak
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif /* HAVE_SYS_WEAK_ALIAS */
|
|
@@ -96,4 +96,5 @@ sudo_vwarn_nodebug_v1
|
|||||||
sudo_vwarnx_nodebug_v1
|
sudo_vwarnx_nodebug_v1
|
||||||
sudo_warn_nodebug_v1
|
sudo_warn_nodebug_v1
|
||||||
sudo_warn_set_conversation_v1
|
sudo_warn_set_conversation_v1
|
||||||
|
sudo_warn_set_locale_func_v1
|
||||||
sudo_warnx_nodebug_v1
|
sudo_warnx_nodebug_v1
|
||||||
|
@@ -1,338 +0,0 @@
|
|||||||
# ===========================================================================
|
|
||||||
# http://www.gnu.org/software/autoconf-archive/ax_sys_weak_alias.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_SYS_WEAK_ALIAS
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Determines whether weak aliases are supported on the system, and if so,
|
|
||||||
# what scheme is used to declare them. Also checks to see if aliases can
|
|
||||||
# cross object file boundaries, as some systems don't permit them to.
|
|
||||||
#
|
|
||||||
# Most systems permit something called a "weak alias" or "weak symbol."
|
|
||||||
# These aliases permit a library to provide a stub form of a routine
|
|
||||||
# defined in another library, thus allowing the first library to operate
|
|
||||||
# even if the other library is not linked. This macro will check for
|
|
||||||
# support of weak aliases, figure out what schemes are available, and
|
|
||||||
# determine some characteristics of the weak alias support -- primarily,
|
|
||||||
# whether a weak alias declared in one object file may be referenced from
|
|
||||||
# another object file.
|
|
||||||
#
|
|
||||||
# There are four known schemes of declaring weak symbols; each scheme is
|
|
||||||
# checked in turn, and the first one found is prefered. Note that only one
|
|
||||||
# of the mentioned preprocessor macros will be defined!
|
|
||||||
#
|
|
||||||
# 1. #pragma weak
|
|
||||||
#
|
|
||||||
# This scheme is in use by many compilers other than the GNU C compiler.
|
|
||||||
# It is also particularly easy to use, and fairly portable -- well, as
|
|
||||||
# portable as these things get. If this scheme is detected first, the
|
|
||||||
# preprocessor macro HAVE_SYS_WEAK_ALIAS_PRAGMA will be defined to 1. This
|
|
||||||
# scheme is used as in the following code fragment:
|
|
||||||
#
|
|
||||||
# extern void weakf(int c);
|
|
||||||
# #pragma weak weakf = __weakf
|
|
||||||
# void __weakf(int c)
|
|
||||||
# {
|
|
||||||
# /* Function definition... */
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# 2. #pragma _HP_SECONDARY_DEF
|
|
||||||
#
|
|
||||||
# This scheme appears to be in use by the HP compiler. As it is rather
|
|
||||||
# specialized, this is one of the last schemes checked. If it is the first
|
|
||||||
# one detected, the preprocessor macro HAVE_SYS_WEAK_ALIAS_HPSECONDARY
|
|
||||||
# will be defined to 1. This scheme is used as in the following code
|
|
||||||
# fragment:
|
|
||||||
#
|
|
||||||
# extern void weakf(int c);
|
|
||||||
# #pragma _HP_SECONDARY_DEF __weakf weakf
|
|
||||||
# void __weakf(int c)
|
|
||||||
# {
|
|
||||||
# /* Function definition... */
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# 3. #pragma _CRI duplicate
|
|
||||||
#
|
|
||||||
# This scheme appears to be in use by the Cray compiler. As it is rather
|
|
||||||
# specialized, it too is one of the last schemes checked. If it is the
|
|
||||||
# first one detected, the preprocessor macro
|
|
||||||
# HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE will be defined to 1. This scheme is
|
|
||||||
# used as in the following code fragment:
|
|
||||||
#
|
|
||||||
# extern void weakf(int c);
|
|
||||||
# #pragma _CRI duplicate weakf as __weakf
|
|
||||||
# void __weakf(int c)
|
|
||||||
# {
|
|
||||||
# /* Function definition... */
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# 4. Function attributes
|
|
||||||
#
|
|
||||||
# This scheme was first introduced by the GNU C compiler, and attaches
|
|
||||||
# attributes to particular functions. However, since some compilers
|
|
||||||
# simply ignore unsupported attributes, this scheme is tried last.
|
|
||||||
# If this scheme is detected, the preprocessor macro
|
|
||||||
# HAVE_SYS_WEAK_ALIAS_ATTRIBUTE will be defined to 1.
|
|
||||||
# This scheme is used as in the following code fragment:
|
|
||||||
#
|
|
||||||
# void __weakf(int c)
|
|
||||||
# {
|
|
||||||
# /* Function definition... */
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# void weakf(int c) __attribute__((weak, alias("__weakf")));
|
|
||||||
#
|
|
||||||
# In addition to the preprocessor macros listed above, if any scheme is
|
|
||||||
# found, the preprocessor macro HAVE_SYS_WEAK_ALIAS will also be defined
|
|
||||||
# to 1.
|
|
||||||
#
|
|
||||||
# Once a weak aliasing scheme has been found, a check will be performed to
|
|
||||||
# see if weak aliases are honored across object file boundaries. If they
|
|
||||||
# are, the HAVE_SYS_WEAK_ALIAS_CROSSFILE preprocessor macro is defined to
|
|
||||||
# 1.
|
|
||||||
#
|
|
||||||
# This Autoconf macro also makes two substitutions. The first, WEAK_ALIAS,
|
|
||||||
# contains the name of the scheme found (one of "attribute", "pragma",
|
|
||||||
# "hpsecondary", or "criduplicate"), or "no" if no weak aliasing scheme
|
|
||||||
# was found. The second, WEAK_ALIAS_CROSSFILE, is set to "yes" or "no"
|
|
||||||
# depending on whether or not weak aliases may cross object file
|
|
||||||
# boundaries.
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Kevin L. Mitchell <klmitch@mit.edu>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
|
||||||
# warranty.
|
|
||||||
|
|
||||||
#serial 6
|
|
||||||
|
|
||||||
AU_ALIAS([KLM_SYS_WEAK_ALIAS], [AX_SYS_WEAK_ALIAS])
|
|
||||||
AC_DEFUN([AX_SYS_WEAK_ALIAS], [
|
|
||||||
# starting point: no aliasing scheme yet...
|
|
||||||
ax_sys_weak_alias=no
|
|
||||||
|
|
||||||
# Figure out what kind of aliasing may be supported...
|
|
||||||
_AX_SYS_WEAK_ALIAS_PRAGMA
|
|
||||||
_AX_SYS_WEAK_ALIAS_HPSECONDARY
|
|
||||||
_AX_SYS_WEAK_ALIAS_CRIDUPLICATE
|
|
||||||
_AX_SYS_WEAK_ALIAS_ATTRIBUTE
|
|
||||||
|
|
||||||
# Do we actually support aliasing?
|
|
||||||
AC_CACHE_CHECK([how to create weak aliases with $CC],
|
|
||||||
[ax_cv_sys_weak_alias],
|
|
||||||
[ax_cv_sys_weak_alias=$ax_sys_weak_alias])
|
|
||||||
|
|
||||||
# OK, set a #define
|
|
||||||
AS_IF([test $ax_cv_sys_weak_alias != no], [
|
|
||||||
AC_DEFINE([HAVE_SYS_WEAK_ALIAS], 1,
|
|
||||||
[Define this if your system can create weak aliases])
|
|
||||||
])
|
|
||||||
|
|
||||||
# Can aliases cross object file boundaries?
|
|
||||||
_AX_SYS_WEAK_ALIAS_CROSSFILE
|
|
||||||
|
|
||||||
# OK, remember the results
|
|
||||||
AC_SUBST([WEAK_ALIAS], [$ax_cv_sys_weak_alias])
|
|
||||||
AC_SUBST([WEAK_ALIAS_CROSSFILE], [$ax_cv_sys_weak_alias_crossfile])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([_AX_SYS_WEAK_ALIAS_ATTRIBUTE],
|
|
||||||
[ # Test whether compiler accepts __attribute__ form of weak aliasing
|
|
||||||
AC_CACHE_CHECK([whether $CC accepts function __attribute__((weak,alias()))],
|
|
||||||
[ax_cv_sys_weak_alias_attribute], [
|
|
||||||
# We add -Werror if it's gcc to force an error exit if the weak attribute
|
|
||||||
# isn't understood
|
|
||||||
AS_IF([test "$GCC" = yes], [
|
|
||||||
save_CFLAGS=$CFLAGS
|
|
||||||
CFLAGS=-Werror])
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
AC_LINK_IFELSE([
|
|
||||||
AC_LANG_PROGRAM([
|
|
||||||
void __weakf(int c) {}
|
|
||||||
void weakf(int c) __attribute__((weak, alias("__weakf")));],
|
|
||||||
[weakf(0)])],
|
|
||||||
[ax_cv_sys_weak_alias_attribute=yes],
|
|
||||||
[ax_cv_sys_weak_alias_attribute=no])
|
|
||||||
|
|
||||||
# Restore original CFLAGS
|
|
||||||
AS_IF([test "$GCC" = yes], [
|
|
||||||
CFLAGS=$save_CFLAGS])
|
|
||||||
])
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
AS_IF([test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_attribute = yes], [
|
|
||||||
ax_sys_weak_alias=attribute
|
|
||||||
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_ATTRIBUTE], 1,
|
|
||||||
[Define this if weak aliases may be created with __attribute__])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([_AX_SYS_WEAK_ALIAS_PRAGMA],
|
|
||||||
[ # Test whether compiler accepts #pragma form of weak aliasing
|
|
||||||
AC_CACHE_CHECK([whether $CC supports @%:@pragma weak],
|
|
||||||
[ax_cv_sys_weak_alias_pragma], [
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
AC_LINK_IFELSE([
|
|
||||||
AC_LANG_PROGRAM([
|
|
||||||
extern void weakf(int c);
|
|
||||||
@%:@pragma weak weakf = __weakf
|
|
||||||
void __weakf(int c) {}],
|
|
||||||
[weakf(0)])],
|
|
||||||
[ax_cv_sys_weak_alias_pragma=yes],
|
|
||||||
[ax_cv_sys_weak_alias_pragma=no])
|
|
||||||
])
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
AS_IF([test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_pragma = yes], [
|
|
||||||
ax_sys_weak_alias=pragma
|
|
||||||
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_PRAGMA], 1,
|
|
||||||
[Define this if weak aliases may be created with @%:@pragma weak])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([_AX_SYS_WEAK_ALIAS_HPSECONDARY],
|
|
||||||
[ # Test whether compiler accepts _HP_SECONDARY_DEF pragma from HP...
|
|
||||||
AC_CACHE_CHECK([whether $CC supports @%:@pragma _HP_SECONDARY_DEF],
|
|
||||||
[ax_cv_sys_weak_alias_hpsecondary], [
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
AC_LINK_IFELSE([
|
|
||||||
AC_LANG_PROGRAM([
|
|
||||||
extern void weakf(int c);
|
|
||||||
@%:@pragma _HP_SECONDARY_DEF __weakf weakf
|
|
||||||
void __weakf(int c) {}],
|
|
||||||
[weakf(0)])],
|
|
||||||
[ax_cv_sys_weak_alias_hpsecondary=yes],
|
|
||||||
[ax_cv_sys_weak_alias_hpsecondary=no])
|
|
||||||
])
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
AS_IF([test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_hpsecondary = yes], [
|
|
||||||
ax_sys_weak_alias=hpsecondary
|
|
||||||
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_HPSECONDARY], 1,
|
|
||||||
[Define this if weak aliases may be created with @%:@pragma _HP_SECONDARY_DEF])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([_AX_SYS_WEAK_ALIAS_CRIDUPLICATE],
|
|
||||||
[ # Test whether compiler accepts "_CRI duplicate" pragma from Cray
|
|
||||||
AC_CACHE_CHECK([whether $CC supports @%:@pragma _CRI duplicate],
|
|
||||||
[ax_cv_sys_weak_alias_criduplicate], [
|
|
||||||
|
|
||||||
# Try linking with a weak alias...
|
|
||||||
AC_LINK_IFELSE([
|
|
||||||
AC_LANG_PROGRAM([
|
|
||||||
extern void weakf(int c);
|
|
||||||
@%:@pragma _CRI duplicate weakf as __weakf
|
|
||||||
void __weakf(int c) {}],
|
|
||||||
[weakf(0)])],
|
|
||||||
[ax_cv_sys_weak_alias_criduplicate=yes],
|
|
||||||
[ax_cv_sys_weak_alias_criduplicate=no])
|
|
||||||
])
|
|
||||||
|
|
||||||
# What was the result of the test?
|
|
||||||
AS_IF([test $ax_sys_weak_alias = no &&
|
|
||||||
test $ax_cv_sys_weak_alias_criduplicate = yes], [
|
|
||||||
ax_sys_weak_alias=criduplicate
|
|
||||||
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE], 1,
|
|
||||||
[Define this if weak aliases may be created with @%:@pragma _CRI duplicate])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Note: This macro is modeled closely on AC_LINK_IFELSE, and in fact
|
|
||||||
dnl depends on some implementation details of that macro, particularly
|
|
||||||
dnl its use of _AC_MSG_LOG_CONFTEST to log the failed test program and
|
|
||||||
dnl its use of ac_link for running the linker.
|
|
||||||
AC_DEFUN([_AX_SYS_WEAK_ALIAS_CROSSFILE],
|
|
||||||
[ # Check to see if weak aliases can cross object file boundaries
|
|
||||||
AC_CACHE_CHECK([whether $CC supports weak aliases across object file boundaries],
|
|
||||||
[ax_cv_sys_weak_alias_crossfile], [
|
|
||||||
AS_IF([test $ax_cv_sys_weak_alias = no],
|
|
||||||
[ax_cv_sys_weak_alias_crossfile=no], [
|
|
||||||
dnl Must build our own test files...
|
|
||||||
# conftest1 contains our weak alias definition...
|
|
||||||
cat >conftest1.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
|
||||||
_ACEOF
|
|
||||||
cat confdefs.h >>conftest1.$ac_ext
|
|
||||||
cat >>conftest1.$ac_ext <<_ACEOF
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
@%:@ifndef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
|
|
||||||
extern void weakf(int c);
|
|
||||||
@%:@endif
|
|
||||||
@%:@if defined(HAVE_SYS_WEAK_ALIAS_PRAGMA)
|
|
||||||
@%:@pragma weak weakf = __weakf
|
|
||||||
@%:@elif defined(HAVE_SYS_WEAK_ALIAS_HPSECONDARY)
|
|
||||||
@%:@pragma _HP_SECONDARY_DEF __weakf weakf
|
|
||||||
@%:@elif defined(HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE)
|
|
||||||
@%:@pragma _CRI duplicate weakf as __weakf
|
|
||||||
@%:@endif
|
|
||||||
void __weakf(int c) {}
|
|
||||||
@%:@ifdef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
|
|
||||||
void weakf(int c) __attribute((weak, alias("__weakf")));
|
|
||||||
@%:@endif
|
|
||||||
_ACEOF
|
|
||||||
# And conftest2 contains our main routine that calls it
|
|
||||||
cat >conftest2.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
|
||||||
_ACEOF
|
|
||||||
cat confdefs.h >> conftest2.$ac_ext
|
|
||||||
cat >>conftest2.$ac_ext <<_ACEOF
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
extern void weakf(int c);
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
weakf(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
# We must remove the object files (if any) ourselves...
|
|
||||||
rm -f conftest2.$ac_objext conftest$ac_exeext
|
|
||||||
|
|
||||||
# Change ac_link to compile *2* files together
|
|
||||||
save_aclink=$ac_link
|
|
||||||
ac_link=`echo "$ac_link" | \
|
|
||||||
sed -e 's/conftest\(\.\$ac_ext\)/conftest1\1 conftest2\1/'`
|
|
||||||
dnl Substitute our own routine for logging the conftest
|
|
||||||
m4_pushdef([_AC_MSG_LOG_CONFTEST],
|
|
||||||
[echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD
|
|
||||||
echo ">>> conftest1.$ac_ext" >&AS_MESSAGE_LOG_FD
|
|
||||||
sed "s/^/| /" conftest1.$ac_ext >&AS_MESSAGE_LOG_FD
|
|
||||||
echo ">>> conftest2.$ac_ext" >&AS_MESSAGE_LOG_FD
|
|
||||||
sed "s/^/| /" conftest2.$ac_ext >&AS_MESSAGE_LOG_FD
|
|
||||||
])dnl
|
|
||||||
# Since we created the files ourselves, don't use SOURCE argument
|
|
||||||
AC_LINK_IFELSE(, [ax_cv_sys_weak_alias_crossfile=yes],
|
|
||||||
[ax_cv_sys_weak_alias_crossfile=no])
|
|
||||||
dnl Restore _AC_MSG_LOG_CONFTEST
|
|
||||||
m4_popdef([_AC_MSG_LOG_CONFTEST])dnl
|
|
||||||
# Restore ac_link
|
|
||||||
ac_link=$save_aclink
|
|
||||||
|
|
||||||
# We must remove the object files (if any) and C files ourselves...
|
|
||||||
rm -f conftest1.$ac_ext conftest2.$ac_ext \
|
|
||||||
conftest1.$ac_objext conftest2.$ac_objext
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
# What were the results of the test?
|
|
||||||
AS_IF([test $ax_cv_sys_weak_alias_crossfile = yes], [
|
|
||||||
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_CROSSFILE], 1,
|
|
||||||
[Define this if weak aliases in other files are honored])
|
|
||||||
])
|
|
||||||
])
|
|
2
mkdep.pl
2
mkdep.pl
@@ -65,7 +65,7 @@ sub mkdep {
|
|||||||
|
|
||||||
# Expand some configure bits
|
# Expand some configure bits
|
||||||
$makefile =~ s:\@DEV\@::g;
|
$makefile =~ s:\@DEV\@::g;
|
||||||
$makefile =~ s:\@COMMON_OBJS\@:aix.lo event_poll.lo event_select.lo locale_weak.lo:;
|
$makefile =~ s:\@COMMON_OBJS\@:aix.lo event_poll.lo event_select.lo:;
|
||||||
$makefile =~ s:\@SUDO_OBJS\@:openbsd.o preload.o selinux.o sesh.o solaris.o sudo_noexec.lo:;
|
$makefile =~ s:\@SUDO_OBJS\@:openbsd.o preload.o selinux.o sesh.o solaris.o sudo_noexec.lo:;
|
||||||
$makefile =~ s:\@SUDOERS_OBJS\@:bsm_audit.lo linux_audit.lo ldap.lo solaris_audit.lo sssd.lo:;
|
$makefile =~ s:\@SUDOERS_OBJS\@:bsm_audit.lo linux_audit.lo ldap.lo solaris_audit.lo sssd.lo:;
|
||||||
# XXX - fill in AUTH_OBJS from contents of the auth dir instead
|
# XXX - fill in AUTH_OBJS from contents of the auth dir instead
|
||||||
|
@@ -985,9 +985,10 @@ sudo_nss.lo: $(srcdir)/sudo_nss.c $(devdir)/def_data.h \
|
|||||||
$(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
|
$(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
|
||||||
$(top_builddir)/pathnames.h
|
$(top_builddir)/pathnames.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_nss.c
|
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_nss.c
|
||||||
sudo_printf.o: $(srcdir)/sudo_printf.c $(incdir)/sudo_compat.h \
|
sudo_printf.o: $(srcdir)/sudo_printf.c $(incdir)/compat/stdbool.h \
|
||||||
$(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \
|
$(incdir)/sudo_compat.h $(incdir)/sudo_debug.h \
|
||||||
$(incdir)/sudo_queue.h $(top_builddir)/config.h
|
$(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
|
||||||
|
$(top_builddir)/config.h
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_printf.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_printf.c
|
||||||
sudoers.lo: $(srcdir)/sudoers.c $(devdir)/def_data.h \
|
sudoers.lo: $(srcdir)/sudoers.c $(devdir)/def_data.h \
|
||||||
$(incdir)/compat/getaddrinfo.h $(incdir)/compat/stdbool.h \
|
$(incdir)/compat/getaddrinfo.h $(incdir)/compat/stdbool.h \
|
||||||
|
@@ -110,30 +110,10 @@ sudoers_setlocale(int newlocale, int *prevlocale)
|
|||||||
return res ? true : false;
|
return res ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBINTL_H
|
bool
|
||||||
char *
|
sudoers_warn_setlocale(bool restore, int *cookie)
|
||||||
sudo_warn_gettext_v1(const char *msgid)
|
|
||||||
{
|
{
|
||||||
int warning_locale;
|
if (restore)
|
||||||
char *msg;
|
return sudoers_setlocale(*cookie, NULL);
|
||||||
|
return sudoers_setlocale(SUDOERS_LOCALE_USER, cookie);
|
||||||
sudoers_setlocale(SUDOERS_LOCALE_USER, &warning_locale);
|
|
||||||
msg = gettext(msgid);
|
|
||||||
sudoers_setlocale(warning_locale, NULL);
|
|
||||||
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_LIBINTL_H */
|
|
||||||
|
|
||||||
char *
|
|
||||||
sudo_warn_strerror_v1(int errnum)
|
|
||||||
{
|
|
||||||
int warning_locale;
|
|
||||||
char *errmsg;
|
|
||||||
|
|
||||||
sudoers_setlocale(SUDOERS_LOCALE_USER, &warning_locale);
|
|
||||||
errmsg = strerror(errnum);
|
|
||||||
sudoers_setlocale(warning_locale, NULL);
|
|
||||||
|
|
||||||
return errmsg;
|
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,7 @@ extern int NewArgc;
|
|||||||
extern char **NewArgv;
|
extern char **NewArgv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool sudoers_warn_setlocale(bool restore, int *cookie);
|
||||||
bool sudoers_setlocale(int newlocale, int *prevlocale);
|
bool sudoers_setlocale(int newlocale, int *prevlocale);
|
||||||
int sudoers_getlocale(void);
|
int sudoers_getlocale(void);
|
||||||
int audit_success(int argc, char *argv[]);
|
int audit_success(int argc, char *argv[]);
|
||||||
|
@@ -228,6 +228,8 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
|||||||
volatile int rval = true;
|
volatile int rval = true;
|
||||||
debug_decl(sudoers_policy_main, SUDOERS_DEBUG_PLUGIN)
|
debug_decl(sudoers_policy_main, SUDOERS_DEBUG_PLUGIN)
|
||||||
|
|
||||||
|
sudo_warn_set_locale_func(sudoers_warn_setlocale);
|
||||||
|
|
||||||
/* Is root even allowed to run sudo? */
|
/* Is root even allowed to run sudo? */
|
||||||
if (user_uid == 0 && !def_root_sudo) {
|
if (user_uid == 0 && !def_root_sudo) {
|
||||||
/* Not an audit event. */
|
/* Not an audit event. */
|
||||||
@@ -553,6 +555,8 @@ done:
|
|||||||
sudo_endpwent();
|
sudo_endpwent();
|
||||||
sudo_endgrent();
|
sudo_endgrent();
|
||||||
|
|
||||||
|
sudo_warn_set_locale_func(NULL);
|
||||||
|
|
||||||
debug_return_int(rval);
|
debug_return_int(rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -105,9 +105,9 @@ OBJS = conversation.o env_hooks.o exec.o exec_common.o exec_pty.o \
|
|||||||
preserve_fds.o signal.o sudo.o sudo_edit.o tgetpass.o ttyname.o \
|
preserve_fds.o signal.o sudo.o sudo_edit.o tgetpass.o ttyname.o \
|
||||||
utmp.o @SUDO_OBJS@
|
utmp.o @SUDO_OBJS@
|
||||||
|
|
||||||
SESH_OBJS = sesh.o exec_common.o locale_stub.o
|
SESH_OBJS = sesh.o exec_common.o
|
||||||
|
|
||||||
CHECK_TTYNAME_OBJS = check_ttyname.o locale_stub.o ttyname.o
|
CHECK_TTYNAME_OBJS = check_ttyname.o ttyname.o
|
||||||
|
|
||||||
LIBOBJDIR = $(top_builddir)/@ac_config_libobj_dir@/
|
LIBOBJDIR = $(top_builddir)/@ac_config_libobj_dir@/
|
||||||
|
|
||||||
@@ -287,10 +287,6 @@ load_plugins.o: $(srcdir)/load_plugins.c $(incdir)/compat/stdbool.h \
|
|||||||
$(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \
|
$(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \
|
||||||
$(top_builddir)/pathnames.h
|
$(top_builddir)/pathnames.h
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/load_plugins.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/load_plugins.c
|
||||||
locale_stub.o: $(srcdir)/locale_stub.c $(incdir)/sudo_compat.h \
|
|
||||||
$(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
|
|
||||||
$(top_builddir)/config.h
|
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/locale_stub.c
|
|
||||||
net_ifs.o: $(srcdir)/net_ifs.c $(incdir)/compat/stdbool.h \
|
net_ifs.o: $(srcdir)/net_ifs.c $(incdir)/compat/stdbool.h \
|
||||||
$(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
|
$(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
|
||||||
$(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
|
$(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
|
||||||
|
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2013-2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#if !defined(HAVE_SYS_WEAK_ALIAS)
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef HAVE_STRING_H
|
|
||||||
# include <string.h>
|
|
||||||
#endif /* HAVE_STRING_H */
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif /* HAVE_STRINGS_H */
|
|
||||||
|
|
||||||
#define DEFAULT_TEXT_DOMAIN "sudo"
|
|
||||||
#include "sudo_gettext.h" /* must be included before sudo_compat.h */
|
|
||||||
|
|
||||||
#include "sudo_compat.h"
|
|
||||||
#include "sudo_fatal.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBINTL_H
|
|
||||||
/* No need to swap locales in the front end. */
|
|
||||||
char *
|
|
||||||
sudo_warn_gettext_v1(const char *msgid)
|
|
||||||
{
|
|
||||||
return gettext(msgid);
|
|
||||||
}
|
|
||||||
#endif /* HAVE_LIBINTL_H */
|
|
||||||
|
|
||||||
/* No need to swap locales in the front end. */
|
|
||||||
char *
|
|
||||||
sudo_warn_strerror_v1(int errnum)
|
|
||||||
{
|
|
||||||
return strerror(errnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !HAVE_SYS_WEAK_ALIAS */
|
|
Reference in New Issue
Block a user