Skip to content

Commit

Permalink
Add exported libsudo_util functions to util.exp and mark in headers
Browse files Browse the repository at this point in the history
using __dso_public.
  • Loading branch information
millert committed Jun 26, 2014
1 parent 87c2fe5 commit 088edcb
Show file tree
Hide file tree
Showing 44 changed files with 537 additions and 295 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -163,6 +163,7 @@ lib/util/sudo_dso.c
lib/util/sudo_printf.c
lib/util/term.c
lib/util/ttysize.c
lib/util/util.exp
lib/util/utimes.c
lib/zlib/Makefile.in
lib/zlib/adler32.c
Expand Down
25 changes: 14 additions & 11 deletions Makefile.in
Expand Up @@ -59,7 +59,10 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@

SHELL = @SHELL@

SED = @SED@

INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
INSTALL_OWNER = -o $(install_uid) -g $(install_gid)

ECHO_N = @ECHO_N@
ECHO_C = @ECHO_C@
Expand Down Expand Up @@ -104,19 +107,19 @@ cppcheck: config.status

install-dirs install-binaries install-includes install-plugin: config.status pre-install
for d in $(SUBDIRS); do \
(cd $$d && exec $(MAKE) $@) && continue; \
(cd $$d && exec $(MAKE) "INSTALL_OWNER=$(INSTALL_OWNER)" $@) && continue; \
exit $$?; \
done

install-doc: config.status ChangeLog
for d in $(SUBDIRS); do \
(cd $$d && exec $(MAKE) $@) && continue; \
(cd $$d && exec $(MAKE) "INSTALL_OWNER=$(INSTALL_OWNER)" $@) && continue; \
exit $$?; \
done

install: config.status ChangeLog pre-install install-nls
for d in $(SUBDIRS); do \
(cd $$d && exec $(MAKE) $@) && continue; \
(cd $$d && exec $(MAKE) "INSTALL_OWNER=$(INSTALL_OWNER)" $@) && continue; \
exit $$?; \
done

Expand Down Expand Up @@ -190,7 +193,7 @@ update-pot:
sudo) tmpfiles=; cfiles="src/*c lib/*/*c";; \
sudoers) \
echo "syntax error" > confstr.sh; \
sed -n -e 's/^badpass_message="/gettext "/p' \
$(SED) -n -e 's/^badpass_message="/gettext "/p' \
-e 's/^passprompt="/gettext "/p' \
-e 's/^mailsub="/gettext "/p' configure.ac \
>> confstr.sh; \
Expand All @@ -204,7 +207,7 @@ update-pot:
rm -f $$pot.tmp; \
else \
printf '/^#$$/+1,$$d\nw\nq\n' | ed - $$pot; \
sed '1,/^#$$/d' $$pot.tmp >> $$pot; \
$(SED) '1,/^#$$/d' $$pot.tmp >> $$pot; \
rm -f $$pot.tmp; \
fi; \
done; \
Expand Down Expand Up @@ -234,14 +237,14 @@ compile-po:
POFILES="$$POFILES $$po"; \
done; \
done; \
echo "all: `echo $$POFILES | sed 's/\.po/.mo/g'`" >> Makefile.$$$$; \
echo "all: `echo $$POFILES | $(SED) 's/\.po/.mo/g'`" >> Makefile.$$$$; \
echo "" >> Makefile.$$$$; \
for po in $$POFILES; do \
mo=`echo $$po | sed 's/po$$/mo/'`; \
mo=`echo $$po | $(SED) 's/po$$/mo/'`; \
echo "$$mo: $$po" >> Makefile.$$$$; \
echo " $(MSGFMT) --statistics -c -o $$mo $$po" >> Makefile.$$$$; \
done; \
make -f Makefile.$$$$; \
$(MAKE) -f Makefile.$$$$; \
rm -f Makefile.$$$$; \
fi

