Add exported libsudo_util functions to util.exp and mark in headers

using __dso_public.
This commit is contained in:
Todd C. Miller
2014-06-26 15:51:15 -06:00
parent 87c2fe5a31
commit 088edcb6f5
44 changed files with 537 additions and 295 deletions

View File

@@ -36,9 +36,21 @@ libexecdir = @libexecdir@
datarootdir = @datarootdir@
localstatedir = @localstatedir@
# File extension, mode and map file to use for shared libraries/objects
soext = @SOEXT@
shlib_mode = @SHLIB_MODE@
shlib_exp = $(srcdir)/util.exp
shlib_map = util.map
shlib_opt = util.opt
# Compiler & tools to use
CC = @CC@
LIBTOOL = @LIBTOOL@
SED = @SED@
# Our install program supports extra flags...
INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
INSTALL_OWNER = -o $(install_uid) -g $(install_gid)
# C preprocessor flags
CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(top_srcdir) @CPPFLAGS@
@@ -46,6 +58,10 @@ CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(top_srcdir) @CPPFLAGS@
# Usually -O and/or -g
CFLAGS = @CFLAGS@
# Flags to pass to the link stage
LDFLAGS = @LDFLAGS@
LT_LDFLAGS = @LT_LDFLAGS@ @LT_LDMAP@ @LT_LDOPT@ @LT_LDEXPORTS@
# PIE flags
PIE_CFLAGS = @PIE_CFLAGS@
PIE_LDFLAGS = @PIE_LDFLAGS@
@@ -54,6 +70,9 @@ PIE_LDFLAGS = @PIE_LDFLAGS@
SSP_CFLAGS = @SSP_CFLAGS@
SSP_LDFLAGS = @SSP_LDFLAGS@
# Libtool style shard library version
SHLIB_VERSION = 0:0:0
# cppcheck options, usually set in the top-level Makefile
CPPCHECK_OPTS = -q --force --enable=warning,performance,portability --suppress=constStatement --error-exitcode=1 --inline-suppr -U__cplusplus -UQUAD_MAX -UQUAD_MIN -UUQUAD_MAX -U_POSIX_HOST_NAME_MAX -U_POSIX_PATH_MAX
@@ -62,6 +81,10 @@ TEST_PROGS = atofoo_test conf_test hltq_test parseln_test @COMPAT_TEST_PROGS@
TEST_LIBS = @LIBS@ @LIBINTL@
TEST_LDFLAGS = @LDFLAGS@
# User and group ids the installed files should be "owned" by
install_uid = 0
install_gid = 0
# OS dependent defines
DEFS = @OSDEFS@ -D_PATH_SUDO_CONF=\"$(sysconfdir)/sudo.conf\"
@@ -85,6 +108,10 @@ CONF_TEST_OBJS = conf_test.lo locale_stub.lo
HLTQ_TEST_OBJS = hltq_test.lo locale_stub.lo
FNM_TEST_OBJS = fnm_test.lo locale_stub.lo
GLOBTEST_OBJS = globtest.lo locale_stub.lo
all: libsudo_util.la
Makefile: $(srcdir)/Makefile.in
@@ -98,8 +125,14 @@ Makefile: $(srcdir)/Makefile.in
.c.lo:
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $<
libsudo_util.la: $(LTOBJS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(LTOBJS) -no-install
$(shlib_map): $(shlib_exp)
@awk 'BEGIN { print "{\n\tglobal:" } { print "\t\t"$$0";" } END { print "\tlocal:\n\t\t*;\n};" }' $(shlib_exp) > $@
$(shlib_opt): $(shlib_exp)
@$(SED) 's/^/+e /' $(shlib_exp) > $@
libsudo_util.la: $(LTOBJS) @LT_LDDEP@
$(LIBTOOL) --mode=link $(CC) -o $@ $(LDFLAGS) $(LT_LDFLAGS) $(LTOBJS) -version-info $(SHLIB_VERSION) -rpath $(libexecdir)/sudo @LIBDL@
siglist.c: mksiglist
./mksiglist > $@
@@ -113,12 +146,6 @@ mksiglist: $(srcdir)/mksiglist.c $(srcdir)/mksiglist.h $(incdir)/missing.h $(top
mksigname: $(srcdir)/mksigname.c $(srcdir)/mksigname.h $(incdir)/missing.h $(top_builddir)/config.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/mksigname.c -o $@
fnm_test: fnm_test.o libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ fnm_test.o libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS)
globtest: globtest.o libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ globtest.o libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS)
$(srcdir)/mksiglist.h: $(srcdir)/siglist.in
@if [ -n "$(DEVEL)" ]; then \
awk 'BEGIN {print "/* public domain */\n"} /^ [A-Z]/ {printf("#ifdef SIG%s\n if (sudo_sys_siglist[SIG%s] == NULL)\n\tsudo_sys_siglist[SIG%s] = \"%s\";\n#endif\n", $$1, $$1, $$1, substr($$0, 13))}' < $(srcdir)/siglist.in > $@; \
@@ -130,22 +157,32 @@ $(srcdir)/mksigname.h: $(srcdir)/siglist.in
fi
atofoo_test: $(ATOFOO_TEST_OBJS) libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ $(ATOFOO_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(ATOFOO_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS) -no-fast-install
conf_test: $(CONF_TEST_OBJS) libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ $(CONF_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(CONF_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS) -no-fast-install
parseln_test: $(PARSELN_TEST_OBJS) libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ $(PARSELN_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
fnm_test: $(FNM_TEST_OBJS) libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ $(FNM_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS) -no-fast-install
globtest: $(GLOBTEST_OBJS) libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ $(GLOBTEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS) -no-fast-install
hltq_test: $(HLTQ_TEST_OBJS) libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ $(HLTQ_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(HLTQ_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS) -no-fast-install
parseln_test: $(PARSELN_TEST_OBJS) libsudo_util.la
$(LIBTOOL) --mode=link $(CC) -o $@ $(PARSELN_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS) -no-fast-install
pre-install:
install:
install: install-dirs
if [ X"$(soext)" != X"" ]; then \
INSTALL_BACKUP='~' $(LIBTOOL) --quiet --mode=install $(INSTALL) $(INSTALL_OWNER) libsudo_util.la $(DESTDIR)$(libexecdir)/sudo; \
fi
install-dirs:
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)/sudo
install-binaries:
@@ -168,7 +205,7 @@ check: $(TEST_PROGS)
./fnm_test $(srcdir)/regress/fnmatch/fnm_test.in || rval=`expr $$rval + $$?`; \
fi; \
if test -f globtest; then \
mkdir -p `sed 's@/[^/]*$$@@' $(srcdir)/regress/glob/files | sort -u`; \
mkdir -p `$(SED) 's@/[^/]*$$@@' $(srcdir)/regress/glob/files | sort -u`; \
touch `cat $(srcdir)/regress/glob/files`; \
chmod 0755 `grep '/r[^/]*$$' $(srcdir)/regress/glob/files`; \
chmod 0444 `grep '/s[^/]*$$' $(srcdir)/regress/glob/files`; \
@@ -305,9 +342,10 @@ fmt_string.lo: $(srcdir)/fmt_string.c $(incdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/sudo_debug.h \
$(incdir)/sudo_util.h $(top_builddir)/config.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fmt_string.c
fnm_test.o: $(srcdir)/regress/fnmatch/fnm_test.c $(incdir)/compat/fnmatch.h \
$(incdir)/missing.h $(top_builddir)/config.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/fnmatch/fnm_test.c
fnm_test.lo: $(srcdir)/regress/fnmatch/fnm_test.c $(incdir)/compat/fnmatch.h \
$(incdir)/missing.h $(top_builddir)/config.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/fnmatch/fnm_test.c
fnm_test.o: fnm_test.lo
fnmatch.lo: $(srcdir)/fnmatch.c $(incdir)/compat/charclass.h \
$(incdir)/compat/fnmatch.h $(incdir)/missing.h \
$(top_builddir)/config.h
@@ -334,9 +372,10 @@ gidlist.lo: $(srcdir)/gidlist.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \
glob.lo: $(srcdir)/glob.c $(incdir)/compat/charclass.h $(incdir)/compat/glob.h \
$(incdir)/missing.h $(top_builddir)/config.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/glob.c
globtest.o: $(srcdir)/regress/glob/globtest.c $(incdir)/compat/glob.h \
$(incdir)/missing.h $(top_builddir)/config.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/glob/globtest.c
globtest.lo: $(srcdir)/regress/glob/globtest.c $(incdir)/compat/glob.h \
$(incdir)/missing.h $(top_builddir)/config.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/glob/globtest.c
globtest.o: globtest.lo
hltq_test.lo: $(srcdir)/regress/tailq/hltq_test.c $(incdir)/compat/stdbool.h \
$(incdir)/fatal.h $(incdir)/missing.h $(incdir)/queue.h \
$(incdir)/sudo_util.h $(top_builddir)/config.h
@@ -369,7 +408,7 @@ parseln_test.lo: $(srcdir)/regress/sudo_parseln/parseln_test.c \
progname.lo: $(srcdir)/progname.c $(incdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/sudo_util.h $(top_builddir)/config.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/progname.c
pw_dup.lo: $(srcdir)/pw_dup.c $(top_builddir)/config.h
pw_dup.lo: $(srcdir)/pw_dup.c $(incdir)/missing.h $(top_builddir)/config.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/pw_dup.c
secure_path.lo: $(srcdir)/secure_path.c $(incdir)/missing.h \
$(incdir)/secure_path.h $(incdir)/sudo_debug.h \

View File

@@ -43,7 +43,7 @@ struct sudo_fatal_callback {
};
SLIST_HEAD(sudo_fatal_callback_list, sudo_fatal_callback);
sigjmp_buf fatal_jmp;
__dso_public sigjmp_buf fatal_jmp;
static bool setjmp_enabled = false;
static struct sudo_fatal_callback_list callbacks;

View File

@@ -59,8 +59,8 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#include "compat/getaddrinfo.h"
#include "missing.h"
#include "compat/getaddrinfo.h"
/* We need access to h_errno to map errors from gethostbyname. */
#ifndef HAVE_DECL_H_ERRNO

View File

@@ -45,6 +45,8 @@
#endif /* HAVE_MALLOC_H && !STDC_HEADERS */
#include <pwd.h>
#include "missing.h"
#define PW_SIZE(name, size) \
do { \
if (pw->name) { \

View File

@@ -14,14 +14,15 @@
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif /* HAVE_STRINGS_H */
#include "missing.h"
#ifdef HAVE_FNMATCH
# include <fnmatch.h>
#else
# include "compat/fnmatch.h"
#endif
#include "missing.h"
__dso_public int main(int argc, char *argv[]);
int

View File

@@ -40,8 +40,8 @@
#endif
#include <errno.h>
#include "sudo_dso.h"
#include "missing.h"
#include "sudo_dso.h"
/*
* Pointer for statically compiled symbols.

View File

@@ -33,7 +33,7 @@
#include "sudo_plugin.h"
#include "sudo_debug.h"
int
__dso_public int
_sudo_printf(int msg_type, const char *fmt, ...)
{
va_list ap;
@@ -67,4 +67,4 @@ _sudo_printf(int msg_type, const char *fmt, ...)
return len;
}
sudo_printf_t sudo_printf = _sudo_printf;
__dso_public sudo_printf_t sudo_printf = _sudo_printf;

View File

@@ -69,8 +69,8 @@ static struct termios term, oterm;
static int changed;
/* tgetpass() needs to know the erase and kill chars for cbreak mode. */
int term_erase;
int term_kill;
__dso_public int term_erase;
__dso_public int term_kill;
static volatile sig_atomic_t got_sigttou;

155
lib/util/util.exp Normal file
View File

@@ -0,0 +1,155 @@
SHA224Final
SHA224Init
SHA224Pad
SHA224Transform
SHA224Update
SHA256Final
SHA256Init
SHA256Pad
SHA256Transform
SHA256Update
SHA384Final
SHA384Init
SHA384Pad
SHA384Transform
SHA384Update
SHA512Final
SHA512Init
SHA512Pad
SHA512Transform
SHA512Update
_sudo_printf
aix_prep_user
aix_restoreauthdb
aix_setauthdb
atobool
atoid
atomode
closefrom_fallback
easprintf
ecalloc
emalloc
emallocarray
erealloc
ereallocarray
erecalloc
estrdup
estrndup
evasprintf
fatal_callback_deregister
fatal_callback_register
fatal_disable_setjmp
fatal_enable_setjmp
fatal_jmp
fatal_nodebug
fatalx_nodebug
fmt_string
get_ttysize
getprogname
initprogname
isblank
lbuf_append
lbuf_append_quoted
lbuf_destroy
lbuf_init
lbuf_print
lock_file
parse_gid_list
sudo_asprintf
sudo_clock_gettime
sudo_closefrom
sudo_conf_askpass_path
sudo_conf_debug_flags
sudo_conf_disable_coredump
sudo_conf_group_source
sudo_conf_max_groups
sudo_conf_noexec_path
sudo_conf_plugin_dir_path
sudo_conf_plugins
sudo_conf_probe_interfaces
sudo_conf_read
sudo_conf_sesh_path
sudo_debug_enter
sudo_debug_execve2
sudo_debug_exit
sudo_debug_exit_bool
sudo_debug_exit_int
sudo_debug_exit_long
sudo_debug_exit_ptr
sudo_debug_exit_size_t
sudo_debug_exit_str
sudo_debug_exit_str_masked
sudo_debug_fd_get
sudo_debug_fd_set
sudo_debug_fork
sudo_debug_init
sudo_debug_printf2
sudo_debug_printf_nvm
sudo_debug_vprintf2
sudo_debug_write
sudo_debug_write2
sudo_dso_findsym
sudo_dso_load
sudo_dso_preload_table
sudo_dso_strerror
sudo_dso_unload
sudo_ev_add
sudo_ev_alloc
sudo_ev_base_alloc
sudo_ev_base_free
sudo_ev_del
sudo_ev_free
sudo_ev_get_timeleft
sudo_ev_got_break
sudo_ev_got_exit
sudo_ev_loop
sudo_ev_loopbreak
sudo_ev_loopcontinue
sudo_ev_loopexit
sudo_fnmatch
sudo_freeaddrinfo
sudo_futimes
sudo_gai_strerror
sudo_getaddrinfo
sudo_getcwd
sudo_getgrouplist
sudo_getline
sudo_getopt_long
sudo_getopt_long_only
sudo_glob
sudo_globfree
sudo_inet_pton
sudo_memrchr
sudo_memset_s
sudo_mkdtemp
sudo_mkstemps
sudo_parseln
sudo_printf
sudo_pw_dup
sudo_secure_dir
sudo_secure_file
sudo_setgroups
sudo_sig2str
sudo_snprintf
sudo_strlcat
sudo_strlcpy
sudo_strsignal
sudo_strtonum
sudo_utimes
sudo_vasprintf
sudo_vsnprintf
term_cbreak
term_copy
term_erase
term_kill
term_noecho
term_raw
term_restore
touch
vfatal_nodebug
vfatalx_nodebug
vwarning_nodebug
vwarningx_nodebug
warning_gettext
warning_nodebug
warningx_nodebug