From: Todd C. Miller Date: Mon, 27 Oct 2014 11:26:08 +0000 (-0600) Subject: Version the symbols for sudo_debug.c now that the API is stable. X-Git-Tag: SUDO_1_8_12^2~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=adfdad9ae06cb70c83b9b0ac7b66df77cb9519b1;p=sudo Version the symbols for sudo_debug.c now that the API is stable. --- diff --git a/configure.ac b/configure.ac index 641ad3190..29979e2a2 100644 --- a/configure.ac +++ b/configure.ac @@ -2147,7 +2147,7 @@ AC_INCLUDES_DEFAULT [AC_MSG_RESULT([no]) AC_DEFINE([NO_VARIADIC_MACROS], [1], [Define if your C preprocessor does not support variadic macros.]) AC_MSG_WARN([Your C preprocessor doesn't support variadic macros, debugging support will be limited]) - SUDO_APPEND_COMPAT_EXP(sudo_debug_printf_nvm) + SUDO_APPEND_COMPAT_EXP(sudo_debug_printf_nvm_v1) ]) dnl diff --git a/include/sudo_debug.h b/include/sudo_debug.h index 4e5e8cfcc..36e747670 100644 --- a/include/sudo_debug.h +++ b/include/sudo_debug.h @@ -229,27 +229,50 @@ struct sudo_conf_debug_file_list; #define sudo_debug_write(fd, str, len, errnum) \ sudo_debug_write2(fd, NULL, NULL, 0, (str), (len), (errnum)) -__dso_public int sudo_debug_deregister(int instance_id); -__dso_public void sudo_debug_enter(const char *func, const char *file, int line, int subsys); -__dso_public void sudo_debug_execve2(int level, const char *path, char *const argv[], char *const envp[]); -__dso_public void sudo_debug_exit(const char *func, const char *file, int line, int subsys); -__dso_public void sudo_debug_exit_bool(const char *func, const char *file, int line, int subsys, int rval); -__dso_public void sudo_debug_exit_int(const char *func, const char *file, int line, int subsys, int rval); -__dso_public void sudo_debug_exit_long(const char *func, const char *file, int line, int subsys, long rval); -__dso_public void sudo_debug_exit_ptr(const char *func, const char *file, int line, int subsys, const void *rval); -__dso_public void sudo_debug_exit_size_t(const char *func, const char *file, int line, int subsys, size_t rval); -__dso_public void sudo_debug_exit_str(const char *func, const char *file, int line, int subsys, const char *rval); -__dso_public void sudo_debug_exit_str_masked(const char *func, const char *file, int line, int subsys, const char *rval); -__dso_public pid_t sudo_debug_fork(void); -__dso_public int sudo_debug_get_default_instance(void); -__dso_public int sudo_debug_get_fds(unsigned char **fds); -__dso_public int sudo_debug_get_instance(const char *program); -__dso_public void sudo_debug_printf2(const char *func, const char *file, int line, int level, const char *fmt, ...) __printf0like(5, 6); -__dso_public void sudo_debug_printf_nvm(int pri, const char *fmt, ...) __printf0like(2, 3); -__dso_public int sudo_debug_register(const char *program, const char *const subsystems[], unsigned int ids[], struct sudo_conf_debug_file_list *debug_files); -__dso_public int sudo_debug_set_default_instance(int inst); -__dso_public void sudo_debug_update_fd(int ofd, int nfd); -__dso_public void sudo_debug_vprintf2(const char *func, const char *file, int line, int level, const char *fmt, va_list ap) __printf0like(5, 0); -__dso_public void sudo_debug_write2(int fd, const char *func, const char *file, int line, const char *str, int len, int errnum); +__dso_public int sudo_debug_deregister_v1(int instance_id); +__dso_public void sudo_debug_enter_v1(const char *func, const char *file, int line, int subsys); +__dso_public void sudo_debug_execve2_v1(int level, const char *path, char *const argv[], char *const envp[]); +__dso_public void sudo_debug_exit_v1(const char *func, const char *file, int line, int subsys); +__dso_public void sudo_debug_exit_bool_v1(const char *func, const char *file, int line, int subsys, int rval); +__dso_public void sudo_debug_exit_int_v1(const char *func, const char *file, int line, int subsys, int rval); +__dso_public void sudo_debug_exit_long_v1(const char *func, const char *file, int line, int subsys, long rval); +__dso_public void sudo_debug_exit_ptr_v1(const char *func, const char *file, int line, int subsys, const void *rval); +__dso_public void sudo_debug_exit_size_t_v1(const char *func, const char *file, int line, int subsys, size_t rval); +__dso_public void sudo_debug_exit_str_v1(const char *func, const char *file, int line, int subsys, const char *rval); +__dso_public void sudo_debug_exit_str_masked_v1(const char *func, const char *file, int line, int subsys, const char *rval); +__dso_public pid_t sudo_debug_fork_v1(void); +__dso_public int sudo_debug_get_default_instance_v1(void); +__dso_public int sudo_debug_get_fds_v1(unsigned char **fds); +__dso_public int sudo_debug_get_instance_v1(const char *program); +__dso_public void sudo_debug_printf2_v1(const char *func, const char *file, int line, int level, const char *fmt, ...) __printf0like(5, 6); +__dso_public void sudo_debug_printf_nvm_v1(int pri, const char *fmt, ...) __printf0like(2, 3); +__dso_public int sudo_debug_register_v1(const char *program, const char *const subsystems[], unsigned int ids[], struct sudo_conf_debug_file_list *debug_files); +__dso_public int sudo_debug_set_default_instance_v1(int inst); +__dso_public void sudo_debug_update_fd_v1(int ofd, int nfd); +__dso_public void sudo_debug_vprintf2_v1(const char *func, const char *file, int line, int level, const char *fmt, va_list ap) __printf0like(5, 0); +__dso_public void sudo_debug_write2_v1(int fd, const char *func, const char *file, int line, const char *str, int len, int errnum); + +#define sudo_debug_deregister(_a) sudo_debug_deregister_v1((_a)) +#define sudo_debug_enter(_a, _b, _c, _d) sudo_debug_enter_v1((_a), (_b), (_c), (_d)) +#define sudo_debug_execve2(_a, _b, _c, _d) sudo_debug_execve2_v1((_a), (_b), (_c), (_d)) +#define sudo_debug_exit(_a, _b, _c, _d) sudo_debug_exit_v1((_a), (_b), (_c), (_d)) +#define sudo_debug_exit_bool(_a, _b, _c, _d, _e) sudo_debug_exit_bool_v1((_a), (_b), (_c), (_d), (_e)) +#define sudo_debug_exit_int(_a, _b, _c, _d, _e) sudo_debug_exit_int_v1((_a), (_b), (_c), (_d), (_e)) +#define sudo_debug_exit_long(_a, _b, _c, _d, _e) sudo_debug_exit_long_v1((_a), (_b), (_c), (_d), (_e)) +#define sudo_debug_exit_ptr(_a, _b, _c, _d, _e) sudo_debug_exit_ptr_v1((_a), (_b), (_c), (_d), (_e)) +#define sudo_debug_exit_size_t(_a, _b, _c, _d, _e) sudo_debug_exit_size_t_v1((_a), (_b), (_c), (_d), (_e)) +#define sudo_debug_exit_str(_a, _b, _c, _d, _e) sudo_debug_exit_str_v1((_a), (_b), (_c), (_d), (_e)) +#define sudo_debug_exit_str_masked(_a, _b, _c, _d, _e) sudo_debug_exit_str_masked_v1((_a), (_b), (_c), (_d), (_e)) +#define sudo_debug_fork() sudo_debug_fork_v1() +#define sudo_debug_get_default_instance() sudo_debug_get_default_instance_v1() +#define sudo_debug_get_fds(_a) sudo_debug_get_fds_v1((_a)) +#define sudo_debug_get_instance(_a) sudo_debug_get_instance_v1((_a)) +#define sudo_debug_printf2 sudo_debug_printf2_v1 +#define sudo_debug_printf_nvm sudo_debug_printf_nvm_v1 +#define sudo_debug_register(_a, _b, _c, _d) sudo_debug_register_v1((_a), (_b), (_c), (_d)) +#define sudo_debug_set_default_instance(_a) sudo_debug_set_default_instance_v1((_a)) +#define sudo_debug_update_fd(_a, _b) sudo_debug_update_fd_v1((_a), (_b)) +#define sudo_debug_vprintf2(_a, _b, _c, _d, _e, _f) sudo_debug_vprintf2_v1((_a), (_b), (_c), (_d), (_e), (_f)) +#define sudo_debug_write2(_a, _b, _c, _d, _e, _f, _g) sudo_debug_write2_v1((_a), (_b), (_c), (_d), (_e), (_f), (_g)) #endif /* _SUDO_DEBUG_H */ diff --git a/lib/util/sudo_debug.c b/lib/util/sudo_debug.c index fb29b21ab..ae693f088 100644 --- a/lib/util/sudo_debug.c +++ b/lib/util/sudo_debug.c @@ -225,7 +225,7 @@ sudo_debug_new_output(struct sudo_debug_instance *instance, * Returns instance index on success or -1 if cannot open debugfile. */ int -sudo_debug_register(const char *program, const char *const subsystems[], +sudo_debug_register_v1(const char *program, const char *const subsystems[], unsigned int ids[], struct sudo_conf_debug_file_list *debug_files) { struct sudo_debug_instance *instance = NULL; @@ -330,7 +330,7 @@ sudo_debug_register(const char *program, const char *const subsystems[], * and free up any associated data structures. */ int -sudo_debug_deregister(int instance_id) +sudo_debug_deregister_v1(int instance_id) { struct sudo_debug_instance *instance; struct sudo_debug_output *output, *next; @@ -368,7 +368,7 @@ sudo_debug_deregister(int instance_id) } int -sudo_debug_get_instance(const char *program) +sudo_debug_get_instance_v1(const char *program) { int idx; @@ -382,7 +382,7 @@ sudo_debug_get_instance(const char *program) } int -sudo_debug_set_output_fd(int level, int ofd, int nfd) +sudo_debug_set_output_fd_v1(int level, int ofd, int nfd) { struct sudo_debug_instance *instance; struct sudo_debug_output *output; @@ -404,7 +404,7 @@ sudo_debug_set_output_fd(int level, int ofd, int nfd) } pid_t -sudo_debug_fork(void) +sudo_debug_fork_v1(void) { pid_t pid; @@ -418,7 +418,7 @@ sudo_debug_fork(void) } void -sudo_debug_enter(const char *func, const char *file, int line, +sudo_debug_enter_v1(const char *func, const char *file, int line, int subsys) { sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE, @@ -426,7 +426,7 @@ sudo_debug_enter(const char *func, const char *file, int line, } void -sudo_debug_exit(const char *func, const char *file, int line, +sudo_debug_exit_v1(const char *func, const char *file, int line, int subsys) { sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE, @@ -434,7 +434,7 @@ sudo_debug_exit(const char *func, const char *file, int line, } void -sudo_debug_exit_int(const char *func, const char *file, int line, +sudo_debug_exit_int_v1(const char *func, const char *file, int line, int subsys, int rval) { sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE, @@ -442,7 +442,7 @@ sudo_debug_exit_int(const char *func, const char *file, int line, } void -sudo_debug_exit_long(const char *func, const char *file, int line, +sudo_debug_exit_long_v1(const char *func, const char *file, int line, int subsys, long rval) { sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE, @@ -450,7 +450,7 @@ sudo_debug_exit_long(const char *func, const char *file, int line, } void -sudo_debug_exit_size_t(const char *func, const char *file, int line, +sudo_debug_exit_size_t_v1(const char *func, const char *file, int line, int subsys, size_t rval) { /* XXX - should use %zu but our snprintf.c doesn't support it */ @@ -460,7 +460,7 @@ sudo_debug_exit_size_t(const char *func, const char *file, int line, /* We use int, not bool, here for functions that return -1 on error. */ void -sudo_debug_exit_bool(const char *func, const char *file, int line, +sudo_debug_exit_bool_v1(const char *func, const char *file, int line, int subsys, int rval) { if (rval == true || rval == false) { @@ -473,7 +473,7 @@ sudo_debug_exit_bool(const char *func, const char *file, int line, } void -sudo_debug_exit_str(const char *func, const char *file, int line, +sudo_debug_exit_str_v1(const char *func, const char *file, int line, int subsys, const char *rval) { sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE, @@ -481,7 +481,7 @@ sudo_debug_exit_str(const char *func, const char *file, int line, } void -sudo_debug_exit_str_masked(const char *func, const char *file, int line, +sudo_debug_exit_str_masked_v1(const char *func, const char *file, int line, int subsys, const char *rval) { static const char stars[] = "********************************************************************************"; @@ -492,7 +492,7 @@ sudo_debug_exit_str_masked(const char *func, const char *file, int line, } void -sudo_debug_exit_ptr(const char *func, const char *file, int line, +sudo_debug_exit_ptr_v1(const char *func, const char *file, int line, int subsys, const void *rval) { sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE, @@ -500,7 +500,7 @@ sudo_debug_exit_ptr(const char *func, const char *file, int line, } void -sudo_debug_write2(int fd, const char *func, const char *file, int lineno, +sudo_debug_write2_v1(int fd, const char *func, const char *file, int lineno, const char *str, int len, int errnum) { char *timestr, numbuf[(((sizeof(int) * 8) + 2) / 3) + 2]; @@ -577,7 +577,7 @@ sudo_debug_write2(int fd, const char *func, const char *file, int lineno, } void -sudo_debug_vprintf2(const char *func, const char *file, int lineno, int level, +sudo_debug_vprintf2_v1(const char *func, const char *file, int lineno, int level, const char *fmt, va_list ap) { int buflen, idx, pri, saved_errno = errno; @@ -643,7 +643,7 @@ out: #ifdef NO_VARIADIC_MACROS void -sudo_debug_printf_nvm(int pri, const char *fmt, ...) +sudo_debug_printf_nvm_v1(int pri, const char *fmt, ...) { va_list ap; @@ -654,7 +654,7 @@ sudo_debug_printf_nvm(int pri, const char *fmt, ...) #endif /* NO_VARIADIC_MACROS */ void -sudo_debug_printf2(const char *func, const char *file, int lineno, int level, +sudo_debug_printf2_v1(const char *func, const char *file, int lineno, int level, const char *fmt, ...) { va_list ap; @@ -667,7 +667,7 @@ sudo_debug_printf2(const char *func, const char *file, int lineno, int level, #define EXEC_PREFIX "exec " void -sudo_debug_execve2(int level, const char *path, char *const argv[], char *const envp[]) +sudo_debug_execve2_v1(int level, const char *path, char *const argv[], char *const envp[]) { int buflen, idx, pri, saved_errno = errno; unsigned int subsys; @@ -782,7 +782,7 @@ out: * if no default instance is set. */ int -sudo_debug_get_default_instance(void) +sudo_debug_get_default_instance_v1(void) { return SUDO_DEBUG_MKINSTANCE(sudo_debug_default_instance); } @@ -793,7 +793,7 @@ sudo_debug_get_default_instance(void) * of this is the only instance. */ int -sudo_debug_set_default_instance(int inst) +sudo_debug_set_default_instance_v1(int inst) { const int idx = SUDO_DEBUG_INSTANCE(inst); const int old_idx = sudo_debug_default_instance; @@ -808,7 +808,7 @@ sudo_debug_set_default_instance(int inst) * Also updates sudo_debug_fds. */ void -sudo_debug_update_fd(int ofd, int nfd) +sudo_debug_update_fd_v1(int ofd, int nfd) { int idx; @@ -838,7 +838,7 @@ sudo_debug_update_fd(int ofd, int nfd) * Fills in fds with the value of sudo_debug_fds. */ int -sudo_debug_get_fds(unsigned char **fds) +sudo_debug_get_fds_v1(unsigned char **fds) { *fds = sudo_debug_fds; return sudo_debug_max_fd; diff --git a/lib/util/util.exp.in b/lib/util/util.exp.in index 83b86c1d7..12d604dae 100644 --- a/lib/util/util.exp.in +++ b/lib/util/util.exp.in @@ -11,27 +11,27 @@ sudo_conf_plugins_v1 sudo_conf_probe_interfaces_v1 sudo_conf_read_v1 sudo_conf_sesh_path_v1 -sudo_debug_deregister -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_fork -sudo_debug_get_default_instance -sudo_debug_get_fds -sudo_debug_get_instance -sudo_debug_printf2 -sudo_debug_register -sudo_debug_set_default_instance -sudo_debug_update_fd -sudo_debug_vprintf2 -sudo_debug_write2 +sudo_debug_deregister_v1 +sudo_debug_enter_v1 +sudo_debug_execve2_v1 +sudo_debug_exit_v1 +sudo_debug_exit_bool_v1 +sudo_debug_exit_int_v1 +sudo_debug_exit_long_v1 +sudo_debug_exit_ptr_v1 +sudo_debug_exit_size_t_v1 +sudo_debug_exit_str_v1 +sudo_debug_exit_str_masked_v1 +sudo_debug_fork_v1 +sudo_debug_get_default_instance_v1 +sudo_debug_get_fds_v1 +sudo_debug_get_instance_v1 +sudo_debug_printf2_v1 +sudo_debug_register_v1 +sudo_debug_set_default_instance_v1 +sudo_debug_update_fd_v1 +sudo_debug_vprintf2_v1 +sudo_debug_write2_v1 sudo_dso_findsym_v1 sudo_dso_load_v1 sudo_dso_preload_table_v1