Expand All @@ -251,7 +254,7 @@ install-nls:
for pot in $(POTFILES); do \
podir=`dirname $$pot`; \
domain=`basename $$pot .pot`; \
SUDO_LINGUAS=$${LINGUAS-"`echo $$podir/*.mo|sed 's:'$$podir'/\([^ ]*\).mo:\1:g'`"}; \
SUDO_LINGUAS=$${LINGUAS-"`echo $$podir/*.mo | $(SED) 's:'$$podir'/\([^ ]*\).mo:\1:g'`"}; \
echo $(ECHO_N) "Installing $$domain message catalogs:$(ECHO_C)"; \
for lang in $$SUDO_LINGUAS; do \
test -s $$podir/$$lang.mo || continue; \
Expand Down Expand Up @@ -282,13 +285,13 @@ dist: check-dist force-dist
force-dist: ChangeLog $(srcdir)/MANIFEST
pax -w -x ustar -s '/^/$(PACKAGE_TARNAME)-$(VERSION)\//' \
-f ../$(PACKAGE_TARNAME)-$(VERSION).tar \
`sed 's/[ ].*//' $(srcdir)/MANIFEST`
`$(SED) 's/[ ].*//' $(srcdir)/MANIFEST`
gzip -9f ../$(PACKAGE_TARNAME)-$(VERSION).tar
ls -l ../$(PACKAGE_TARNAME)-$(VERSION).tar.gz

package: sudo.pp
DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
$(MAKE) install DESTDIR=$$DESTDIR && \
$(MAKE) install INSTALL_OWNER= DESTDIR=$$DESTDIR && \
$(SHELL) $(srcdir)/pp $(PPFLAGS) \
--destdir=$$DESTDIR \
$(srcdir)/sudo.pp \
Expand Down
19 changes: 10 additions & 9 deletions doc/Makefile.in
Expand Up @@ -34,6 +34,7 @@ TR = @TRPROG@

# Our install program supports extra flags...
INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
INSTALL_OWNER = -o $(install_uid) -g $(install_gid)

# Where to install things...
prefix = @prefix@
Expand Down Expand Up @@ -305,15 +306,15 @@ install-binaries:
install-includes:

install-doc: install-dirs
for f in $(OTHER_DOCS); do $(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $$f $(DESTDIR)$(docdir); done
@LDAP@for f in $(OTHER_DOCS_LDAP); do $(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $$f $(DESTDIR)$(docdir); done
$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $(mansrcdir)/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $(mansrcdir)/sudo_plugin.$(mantype) $(DESTDIR)$(mandirsu)/sudo_plugin.$(mansectsu)
$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $(mansrcdir)/sudoreplay.$(mantype) $(DESTDIR)$(mandirsu)/sudoreplay.$(mansectsu)
$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $(mansrcdir)/visudo.$(mantype) $(DESTDIR)$(mandirsu)/visudo.$(mansectsu)
$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $(mansrcdir)/sudo.conf.$(mantype) $(DESTDIR)$(mandirform)/sudo.conf.$(mansectform)
$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $(mansrcdir)/sudoers.$(mantype) $(DESTDIR)$(mandirform)/sudoers.$(mansectform)
@LDAP@$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $(mansrcdir)/sudoers.ldap.$(mantype) $(DESTDIR)$(mandirform)/sudoers.ldap.$(mansectform)
for f in $(OTHER_DOCS); do $(INSTALL) $(INSTALL_OWNER) -m 0644 $$f $(DESTDIR)$(docdir); done
@LDAP@for f in $(OTHER_DOCS_LDAP); do $(INSTALL) $(INSTALL_OWNER) -m 0644 $$f $(DESTDIR)$(docdir); done
$(INSTALL) $(INSTALL_OWNER) -m 0644 $(mansrcdir)/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
$(INSTALL) $(INSTALL_OWNER) -m 0644 $(mansrcdir)/sudo_plugin.$(mantype) $(DESTDIR)$(mandirsu)/sudo_plugin.$(mansectsu)
$(INSTALL) $(INSTALL_OWNER) -m 0644 $(mansrcdir)/sudoreplay.$(mantype) $(DESTDIR)$(mandirsu)/sudoreplay.$(mansectsu)
$(INSTALL) $(INSTALL_OWNER) -m 0644 $(mansrcdir)/visudo.$(mantype) $(DESTDIR)$(mandirsu)/visudo.$(mansectsu)
$(INSTALL) $(INSTALL_OWNER) -m 0644 $(mansrcdir)/sudo.conf.$(mantype) $(DESTDIR)$(mandirform)/sudo.conf.$(mansectform)
$(INSTALL) $(INSTALL_OWNER) -m 0644 $(mansrcdir)/sudoers.$(mantype) $(DESTDIR)$(mandirform)/sudoers.$(mansectform)
@LDAP@$(INSTALL) $(INSTALL_OWNER) -m 0644 $(mansrcdir)/sudoers.ldap.$(mantype) $(DESTDIR)$(mandirform)/sudoers.ldap.$(mansectform)
@if test -n "$(MANCOMPRESS)"; then \
for f in $(mandirsu)/sudo.$(mansectsu) $(mandirsu)/sudo_plugin.$(mansectsu) $(mandirsu)/sudoreplay.$(mansectsu) $(mandirsu)/visudo.$(mansectsu) $(mandirform)/sudo.conf.$(mansectform) $(mandirform)/sudoers.$(mansectform) $(mandirform)/sudoers.ldap.$(mansectform); do \
if test -f $(DESTDIR)$$f; then \
Expand Down
20 changes: 10 additions & 10 deletions include/alloc.h
Expand Up @@ -23,15 +23,15 @@
#undef efree
#define efree(x) free((void *)(x))

int easprintf(char **, const char *, ...) __printflike(2, 3);
int evasprintf(char **, const char *, va_list) __printflike(2, 0);
void *ecalloc(size_t, size_t) __malloc_like;
void *emalloc(size_t) __malloc_like;
void *emallocarray(size_t, size_t) __malloc_like;
void *erealloc(void *, size_t);
void *ereallocarray(void *, size_t, size_t);
void *erecalloc(void *, size_t, size_t, size_t);
char *estrdup(const char *) __malloc_like;
char *estrndup(const char *, size_t) __malloc_like;
__dso_public int easprintf(char **, const char *, ...) __printflike(2, 3);
__dso_public int evasprintf(char **, const char *, va_list) __printflike(2, 0);
__dso_public void *ecalloc(size_t, size_t) __malloc_like;
__dso_public void *emalloc(size_t) __malloc_like;
__dso_public void *emallocarray(size_t, size_t) __malloc_like;
__dso_public void *erealloc(void *, size_t);
__dso_public void *ereallocarray(void *, size_t, size_t);
__dso_public void *erecalloc(void *, size_t, size_t, size_t);
__dso_public char *estrdup(const char *) __malloc_like;
__dso_public char *estrndup(const char *, size_t) __malloc_like;

#endif /* _SUDO_ALLOC_H */
2 changes: 1 addition & 1 deletion include/compat/fnmatch.h
Expand Up @@ -25,7 +25,7 @@
#define FNM_LEADING_DIR (1 << 3) /* Only match the leading directory */
#define FNM_CASEFOLD (1 << 4) /* Case insensitive matching */

int sudo_fnmatch(const char *pattern, const char *string, int flags);
__dso_public int sudo_fnmatch(const char *pattern, const char *string, int flags);

#define fnmatch(_a, _b, _c) sudo_fnmatch((_a), (_b), (_c))

Expand Down
6 changes: 3 additions & 3 deletions include/compat/getaddrinfo.h
Expand Up @@ -66,10 +66,10 @@ struct addrinfo {
#define EAI_OVERFLOW 10 /* An argument buffer overflowed */

/* Function prototypes. */
int sudo_getaddrinfo(const char *nodename, const char *servname,
__dso_public int sudo_getaddrinfo(const char *nodename, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
void sudo_freeaddrinfo(struct addrinfo *ai);
const char *sudo_gai_strerror(int ecode);
__dso_public void sudo_freeaddrinfo(struct addrinfo *ai);
__dso_public const char *sudo_gai_strerror(int ecode);

/* Map sudo_* to RFC 3493 names. */
#undef getaddrinfo
Expand Down
6 changes: 3 additions & 3 deletions include/compat/getopt.h
Expand Up @@ -55,19 +55,19 @@ struct option {
int val;
};

int sudo_getopt_long(int, char * const *, const char *,
__dso_public int sudo_getopt_long(int, char * const *, const char *,
const struct option *, int *);
#undef getopt_long
#define getopt_long(_a, _b, _c, _d, _e) \
sudo_getopt_long((_a), (_b), (_c), (_d), (_e))

int sudo_getopt_long_only(int, char * const *, const char *,
__dso_public int sudo_getopt_long_only(int, char * const *, const char *,
const struct option *, int *);
#undef getopt_long_only
#define getopt_long_only(_a, _b, _c, _d, _e) \
sudo_getopt_long_only((_a), (_b), (_c), (_d), (_e))
#if 0
int sudo_getopt(int, char * const [], const char *);
__dso_public int sudo_getopt(int, char * const [], const char *);
#undef getopt
#define getopt(_a, _b, _c) sudo_getopt((_a), (_b), (_c))
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/compat/glob.h
Expand Up @@ -69,8 +69,8 @@ typedef struct {
#define GLOB_NOSYS (-4) /* Function not supported. */
#define GLOB_ABEND GLOB_ABORTED

int sudo_glob(const char *, int, int (*)(const char *, int), glob_t *);
void sudo_globfree(glob_t *);
__dso_public int sudo_glob(const char *, int, int (*)(const char *, int), glob_t *);
__dso_public void sudo_globfree(glob_t *);

#define glob(_a, _b, _c, _d) sudo_glob((_a), (_b), (_c), (_d))
#define globfree(_a) sudo_globfree((_a))
Expand Down
42 changes: 21 additions & 21 deletions include/compat/sha2.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2013-2014 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
Expand Down Expand Up @@ -47,28 +47,28 @@ typedef struct {
uint8_t buffer[SHA512_BLOCK_LENGTH];
} SHA2_CTX;

void SHA224Init(SHA2_CTX *ctx);
void SHA224Pad(SHA2_CTX *ctx);
void SHA224Transform(uint32_t state[8], const uint8_t buffer[SHA224_BLOCK_LENGTH]);
void SHA224Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
void SHA224Final(uint8_t digest[SHA224_DIGEST_LENGTH], SHA2_CTX *ctx);
__dso_public void SHA224Init(SHA2_CTX *ctx);
__dso_public void SHA224Pad(SHA2_CTX *ctx);
__dso_public void SHA224Transform(uint32_t state[8], const uint8_t buffer[SHA224_BLOCK_LENGTH]);
__dso_public void SHA224Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
__dso_public void SHA224Final(uint8_t digest[SHA224_DIGEST_LENGTH], SHA2_CTX *ctx);

void SHA256Init(SHA2_CTX *ctx);
void SHA256Pad(SHA2_CTX *ctx);
void SHA256Transform(uint32_t state[8], const uint8_t buffer[SHA256_BLOCK_LENGTH]);
void SHA256Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
void SHA256Final(uint8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *ctx);
__dso_public void SHA256Init(SHA2_CTX *ctx);
__dso_public void SHA256Pad(SHA2_CTX *ctx);
__dso_public void SHA256Transform(uint32_t state[8], const uint8_t buffer[SHA256_BLOCK_LENGTH]);
__dso_public void SHA256Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
__dso_public void SHA256Final(uint8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *ctx);

void SHA384Init(SHA2_CTX *ctx);
void SHA384Pad(SHA2_CTX *ctx);
void SHA384Transform(uint64_t state[8], const uint8_t buffer[SHA384_BLOCK_LENGTH]);
void SHA384Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
void SHA384Final(uint8_t digest[SHA384_DIGEST_LENGTH], SHA2_CTX *ctx);
__dso_public void SHA384Init(SHA2_CTX *ctx);
__dso_public void SHA384Pad(SHA2_CTX *ctx);
__dso_public void SHA384Transform(uint64_t state[8], const uint8_t buffer[SHA384_BLOCK_LENGTH]);
__dso_public void SHA384Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
__dso_public void SHA384Final(uint8_t digest[SHA384_DIGEST_LENGTH], SHA2_CTX *ctx);

void SHA512Init(SHA2_CTX *ctx);
void SHA512Pad(SHA2_CTX *ctx);
void SHA512Transform(uint64_t state[8], const uint8_t buffer[SHA512_BLOCK_LENGTH]);
void SHA512Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
void SHA512Final(uint8_t digest[SHA512_DIGEST_LENGTH], SHA2_CTX *ctx);
__dso_public void SHA512Init(SHA2_CTX *ctx);
__dso_public void SHA512Pad(SHA2_CTX *ctx);
__dso_public void SHA512Transform(uint64_t state[8], const uint8_t buffer[SHA512_BLOCK_LENGTH]);
__dso_public void SHA512Update(SHA2_CTX *ctx, const uint8_t *data, size_t len);
__dso_public void SHA512Final(uint8_t digest[SHA512_DIGEST_LENGTH], SHA2_CTX *ctx);

#endif /* _SUDOERS_SHA2_H */
26 changes: 13 additions & 13 deletions include/fatal.h
Expand Up @@ -119,18 +119,18 @@
extern int (*sudo_printf)(int msg_type, const char *fmt, ...);
extern sigjmp_buf fatal_jmp;

int fatal_callback_deregister(void (*func)(void));
int fatal_callback_register(void (*func)(void));
char *warning_gettext(const char *msgid) __format_arg(1);
void fatal_disable_setjmp(void);
void fatal_enable_setjmp(void);
void fatal_nodebug(const char *, ...) __printf0like(1, 2) __attribute__((__noreturn__));
void fatalx_nodebug(const char *, ...) __printflike(1, 2) __attribute__((__noreturn__));
void vfatal_nodebug(const char *, va_list ap) __printf0like(1, 0) __attribute__((__noreturn__));
void vfatalx_nodebug(const char *, va_list ap) __printflike(1, 0) __attribute__((__noreturn__));
void warning_nodebug(const char *, ...) __printf0like(1, 2);
void warningx_nodebug(const char *, ...) __printflike(1, 2);
void vwarning_nodebug(const char *, va_list ap) __printf0like(1, 0);
void vwarningx_nodebug(const char *, va_list ap) __printflike(1, 0);
__dso_public int fatal_callback_deregister(void (*func)(void));
__dso_public int fatal_callback_register(void (*func)(void));
__dso_public char *warning_gettext(const char *msgid) __format_arg(1);
__dso_public void fatal_disable_setjmp(void);
__dso_public void fatal_enable_setjmp(void);
__dso_public void fatal_nodebug(const char *, ...) __printf0like(1, 2) __attribute__((__noreturn__));
__dso_public void fatalx_nodebug(const char *, ...) __printflike(1, 2) __attribute__((__noreturn__));
__dso_public void vfatal_nodebug(const char *, va_list ap) __printf0like(1, 0) __attribute__((__noreturn__));
__dso_public void vfatalx_nodebug(const char *, va_list ap) __printflike(1, 0) __attribute__((__noreturn__));
__dso_public void warning_nodebug(const char *, ...) __printf0like(1, 2);
__dso_public void warningx_nodebug(const char *, ...) __printflike(1, 2);
__dso_public void vwarning_nodebug(const char *, va_list ap) __printf0like(1, 0);
__dso_public void vwarningx_nodebug(const char *, va_list ap) __printflike(1, 0);

#endif /* _SUDO_FATAL_H_ */
6 changes: 3 additions & 3 deletions include/fileops.h
Expand Up @@ -26,8 +26,8 @@

struct timeval;

bool lock_file(int, int);
int touch(int, char *, struct timeval *);
ssize_t sudo_parseln(char **buf, size_t *bufsize, unsigned int *lineno, FILE *fp);
__dso_public bool lock_file(int, int);
__dso_public int touch(int, char *, struct timeval *);
__dso_public ssize_t sudo_parseln(char **buf, size_t *bufsize, unsigned int *lineno, FILE *fp);

#endif /* _SUDO_FILEOPS_H */
10 changes: 5 additions & 5 deletions include/lbuf.h
Expand Up @@ -32,10 +32,10 @@ struct lbuf {
int cols;
};

void lbuf_init(struct lbuf *, int (*)(const char *), int, const char *, int);
void lbuf_destroy(struct lbuf *);
void lbuf_append(struct lbuf *, const char *, ...) __printflike(2, 3);
void lbuf_append_quoted(struct lbuf *, const char *, const char *, ...) __printflike(3, 4);
void lbuf_print(struct lbuf *);
__dso_public void lbuf_init(struct lbuf *, int (*)(const char *), int, const char *, int);
__dso_public void lbuf_destroy(struct lbuf *);
__dso_public void lbuf_append(struct lbuf *, const char *, ...) __printflike(2, 3);
__dso_public void lbuf_append_quoted(struct lbuf *, const char *, const char *, ...) __printflike(3, 4);
__dso_public void lbuf_print(struct lbuf *);

#endif /* _SUDO_LBUF_H */

0 comments on commit 088edcb

Please sign in to comment.