mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-01 14:55:12 +00:00
Rename warning/fatal -> sudo_warn/sudo_fatal to avoid namespace
pollution in libsudo_util.so.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 2004, 2010-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
|
||||
@@ -20,110 +20,110 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* We wrap fatal/fatalx and warning/warningx so that the same output can
|
||||
* We wrap fatal/fatalx and warn/warnx so that the same output can
|
||||
* go to the debug file, if there is one.
|
||||
*/
|
||||
#if (defined(SUDO_ERROR_WRAP) && SUDO_ERROR_WRAP == 0) || defined(NO_VARIADIC_MACROS)
|
||||
# define fatal fatal_nodebug
|
||||
# define fatalx fatalx_nodebug
|
||||
# define warning warning_nodebug
|
||||
# define warningx warningx_nodebug
|
||||
# define vfatal(fmt, ap) fatal_nodebug((fmt), (ap))
|
||||
# define vfatalx(fmt, ap) fatalx_nodebug((fmt), (ap))
|
||||
# define vwarning(fmt, ap) warning_nodebug((fmt), (ap))
|
||||
# define vwarningx(fmt, ap) warningx_nodebug((fmt), (ap))
|
||||
# define sudo_fatal sudo_fatal_nodebug
|
||||
# define sudo_fatalx sudo_fatalx_nodebug
|
||||
# define sudo_warn sudo_warn_nodebug
|
||||
# define sudo_warnx sudo_warnx_nodebug
|
||||
# define sudo_vfatal(fmt, ap) sudo_vfatal_nodebug((fmt), (ap))
|
||||
# define sudo_vfatalx(fmt, ap) sudo_vfatalx_nodebug((fmt), (ap))
|
||||
# define sudo_vwarn(fmt, ap) sudo_vwarn_nodebug((fmt), (ap))
|
||||
# define sudo_vwarnx(fmt, ap) sudo_vwarnx_nodebug((fmt), (ap))
|
||||
#else /* SUDO_ERROR_WRAP */
|
||||
# if defined(__GNUC__) && __GNUC__ == 2
|
||||
# define fatal(fmt...) do { \
|
||||
# define sudo_fatal(fmt...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
|
||||
fmt); \
|
||||
fatal_nodebug(fmt); \
|
||||
sudo_fatal_nodebug(fmt); \
|
||||
} while (0)
|
||||
# define fatalx(fmt...) do { \
|
||||
# define sudo_fatalx(fmt...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, fmt); \
|
||||
fatalx_nodebug(fmt); \
|
||||
sudo_fatalx_nodebug(fmt); \
|
||||
} while (0)
|
||||
# define warning(fmt...) do { \
|
||||
# define sudo_warn(fmt...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
|
||||
fmt); \
|
||||
warning_nodebug(fmt); \
|
||||
sudo_warn_nodebug(fmt); \
|
||||
} while (0)
|
||||
# define warningx(fmt...) do { \
|
||||
# define sudo_warnx(fmt...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, fmt); \
|
||||
warningx_nodebug(fmt); \
|
||||
sudo_warnx_nodebug(fmt); \
|
||||
} while (0)
|
||||
# else
|
||||
# define fatal(...) do { \
|
||||
# define sudo_fatal(...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
|
||||
__VA_ARGS__); \
|
||||
fatal_nodebug(__VA_ARGS__); \
|
||||
sudo_fatal_nodebug(__VA_ARGS__); \
|
||||
} while (0)
|
||||
# define fatalx(...) do { \
|
||||
# define sudo_fatalx(...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, __VA_ARGS__); \
|
||||
fatalx_nodebug(__VA_ARGS__); \
|
||||
sudo_fatalx_nodebug(__VA_ARGS__); \
|
||||
} while (0)
|
||||
# define warning(...) do { \
|
||||
# define sudo_warn(...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
|
||||
__VA_ARGS__); \
|
||||
warning_nodebug(__VA_ARGS__); \
|
||||
sudo_warn_nodebug(__VA_ARGS__); \
|
||||
} while (0)
|
||||
# define warningx(...) do { \
|
||||
# define sudo_warnx(...) do { \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|sudo_debug_subsys, __VA_ARGS__); \
|
||||
warningx_nodebug(__VA_ARGS__); \
|
||||
sudo_warnx_nodebug(__VA_ARGS__); \
|
||||
} while (0)
|
||||
# endif /* __GNUC__ == 2 */
|
||||
# define vfatal(fmt, ap) do { \
|
||||
# define sudo_vfatal(fmt, ap) do { \
|
||||
va_list ap2; \
|
||||
va_copy(ap2, (ap)); \
|
||||
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
|
||||
(fmt), ap2); \
|
||||
vfatal_nodebug((fmt), (ap)); \
|
||||
sudo_vfatal_nodebug((fmt), (ap)); \
|
||||
} while (0)
|
||||
# define vfatalx(fmt, ap) do { \
|
||||
# define sudo_vfatalx(fmt, ap) do { \
|
||||
va_list ap2; \
|
||||
va_copy(ap2, (ap)); \
|
||||
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), ap2); \
|
||||
vfatalx_nodebug((fmt), (ap)); \
|
||||
sudo_vfatalx_nodebug((fmt), (ap)); \
|
||||
} while (0)
|
||||
# define vwarning(fmt, ap) do { \
|
||||
# define sudo_vwarn(fmt, ap) do { \
|
||||
va_list ap2; \
|
||||
va_copy(ap2, (ap)); \
|
||||
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
|
||||
(fmt), ap2); \
|
||||
vwarning_nodebug((fmt), (ap)); \
|
||||
sudo_vwarn_nodebug((fmt), (ap)); \
|
||||
} while (0)
|
||||
# define vwarningx(fmt, ap) do { \
|
||||
# define sudo_vwarnx(fmt, ap) do { \
|
||||
va_list ap2; \
|
||||
va_copy(ap2, (ap)); \
|
||||
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
|
||||
SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), ap2); \
|
||||
vwarningx_nodebug((fmt), (ap)); \
|
||||
sudo_vwarnx_nodebug((fmt), (ap)); \
|
||||
} while (0)
|
||||
#endif /* SUDO_ERROR_WRAP */
|
||||
|
||||
extern int (*sudo_printf)(int msg_type, const char *fmt, ...);
|
||||
|
||||
__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_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);
|
||||
__dso_public int sudo_fatal_callback_deregister(void (*func)(void));
|
||||
__dso_public int sudo_fatal_callback_register(void (*func)(void));
|
||||
__dso_public char *sudo_warn_gettext(const char *msgid) __format_arg(1);
|
||||
__dso_public void sudo_fatal_nodebug(const char *, ...) __printf0like(1, 2) __attribute__((__noreturn__));
|
||||
__dso_public void sudo_fatalx_nodebug(const char *, ...) __printflike(1, 2) __attribute__((__noreturn__));
|
||||
__dso_public void sudo_vfatal_nodebug(const char *, va_list ap) __printf0like(1, 0) __attribute__((__noreturn__));
|
||||
__dso_public void sudo_vfatalx_nodebug(const char *, va_list ap) __printflike(1, 0) __attribute__((__noreturn__));
|
||||
__dso_public void sudo_warn_nodebug(const char *, ...) __printf0like(1, 2);
|
||||
__dso_public void sudo_warnx_nodebug(const char *, ...) __printflike(1, 2);
|
||||
__dso_public void sudo_vwarn_nodebug(const char *, va_list ap) __printf0like(1, 0);
|
||||
__dso_public void sudo_vwarnx_nodebug(const char *, va_list ap) __printflike(1, 0);
|
||||
|
||||
#endif /* _SUDO_FATAL_H_ */
|
||||
|
@@ -54,7 +54,7 @@
|
||||
# define _(String) gettext(String)
|
||||
# define gettext_noop(String) String
|
||||
# define N_(String) gettext_noop(String)
|
||||
# define U_(String) warning_gettext(String)
|
||||
# define U_(String) sudo_warn_gettext(String)
|
||||
|
||||
#else /* !HAVE_LIBINTL_H */
|
||||
|
||||
|
@@ -89,7 +89,7 @@ aix_setlimits(char *user)
|
||||
debug_decl(aix_setlimits, SUDO_DEBUG_UTIL)
|
||||
|
||||
if (setuserdb(S_READ) != 0) {
|
||||
warning(U_("unable to open userdb"));
|
||||
sudo_warn(U_("unable to open userdb"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
|
||||
@@ -148,12 +148,12 @@ aix_setauthdb(char *user)
|
||||
|
||||
if (user != NULL) {
|
||||
if (setuserdb(S_READ) != 0) {
|
||||
warning(U_("unable to open userdb"));
|
||||
sudo_warn(U_("unable to open userdb"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if (getuserattr(user, S_REGISTRY, ®istry, SEC_CHAR) == 0) {
|
||||
if (setauthdb(registry, NULL) != 0) {
|
||||
warning(U_("unable to switch to registry \"%s\" for %s"),
|
||||
sudo_warn(U_("unable to switch to registry \"%s\" for %s"),
|
||||
registry, user);
|
||||
debug_return_int(-1);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ aix_restoreauthdb(void)
|
||||
debug_decl(aix_setauthdb, SUDO_DEBUG_UTIL)
|
||||
|
||||
if (setauthdb(NULL, NULL) != 0) {
|
||||
warning(U_("unable to restore registry"));
|
||||
sudo_warn(U_("unable to restore registry"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
debug_return_int(0);
|
||||
|
@@ -79,10 +79,10 @@ emalloc(size_t size)
|
||||
void *ptr;
|
||||
|
||||
if (size == 0)
|
||||
fatalx_nodebug(_("internal error, tried to emalloc(0)"));
|
||||
sudo_fatalx_nodebug(_("internal error, tried to emalloc(0)"));
|
||||
|
||||
if ((ptr = malloc(size)) == NULL)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ emallocarray(size_t nmemb, size_t size)
|
||||
void *ptr;
|
||||
|
||||
if (nmemb == 0 || size == 0)
|
||||
fatalx_nodebug(_("internal error, tried to emallocarray(0)"));
|
||||
sudo_fatalx_nodebug(_("internal error, tried to emallocarray(0)"));
|
||||
if (nmemb > SIZE_MAX / size)
|
||||
fatalx_nodebug(_("internal error, %s overflow"), "emallocarray");
|
||||
sudo_fatalx_nodebug(_("internal error, %s overflow"), "emallocarray");
|
||||
|
||||
size *= nmemb;
|
||||
if ((ptr = malloc(size)) == NULL)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -117,14 +117,14 @@ ecalloc(size_t nmemb, size_t size)
|
||||
void *ptr;
|
||||
|
||||
if (nmemb == 0 || size == 0)
|
||||
fatalx_nodebug(_("internal error, tried to ecalloc(0)"));
|
||||
sudo_fatalx_nodebug(_("internal error, tried to ecalloc(0)"));
|
||||
if (nmemb != 1) {
|
||||
if (nmemb > SIZE_MAX / size)
|
||||
fatalx_nodebug(_("internal error, %s overflow"), "ecalloc");
|
||||
sudo_fatalx_nodebug(_("internal error, %s overflow"), "ecalloc");
|
||||
size *= nmemb;
|
||||
}
|
||||
if ((ptr = malloc(size)) == NULL)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
@@ -139,11 +139,11 @@ erealloc(void *ptr, size_t size)
|
||||
{
|
||||
|
||||
if (size == 0)
|
||||
fatalx_nodebug(_("internal error, tried to erealloc(0)"));
|
||||
sudo_fatalx_nodebug(_("internal error, tried to erealloc(0)"));
|
||||
|
||||
ptr = ptr ? realloc(ptr, size) : malloc(size);
|
||||
if (ptr == NULL)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -158,14 +158,14 @@ ereallocarray(void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
|
||||
if (nmemb == 0 || size == 0)
|
||||
fatalx_nodebug(_("internal error, tried to ereallocarray(0)"));
|
||||
sudo_fatalx_nodebug(_("internal error, tried to ereallocarray(0)"));
|
||||
if (nmemb > SIZE_MAX / size)
|
||||
fatalx_nodebug(_("internal error, %s overflow"), "ereallocarray");
|
||||
sudo_fatalx_nodebug(_("internal error, %s overflow"), "ereallocarray");
|
||||
|
||||
size *= nmemb;
|
||||
ptr = ptr ? realloc(ptr, size) : malloc(size);
|
||||
if (ptr == NULL)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -181,14 +181,14 @@ erecalloc(void *ptr, size_t onmemb, size_t nmemb, size_t msize)
|
||||
size_t size;
|
||||
|
||||
if (nmemb == 0 || msize == 0)
|
||||
fatalx_nodebug(_("internal error, tried to erecalloc(0)"));
|
||||
sudo_fatalx_nodebug(_("internal error, tried to erecalloc(0)"));
|
||||
if (nmemb > SIZE_MAX / msize)
|
||||
fatalx_nodebug(_("internal error, %s overflow"), "erecalloc");
|
||||
sudo_fatalx_nodebug(_("internal error, %s overflow"), "erecalloc");
|
||||
|
||||
size = nmemb * msize;
|
||||
ptr = ptr ? realloc(ptr, size) : malloc(size);
|
||||
if (ptr == NULL)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
if (nmemb > onmemb) {
|
||||
size = (nmemb - onmemb) * msize;
|
||||
memset((char *)ptr + (onmemb * msize), 0, size);
|
||||
@@ -252,7 +252,7 @@ easprintf(char **ret, const char *fmt, ...)
|
||||
va_end(ap);
|
||||
|
||||
if (len == -1)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -266,6 +266,6 @@ evasprintf(char **ret, const char *format, va_list args)
|
||||
int len;
|
||||
|
||||
if ((len = vasprintf(ret, format, args)) == -1)
|
||||
fatal_nodebug(NULL);
|
||||
sudo_fatal_nodebug(NULL);
|
||||
return len;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ do_cleanup(void)
|
||||
}
|
||||
|
||||
void
|
||||
fatal_nodebug(const char *fmt, ...)
|
||||
sudo_fatal_nodebug(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -73,7 +73,7 @@ fatal_nodebug(const char *fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
fatalx_nodebug(const char *fmt, ...)
|
||||
sudo_fatalx_nodebug(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -85,7 +85,7 @@ fatalx_nodebug(const char *fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
vfatal_nodebug(const char *fmt, va_list ap)
|
||||
sudo_sudo_vfatal_nodebug(const char *fmt, va_list ap)
|
||||
{
|
||||
_warning(1, fmt, ap);
|
||||
do_cleanup();
|
||||
@@ -93,7 +93,7 @@ vfatal_nodebug(const char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
void
|
||||
vfatalx_nodebug(const char *fmt, va_list ap)
|
||||
sudo_sudo_vfatalx_nodebug(const char *fmt, va_list ap)
|
||||
{
|
||||
_warning(0, fmt, ap);
|
||||
do_cleanup();
|
||||
@@ -101,7 +101,7 @@ vfatalx_nodebug(const char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
void
|
||||
warning_nodebug(const char *fmt, ...)
|
||||
sudo_warn_nodebug(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -111,7 +111,7 @@ warning_nodebug(const char *fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
warningx_nodebug(const char *fmt, ...)
|
||||
sudo_warnx_nodebug(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@@ -120,13 +120,13 @@ warningx_nodebug(const char *fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
vwarning_nodebug(const char *fmt, va_list ap)
|
||||
sudo_vwarn_nodebug(const char *fmt, va_list ap)
|
||||
{
|
||||
_warning(1, fmt, ap);
|
||||
}
|
||||
|
||||
void
|
||||
vwarningx_nodebug(const char *fmt, va_list ap)
|
||||
sudo_vwarnx_nodebug(const char *fmt, va_list ap)
|
||||
{
|
||||
_warning(0, fmt, ap);
|
||||
}
|
||||
@@ -155,10 +155,10 @@ _warning(int use_errno, const char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a callback to be run when fatal()/fatalx() is called.
|
||||
* Register a callback to be run when sudo_fatal()/sudo_fatalx() is called.
|
||||
*/
|
||||
int
|
||||
fatal_callback_register(void (*func)(void))
|
||||
sudo_fatal_callback_register(void (*func)(void))
|
||||
{
|
||||
struct sudo_fatal_callback *cb;
|
||||
|
||||
@@ -179,10 +179,10 @@ fatal_callback_register(void (*func)(void))
|
||||
}
|
||||
|
||||
/*
|
||||
* Deregister a fatal()/fatalx() callback.
|
||||
* Deregister a sudo_fatal()/sudo_fatalx() callback.
|
||||
*/
|
||||
int
|
||||
fatal_callback_deregister(void (*func)(void))
|
||||
sudo_fatal_callback_deregister(void (*func)(void))
|
||||
{
|
||||
struct sudo_fatal_callback *cb, **prev;
|
||||
|
||||
|
@@ -274,7 +274,7 @@ parse_long_options(char * const *nargv, const char *options,
|
||||
if (!exact_match && second_partial_match) {
|
||||
/* ambiguous abbreviation */
|
||||
if (PRINT_ERROR)
|
||||
warningx(ambig,
|
||||
sudo_warnx(ambig,
|
||||
#ifdef GNU_COMPATIBLE
|
||||
current_dash,
|
||||
#endif
|
||||
@@ -287,7 +287,7 @@ parse_long_options(char * const *nargv, const char *options,
|
||||
if (long_options[match].has_arg == no_argument
|
||||
&& has_equal) {
|
||||
if (PRINT_ERROR)
|
||||
warningx(noarg,
|
||||
sudo_warnx(noarg,
|
||||
#ifdef GNU_COMPATIBLE
|
||||
current_dash,
|
||||
#endif
|
||||
@@ -325,7 +325,7 @@ parse_long_options(char * const *nargv, const char *options,
|
||||
* should be generated.
|
||||
*/
|
||||
if (PRINT_ERROR)
|
||||
warningx(recargstring,
|
||||
sudo_warnx(recargstring,
|
||||
#ifdef GNU_COMPATIBLE
|
||||
current_dash,
|
||||
#endif
|
||||
@@ -346,7 +346,7 @@ parse_long_options(char * const *nargv, const char *options,
|
||||
return (-1);
|
||||
}
|
||||
if (PRINT_ERROR)
|
||||
warningx(illoptstring,
|
||||
sudo_warnx(illoptstring,
|
||||
#ifdef GNU_COMPATIBLE
|
||||
current_dash,
|
||||
#endif
|
||||
@@ -529,11 +529,11 @@ start:
|
||||
++optind;
|
||||
#ifdef GNU_COMPATIBLE
|
||||
if (PRINT_ERROR)
|
||||
warningx(posixly_correct ? illoptchar : gnuoptchar,
|
||||
sudo_warnx(posixly_correct ? illoptchar : gnuoptchar,
|
||||
optchar);
|
||||
#else
|
||||
if (PRINT_ERROR)
|
||||
warningx(illoptchar, optchar);
|
||||
sudo_warnx(illoptchar, optchar);
|
||||
#endif
|
||||
optopt = optchar;
|
||||
return (BADCH);
|
||||
@@ -545,7 +545,7 @@ start:
|
||||
else if (++optind >= nargc) { /* no arg */
|
||||
place = EMSG;
|
||||
if (PRINT_ERROR)
|
||||
warningx(recargchar, optchar);
|
||||
sudo_warnx(recargchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADARG);
|
||||
} else /* white space */
|
||||
@@ -569,7 +569,7 @@ start:
|
||||
if (++optind >= nargc) { /* no arg */
|
||||
place = EMSG;
|
||||
if (PRINT_ERROR)
|
||||
warningx(recargchar, optchar);
|
||||
sudo_warnx(recargchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADARG);
|
||||
} else
|
||||
|
@@ -75,7 +75,7 @@ sudo_parse_gids(const char *gidstr, const gid_t *basegid, GETGROUPS_T **gidsp)
|
||||
do {
|
||||
gids[ngids] = (GETGROUPS_T) atoid(cp, ",", &ep, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s"), cp, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), cp, U_(errstr));
|
||||
free(gids);
|
||||
debug_return_int(-1);
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ test_atobool(int *ntests)
|
||||
(*ntests)++;
|
||||
value = atobool(d->bool_str);
|
||||
if (value != d->value) {
|
||||
warningx_nodebug("FAIL: %s != %d", d->bool_str, d->value);
|
||||
sudo_warnx_nodebug("FAIL: %s != %d", d->bool_str, d->value);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
@@ -109,14 +109,14 @@ test_atoid(int *ntests)
|
||||
value = atoid(d->idstr, d->sep, &ep, &errstr);
|
||||
if (errstr != NULL) {
|
||||
if (d->id != (id_t)-1) {
|
||||
warningx_nodebug("FAIL: %s: %s", d->idstr, errstr);
|
||||
sudo_warnx_nodebug("FAIL: %s: %s", d->idstr, errstr);
|
||||
errors++;
|
||||
}
|
||||
} else if (value != d->id) {
|
||||
warningx_nodebug("FAIL: %s != %u", d->idstr, (unsigned int)d->id);
|
||||
sudo_warnx_nodebug("FAIL: %s != %u", d->idstr, (unsigned int)d->id);
|
||||
errors++;
|
||||
} else if (d->ep != NULL && ep[0] != d->ep[0]) {
|
||||
warningx_nodebug("FAIL: ep[0] %d != %d", (int)(unsigned char)ep[0],
|
||||
sudo_warnx_nodebug("FAIL: ep[0] %d != %d", (int)(unsigned char)ep[0],
|
||||
(int)(unsigned char)d->ep[0]);
|
||||
errors++;
|
||||
}
|
||||
@@ -151,11 +151,11 @@ test_atomode(int *ntests)
|
||||
mode = atomode(d->mode_str, &errstr);
|
||||
if (errstr != NULL) {
|
||||
if (d->mode != (mode_t)-1) {
|
||||
warningx_nodebug("FAIL: %s: %s", d->mode_str, errstr);
|
||||
sudo_warnx_nodebug("FAIL: %s: %s", d->mode_str, errstr);
|
||||
errors++;
|
||||
}
|
||||
} else if (mode != d->mode) {
|
||||
warningx_nodebug("FAIL: %s != 0%o", d->mode_str,
|
||||
sudo_warnx_nodebug("FAIL: %s != 0%o", d->mode_str,
|
||||
(unsigned int) d->mode);
|
||||
errors++;
|
||||
}
|
||||
|
@@ -81,17 +81,17 @@ main(int argc, char *argv[])
|
||||
d1.a = 1;
|
||||
d1.b = 'a';
|
||||
if (HLTQ_FIRST(&d1) != &d1) {
|
||||
warningx_nodebug("FAIL: HLTQ_FIRST(1 entry) doesn't return first element: got %p, expected %p", HLTQ_FIRST(&d1), &d1);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_FIRST(1 entry) doesn't return first element: got %p, expected %p", HLTQ_FIRST(&d1), &d1);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (HLTQ_LAST(&d1, test_data, entries) != &d1) {
|
||||
warningx_nodebug("FAIL: HLTQ_LAST(1 entry) doesn't return first element: got %p, expected %p", HLTQ_LAST(&d1, test_data, entries), &d1);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_LAST(1 entry) doesn't return first element: got %p, expected %p", HLTQ_LAST(&d1, test_data, entries), &d1);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (HLTQ_PREV(&d1, test_data, entries) != NULL) {
|
||||
warningx_nodebug("FAIL: HLTQ_PREV(1 entry) doesn't return NULL: got %p", HLTQ_PREV(&d1, test_data, entries));
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_PREV(1 entry) doesn't return NULL: got %p", HLTQ_PREV(&d1, test_data, entries));
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
@@ -113,44 +113,44 @@ main(int argc, char *argv[])
|
||||
* work as expected.
|
||||
*/
|
||||
if (HLTQ_FIRST(hltq) != &d1) {
|
||||
warningx_nodebug("FAIL: HLTQ_FIRST(3 entries) doesn't return first element: got %p, expected %p", HLTQ_FIRST(hltq), &d1);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_FIRST(3 entries) doesn't return first element: got %p, expected %p", HLTQ_FIRST(hltq), &d1);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (HLTQ_LAST(hltq, test_data, entries) != &d3) {
|
||||
warningx_nodebug("FAIL: HLTQ_LAST(3 entries) doesn't return third element: got %p, expected %p", HLTQ_LAST(hltq, test_data, entries), &d3);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_LAST(3 entries) doesn't return third element: got %p, expected %p", HLTQ_LAST(hltq, test_data, entries), &d3);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
|
||||
if (HLTQ_NEXT(&d1, entries) != &d2) {
|
||||
warningx_nodebug("FAIL: HLTQ_NEXT(&d1) doesn't return &d2: got %p, expected %p", HLTQ_NEXT(&d1, entries), &d2);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_NEXT(&d1) doesn't return &d2: got %p, expected %p", HLTQ_NEXT(&d1, entries), &d2);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (HLTQ_NEXT(&d2, entries) != &d3) {
|
||||
warningx_nodebug("FAIL: HLTQ_NEXT(&d2) doesn't return &d3: got %p, expected %p", HLTQ_NEXT(&d2, entries), &d3);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_NEXT(&d2) doesn't return &d3: got %p, expected %p", HLTQ_NEXT(&d2, entries), &d3);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (HLTQ_NEXT(&d3, entries) != NULL) {
|
||||
warningx_nodebug("FAIL: HLTQ_NEXT(&d3) doesn't return NULL: got %p", HLTQ_NEXT(&d3, entries));
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_NEXT(&d3) doesn't return NULL: got %p", HLTQ_NEXT(&d3, entries));
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
|
||||
if (HLTQ_PREV(&d1, test_data, entries) != NULL) {
|
||||
warningx_nodebug("FAIL: HLTQ_PREV(&d1) doesn't return NULL: got %p", HLTQ_PREV(&d1, test_data, entries));
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_PREV(&d1) doesn't return NULL: got %p", HLTQ_PREV(&d1, test_data, entries));
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (HLTQ_PREV(&d2, test_data, entries) != &d1) {
|
||||
warningx_nodebug("FAIL: HLTQ_PREV(&d2) doesn't return &d1: got %p, expected %p", HLTQ_PREV(&d2, test_data, entries), &d1);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_PREV(&d2) doesn't return &d1: got %p, expected %p", HLTQ_PREV(&d2, test_data, entries), &d1);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (HLTQ_PREV(&d3, test_data, entries) != &d2) {
|
||||
warningx_nodebug("FAIL: HLTQ_PREV(&d3) doesn't return &d2: got %p, expected %p", HLTQ_PREV(&d3, test_data, entries), &d2);
|
||||
sudo_warnx_nodebug("FAIL: HLTQ_PREV(&d3) doesn't return &d2: got %p, expected %p", HLTQ_PREV(&d3, test_data, entries), &d2);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
@@ -159,44 +159,44 @@ main(int argc, char *argv[])
|
||||
HLTQ_TO_TAILQ(&tq, hltq, entries);
|
||||
|
||||
if (TAILQ_FIRST(&tq) != &d1) {
|
||||
warningx_nodebug("FAIL: TAILQ_FIRST(&tq) doesn't return first element: got %p, expected %p", TAILQ_FIRST(&tq), &d1);
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_FIRST(&tq) doesn't return first element: got %p, expected %p", TAILQ_FIRST(&tq), &d1);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (TAILQ_LAST(&tq, test_data_list) != &d3) {
|
||||
warningx_nodebug("FAIL: TAILQ_LAST(&tq) doesn't return third element: got %p, expected %p", TAILQ_LAST(&tq, test_data_list), &d3);
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_LAST(&tq) doesn't return third element: got %p, expected %p", TAILQ_LAST(&tq, test_data_list), &d3);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
|
||||
if (TAILQ_NEXT(&d1, entries) != &d2) {
|
||||
warningx_nodebug("FAIL: TAILQ_NEXT(&d1) doesn't return &d2: got %p, expected %p", TAILQ_NEXT(&d1, entries), &d2);
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_NEXT(&d1) doesn't return &d2: got %p, expected %p", TAILQ_NEXT(&d1, entries), &d2);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (TAILQ_NEXT(&d2, entries) != &d3) {
|
||||
warningx_nodebug("FAIL: TAILQ_NEXT(&d2) doesn't return &d3: got %p, expected %p", TAILQ_NEXT(&d2, entries), &d3);
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_NEXT(&d2) doesn't return &d3: got %p, expected %p", TAILQ_NEXT(&d2, entries), &d3);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (TAILQ_NEXT(&d3, entries) != NULL) {
|
||||
warningx_nodebug("FAIL: TAILQ_NEXT(&d3) doesn't return NULL: got %p", TAILQ_NEXT(&d3, entries));
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_NEXT(&d3) doesn't return NULL: got %p", TAILQ_NEXT(&d3, entries));
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
|
||||
if (TAILQ_PREV(&d1, test_data_list, entries) != NULL) {
|
||||
warningx_nodebug("FAIL: TAILQ_PREV(&d1) doesn't return NULL: got %p", TAILQ_PREV(&d1, test_data_list, entries));
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_PREV(&d1) doesn't return NULL: got %p", TAILQ_PREV(&d1, test_data_list, entries));
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (TAILQ_PREV(&d2, test_data_list, entries) != &d1) {
|
||||
warningx_nodebug("FAIL: TAILQ_PREV(&d2) doesn't return &d1: got %p, expected %p", TAILQ_PREV(&d2, test_data_list, entries), &d1);
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_PREV(&d2) doesn't return &d1: got %p, expected %p", TAILQ_PREV(&d2, test_data_list, entries), &d1);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
if (TAILQ_PREV(&d3, test_data_list, entries) != &d2) {
|
||||
warningx_nodebug("FAIL: TAILQ_PREV(&d3) doesn't return &d2: got %p, expected %p", TAILQ_PREV(&d3, test_data_list, entries), &d2);
|
||||
sudo_warnx_nodebug("FAIL: TAILQ_PREV(&d3) doesn't return &d2: got %p, expected %p", TAILQ_PREV(&d3, test_data_list, entries), &d2);
|
||||
errors++;
|
||||
}
|
||||
ntests++;
|
||||
|
@@ -177,7 +177,7 @@ set_var_group_source(const char *entry, const char *conf_file)
|
||||
} else if (strcasecmp(entry, "dynamic") == 0) {
|
||||
sudo_conf_data.group_source = GROUP_SOURCE_DYNAMIC;
|
||||
} else {
|
||||
warningx(U_("unsupported group source `%s' in %s, line %d"), entry,
|
||||
sudo_warnx(U_("unsupported group source `%s' in %s, line %d"), entry,
|
||||
conf_file, conf_lineno);
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ set_var_max_groups(const char *entry, const char *conf_file)
|
||||
if (max_groups > 0) {
|
||||
sudo_conf_data.max_groups = max_groups;
|
||||
} else {
|
||||
warningx(U_("invalid max groups `%s' in %s, line %d"), entry,
|
||||
sudo_warnx(U_("invalid max groups `%s' in %s, line %d"), entry,
|
||||
conf_file, conf_lineno);
|
||||
}
|
||||
}
|
||||
@@ -406,20 +406,20 @@ sudo_conf_read(const char *conf_file)
|
||||
case SUDO_PATH_MISSING:
|
||||
/* Root should always be able to read sudo.conf. */
|
||||
if (errno != ENOENT && geteuid() == ROOT_UID)
|
||||
warning(U_("unable to stat %s"), conf_file);
|
||||
sudo_warn(U_("unable to stat %s"), conf_file);
|
||||
goto done;
|
||||
case SUDO_PATH_BAD_TYPE:
|
||||
warningx(U_("%s is not a regular file"), conf_file);
|
||||
sudo_warnx(U_("%s is not a regular file"), conf_file);
|
||||
goto done;
|
||||
case SUDO_PATH_WRONG_OWNER:
|
||||
warningx(U_("%s is owned by uid %u, should be %u"),
|
||||
sudo_warnx(U_("%s is owned by uid %u, should be %u"),
|
||||
conf_file, (unsigned int) sb.st_uid, ROOT_UID);
|
||||
goto done;
|
||||
case SUDO_PATH_WORLD_WRITABLE:
|
||||
warningx(U_("%s is world writable"), conf_file);
|
||||
sudo_warnx(U_("%s is world writable"), conf_file);
|
||||
goto done;
|
||||
case SUDO_PATH_GROUP_WRITABLE:
|
||||
warningx(U_("%s is group writable"), conf_file);
|
||||
sudo_warnx(U_("%s is group writable"), conf_file);
|
||||
goto done;
|
||||
default:
|
||||
/* NOTREACHED */
|
||||
@@ -429,7 +429,7 @@ sudo_conf_read(const char *conf_file)
|
||||
|
||||
if ((fp = fopen(conf_file, "r")) == NULL) {
|
||||
if (errno != ENOENT && geteuid() == ROOT_UID)
|
||||
warning(U_("unable to open %s"), conf_file);
|
||||
sudo_warn(U_("unable to open %s"), conf_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@@ -36,10 +36,10 @@ erecalloc
|
||||
estrdup
|
||||
estrndup
|
||||
evasprintf
|
||||
fatal_callback_deregister
|
||||
fatal_callback_register
|
||||
fatal_nodebug
|
||||
fatalx_nodebug
|
||||
sudo_fatal_callback_deregister
|
||||
sudo_fatal_callback_register
|
||||
sudo_fatal_nodebug
|
||||
sudo_fatalx_nodebug
|
||||
getprogname
|
||||
initprogname
|
||||
isblank
|
||||
@@ -142,10 +142,10 @@ sudo_term_restore
|
||||
sudo_utimes
|
||||
sudo_vasprintf
|
||||
sudo_vsnprintf
|
||||
vfatal_nodebug
|
||||
vfatalx_nodebug
|
||||
vwarning_nodebug
|
||||
vwarningx_nodebug
|
||||
warning_gettext
|
||||
warning_nodebug
|
||||
warningx_nodebug
|
||||
sudo_vfatal_nodebug
|
||||
sudo_vfatalx_nodebug
|
||||
sudo_vwarn_nodebug
|
||||
sudo_vwarnx_nodebug
|
||||
sudo_warn_gettext
|
||||
sudo_warn_nodebug
|
||||
sudo_warnx_nodebug
|
||||
|
@@ -56,22 +56,22 @@ sudo_fwtk_init(struct passwd *pw, sudo_auth *auth)
|
||||
debug_decl(sudo_fwtk_init, SUDO_DEBUG_AUTH)
|
||||
|
||||
if ((confp = cfg_read("sudo")) == (Cfg *)-1) {
|
||||
warningx(U_("unable to read fwtk config"));
|
||||
sudo_warnx(U_("unable to read fwtk config"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
|
||||
if (auth_open(confp)) {
|
||||
warningx(U_("unable to connect to authentication server"));
|
||||
sudo_warnx(U_("unable to connect to authentication server"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
|
||||
/* Get welcome message from auth server */
|
||||
if (auth_recv(resp, sizeof(resp))) {
|
||||
warningx(U_("lost connection to authentication server"));
|
||||
sudo_warnx(U_("lost connection to authentication server"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
if (strncmp(resp, "Authsrv ready", 13) != 0) {
|
||||
warningx(U_("authentication server error:\n%s"), resp);
|
||||
sudo_warnx(U_("authentication server error:\n%s"), resp);
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ sudo_fwtk_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
|
||||
(void) snprintf(buf, sizeof(buf), "authorize %s 'sudo'", pw->pw_name);
|
||||
restart:
|
||||
if (auth_send(buf) || auth_recv(resp, sizeof(resp))) {
|
||||
warningx(U_("lost connection to authentication server"));
|
||||
sudo_warnx(U_("lost connection to authentication server"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ restart:
|
||||
strlcpy(buf, "response dummy", sizeof(buf));
|
||||
goto restart;
|
||||
} else {
|
||||
warningx("%s", resp);
|
||||
sudo_warnx("%s", resp);
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
if (!pass) { /* ^C or error */
|
||||
@@ -124,7 +124,7 @@ restart:
|
||||
/* Send the user's response to the server */
|
||||
(void) snprintf(buf, sizeof(buf), "response '%s'", pass);
|
||||
if (auth_send(buf) || auth_recv(resp, sizeof(resp))) {
|
||||
warningx(U_("lost connection to authentication server"));
|
||||
sudo_warnx(U_("lost connection to authentication server"));
|
||||
error = AUTH_FATAL;
|
||||
goto done;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ restart:
|
||||
|
||||
/* Main loop prints "Permission Denied" or insult. */
|
||||
if (strcmp(resp, "Permission Denied.") != 0)
|
||||
warningx("%s", resp);
|
||||
sudo_warnx("%s", resp);
|
||||
error = AUTH_FAILURE;
|
||||
done:
|
||||
memset_s(pass, SUDO_PASS_MAX, 0, strlen(pass));
|
||||
|
@@ -100,7 +100,7 @@ sudo_rfc1938_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
|
||||
*/
|
||||
if (rfc1938challenge(&rfc1938, pw->pw_name, challenge, sizeof(challenge))) {
|
||||
if (IS_ONEANDONLY(auth)) {
|
||||
warningx(U_("you do not exist in the %s database"), auth->name);
|
||||
sudo_warnx(U_("you do not exist in the %s database"), auth->name);
|
||||
debug_return_int(AUTH_FATAL);
|
||||
} else {
|
||||
debug_return_int(AUTH_FAILURE);
|
||||
|
@@ -77,7 +77,7 @@ sudo_securid_init(struct passwd *pw, sudo_auth *auth)
|
||||
if (AceInitialize() != SD_FALSE)
|
||||
debug_return_int(AUTH_SUCCESS);
|
||||
|
||||
warningx(U_("failed to initialise the ACE API library"));
|
||||
sudo_warnx(U_("failed to initialise the ACE API library"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ sudo_securid_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
|
||||
|
||||
/* Re-initialize SecurID every time. */
|
||||
if (SD_Init(sd) != ACM_OK) {
|
||||
warningx(U_("unable to contact the SecurID server"));
|
||||
sudo_warnx(U_("unable to contact the SecurID server"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
|
||||
@@ -112,23 +112,23 @@ sudo_securid_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
|
||||
|
||||
switch (retval) {
|
||||
case ACM_OK:
|
||||
warningx(U_("User ID locked for SecurID Authentication"));
|
||||
sudo_warnx(U_("User ID locked for SecurID Authentication"));
|
||||
debug_return_int(AUTH_SUCCESS);
|
||||
|
||||
case ACE_UNDEFINED_USERNAME:
|
||||
warningx(U_("invalid username length for SecurID"));
|
||||
sudo_warnx(U_("invalid username length for SecurID"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
|
||||
case ACE_ERR_INVALID_HANDLE:
|
||||
warningx(U_("invalid Authentication Handle for SecurID"));
|
||||
sudo_warnx(U_("invalid Authentication Handle for SecurID"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
|
||||
case ACM_ACCESS_DENIED:
|
||||
warningx(U_("SecurID communication failed"));
|
||||
sudo_warnx(U_("SecurID communication failed"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
|
||||
default:
|
||||
warningx(U_("unknown SecurID error"));
|
||||
sudo_warnx(U_("unknown SecurID error"));
|
||||
debug_return_int(AUTH_FATAL);
|
||||
}
|
||||
}
|
||||
@@ -162,17 +162,17 @@ sudo_securid_verify(struct passwd *pw, char *pass, sudo_auth *auth)
|
||||
break;
|
||||
|
||||
case ACE_UNDEFINED_PASSCODE:
|
||||
warningx(U_("invalid passcode length for SecurID"));
|
||||
sudo_warnx(U_("invalid passcode length for SecurID"));
|
||||
rval = AUTH_FATAL;
|
||||
break;
|
||||
|
||||
case ACE_UNDEFINED_USERNAME:
|
||||
warningx(U_("invalid username length for SecurID"));
|
||||
sudo_warnx(U_("invalid username length for SecurID"));
|
||||
rval = AUTH_FATAL;
|
||||
break;
|
||||
|
||||
case ACE_ERR_INVALID_HANDLE:
|
||||
warningx(U_("invalid Authentication Handle for SecurID"));
|
||||
sudo_warnx(U_("invalid Authentication Handle for SecurID"));
|
||||
rval = AUTH_FATAL;
|
||||
break;
|
||||
|
||||
@@ -211,7 +211,7 @@ then enter the new token code.\n", \
|
||||
break;
|
||||
|
||||
default:
|
||||
warningx(U_("unknown SecurID error"));
|
||||
sudo_warnx(U_("unknown SecurID error"));
|
||||
rval = AUTH_FATAL;
|
||||
break;
|
||||
}
|
||||
|
@@ -61,12 +61,12 @@ audit_sudo_selected(int sorf)
|
||||
auditinfo_t ainfo;
|
||||
/* Fall back to older BSM API. */
|
||||
if (getaudit(&ainfo) < 0) {
|
||||
warning("getaudit");
|
||||
sudo_warn("getaudit");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
mask = &ainfo.ai_mask;
|
||||
} else {
|
||||
warning("getaudit_addr");
|
||||
sudo_warn("getaudit_addr");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
} else {
|
||||
@@ -97,7 +97,7 @@ bsm_audit_success(char *exec_args[])
|
||||
if (auditon(A_GETCOND, (caddr_t)&au_cond, sizeof(long)) < 0) {
|
||||
if (errno == AUDIT_NOT_CONFIGURED)
|
||||
debug_return_int(0);
|
||||
warning(U_("Could not determine audit condition"));
|
||||
sudo_warn(U_("Could not determine audit condition"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if (au_cond == AUC_NOAUDIT)
|
||||
@@ -110,11 +110,11 @@ bsm_audit_success(char *exec_args[])
|
||||
if (selected != 1)
|
||||
debug_return_int(!selected ? 0 : -1);
|
||||
if (getauid(&auid) < 0) {
|
||||
warning("getauid");
|
||||
sudo_warn("getauid");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if ((aufd = au_open()) == -1) {
|
||||
warning("au_open");
|
||||
sudo_warn("au_open");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
pid = getpid();
|
||||
@@ -126,29 +126,29 @@ bsm_audit_success(char *exec_args[])
|
||||
* NB: We should probably watch out for ERANGE here.
|
||||
*/
|
||||
if (getaudit(&ainfo) < 0) {
|
||||
warning("getaudit");
|
||||
sudo_warn("getaudit");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
tok = au_to_subject(auid, geteuid(), getegid(), getuid(),
|
||||
getuid(), pid, pid, &ainfo.ai_termid);
|
||||
} else {
|
||||
warning("getaudit_addr");
|
||||
sudo_warn("getaudit_addr");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if (tok == NULL) {
|
||||
warning("au_to_subject");
|
||||
sudo_warn("au_to_subject");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
au_write(aufd, tok);
|
||||
tok = au_to_exec_args(exec_args);
|
||||
if (tok == NULL) {
|
||||
warning("au_to_exec_args");
|
||||
sudo_warn("au_to_exec_args");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
au_write(aufd, tok);
|
||||
tok = au_to_return32(0, 0);
|
||||
if (tok == NULL) {
|
||||
warning("au_to_return32");
|
||||
sudo_warn("au_to_return32");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
au_write(aufd, tok);
|
||||
@@ -158,7 +158,7 @@ bsm_audit_success(char *exec_args[])
|
||||
if (au_close(aufd, 1, AUE_sudo) == -1)
|
||||
#endif
|
||||
{
|
||||
warning(U_("unable to commit audit record"));
|
||||
sudo_warn(U_("unable to commit audit record"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
debug_return_int(0);
|
||||
@@ -186,7 +186,7 @@ bsm_audit_failure(char *exec_args[], char const *const fmt, va_list ap)
|
||||
if (auditon(A_GETCOND, (caddr_t)&au_cond, sizeof(long)) < 0) {
|
||||
if (errno == AUDIT_NOT_CONFIGURED)
|
||||
debug_return_int(0);
|
||||
warning(U_("Could not determine audit condition"));
|
||||
sudo_warn(U_("Could not determine audit condition"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if (au_cond == AUC_NOAUDIT)
|
||||
@@ -194,11 +194,11 @@ bsm_audit_failure(char *exec_args[], char const *const fmt, va_list ap)
|
||||
if (!audit_sudo_selected(AU_PRS_FAILURE))
|
||||
debug_return_int(0);
|
||||
if (getauid(&auid) < 0) {
|
||||
warning("getauid");
|
||||
sudo_warn("getauid");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if ((aufd = au_open()) == -1) {
|
||||
warning("au_open");
|
||||
sudo_warn("au_open");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
pid = getpid();
|
||||
@@ -207,36 +207,36 @@ bsm_audit_failure(char *exec_args[], char const *const fmt, va_list ap)
|
||||
getuid(), pid, pid, &ainfo_addr.ai_termid);
|
||||
} else if (errno == ENOSYS) {
|
||||
if (getaudit(&ainfo) < 0) {
|
||||
warning("getaudit");
|
||||
sudo_warn("getaudit");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
tok = au_to_subject(auid, geteuid(), getegid(), getuid(),
|
||||
getuid(), pid, pid, &ainfo.ai_termid);
|
||||
} else {
|
||||
warning("getaudit_addr");
|
||||
sudo_warn("getaudit_addr");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if (tok == NULL) {
|
||||
warning("au_to_subject");
|
||||
sudo_warn("au_to_subject");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
au_write(aufd, tok);
|
||||
tok = au_to_exec_args(exec_args);
|
||||
if (tok == NULL) {
|
||||
warning("au_to_exec_args");
|
||||
sudo_warn("au_to_exec_args");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
au_write(aufd, tok);
|
||||
(void) vsnprintf(text, sizeof(text), fmt, ap);
|
||||
tok = au_to_text(text);
|
||||
if (tok == NULL) {
|
||||
warning("au_to_text");
|
||||
sudo_warn("au_to_text");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
au_write(aufd, tok);
|
||||
tok = au_to_return32(EPERM, 1);
|
||||
if (tok == NULL) {
|
||||
warning("au_to_return32");
|
||||
sudo_warn("au_to_return32");
|
||||
debug_return_int(-1);
|
||||
}
|
||||
au_write(aufd, tok);
|
||||
@@ -246,7 +246,7 @@ bsm_audit_failure(char *exec_args[], char const *const fmt, va_list ap)
|
||||
if (au_close(aufd, 1, AUE_sudo) == -1)
|
||||
#endif
|
||||
{
|
||||
warning(U_("unable to commit audit record"));
|
||||
sudo_warn(U_("unable to commit audit record"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
debug_return_int(0);
|
||||
|
@@ -207,7 +207,7 @@ set_default(char *var, char *val, int op)
|
||||
break;
|
||||
}
|
||||
if (!cur->name) {
|
||||
warningx(U_("unknown defaults entry `%s'"), var);
|
||||
sudo_warnx(U_("unknown defaults entry `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -215,20 +215,20 @@ set_default(char *var, char *val, int op)
|
||||
case T_LOGFAC:
|
||||
if (!store_syslogfac(val, cur, op)) {
|
||||
if (val)
|
||||
warningx(U_("value `%s' is invalid for option `%s'"),
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"),
|
||||
val, var);
|
||||
else
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
case T_LOGPRI:
|
||||
if (!store_syslogpri(val, cur, op)) {
|
||||
if (val)
|
||||
warningx(U_("value `%s' is invalid for option `%s'"),
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"),
|
||||
val, var);
|
||||
else
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
@@ -236,16 +236,16 @@ set_default(char *var, char *val, int op)
|
||||
if (!val) {
|
||||
/* Check for bogus boolean usage or lack of a value. */
|
||||
if (!ISSET(cur->type, T_BOOL) || op != false) {
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
}
|
||||
if (ISSET(cur->type, T_PATH) && val && *val != '/') {
|
||||
warningx(U_("values for `%s' must start with a '/'"), var);
|
||||
sudo_warnx(U_("values for `%s' must start with a '/'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
if (!store_str(val, cur, op)) {
|
||||
warningx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
@@ -253,12 +253,12 @@ set_default(char *var, char *val, int op)
|
||||
if (!val) {
|
||||
/* Check for bogus boolean usage or lack of a value. */
|
||||
if (!ISSET(cur->type, T_BOOL) || op != false) {
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
}
|
||||
if (!store_int(val, cur, op)) {
|
||||
warningx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
@@ -266,12 +266,12 @@ set_default(char *var, char *val, int op)
|
||||
if (!val) {
|
||||
/* Check for bogus boolean usage or lack of a value. */
|
||||
if (!ISSET(cur->type, T_BOOL) || op != false) {
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
}
|
||||
if (!store_uint(val, cur, op)) {
|
||||
warningx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
@@ -279,12 +279,12 @@ set_default(char *var, char *val, int op)
|
||||
if (!val) {
|
||||
/* Check for bogus boolean usage or lack of a value. */
|
||||
if (!ISSET(cur->type, T_BOOL) || op != false) {
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
}
|
||||
if (!store_float(val, cur, op)) {
|
||||
warningx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
@@ -292,18 +292,18 @@ set_default(char *var, char *val, int op)
|
||||
if (!val) {
|
||||
/* Check for bogus boolean usage or lack of a value. */
|
||||
if (!ISSET(cur->type, T_BOOL) || op != false) {
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
}
|
||||
if (!store_mode(val, cur, op)) {
|
||||
warningx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
case T_FLAG:
|
||||
if (val) {
|
||||
warningx(U_("option `%s' does not take a value"), var);
|
||||
sudo_warnx(U_("option `%s' does not take a value"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
cur->sd_un.flag = op;
|
||||
@@ -312,22 +312,22 @@ set_default(char *var, char *val, int op)
|
||||
if (!val) {
|
||||
/* Check for bogus boolean usage or lack of a value. */
|
||||
if (!ISSET(cur->type, T_BOOL) || op != false) {
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
}
|
||||
if (!store_list(val, cur, op)) {
|
||||
warningx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
case T_TUPLE:
|
||||
if (!val && !ISSET(cur->type, T_BOOL)) {
|
||||
warningx(U_("no value specified for `%s'"), var);
|
||||
sudo_warnx(U_("no value specified for `%s'"), var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
if (!store_tuple(val, cur, op)) {
|
||||
warningx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
break;
|
||||
@@ -598,7 +598,7 @@ check_defaults(int what, bool quiet)
|
||||
}
|
||||
if (cur->name == NULL) {
|
||||
if (!quiet)
|
||||
warningx(U_("unknown defaults entry `%s'"), def->var);
|
||||
sudo_warnx(U_("unknown defaults entry `%s'"), def->var);
|
||||
rc = false;
|
||||
}
|
||||
}
|
||||
|
@@ -271,14 +271,14 @@ sudo_putenv_nodebug(char *str, bool dupcheck, bool overwrite)
|
||||
size_t nsize;
|
||||
|
||||
if (env.env_size > SIZE_MAX - 128) {
|
||||
warningx_nodebug(U_("internal error, %s overflow"),
|
||||
sudo_warnx_nodebug(U_("internal error, %s overflow"),
|
||||
"sudo_putenv_nodebug");
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
nsize = env.env_size + 128;
|
||||
if (nsize > SIZE_MAX / sizeof(char *)) {
|
||||
warningx_nodebug(U_("internal error, %s overflow"),
|
||||
sudo_warnx_nodebug(U_("internal error, %s overflow"),
|
||||
"sudo_putenv_nodebug");
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
@@ -354,7 +354,7 @@ sudo_putenv(char *str, bool dupcheck, bool overwrite)
|
||||
if (rval == -1) {
|
||||
#ifdef ENV_DEBUG
|
||||
if (env.envp[env.env_len] != NULL)
|
||||
warningx(U_("sudo_putenv: corrupted envp, length mismatch"));
|
||||
sudo_warnx(U_("sudo_putenv: corrupted envp, length mismatch"));
|
||||
#endif
|
||||
}
|
||||
debug_return_int(rval);
|
||||
@@ -381,7 +381,7 @@ sudo_setenv2(const char *var, const char *val, bool dupcheck, bool overwrite)
|
||||
strlcat(estring, "=", esize) >= esize ||
|
||||
strlcat(estring, val, esize) >= esize) {
|
||||
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
errno = EOVERFLOW;
|
||||
} else {
|
||||
rval = sudo_putenv(estring, dupcheck, overwrite);
|
||||
|
@@ -80,39 +80,39 @@ group_plugin_load(char *plugin_info)
|
||||
}
|
||||
if (len <= 0 || (size_t)len >= sizeof(path)) {
|
||||
errno = ENAMETOOLONG;
|
||||
warning("%s%s",
|
||||
sudo_warn("%s%s",
|
||||
(*plugin_info != '/') ? _PATH_SUDO_PLUGIN_DIR : "", plugin_info);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Sanity check plugin path. */
|
||||
if (stat(path, &sb) != 0) {
|
||||
warning("%s", path);
|
||||
sudo_warn("%s", path);
|
||||
goto done;
|
||||
}
|
||||
if (sb.st_uid != ROOT_UID) {
|
||||
warningx(U_("%s must be owned by uid %d"), path, ROOT_UID);
|
||||
sudo_warnx(U_("%s must be owned by uid %d"), path, ROOT_UID);
|
||||
goto done;
|
||||
}
|
||||
if ((sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
|
||||
warningx(U_("%s must only be writable by owner"), path);
|
||||
sudo_warnx(U_("%s must only be writable by owner"), path);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Open plugin and map in symbol. */
|
||||
group_handle = sudo_dso_load(path, SUDO_DSO_LAZY|SUDO_DSO_GLOBAL);
|
||||
if (!group_handle) {
|
||||
warningx(U_("unable to load %s: %s"), path, sudo_dso_strerror());
|
||||
sudo_warnx(U_("unable to load %s: %s"), path, sudo_dso_strerror());
|
||||
goto done;
|
||||
}
|
||||
group_plugin = sudo_dso_findsym(group_handle, "group_plugin");
|
||||
if (group_plugin == NULL) {
|
||||
warningx(U_("unable to find symbol \"group_plugin\" in %s"), path);
|
||||
sudo_warnx(U_("unable to find symbol \"group_plugin\" in %s"), path);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (GROUP_API_VERSION_GET_MAJOR(group_plugin->version) != GROUP_API_VERSION_MAJOR) {
|
||||
warningx(U_("%s: incompatible group plugin major version %d, expected %d"),
|
||||
sudo_warnx(U_("%s: incompatible group plugin major version %d, expected %d"),
|
||||
path, GROUP_API_VERSION_GET_MAJOR(group_plugin->version),
|
||||
GROUP_API_VERSION_MAJOR);
|
||||
goto done;
|
||||
|
@@ -491,7 +491,7 @@ iolog_deserialize_info(struct iolog_details *details, char * const user_info[],
|
||||
if (runas_uid_str != NULL) {
|
||||
id = atoid(runas_uid_str, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
warningx("runas uid %s: %s", runas_uid_str, U_(errstr));
|
||||
sudo_warnx("runas uid %s: %s", runas_uid_str, U_(errstr));
|
||||
else
|
||||
runas_uid = (uid_t)id;
|
||||
}
|
||||
@@ -500,7 +500,7 @@ iolog_deserialize_info(struct iolog_details *details, char * const user_info[],
|
||||
if (runas_gid_str != NULL) {
|
||||
id = atoid(runas_gid_str, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
warningx("runas gid %s: %s", runas_gid_str, U_(errstr));
|
||||
sudo_warnx("runas gid %s: %s", runas_gid_str, U_(errstr));
|
||||
else
|
||||
runas_gid = (gid_t)id;
|
||||
}
|
||||
|
@@ -114,23 +114,23 @@ extern int ldapssl_set_strength(LDAP *ldap, int strength);
|
||||
#if defined(__GNUC__) && __GNUC__ == 2
|
||||
# define DPRINTF1(fmt...) do { \
|
||||
if (ldap_conf.debug >= 1) \
|
||||
warningx(__VA_ARGS__); \
|
||||
sudo_warnx(__VA_ARGS__); \
|
||||
sudo_debug_printf(SUDO_DEBUG_DIAG, fmt); \
|
||||
} while (0)
|
||||
# define DPRINTF2(fmt...) do { \
|
||||
if (ldap_conf.debug >= 2) \
|
||||
warningx(__VA_ARGS__); \
|
||||
sudo_warnx(__VA_ARGS__); \
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, fmt); \
|
||||
} while (0)
|
||||
#else
|
||||
# define DPRINTF1(...) do { \
|
||||
if (ldap_conf.debug >= 1) \
|
||||
warningx(__VA_ARGS__); \
|
||||
sudo_warnx(__VA_ARGS__); \
|
||||
sudo_debug_printf(SUDO_DEBUG_DIAG, __VA_ARGS__); \
|
||||
} while (0)
|
||||
# define DPRINTF2(...) do { \
|
||||
if (ldap_conf.debug >= 2) \
|
||||
warningx(__VA_ARGS__); \
|
||||
sudo_warnx(__VA_ARGS__); \
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#endif
|
||||
@@ -403,7 +403,7 @@ sudo_ldap_conf_add_ports(void)
|
||||
hostbuf[0] = '\0';
|
||||
len = snprintf(defport, sizeof(defport), ":%d", ldap_conf.port);
|
||||
if (len <= 0 || (size_t)len >= sizeof(defport)) {
|
||||
warningx(U_("sudo_ldap_conf_add_ports: port too large"));
|
||||
sudo_warnx(U_("sudo_ldap_conf_add_ports: port too large"));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ sudo_ldap_conf_add_ports(void)
|
||||
debug_return_bool(true);
|
||||
|
||||
toobig:
|
||||
warningx(U_("sudo_ldap_conf_add_ports: out of space expanding hostbuf"));
|
||||
sudo_warnx(U_("sudo_ldap_conf_add_ports: out of space expanding hostbuf"));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
#endif
|
||||
@@ -461,7 +461,7 @@ sudo_ldap_parse_uri(const struct ldap_config_str_list *uri_list)
|
||||
nldaps++;
|
||||
host = uri + 8;
|
||||
} else {
|
||||
warningx(U_("unsupported LDAP uri type: %s"), uri);
|
||||
sudo_warnx(U_("unsupported LDAP uri type: %s"), uri);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -492,11 +492,11 @@ sudo_ldap_parse_uri(const struct ldap_config_str_list *uri_list)
|
||||
|
||||
if (nldaps != 0) {
|
||||
if (nldap != 0) {
|
||||
warningx(U_("unable to mix ldap and ldaps URIs"));
|
||||
sudo_warnx(U_("unable to mix ldap and ldaps URIs"));
|
||||
goto done;
|
||||
}
|
||||
if (ldap_conf.ssl_mode == SUDO_LDAP_STARTTLS)
|
||||
warningx(U_("starttls not supported when using ldaps"));
|
||||
sudo_warnx(U_("starttls not supported when using ldaps"));
|
||||
ldap_conf.ssl_mode = SUDO_LDAP_SSL;
|
||||
}
|
||||
efree(buf);
|
||||
@@ -514,7 +514,7 @@ done:
|
||||
debug_return_int(rc);
|
||||
|
||||
toobig:
|
||||
warningx(U_("sudo_ldap_parse_uri: out of space building hostbuf"));
|
||||
sudo_warnx(U_("sudo_ldap_parse_uri: out of space building hostbuf"));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
#else
|
||||
@@ -529,7 +529,7 @@ sudo_ldap_join_uri(struct ldap_config_str_list *uri_list)
|
||||
STAILQ_FOREACH(uri, uri_list, entries) {
|
||||
if (ldap_conf.ssl_mode == SUDO_LDAP_STARTTLS) {
|
||||
if (strncasecmp(uri->val, "ldaps://", 8) == 0) {
|
||||
warningx(U_("starttls not supported when using ldaps"));
|
||||
sudo_warnx(U_("starttls not supported when using ldaps"));
|
||||
ldap_conf.ssl_mode = SUDO_LDAP_SSL;
|
||||
}
|
||||
}
|
||||
@@ -596,10 +596,10 @@ sudo_ldap_init(LDAP **ldp, const char *host, int port)
|
||||
}
|
||||
}
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx(U_("unable to initialize SSL cert and key db: %s"),
|
||||
sudo_warnx(U_("unable to initialize SSL cert and key db: %s"),
|
||||
ldapssl_err2string(rc));
|
||||
if (ldap_conf.tls_certfile == NULL)
|
||||
warningx(U_("you must set TLS_CERT in %s to use SSL"),
|
||||
sudo_warnx(U_("you must set TLS_CERT in %s to use SSL"),
|
||||
path_ldap_conf);
|
||||
goto done;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ sudo_ldap_init(LDAP **ldp, const char *host, int port)
|
||||
rc = ldap_ssl_client_init(ldap_conf.tls_keyfile, ldap_conf.tls_keypw,
|
||||
0, &sslrc);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_ssl_client_init(): %s (SSL reason code %d)",
|
||||
sudo_warnx("ldap_ssl_client_init(): %s (SSL reason code %d)",
|
||||
ldap_err2string(rc), sslrc);
|
||||
goto done;
|
||||
}
|
||||
@@ -1090,13 +1090,13 @@ sudo_ldap_timefilter(char *buffer, size_t buffersize)
|
||||
/* Make sure we have a formatted timestamp for __now__. */
|
||||
time(&now);
|
||||
if ((tp = gmtime(&now)) == NULL) {
|
||||
warning(U_("unable to get GMT time"));
|
||||
sudo_warn(U_("unable to get GMT time"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Format the timestamp according to the RFC. */
|
||||
if (strftime(timebuffer, sizeof(timebuffer), "%Y%m%d%H%M%S.0Z", tp) == 0) {
|
||||
warningx(U_("unable to format timestamp"));
|
||||
sudo_warnx(U_("unable to format timestamp"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -1104,7 +1104,7 @@ sudo_ldap_timefilter(char *buffer, size_t buffersize)
|
||||
bytes = snprintf(buffer, buffersize, "(&(|(!(sudoNotAfter=*))(sudoNotAfter>=%s))(|(!(sudoNotBefore=*))(sudoNotBefore<=%s)))",
|
||||
timebuffer, timebuffer);
|
||||
if (bytes <= 0 || (size_t)bytes >= buffersize) {
|
||||
warning(U_("unable to build time filter"));
|
||||
sudo_warn(U_("unable to build time filter"));
|
||||
bytes = 0;
|
||||
}
|
||||
|
||||
@@ -1323,7 +1323,7 @@ sudo_ldap_build_pass1(struct passwd *pw)
|
||||
|
||||
/* Add ALL to list and end the global OR */
|
||||
if (strlcat(buf, "(sudoUser=ALL)", sz) >= sz) {
|
||||
warningx(U_("sudo_ldap_build_pass1 allocation mismatch"));
|
||||
sudo_warnx(U_("sudo_ldap_build_pass1 allocation mismatch"));
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
|
||||
@@ -1436,7 +1436,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
|
||||
case CONF_INT:
|
||||
*(int *)(cur->valp) = strtonum(value, INT_MIN, INT_MAX, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s: %s: %s"),
|
||||
sudo_warnx(U_("%s: %s: %s: %s"),
|
||||
path_ldap_conf, keyword, value, U_(errstr));
|
||||
}
|
||||
break;
|
||||
@@ -2130,14 +2130,14 @@ sudo_krb5_copy_cc_file(const char *old_ccname)
|
||||
do {
|
||||
nwritten = write(nfd, buf + off, nread - off);
|
||||
if (nwritten == -1) {
|
||||
warning("error writing to %s", new_ccname);
|
||||
sudo_warn("error writing to %s", new_ccname);
|
||||
goto write_error;
|
||||
}
|
||||
off += nwritten;
|
||||
} while (off < nread);
|
||||
}
|
||||
if (nread == -1)
|
||||
warning("unable to read %s", new_ccname);
|
||||
sudo_warn("unable to read %s", new_ccname);
|
||||
write_error:
|
||||
close(nfd);
|
||||
if (nread != -1 && nwritten != -1) {
|
||||
@@ -2146,7 +2146,7 @@ write_error:
|
||||
unlink(new_ccname); /* failed */
|
||||
}
|
||||
} else {
|
||||
warning("unable to create temp file %s", new_ccname);
|
||||
sudo_warn("unable to create temp file %s", new_ccname);
|
||||
}
|
||||
}
|
||||
close(ofd);
|
||||
@@ -2170,7 +2170,7 @@ sudo_ldap_sasl_interact(LDAP *ld, unsigned int flags, void *_auth_id,
|
||||
|
||||
for (; interact->id != SASL_CB_LIST_END; interact++) {
|
||||
if (interact->id != SASL_CB_USER) {
|
||||
warningx("sudo_ldap_sasl_interact: unexpected interact id %lu",
|
||||
sudo_warnx("sudo_ldap_sasl_interact: unexpected interact id %lu",
|
||||
interact->id);
|
||||
rc = LDAP_PARAM_ERROR;
|
||||
break;
|
||||
@@ -2222,7 +2222,7 @@ sudo_ldap_set_options_table(LDAP *ld, struct ldap_config_table *table)
|
||||
DPRINTF1("ldap_set_option: %s -> %d", cur->conf_str, ival);
|
||||
rc = ldap_set_option(ld, cur->opt_val, &ival);
|
||||
if (rc != LDAP_OPT_SUCCESS) {
|
||||
warningx("ldap_set_option: %s -> %d: %s",
|
||||
sudo_warnx("ldap_set_option: %s -> %d: %s",
|
||||
cur->conf_str, ival, ldap_err2string(rc));
|
||||
errors++;
|
||||
}
|
||||
@@ -2234,7 +2234,7 @@ sudo_ldap_set_options_table(LDAP *ld, struct ldap_config_table *table)
|
||||
DPRINTF1("ldap_set_option: %s -> %s", cur->conf_str, sval);
|
||||
rc = ldap_set_option(ld, cur->opt_val, sval);
|
||||
if (rc != LDAP_OPT_SUCCESS) {
|
||||
warningx("ldap_set_option: %s -> %s: %s",
|
||||
sudo_warnx("ldap_set_option: %s -> %s: %s",
|
||||
cur->conf_str, sval, ldap_err2string(rc));
|
||||
errors++;
|
||||
}
|
||||
@@ -2290,7 +2290,7 @@ sudo_ldap_set_options_conn(LDAP *ld)
|
||||
DPRINTF1("ldap_set_option(LDAP_OPT_TIMEOUT, %d)", ldap_conf.timeout);
|
||||
rc = ldap_set_option(ld, LDAP_OPT_TIMEOUT, &tv);
|
||||
if (rc != LDAP_OPT_SUCCESS) {
|
||||
warningx("ldap_set_option(TIMEOUT, %d): %s",
|
||||
sudo_warnx("ldap_set_option(TIMEOUT, %d): %s",
|
||||
ldap_conf.timeout, ldap_err2string(rc));
|
||||
}
|
||||
}
|
||||
@@ -2307,7 +2307,7 @@ sudo_ldap_set_options_conn(LDAP *ld)
|
||||
# if !defined(LDAP_OPT_CONNECT_TIMEOUT) || LDAP_VENDOR_VERSION != 510
|
||||
/* Tivoli Directory Server 6.3 libs always return a (bogus) error. */
|
||||
if (rc != LDAP_OPT_SUCCESS) {
|
||||
warningx("ldap_set_option(NETWORK_TIMEOUT, %d): %s",
|
||||
sudo_warnx("ldap_set_option(NETWORK_TIMEOUT, %d): %s",
|
||||
ldap_conf.bind_timelimit / 1000, ldap_err2string(rc));
|
||||
}
|
||||
# endif
|
||||
@@ -2320,7 +2320,7 @@ sudo_ldap_set_options_conn(LDAP *ld)
|
||||
DPRINTF1("ldap_set_option(LDAP_OPT_X_TLS, LDAP_OPT_X_TLS_HARD)");
|
||||
rc = ldap_set_option(ld, LDAP_OPT_X_TLS, &val);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_set_option(LDAP_OPT_X_TLS, LDAP_OPT_X_TLS_HARD): %s",
|
||||
sudo_warnx("ldap_set_option(LDAP_OPT_X_TLS, LDAP_OPT_X_TLS_HARD): %s",
|
||||
ldap_err2string(rc));
|
||||
debug_return_int(-1);
|
||||
}
|
||||
@@ -2443,7 +2443,7 @@ sudo_ldap_bind_s(LDAP *ld)
|
||||
unlink(tmp_ccname);
|
||||
}
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_sasl_interactive_bind_s(): %s",
|
||||
sudo_warnx("ldap_sasl_interactive_bind_s(): %s",
|
||||
ldap_err2string(rc));
|
||||
goto done;
|
||||
}
|
||||
@@ -2460,7 +2460,7 @@ sudo_ldap_bind_s(LDAP *ld)
|
||||
rc = ldap_sasl_bind_s(ld, ldap_conf.binddn, LDAP_SASL_SIMPLE, &bv,
|
||||
NULL, NULL, NULL);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_sasl_bind_s(): %s", ldap_err2string(rc));
|
||||
sudo_warnx("ldap_sasl_bind_s(): %s", ldap_err2string(rc));
|
||||
goto done;
|
||||
}
|
||||
DPRINTF1("ldap_sasl_bind_s() ok");
|
||||
@@ -2469,7 +2469,7 @@ sudo_ldap_bind_s(LDAP *ld)
|
||||
{
|
||||
rc = ldap_simple_bind_s(ld, ldap_conf.binddn, ldap_conf.bindpw);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_simple_bind_s(): %s", ldap_err2string(rc));
|
||||
sudo_warnx("ldap_simple_bind_s(): %s", ldap_err2string(rc));
|
||||
goto done;
|
||||
}
|
||||
DPRINTF1("ldap_simple_bind_s() ok");
|
||||
@@ -2521,7 +2521,7 @@ sudo_ldap_open(struct sudo_nss *nss)
|
||||
rc = ldap_initialize(&ld, buf);
|
||||
efree(buf);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx(U_("unable to initialize LDAP: %s"),
|
||||
sudo_warnx(U_("unable to initialize LDAP: %s"),
|
||||
ldap_err2string(rc));
|
||||
}
|
||||
}
|
||||
@@ -2543,7 +2543,7 @@ sudo_ldap_open(struct sudo_nss *nss)
|
||||
#if defined(HAVE_LDAP_START_TLS_S)
|
||||
rc = ldap_start_tls_s(ld, NULL, NULL);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_start_tls_s(): %s", ldap_err2string(rc));
|
||||
sudo_warnx("ldap_start_tls_s(): %s", ldap_err2string(rc));
|
||||
goto done;
|
||||
}
|
||||
DPRINTF1("ldap_start_tls_s() ok");
|
||||
@@ -2552,18 +2552,18 @@ sudo_ldap_open(struct sudo_nss *nss)
|
||||
rc = ldap_ssl_client_init(ldap_conf.tls_keyfile, ldap_conf.tls_keypw,
|
||||
0, &sslrc);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_ssl_client_init(): %s (SSL reason code %d)",
|
||||
sudo_warnx("ldap_ssl_client_init(): %s (SSL reason code %d)",
|
||||
ldap_err2string(rc), sslrc);
|
||||
goto done;
|
||||
}
|
||||
rc = ldap_start_tls_s_np(ld, NULL);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
warningx("ldap_start_tls_s_np(): %s", ldap_err2string(rc));
|
||||
sudo_warnx("ldap_start_tls_s_np(): %s", ldap_err2string(rc));
|
||||
goto done;
|
||||
}
|
||||
DPRINTF1("ldap_start_tls_s_np() ok");
|
||||
#else
|
||||
warningx(U_("start_tls specified but LDAP libs do not support ldap_start_tls_s() or ldap_start_tls_s_np()"));
|
||||
sudo_warnx(U_("start_tls specified but LDAP libs do not support ldap_start_tls_s() or ldap_start_tls_s_np()"));
|
||||
#endif /* !HAVE_LDAP_START_TLS_S && !HAVE_LDAP_START_TLS_S_NP */
|
||||
}
|
||||
|
||||
@@ -2796,7 +2796,7 @@ sudo_ldap_result_add_entry(struct ldap_result *lres, LDAPMessage *entry)
|
||||
DPRINTF2("order attribute raw: %s", (*bv)->bv_val);
|
||||
order = strtod((*bv)->bv_val, &ep);
|
||||
if (ep == (*bv)->bv_val || *ep != '\0') {
|
||||
warningx(U_("invalid sudoOrder attribute: %s"), (*bv)->bv_val);
|
||||
sudo_warnx(U_("invalid sudoOrder attribute: %s"), (*bv)->bv_val);
|
||||
order = 0.0;
|
||||
}
|
||||
DPRINTF2("order attribute: %f", order);
|
||||
|
@@ -58,7 +58,7 @@ linux_audit_open(void)
|
||||
if (au_fd == -1) {
|
||||
/* Kernel may not have audit support. */
|
||||
if (errno != EINVAL && errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT) {
|
||||
warning(U_("unable to open audit system"));
|
||||
sudo_warn(U_("unable to open audit system"));
|
||||
au_fd == AUDIT_NOT_CONFIGURED;
|
||||
}
|
||||
} else {
|
||||
@@ -86,7 +86,7 @@ linux_audit_command(char *argv[], int result)
|
||||
for (av = argv; *av != NULL; av++) {
|
||||
n = strlcpy(cp, *av, size - (cp - command));
|
||||
if (n >= size - (cp - command)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += n;
|
||||
@@ -97,7 +97,7 @@ linux_audit_command(char *argv[], int result)
|
||||
/* Log command, ignoring ECONNREFUSED on error. */
|
||||
if (audit_log_user_command(au_fd, AUDIT_USER_CMD, command, NULL, result) <= 0) {
|
||||
if (errno != ECONNREFUSED) {
|
||||
warning(U_("unable to send audit message"));
|
||||
sudo_warn(U_("unable to send audit message"));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ sudoers_setlocale(int newlocale, int *prevlocale)
|
||||
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
char *
|
||||
warning_gettext(const char *msgid)
|
||||
sudo_warn_gettext(const char *msgid)
|
||||
{
|
||||
int warning_locale;
|
||||
char *msg;
|
||||
|
@@ -332,9 +332,9 @@ log_failure(int status, int flags)
|
||||
* their path to just contain a single dir.
|
||||
*/
|
||||
if (flags == NOT_FOUND)
|
||||
warningx(U_("%s: command not found"), user_cmnd);
|
||||
sudo_warnx(U_("%s: command not found"), user_cmnd);
|
||||
else if (flags == NOT_FOUND_DOT)
|
||||
warningx(U_("ignoring `%s' found in '.'\nUse `sudo ./%s' if this is the `%s' you wish to run."), user_cmnd, user_cmnd, user_cmnd);
|
||||
sudo_warnx(U_("ignoring `%s' found in '.'\nUse `sudo ./%s' if this is the `%s' you wish to run."), user_cmnd, user_cmnd, user_cmnd);
|
||||
}
|
||||
|
||||
debug_return;
|
||||
@@ -433,7 +433,7 @@ vlog_warning(int flags, const char *fmt, va_list ap)
|
||||
va_list ap2;
|
||||
debug_decl(vlog_error, SUDO_DEBUG_LOGGING)
|
||||
|
||||
/* Need extra copy of ap for vwarning()/vwarningx() below. */
|
||||
/* Need extra copy of ap for sudo_vwarn()/sudo_vwarnx() below. */
|
||||
if (!ISSET(flags, SLOG_NO_STDERR))
|
||||
va_copy(ap2, ap);
|
||||
|
||||
@@ -498,13 +498,13 @@ vlog_warning(int flags, const char *fmt, va_list ap)
|
||||
sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale);
|
||||
if (fmt == INCORRECT_PASSWORD_ATTEMPT) {
|
||||
unsigned int tries = va_arg(ap2, unsigned int);
|
||||
warningx_nodebug(ngettext("%u incorrect password attempt",
|
||||
sudo_warnx_nodebug(ngettext("%u incorrect password attempt",
|
||||
"%u incorrect password attempts", tries), tries);
|
||||
} else {
|
||||
if (ISSET(flags, SLOG_USE_ERRNO))
|
||||
vwarning_nodebug(_(fmt), ap2);
|
||||
sudo_vwarn_nodebug(_(fmt), ap2);
|
||||
else
|
||||
vwarningx_nodebug(_(fmt), ap2);
|
||||
sudo_vwarnx_nodebug(_(fmt), ap2);
|
||||
}
|
||||
sudoers_setlocale(oldlocale, NULL);
|
||||
va_end(ap2);
|
||||
@@ -581,7 +581,7 @@ send_mail(const char *fmt, ...)
|
||||
switch (pid = sudo_debug_fork()) {
|
||||
case -1:
|
||||
/* Error. */
|
||||
warning(U_("unable to fork"));
|
||||
sudo_warn(U_("unable to fork"));
|
||||
debug_return_int(false);
|
||||
break;
|
||||
case 0:
|
||||
@@ -611,9 +611,9 @@ send_mail(const char *fmt, ...)
|
||||
|
||||
/* Daemonize - disassociate from session/tty. */
|
||||
if (setsid() == -1)
|
||||
warning("setsid");
|
||||
sudo_warn("setsid");
|
||||
if (chdir("/") == -1)
|
||||
warning("chdir(/)");
|
||||
sudo_warn("chdir(/)");
|
||||
if ((fd = open(_PATH_DEVNULL, O_RDWR, 0644)) != -1) {
|
||||
(void) dup2(fd, STDIN_FILENO);
|
||||
(void) dup2(fd, STDOUT_FILENO);
|
||||
@@ -915,6 +915,6 @@ new_logline(const char *message, int serrno)
|
||||
|
||||
debug_return_str(line);
|
||||
toobig:
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
|
@@ -624,7 +624,7 @@ digest_matches(const char *file, const struct sudo_digest *sd)
|
||||
}
|
||||
}
|
||||
if (func == NULL) {
|
||||
warningx(U_("unsupported digest type %d for %s"), sd->digest_type, file);
|
||||
sudo_warnx(U_("unsupported digest type %d for %s"), sd->digest_type, file);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
if (strlen(sd->digest_str) == func->digest_len * 2) {
|
||||
@@ -653,7 +653,7 @@ digest_matches(const char *file, const struct sudo_digest *sd)
|
||||
func->update(&ctx, buf, nread);
|
||||
}
|
||||
if (ferror(fp)) {
|
||||
warningx(U_("%s: read error"), file);
|
||||
sudo_warnx(U_("%s: read error"), file);
|
||||
fclose(fp);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -667,7 +667,7 @@ digest_matches(const char *file, const struct sudo_digest *sd)
|
||||
func->digest_name, file, sd->digest_str);
|
||||
debug_return_bool(false);
|
||||
bad_format:
|
||||
warningx(U_("digest for %s (%s) is not in %s form"), file,
|
||||
sudo_warnx(U_("digest for %s (%s) is not in %s form"), file,
|
||||
sd->digest_str, func->digest_name);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
@@ -106,7 +106,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("sudoers_uid=") - 1;
|
||||
sudoers_uid = (uid_t) atoid(p, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -115,7 +115,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("sudoers_gid=") - 1;
|
||||
sudoers_gid = (gid_t) atoid(p, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -124,7 +124,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("sudoers_mode=") - 1;
|
||||
sudoers_mode = atomode(p, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -148,7 +148,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("closefrom=") - 1;
|
||||
user_closefrom = strtonum(p, 4, INT_MAX, &errstr);
|
||||
if (user_closefrom == 0) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -264,7 +264,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("max_groups=") - 1;
|
||||
sudo_user.max_groups = strtonum(p, 1, INT_MAX, &errstr);
|
||||
if (sudo_user.max_groups == 0) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -284,7 +284,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("uid=") - 1;
|
||||
user_uid = (uid_t) atoid(p, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -293,7 +293,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("gid=") - 1;
|
||||
user_gid = (gid_t) atoid(p, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -323,7 +323,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("lines=") - 1;
|
||||
sudo_user.lines = strtonum(p, 1, INT_MAX, &errstr);
|
||||
if (sudo_user.lines == 0) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -333,7 +333,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("cols=") - 1;
|
||||
sudo_user.cols = strtonum(p, 1, INT_MAX, &errstr);
|
||||
if (sudo_user.lines == 0) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -342,7 +342,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
||||
p = *cur + sizeof("sid=") - 1;
|
||||
sudo_user.sid = (pid_t) atoid(p, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx(U_("%s: %s"), *cur, U_(errstr));
|
||||
sudo_warnx(U_("%s: %s"), *cur, U_(errstr));
|
||||
goto bad;
|
||||
}
|
||||
continue;
|
||||
@@ -465,7 +465,7 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
|
||||
(unsigned int)runas_pw->pw_gid;
|
||||
len = snprintf(cp, glsize - (cp - gid_list), "%u", egid);
|
||||
if (len < 0 || (size_t)len >= glsize - (cp - gid_list)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
@@ -474,7 +474,7 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
|
||||
len = snprintf(cp, glsize - (cp - gid_list), ",%u",
|
||||
(unsigned int) grlist->gids[i]);
|
||||
if (len < 0 || (size_t)len >= glsize - (cp - gid_list)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
@@ -556,15 +556,15 @@ sudoers_policy_close(int exit_status, int error_code)
|
||||
/* We do not currently log the exit status. */
|
||||
if (error_code) {
|
||||
errno = error_code;
|
||||
warning(U_("unable to execute %s"), safe_cmnd);
|
||||
sudo_warn(U_("unable to execute %s"), safe_cmnd);
|
||||
}
|
||||
|
||||
/* Close the session we opened in sudoers_policy_init_session(). */
|
||||
if (ISSET(sudo_mode, MODE_RUN|MODE_EDIT))
|
||||
(void)sudo_auth_end_session(runas_pw);
|
||||
|
||||
/* Deregister the callback for fatal()/fatalx(). */
|
||||
fatal_callback_deregister(sudoers_cleanup);
|
||||
/* Deregister the callback for sudo_fatal()/sudo_fatalx(). */
|
||||
sudo_fatal_callback_deregister(sudoers_cleanup);
|
||||
|
||||
/* Free remaining references to password and group entries. */
|
||||
/* XXX - move cleanup to function in sudoers.c */
|
||||
@@ -668,7 +668,7 @@ sudoers_policy_list(int argc, char * const argv[], int verbose,
|
||||
if (list_user) {
|
||||
list_pw = sudo_getpwnam(list_user);
|
||||
if (list_pw == NULL) {
|
||||
warningx(U_("unknown user: %s"), list_user);
|
||||
sudo_warnx(U_("unknown user: %s"), list_user);
|
||||
debug_return_bool(-1);
|
||||
}
|
||||
}
|
||||
|
@@ -158,6 +158,6 @@ expand_prompt(const char *old_prompt, const char *auth_user)
|
||||
|
||||
oflow:
|
||||
/* We pre-allocate enough space, so this should never happen. */
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
|
@@ -146,7 +146,7 @@ sudo_getpwuid(uid_t uid)
|
||||
}
|
||||
if (rbinsert(pwcache_byuid, item) != NULL) {
|
||||
/* should not happen */
|
||||
warningx(U_("unable to cache uid %u, already exists"),
|
||||
sudo_warnx(U_("unable to cache uid %u, already exists"),
|
||||
(unsigned int) uid);
|
||||
item->refcnt = 0;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ sudo_getpwnam(const char *name)
|
||||
}
|
||||
if (rbinsert(pwcache_byname, item) != NULL) {
|
||||
/* should not happen */
|
||||
warningx(U_("unable to cache user %s, already exists"), name);
|
||||
sudo_warnx(U_("unable to cache user %s, already exists"), name);
|
||||
item->refcnt = 0;
|
||||
}
|
||||
#ifdef HAVE_SETAUTHDB
|
||||
@@ -397,7 +397,7 @@ sudo_getgrgid(gid_t gid)
|
||||
}
|
||||
if (rbinsert(grcache_bygid, item) != NULL) {
|
||||
/* should not happen */
|
||||
warningx(U_("unable to cache gid %u, already exists"),
|
||||
sudo_warnx(U_("unable to cache gid %u, already exists"),
|
||||
(unsigned int) gid);
|
||||
item->refcnt = 0;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ sudo_getgrnam(const char *name)
|
||||
}
|
||||
if (rbinsert(grcache_byname, item) != NULL) {
|
||||
/* should not happen */
|
||||
warningx(U_("unable to cache group %s, already exists"), name);
|
||||
sudo_warnx(U_("unable to cache group %s, already exists"), name);
|
||||
item->refcnt = 0;
|
||||
}
|
||||
done:
|
||||
@@ -602,7 +602,7 @@ sudo_get_grlist(const struct passwd *pw)
|
||||
}
|
||||
if (rbinsert(grlist_cache, item) != NULL) {
|
||||
/* should not happen */
|
||||
warningx(U_("unable to cache group list for %s, already exists"),
|
||||
sudo_warnx(U_("unable to cache group list for %s, already exists"),
|
||||
pw->pw_name);
|
||||
item->refcnt = 0;
|
||||
}
|
||||
@@ -624,11 +624,11 @@ sudo_set_grlist(struct passwd *pw, char * const *groups, char * const *gids)
|
||||
key.k.name = pw->pw_name;
|
||||
if ((node = rbfind(grlist_cache, &key)) == NULL) {
|
||||
if ((item = sudo_make_grlist_item(pw, groups, gids)) == NULL) {
|
||||
warningx(U_("unable to parse groups for %s"), pw->pw_name);
|
||||
sudo_warnx(U_("unable to parse groups for %s"), pw->pw_name);
|
||||
debug_return_int(-1);
|
||||
}
|
||||
if (rbinsert(grlist_cache, item) != NULL) {
|
||||
warningx(U_("unable to cache group list for %s, already exists"),
|
||||
sudo_warnx(U_("unable to cache group list for %s, already exists"),
|
||||
pw->pw_name);
|
||||
sudo_grlist_delref_item(item);
|
||||
}
|
||||
|
@@ -75,11 +75,11 @@ main(int argc, char *argv[])
|
||||
|
||||
handle = sudo_dso_load(plugin_path, SUDO_DSO_LAZY|SUDO_DSO_GLOBAL);
|
||||
if (handle == NULL)
|
||||
fatalx_nodebug("unable to load %s: %s", plugin_path, sudo_dso_strerror());
|
||||
sudo_fatalx_nodebug("unable to load %s: %s", plugin_path, sudo_dso_strerror());
|
||||
|
||||
fp = fopen(symbols_file, "r");
|
||||
if (fp == NULL)
|
||||
fatal_nodebug("unable to open %s", symbols_file);
|
||||
sudo_fatal_nodebug("unable to open %s", symbols_file);
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||
ntests++;
|
||||
|
@@ -75,18 +75,18 @@ do_check(char *dir_in, char *file_in, char *tdir_out, char *tfile_out)
|
||||
time(&now);
|
||||
timeptr = localtime(&now);
|
||||
if (timeptr == NULL)
|
||||
fatalx("localtime returned NULL");
|
||||
sudo_fatalx("localtime returned NULL");
|
||||
strftime(dir_out, sizeof(dir_out), tdir_out, timeptr);
|
||||
strftime(file_out, sizeof(file_out), tfile_out, timeptr);
|
||||
|
||||
path = expand_iolog_path(NULL, dir_in, file_in, &slash);
|
||||
*slash = '\0';
|
||||
if (strcmp(path, dir_out) != 0) {
|
||||
warningx("%s: expected %s, got %s", dir_in, dir_out, path);
|
||||
sudo_warnx("%s: expected %s, got %s", dir_in, dir_out, path);
|
||||
error = 1;
|
||||
}
|
||||
if (strcmp(slash + 1, file_out) != 0) {
|
||||
warningx("%s: expected %s, got %s", file_in, file_out, slash + 1);
|
||||
sudo_warnx("%s: expected %s, got %s", file_in, file_out, slash + 1);
|
||||
error = 1;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ main(int argc, char *argv[])
|
||||
|
||||
fp = fopen(argv[1], "r");
|
||||
if (fp == NULL)
|
||||
fatalx("unable to open %s", argv[1]);
|
||||
sudo_fatalx("unable to open %s", argv[1]);
|
||||
|
||||
memset(&pw, 0, sizeof(pw));
|
||||
memset(&rpw, 0, sizeof(rpw));
|
||||
@@ -154,7 +154,7 @@ main(int argc, char *argv[])
|
||||
case 2:
|
||||
user_gid = (gid_t)atoid(line, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx("group ID %s: %s", line, errstr);
|
||||
sudo_fatalx("group ID %s: %s", line, errstr);
|
||||
break;
|
||||
case 3:
|
||||
if (runas_pw->pw_name != NULL)
|
||||
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
|
||||
case 4:
|
||||
runas_pw->pw_gid = (gid_t)atoid(line, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx("group ID %s: %s", line, errstr);
|
||||
sudo_fatalx("group ID %s: %s", line, errstr);
|
||||
break;
|
||||
case 5:
|
||||
user_shost = strdup(line);
|
||||
@@ -189,7 +189,7 @@ main(int argc, char *argv[])
|
||||
tests++;
|
||||
break;
|
||||
default:
|
||||
fatalx("internal error, invalid state %d", state);
|
||||
sudo_fatalx("internal error, invalid state %d", state);
|
||||
}
|
||||
state = (state + 1) % MAX_STATE;
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
||||
|
||||
fp = fopen(argv[1], "r");
|
||||
if (fp == NULL)
|
||||
fatalx("unable to open %s", argv[1]);
|
||||
sudo_fatalx("unable to open %s", argv[1]);
|
||||
|
||||
/*
|
||||
* Each test record consists of a log entry on one line and a list of
|
||||
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
|
||||
len = maxlen = strtonum(cp, 1, INT_MAX, NULL);
|
||||
}
|
||||
if (len == 0 || maxlen == 0)
|
||||
fatalx("%s: invalid length on line %d\n", argv[1], lineno);
|
||||
sudo_fatalx("%s: invalid length on line %d\n", argv[1], lineno);
|
||||
while (len <= maxlen) {
|
||||
printf("# word wrap at %d characters\n", (int)len);
|
||||
writeln_wrap(stdout, lines[0], strlen(lines[0]), len);
|
||||
|
@@ -68,12 +68,12 @@ check_addr(char *input)
|
||||
cp++;
|
||||
expected = strtonum(cp, 0, 1, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx("expecting 0 or 1, got %s", cp);
|
||||
sudo_fatalx("expecting 0 or 1, got %s", cp);
|
||||
input[len] = '\0';
|
||||
|
||||
matched = addr_matches(input);
|
||||
if (matched != expected) {
|
||||
warningx("%s %smatched: FAIL", input, matched ? "" : "not ");
|
||||
sudo_warnx("%s %smatched: FAIL", input, matched ? "" : "not ");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -101,7 +101,7 @@ main(int argc, char *argv[])
|
||||
|
||||
fp = fopen(argv[1], "r");
|
||||
if (fp == NULL)
|
||||
fatalx("unable to open %s", argv[1]);
|
||||
sudo_fatalx("unable to open %s", argv[1]);
|
||||
|
||||
/*
|
||||
* Input is in the following format. There are two types of
|
||||
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
|
||||
errors += check_addr(line + sizeof("address:") - 1);
|
||||
ntests++;
|
||||
} else {
|
||||
warningx("unexpected data line: %s\n", line);
|
||||
sudo_warnx("unexpected data line: %s\n", line);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@@ -362,9 +362,9 @@ set_perms(int perm)
|
||||
debug_return_bool(true);
|
||||
bad:
|
||||
if (errno == EAGAIN)
|
||||
warningx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
sudo_warnx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
else
|
||||
warning("%s", U_(errstr));
|
||||
sudo_warn("%s", U_(errstr));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ restore_perms(void)
|
||||
debug_decl(restore_perms, SUDO_DEBUG_PERMS)
|
||||
|
||||
if (perm_stack_depth < 2) {
|
||||
warningx(U_("perm stack underflow"));
|
||||
sudo_warnx(U_("perm stack underflow"));
|
||||
debug_return_bool(true);
|
||||
}
|
||||
|
||||
@@ -393,27 +393,27 @@ restore_perms(void)
|
||||
/* XXX - more cases here where euid != ruid */
|
||||
if (OID(euid) == ROOT_UID) {
|
||||
if (setresuid(-1, ROOT_UID, -1)) {
|
||||
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||
-1, ROOT_UID, -1);
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
if (setresuid(OID(ruid), OID(euid), OID(suid))) {
|
||||
warning("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setresuid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||
(int)OID(ruid), (int)OID(euid), (int)OID(suid));
|
||||
goto bad;
|
||||
}
|
||||
if (setresgid(OID(rgid), OID(egid), OID(sgid))) {
|
||||
warning("setresgid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setresgid() [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->rgid, (int)state->egid, (int)state->sgid,
|
||||
(int)OID(rgid), (int)OID(egid), (int)OID(sgid));
|
||||
goto bad;
|
||||
}
|
||||
if (state->grlist != ostate->grlist) {
|
||||
if (sudo_setgroups(ostate->grlist->ngids, ostate->grlist->gids)) {
|
||||
warning("setgroups()");
|
||||
sudo_warn("setgroups()");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
@@ -701,9 +701,9 @@ set_perms(int perm)
|
||||
debug_return_bool(true);
|
||||
bad:
|
||||
if (errno == EAGAIN)
|
||||
warningx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
sudo_warnx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
else
|
||||
warning("%s", U_(errstr));
|
||||
sudo_warn("%s", U_(errstr));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ restore_perms(void)
|
||||
debug_decl(restore_perms, SUDO_DEBUG_PERMS)
|
||||
|
||||
if (perm_stack_depth < 2) {
|
||||
warningx(U_("perm stack underflow"));
|
||||
sudo_warnx(U_("perm stack underflow"));
|
||||
debug_return_bool(true);
|
||||
}
|
||||
|
||||
@@ -734,7 +734,7 @@ restore_perms(void)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: setuidx(ID_EFFECTIVE, %d)",
|
||||
__func__, ROOT_UID);
|
||||
if (setuidx(ID_EFFECTIVE, ROOT_UID)) {
|
||||
warning("setuidx(ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setuidx(ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||
-1, ROOT_UID, -1);
|
||||
goto bad;
|
||||
@@ -745,7 +745,7 @@ restore_perms(void)
|
||||
"%s: setuidx(ID_EFFECTIVE|ID_REAL|ID_SAVED, %d)",
|
||||
__func__, OID(ruid));
|
||||
if (setuidx(ID_EFFECTIVE|ID_REAL|ID_SAVED, OID(ruid))) {
|
||||
warning("setuidx(ID_EFFECTIVE|ID_REAL|ID_SAVED) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setuidx(ID_EFFECTIVE|ID_REAL|ID_SAVED) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||
(int)OID(ruid), (int)OID(euid), (int)OID(suid));
|
||||
goto bad;
|
||||
@@ -756,7 +756,7 @@ restore_perms(void)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO,
|
||||
"%s: setuidx(ID_EFFECTIVE, %d)", __func__, OID(euid));
|
||||
if (setuidx(ID_EFFECTIVE, OID(euid))) {
|
||||
warning("setuidx(ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setuidx(ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||
(int)OID(ruid), (int)OID(euid), (int)OID(suid));
|
||||
goto bad;
|
||||
@@ -767,7 +767,7 @@ restore_perms(void)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO,
|
||||
"%s: setuidx(ID_REAL|ID_EFFECTIVE, %d)", __func__, OID(ruid));
|
||||
if (setuidx(ID_REAL|ID_EFFECTIVE, OID(ruid))) {
|
||||
warning("setuidx(ID_REAL|ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setuidx(ID_REAL|ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->ruid, (int)state->euid, (int)state->suid,
|
||||
(int)OID(ruid), (int)OID(euid), (int)OID(suid));
|
||||
goto bad;
|
||||
@@ -777,7 +777,7 @@ restore_perms(void)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO,
|
||||
"%s: setuidx(ID_EFFECTIVE, %d)", __func__, ostate->euid);
|
||||
if (setuidx(ID_EFFECTIVE, ostate->euid)) {
|
||||
warning("setuidx(ID_EFFECTIVE, %d)", ostate->euid);
|
||||
sudo_warn("setuidx(ID_EFFECTIVE, %d)", ostate->euid);
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
@@ -789,7 +789,7 @@ restore_perms(void)
|
||||
"%s: setgidx(ID_EFFECTIVE|ID_REAL|ID_SAVED, %d)",
|
||||
__func__, OID(rgid));
|
||||
if (setgidx(ID_EFFECTIVE|ID_REAL|ID_SAVED, OID(rgid))) {
|
||||
warning("setgidx(ID_EFFECTIVE|ID_REAL|ID_SAVED) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setgidx(ID_EFFECTIVE|ID_REAL|ID_SAVED) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->rgid, (int)state->egid, (int)state->sgid,
|
||||
(int)OID(rgid), (int)OID(egid), (int)OID(sgid));
|
||||
goto bad;
|
||||
@@ -798,7 +798,7 @@ restore_perms(void)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: setgidx(ID_EFFECTIVE, %d)",
|
||||
__func__, OID(egid));
|
||||
if (setgidx(ID_EFFECTIVE, OID(egid))) {
|
||||
warning("setgidx(ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setgidx(ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->rgid, (int)state->egid, (int)state->sgid,
|
||||
(int)OID(rgid), (int)OID(egid), (int)OID(sgid));
|
||||
goto bad;
|
||||
@@ -807,7 +807,7 @@ restore_perms(void)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO,
|
||||
"%s: setgidx(ID_EFFECTIVE|ID_REAL, %d)", __func__, OID(rgid));
|
||||
if (setgidx(ID_REAL|ID_EFFECTIVE, OID(rgid))) {
|
||||
warning("setgidx(ID_REAL|ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
sudo_warn("setgidx(ID_REAL|ID_EFFECTIVE) [%d, %d, %d] -> [%d, %d, %d]",
|
||||
(int)state->rgid, (int)state->egid, (int)state->sgid,
|
||||
(int)OID(rgid), (int)OID(egid), (int)OID(sgid));
|
||||
goto bad;
|
||||
@@ -816,7 +816,7 @@ restore_perms(void)
|
||||
}
|
||||
if (state->grlist != ostate->grlist) {
|
||||
if (sudo_setgroups(ostate->grlist->ngids, ostate->grlist->gids)) {
|
||||
warning("setgroups()");
|
||||
sudo_warn("setgroups()");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
@@ -1060,9 +1060,9 @@ set_perms(int perm)
|
||||
debug_return_bool(true);
|
||||
bad:
|
||||
if (errno == EAGAIN)
|
||||
warningx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
sudo_warnx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
else
|
||||
warning("%s", U_(errstr));
|
||||
sudo_warn("%s", U_(errstr));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ restore_perms(void)
|
||||
debug_decl(restore_perms, SUDO_DEBUG_PERMS)
|
||||
|
||||
if (perm_stack_depth < 2) {
|
||||
warningx(U_("perm stack underflow"));
|
||||
sudo_warnx(U_("perm stack underflow"));
|
||||
debug_return_bool(true);
|
||||
}
|
||||
|
||||
@@ -1097,24 +1097,24 @@ restore_perms(void)
|
||||
if (ID(euid) != ROOT_UID)
|
||||
ignore_result(setreuid(-1, ROOT_UID));
|
||||
if (setuid(ROOT_UID)) {
|
||||
warning("setuid() [%d, %d] -> %d)", (int)state->ruid,
|
||||
sudo_warn("setuid() [%d, %d] -> %d)", (int)state->ruid,
|
||||
(int)state->euid, ROOT_UID);
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
if (setreuid(OID(ruid), OID(euid))) {
|
||||
warning("setreuid() [%d, %d] -> [%d, %d]", (int)state->ruid,
|
||||
sudo_warn("setreuid() [%d, %d] -> [%d, %d]", (int)state->ruid,
|
||||
(int)state->euid, (int)OID(ruid), (int)OID(euid));
|
||||
goto bad;
|
||||
}
|
||||
if (setregid(OID(rgid), OID(egid))) {
|
||||
warning("setregid() [%d, %d] -> [%d, %d]", (int)state->rgid,
|
||||
sudo_warn("setregid() [%d, %d] -> [%d, %d]", (int)state->rgid,
|
||||
(int)state->egid, (int)OID(rgid), (int)OID(egid));
|
||||
goto bad;
|
||||
}
|
||||
if (state->grlist != ostate->grlist) {
|
||||
if (sudo_setgroups(ostate->grlist->ngids, ostate->grlist->gids)) {
|
||||
warning("setgroups()");
|
||||
sudo_warn("setgroups()");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
@@ -1356,9 +1356,9 @@ set_perms(int perm)
|
||||
debug_return_bool(true);
|
||||
bad:
|
||||
if (errno == EAGAIN)
|
||||
warningx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
sudo_warnx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
else
|
||||
warning("%s", U_(errstr));
|
||||
sudo_warn("%s", U_(errstr));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -1369,7 +1369,7 @@ restore_perms(void)
|
||||
debug_decl(restore_perms, SUDO_DEBUG_PERMS)
|
||||
|
||||
if (perm_stack_depth < 2) {
|
||||
warningx(U_("perm stack underflow"));
|
||||
sudo_warnx(U_("perm stack underflow"));
|
||||
debug_return_bool(true);
|
||||
}
|
||||
|
||||
@@ -1390,27 +1390,27 @@ restore_perms(void)
|
||||
* real and effective uids to ROOT_UID initially to be safe.
|
||||
*/
|
||||
if (seteuid(ROOT_UID)) {
|
||||
warningx("seteuid() [%d] -> [%d]", (int)state->euid, ROOT_UID);
|
||||
sudo_warnx("seteuid() [%d] -> [%d]", (int)state->euid, ROOT_UID);
|
||||
goto bad;
|
||||
}
|
||||
if (setuid(ROOT_UID)) {
|
||||
warningx("setuid() [%d, %d] -> [%d, %d]", (int)state->ruid, ROOT_UID,
|
||||
sudo_warnx("setuid() [%d, %d] -> [%d, %d]", (int)state->ruid, ROOT_UID,
|
||||
ROOT_UID, ROOT_UID);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (OID(egid) != (gid_t)-1 && setegid(ostate->egid)) {
|
||||
warning("setegid(%d)", (int)ostate->egid);
|
||||
sudo_warn("setegid(%d)", (int)ostate->egid);
|
||||
goto bad;
|
||||
}
|
||||
if (state->grlist != ostate->grlist) {
|
||||
if (sudo_setgroups(ostate->grlist->ngids, ostate->grlist->gids)) {
|
||||
warning("setgroups()");
|
||||
sudo_warn("setgroups()");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
if (OID(euid) != (uid_t)-1 && seteuid(ostate->euid)) {
|
||||
warning("seteuid(%d)", ostate->euid);
|
||||
sudo_warn("seteuid(%d)", ostate->euid);
|
||||
goto bad;
|
||||
}
|
||||
sudo_grlist_delref(state->grlist);
|
||||
@@ -1520,9 +1520,9 @@ set_perms(int perm)
|
||||
debug_return_bool(true);
|
||||
bad:
|
||||
if (errno == EAGAIN)
|
||||
warningx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
sudo_warnx(U_("%s: %s"), U_(errstr), U_("too many processes"));
|
||||
else
|
||||
warning("%s", U_(errstr));
|
||||
sudo_warn("%s", U_(errstr));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -1533,7 +1533,7 @@ restore_perms(void)
|
||||
debug_decl(restore_perms, SUDO_DEBUG_PERMS)
|
||||
|
||||
if (perm_stack_depth < 2) {
|
||||
warningx(U_("perm stack underflow"));
|
||||
sudo_warnx(U_("perm stack underflow"));
|
||||
debug_return_bool(true);
|
||||
}
|
||||
|
||||
@@ -1547,18 +1547,18 @@ restore_perms(void)
|
||||
__func__, (int)state->rgid, (int)ostate->rgid);
|
||||
|
||||
if (OID(rgid) != (gid_t)-1 && setgid(ostate->rgid)) {
|
||||
warning("setgid(%d)", (int)ostate->rgid);
|
||||
sudo_warn("setgid(%d)", (int)ostate->rgid);
|
||||
goto bad;
|
||||
}
|
||||
if (state->grlist != ostate->grlist) {
|
||||
if (sudo_setgroups(ostate->grlist->ngids, ostate->grlist->gids)) {
|
||||
warning("setgroups()");
|
||||
sudo_warn("setgroups()");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
sudo_grlist_delref(state->grlist);
|
||||
if (OID(ruid) != (uid_t)-1 && setuid(ostate->ruid)) {
|
||||
warning("setuid(%d)", (int)ostate->ruid);
|
||||
sudo_warn("setuid(%d)", (int)ostate->ruid);
|
||||
goto bad;
|
||||
}
|
||||
debug_return_bool(true);
|
||||
|
@@ -249,15 +249,15 @@ static int sudo_sss_open(struct sudo_nss *nss)
|
||||
/* Load symbols */
|
||||
handle->ssslib = sudo_dso_load(path, SUDO_DSO_LAZY);
|
||||
if (handle->ssslib == NULL) {
|
||||
warningx(U_("unable to load %s: %s"), path, sudo_dso_strerror());
|
||||
warningx(U_("unable to initialize SSS source. Is SSSD installed on your machine?"));
|
||||
sudo_warnx(U_("unable to load %s: %s"), path, sudo_dso_strerror());
|
||||
sudo_warnx(U_("unable to initialize SSS source. Is SSSD installed on your machine?"));
|
||||
debug_return_int(EFAULT);
|
||||
}
|
||||
|
||||
handle->fn_send_recv =
|
||||
sudo_dso_findsym(handle->ssslib, "sss_sudo_send_recv");
|
||||
if (handle->fn_send_recv == NULL) {
|
||||
warningx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
sudo_warnx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
"sss_sudo_send_recv");
|
||||
debug_return_int(EFAULT);
|
||||
}
|
||||
@@ -265,7 +265,7 @@ static int sudo_sss_open(struct sudo_nss *nss)
|
||||
handle->fn_send_recv_defaults =
|
||||
sudo_dso_findsym(handle->ssslib, "sss_sudo_send_recv_defaults");
|
||||
if (handle->fn_send_recv_defaults == NULL) {
|
||||
warningx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
sudo_warnx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
"sss_sudo_send_recv_defaults");
|
||||
debug_return_int(EFAULT);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ static int sudo_sss_open(struct sudo_nss *nss)
|
||||
handle->fn_free_result =
|
||||
sudo_dso_findsym(handle->ssslib, "sss_sudo_free_result");
|
||||
if (handle->fn_free_result == NULL) {
|
||||
warningx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
sudo_warnx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
"sss_sudo_free_result");
|
||||
debug_return_int(EFAULT);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ static int sudo_sss_open(struct sudo_nss *nss)
|
||||
handle->fn_get_values =
|
||||
sudo_dso_findsym(handle->ssslib, "sss_sudo_get_values");
|
||||
if (handle->fn_get_values == NULL) {
|
||||
warningx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
sudo_warnx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
"sss_sudo_get_values");
|
||||
debug_return_int(EFAULT);
|
||||
}
|
||||
@@ -289,7 +289,7 @@ static int sudo_sss_open(struct sudo_nss *nss)
|
||||
handle->fn_free_values =
|
||||
sudo_dso_findsym(handle->ssslib, "sss_sudo_free_values");
|
||||
if (handle->fn_free_values == NULL) {
|
||||
warningx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
sudo_warnx(U_("unable to find symbol \"%s\" in %s"), path,
|
||||
"sss_sudo_free_values");
|
||||
debug_return_int(EFAULT);
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ sudoers_policy_init(void *info, char * const envp[])
|
||||
sudo_setgrent();
|
||||
|
||||
/* Register fatal/fatalx callback. */
|
||||
fatal_callback_register(sudoers_cleanup);
|
||||
sudo_fatal_callback_register(sudoers_cleanup);
|
||||
|
||||
/* Initialize environment functions (including replacements). */
|
||||
env_init(envp);
|
||||
@@ -165,7 +165,7 @@ sudoers_policy_init(void *info, char * const envp[])
|
||||
}
|
||||
}
|
||||
if (sources == 0) {
|
||||
warningx(U_("no valid sudoers sources found, quitting"));
|
||||
sudo_warnx(U_("no valid sudoers sources found, quitting"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
/* Is root even allowed to run sudo? */
|
||||
if (user_uid == 0 && !def_root_sudo) {
|
||||
/* Not an audit event. */
|
||||
warningx(U_("sudoers specifies that root is not allowed to sudo"));
|
||||
sudo_warnx(U_("sudoers specifies that root is not allowed to sudo"));
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
if (user_closefrom >= 0 && user_closefrom != def_closefrom) {
|
||||
if (!def_closefrom_override) {
|
||||
/* XXX - audit? */
|
||||
warningx(U_("you are not permitted to use the -C option"));
|
||||
sudo_warnx(U_("you are not permitted to use the -C option"));
|
||||
goto bad;
|
||||
}
|
||||
def_closefrom = user_closefrom;
|
||||
@@ -349,7 +349,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
/* Bail if a tty is required and we don't have one. */
|
||||
if (def_requiretty && !tty_present()) {
|
||||
audit_failure(NewArgc, NewArgv, N_("no tty"));
|
||||
warningx(U_("sorry, you must have a tty to run sudo"));
|
||||
sudo_warnx(U_("sorry, you must have a tty to run sudo"));
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -401,17 +401,17 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
/* Finally tell the user if the command did not exist. */
|
||||
if (cmnd_status == NOT_FOUND_DOT) {
|
||||
audit_failure(NewArgc, NewArgv, N_("command in current directory"));
|
||||
warningx(U_("ignoring `%s' found in '.'\nUse `sudo ./%s' if this is the `%s' you wish to run."), user_cmnd, user_cmnd, user_cmnd);
|
||||
sudo_warnx(U_("ignoring `%s' found in '.'\nUse `sudo ./%s' if this is the `%s' you wish to run."), user_cmnd, user_cmnd, user_cmnd);
|
||||
goto bad;
|
||||
} else if (cmnd_status == NOT_FOUND) {
|
||||
if (ISSET(sudo_mode, MODE_CHECK)) {
|
||||
audit_failure(NewArgc, NewArgv, N_("%s: command not found"),
|
||||
NewArgv[0]);
|
||||
warningx(U_("%s: command not found"), NewArgv[0]);
|
||||
sudo_warnx(U_("%s: command not found"), NewArgv[0]);
|
||||
} else {
|
||||
audit_failure(NewArgc, NewArgv, N_("%s: command not found"),
|
||||
user_cmnd);
|
||||
warningx(U_("%s: command not found"), user_cmnd);
|
||||
sudo_warnx(U_("%s: command not found"), user_cmnd);
|
||||
}
|
||||
goto bad;
|
||||
}
|
||||
@@ -420,7 +420,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
if (ISSET(sudo_mode, MODE_RUN) && !def_setenv) {
|
||||
if (ISSET(sudo_mode, MODE_PRESERVE_ENV)) {
|
||||
/* XXX - audit? */
|
||||
warningx(U_("sorry, you are not allowed to preserve the environment"));
|
||||
sudo_warnx(U_("sorry, you are not allowed to preserve the environment"));
|
||||
goto bad;
|
||||
} else {
|
||||
if (!validate_env_vars(sudo_user.env_vars))
|
||||
@@ -493,7 +493,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
#if defined(_AIX) || (defined(__linux__) && !defined(HAVE_PAM))
|
||||
/* Insert system-wide environment variables. */
|
||||
if (!read_env_file(_PATH_ENVIRONMENT, true))
|
||||
warning("%s", _PATH_ENVIRONMENT);
|
||||
sudo_warn("%s", _PATH_ENVIRONMENT);
|
||||
#endif
|
||||
#ifdef HAVE_LOGIN_CAP_H
|
||||
/* Set environment based on login class. */
|
||||
@@ -510,7 +510,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
||||
/* Insert system-wide environment variables. */
|
||||
if (def_env_file) {
|
||||
if (!read_env_file(def_env_file, false))
|
||||
warning("%s", def_env_file);
|
||||
sudo_warn("%s", def_env_file);
|
||||
}
|
||||
|
||||
/* Insert user-specified environment variables. */
|
||||
@@ -595,7 +595,7 @@ init_vars(char * const envp[])
|
||||
* YP/NIS/NIS+/LDAP/etc daemon has died.
|
||||
*/
|
||||
if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) {
|
||||
warningx(U_("unknown uid: %u"), (unsigned int) user_uid);
|
||||
sudo_warnx(U_("unknown uid: %u"), (unsigned int) user_uid);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ set_cmnd(void)
|
||||
for (to = user_args, av = NewArgv + 1; *av; av++) {
|
||||
n = strlcpy(to, *av, size - (to - user_args));
|
||||
if (n >= size - (to - user_args)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
debug_return_int(-1);
|
||||
}
|
||||
to += n;
|
||||
@@ -822,7 +822,7 @@ set_loginclass(struct passwd *pw)
|
||||
|
||||
if (login_class && strcmp(login_class, "-") != 0) {
|
||||
if (user_uid != 0 && pw->pw_uid != 0) {
|
||||
warningx(U_("only root can use `-c %s'"), login_class);
|
||||
sudo_warnx(U_("only root can use `-c %s'"), login_class);
|
||||
rval = false;
|
||||
goto done;
|
||||
}
|
||||
@@ -978,7 +978,7 @@ cb_sudoers_locale(const char *locale)
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup hook for fatal()/fatalx()
|
||||
* Cleanup hook for sudo_fatal()/sudo_fatalx()
|
||||
*/
|
||||
void
|
||||
sudoers_cleanup(void)
|
||||
@@ -1087,7 +1087,7 @@ find_editor(int nfiles, char **files, char ***argv_out)
|
||||
}
|
||||
if (!editor_path) {
|
||||
audit_failure(NewArgc, NewArgv, N_("%s: command not found"), editor);
|
||||
warningx(U_("%s: command not found"), editor);
|
||||
sudo_warnx(U_("%s: command not found"), editor);
|
||||
}
|
||||
debug_return_str(editor_path);
|
||||
}
|
||||
|
@@ -252,7 +252,7 @@ main(int argc, char *argv[])
|
||||
textdomain("sudoers");
|
||||
|
||||
/* Register fatal/fatalx callback. */
|
||||
fatal_callback_register(sudoreplay_cleanup);
|
||||
sudo_fatal_callback_register(sudoreplay_cleanup);
|
||||
|
||||
/* Read sudo.conf. */
|
||||
sudo_conf_read(NULL);
|
||||
@@ -273,7 +273,7 @@ main(int argc, char *argv[])
|
||||
else if (strcmp(cp, "ttyout") == 0)
|
||||
io_log_files[IOFD_TTYOUT].enabled = true;
|
||||
else
|
||||
fatalx(U_("invalid filter option: %s"), optarg);
|
||||
sudo_fatalx(U_("invalid filter option: %s"), optarg);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
@@ -286,13 +286,13 @@ main(int argc, char *argv[])
|
||||
errno = 0;
|
||||
max_wait = strtod(optarg, &ep);
|
||||
if (*ep != '\0' || errno != 0)
|
||||
fatalx(U_("invalid max wait: %s"), optarg);
|
||||
sudo_fatalx(U_("invalid max wait: %s"), optarg);
|
||||
break;
|
||||
case 's':
|
||||
errno = 0;
|
||||
speed_factor = strtod(optarg, &ep);
|
||||
if (*ep != '\0' || errno != 0)
|
||||
fatalx(U_("invalid speed factor: %s"), optarg);
|
||||
sudo_fatalx(U_("invalid speed factor: %s"), optarg);
|
||||
break;
|
||||
case 'V':
|
||||
(void) printf(_("%s version %s\n"), getprogname(), PACKAGE_VERSION);
|
||||
@@ -327,13 +327,13 @@ main(int argc, char *argv[])
|
||||
plen = snprintf(path, sizeof(path), "%s/%.2s/%.2s/%.2s/timing",
|
||||
session_dir, id, &id[2], &id[4]);
|
||||
if (plen <= 0 || (size_t)plen >= sizeof(path))
|
||||
fatalx(U_("%s/%.2s/%.2s/%.2s/timing: %s"), session_dir,
|
||||
sudo_fatalx(U_("%s/%.2s/%.2s/%.2s/timing: %s"), session_dir,
|
||||
id, &id[2], &id[4], strerror(ENAMETOOLONG));
|
||||
} else {
|
||||
plen = snprintf(path, sizeof(path), "%s/%s/timing",
|
||||
session_dir, id);
|
||||
if (plen <= 0 || (size_t)plen >= sizeof(path))
|
||||
fatalx(U_("%s/%s/timing: %s"), session_dir,
|
||||
sudo_fatalx(U_("%s/%s/timing: %s"), session_dir,
|
||||
id, strerror(ENAMETOOLONG));
|
||||
}
|
||||
plen -= 7;
|
||||
@@ -341,7 +341,7 @@ main(int argc, char *argv[])
|
||||
/* Open files for replay, applying replay filter for the -f flag. */
|
||||
for (idx = 0; idx < IOFD_MAX; idx++) {
|
||||
if (open_io_fd(path, plen, &io_log_files[idx]) == -1)
|
||||
fatal(U_("unable to open %s"), path);
|
||||
sudo_fatal(U_("unable to open %s"), path);
|
||||
}
|
||||
|
||||
/* Parse log file. */
|
||||
@@ -411,20 +411,20 @@ replay_session(const double max_wait, const char *decimal)
|
||||
if (idx != -1)
|
||||
(void) fcntl(STDIN_FILENO, F_SETFL, idx | O_NONBLOCK);
|
||||
if (!sudo_term_raw(STDIN_FILENO, 1))
|
||||
fatal(U_("unable to set tty to raw mode"));
|
||||
sudo_fatal(U_("unable to set tty to raw mode"));
|
||||
}
|
||||
|
||||
/* Setup event base and input/output events. */
|
||||
evbase = sudo_ev_base_alloc();
|
||||
if (evbase == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
input_ev = sudo_ev_alloc(STDIN_FILENO, interactive ? SUDO_EV_READ :
|
||||
SUDO_EV_TIMEOUT, check_input, sudo_ev_self_cbarg());
|
||||
if (input_ev == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
output_ev = sudo_ev_alloc(STDIN_FILENO, SUDO_EV_WRITE, write_output, &wc);
|
||||
if (output_ev == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
|
||||
/*
|
||||
* Read each line of the timing file, displaying the output streams.
|
||||
@@ -442,7 +442,7 @@ replay_session(const double max_wait, const char *decimal)
|
||||
|
||||
buf[strcspn(buf, "\n")] = '\0';
|
||||
if (!parse_timing(buf, decimal, &idx, &seconds, &nbytes))
|
||||
fatalx(U_("invalid timing file line: %s"), buf);
|
||||
sudo_fatalx(U_("invalid timing file line: %s"), buf);
|
||||
|
||||
/* Adjust delay using speed factor and clamp to max_wait */
|
||||
to_wait = seconds / speed_factor;
|
||||
@@ -581,7 +581,7 @@ write_output(int fd, int what, void *v)
|
||||
switch (nwritten) {
|
||||
case -1:
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
fatal(U_("unable to write to %s"), "stdout");
|
||||
sudo_fatal(U_("unable to write to %s"), "stdout");
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
@@ -648,7 +648,7 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr)
|
||||
continue;
|
||||
case 'c': /* command */
|
||||
if (av[0][1] == '\0')
|
||||
fatalx(U_("ambiguous expression \"%s\""), *av);
|
||||
sudo_fatalx(U_("ambiguous expression \"%s\""), *av);
|
||||
if (strncmp(*av, "cwd", strlen(*av)) == 0)
|
||||
type = ST_CWD;
|
||||
else if (strncmp(*av, "command", strlen(*av)) == 0)
|
||||
@@ -673,7 +673,7 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr)
|
||||
break;
|
||||
case 't': /* tty or to date */
|
||||
if (av[0][1] == '\0')
|
||||
fatalx(U_("ambiguous expression \"%s\""), *av);
|
||||
sudo_fatalx(U_("ambiguous expression \"%s\""), *av);
|
||||
if (strncmp(*av, "todate", strlen(*av)) == 0)
|
||||
type = ST_TODATE;
|
||||
else if (strncmp(*av, "tty", strlen(*av)) == 0)
|
||||
@@ -695,11 +695,11 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr)
|
||||
if (av[0][1] != '\0')
|
||||
goto bad;
|
||||
if (!sub_expr)
|
||||
fatalx(U_("unmatched ')' in expression"));
|
||||
sudo_fatalx(U_("unmatched ')' in expression"));
|
||||
debug_return_int(av - argv + 1);
|
||||
bad:
|
||||
default:
|
||||
fatalx(U_("unknown search term \"%s\""), *av);
|
||||
sudo_fatalx(U_("unknown search term \"%s\""), *av);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
@@ -713,17 +713,17 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr)
|
||||
av += parse_expr(&sn->u.expr, av + 1, true);
|
||||
} else {
|
||||
if (*(++av) == NULL)
|
||||
fatalx(U_("%s requires an argument"), av[-1]);
|
||||
sudo_fatalx(U_("%s requires an argument"), av[-1]);
|
||||
#ifdef HAVE_REGCOMP
|
||||
if (type == ST_PATTERN) {
|
||||
if (regcomp(&sn->u.cmdre, *av, REG_EXTENDED|REG_NOSUB) != 0)
|
||||
fatalx(U_("invalid regular expression: %s"), *av);
|
||||
sudo_fatalx(U_("invalid regular expression: %s"), *av);
|
||||
} else
|
||||
#endif
|
||||
if (type == ST_TODATE || type == ST_FROMDATE) {
|
||||
sn->u.tstamp = get_date(*av);
|
||||
if (sn->u.tstamp == -1)
|
||||
fatalx(U_("could not parse date \"%s\""), *av);
|
||||
sudo_fatalx(U_("could not parse date \"%s\""), *av);
|
||||
} else {
|
||||
sn->u.ptr = *av;
|
||||
}
|
||||
@@ -732,11 +732,11 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr)
|
||||
STAILQ_INSERT_TAIL(head, sn, entries);
|
||||
}
|
||||
if (sub_expr)
|
||||
fatalx(U_("unmatched '(' in expression"));
|
||||
sudo_fatalx(U_("unmatched '(' in expression"));
|
||||
if (or)
|
||||
fatalx(U_("illegal trailing \"or\""));
|
||||
sudo_fatalx(U_("illegal trailing \"or\""));
|
||||
if (not)
|
||||
fatalx(U_("illegal trailing \"!\""));
|
||||
sudo_fatalx(U_("illegal trailing \"!\""));
|
||||
|
||||
debug_return_int(av - argv);
|
||||
}
|
||||
@@ -775,7 +775,7 @@ match_expr(struct search_node_list *head, struct log_info *log, bool last_match)
|
||||
if (rc && rc != REG_NOMATCH) {
|
||||
char buf[BUFSIZ];
|
||||
regerror(rc, &sn->u.cmdre, buf, sizeof(buf));
|
||||
fatalx("%s", buf);
|
||||
sudo_fatalx("%s", buf);
|
||||
}
|
||||
res = rc == REG_NOMATCH ? 0 : 1;
|
||||
#else
|
||||
@@ -789,7 +789,7 @@ match_expr(struct search_node_list *head, struct log_info *log, bool last_match)
|
||||
res = log->tstamp <= sn->u.tstamp;
|
||||
break;
|
||||
default:
|
||||
fatalx(U_("unknown search type %d"), sn->type);
|
||||
sudo_fatalx(U_("unknown search type %d"), sn->type);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (sn->negated)
|
||||
@@ -812,7 +812,7 @@ parse_logfile(char *logfile)
|
||||
|
||||
fp = fopen(logfile, "r");
|
||||
if (fp == NULL) {
|
||||
warning(U_("unable to open %s"), logfile);
|
||||
sudo_warn(U_("unable to open %s"), logfile);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -826,7 +826,7 @@ parse_logfile(char *logfile)
|
||||
if (getline(&buf, &bufsize, fp) == -1 ||
|
||||
getline(&li->cwd, &cwdsize, fp) == -1 ||
|
||||
getline(&li->cmd, &cmdsize, fp) == -1) {
|
||||
warning(U_("%s: invalid log file"), logfile);
|
||||
sudo_warn(U_("%s: invalid log file"), logfile);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -844,21 +844,21 @@ parse_logfile(char *logfile)
|
||||
|
||||
/* timestamp */
|
||||
if ((ep = strchr(cp, ':')) == NULL) {
|
||||
warning(U_("%s: time stamp field is missing"), logfile);
|
||||
sudo_warn(U_("%s: time stamp field is missing"), logfile);
|
||||
goto bad;
|
||||
}
|
||||
*ep = '\0';
|
||||
li->tstamp = sizeof(time_t) == 4 ? strtonum(cp, INT_MIN, INT_MAX, &errstr) :
|
||||
strtonum(cp, LLONG_MIN, LLONG_MAX, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warning(U_("%s: time stamp %s: %s"), logfile, cp, errstr);
|
||||
sudo_warn(U_("%s: time stamp %s: %s"), logfile, cp, errstr);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* user */
|
||||
cp = ep + 1;
|
||||
if ((ep = strchr(cp, ':')) == NULL) {
|
||||
warning(U_("%s: user field is missing"), logfile);
|
||||
sudo_warn(U_("%s: user field is missing"), logfile);
|
||||
goto bad;
|
||||
}
|
||||
li->user = estrndup(cp, (size_t)(ep - cp));
|
||||
@@ -866,7 +866,7 @@ parse_logfile(char *logfile)
|
||||
/* runas user */
|
||||
cp = ep + 1;
|
||||
if ((ep = strchr(cp, ':')) == NULL) {
|
||||
warning(U_("%s: runas user field is missing"), logfile);
|
||||
sudo_warn(U_("%s: runas user field is missing"), logfile);
|
||||
goto bad;
|
||||
}
|
||||
li->runas_user = estrndup(cp, (size_t)(ep - cp));
|
||||
@@ -874,7 +874,7 @@ parse_logfile(char *logfile)
|
||||
/* runas group */
|
||||
cp = ep + 1;
|
||||
if ((ep = strchr(cp, ':')) == NULL) {
|
||||
warning(U_("%s: runas group field is missing"), logfile);
|
||||
sudo_warn(U_("%s: runas group field is missing"), logfile);
|
||||
goto bad;
|
||||
}
|
||||
if (cp != ep)
|
||||
@@ -989,7 +989,7 @@ session_compare(const void *v1, const void *v2)
|
||||
return strcmp(s1, s2);
|
||||
}
|
||||
|
||||
/* XXX - always returns 0, calls fatal() on failure */
|
||||
/* XXX - always returns 0, calls sudo_fatal() on failure */
|
||||
static int
|
||||
find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty)
|
||||
{
|
||||
@@ -1009,13 +1009,13 @@ find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty)
|
||||
|
||||
d = opendir(dir);
|
||||
if (d == NULL)
|
||||
fatal(U_("unable to open %s"), dir);
|
||||
sudo_fatal(U_("unable to open %s"), dir);
|
||||
|
||||
/* XXX - would be faster to chdir and use relative names */
|
||||
sdlen = strlcpy(pathbuf, dir, sizeof(pathbuf));
|
||||
if (sdlen + 1 >= sizeof(pathbuf)) {
|
||||
errno = ENAMETOOLONG;
|
||||
fatal("%s/", dir);
|
||||
sudo_fatal("%s/", dir);
|
||||
}
|
||||
pathbuf[sdlen++] = '/';
|
||||
pathbuf[sdlen] = '\0';
|
||||
@@ -1054,7 +1054,7 @@ find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty)
|
||||
"%s/log", sessions[i]);
|
||||
if (len <= 0 || (size_t)len >= sizeof(pathbuf) - sdlen) {
|
||||
errno = ENAMETOOLONG;
|
||||
fatal("%s/%s/log", dir, sessions[i]);
|
||||
sudo_fatal("%s/%s/log", dir, sessions[i]);
|
||||
}
|
||||
efree(sessions[i]);
|
||||
|
||||
@@ -1073,7 +1073,7 @@ find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty)
|
||||
debug_return_int(0);
|
||||
}
|
||||
|
||||
/* XXX - always returns 0, calls fatal() on failure */
|
||||
/* XXX - always returns 0, calls sudo_fatal() on failure */
|
||||
static int
|
||||
list_sessions(int argc, char **argv, const char *pattern, const char *user,
|
||||
const char *tty)
|
||||
@@ -1089,7 +1089,7 @@ list_sessions(int argc, char **argv, const char *pattern, const char *user,
|
||||
if (pattern) {
|
||||
re = &rebuf;
|
||||
if (regcomp(re, pattern, REG_EXTENDED|REG_NOSUB) != 0)
|
||||
fatalx(U_("invalid regular expression: %s"), pattern);
|
||||
sudo_fatalx(U_("invalid regular expression: %s"), pattern);
|
||||
}
|
||||
#else
|
||||
re = (char *) pattern;
|
||||
@@ -1116,7 +1116,7 @@ check_input(int fd, int what, void *v)
|
||||
switch (read(fd, &ch, 1)) {
|
||||
case -1:
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
fatal(U_("unable to read %s"), "stdin");
|
||||
sudo_fatal(U_("unable to read %s"), "stdin");
|
||||
break;
|
||||
case 0:
|
||||
/* Ignore EOF. */
|
||||
@@ -1255,7 +1255,7 @@ help(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup hook for fatal()/fatalx()
|
||||
* Cleanup hook for sudo_fatal()/sudo_fatalx()
|
||||
*/
|
||||
static void
|
||||
sudoreplay_cleanup(void)
|
||||
|
@@ -155,7 +155,7 @@ main(int argc, char *argv[])
|
||||
case 'G':
|
||||
sudoers_gid = (gid_t)atoid(optarg, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx("group ID %s: %s", optarg, errstr);
|
||||
sudo_fatalx("group ID %s: %s", optarg, errstr);
|
||||
break;
|
||||
case 'g':
|
||||
runas_group = optarg;
|
||||
@@ -172,7 +172,7 @@ main(int argc, char *argv[])
|
||||
case 'U':
|
||||
sudoers_uid = (uid_t)atoid(optarg, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx("user ID %s: %s", optarg, errstr);
|
||||
sudo_fatalx("user ID %s: %s", optarg, errstr);
|
||||
break;
|
||||
case 'u':
|
||||
runas_user = optarg;
|
||||
@@ -209,11 +209,11 @@ main(int argc, char *argv[])
|
||||
argc -= 2;
|
||||
}
|
||||
if ((sudo_user.pw = sudo_getpwnam(user_name)) == NULL)
|
||||
fatalx(U_("unknown user: %s"), user_name);
|
||||
sudo_fatalx(U_("unknown user: %s"), user_name);
|
||||
|
||||
if (user_host == NULL) {
|
||||
if (gethostname(hbuf, sizeof(hbuf)) != 0)
|
||||
fatal("gethostname");
|
||||
sudo_fatal("gethostname");
|
||||
hbuf[sizeof(hbuf) - 1] = '\0';
|
||||
user_host = hbuf;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ main(int argc, char *argv[])
|
||||
for (to = user_args, from = argv; *from; from++) {
|
||||
n = strlcpy(to, *from, size - (to - user_args));
|
||||
if (n >= size - (to - user_args))
|
||||
fatalx(U_("internal error, %s overflow"), getprogname());
|
||||
sudo_fatalx(U_("internal error, %s overflow"), getprogname());
|
||||
to += n;
|
||||
*to++ = ' ';
|
||||
}
|
||||
@@ -361,7 +361,7 @@ set_runaspw(const char *user)
|
||||
}
|
||||
if (pw == NULL) {
|
||||
if ((pw = sudo_getpwnam(user)) == NULL)
|
||||
fatalx(U_("unknown user: %s"), user);
|
||||
sudo_fatalx(U_("unknown user: %s"), user);
|
||||
}
|
||||
if (runas_pw != NULL)
|
||||
sudo_pw_delref(runas_pw);
|
||||
@@ -385,7 +385,7 @@ set_runasgr(const char *group)
|
||||
}
|
||||
if (gr == NULL) {
|
||||
if ((gr = sudo_getgrnam(group)) == NULL)
|
||||
fatalx(U_("unknown group: %s"), group);
|
||||
sudo_fatalx(U_("unknown group: %s"), group);
|
||||
}
|
||||
if (runas_gr != NULL)
|
||||
sudo_gr_delref(runas_gr);
|
||||
@@ -434,20 +434,20 @@ open_sudoers(const char *sudoers, bool doedit, bool *keepopen)
|
||||
fp = fopen(sudoers, "r");
|
||||
break;
|
||||
case SUDO_PATH_MISSING:
|
||||
warning("unable to stat %s", sudoers_base);
|
||||
sudo_warn("unable to stat %s", sudoers_base);
|
||||
break;
|
||||
case SUDO_PATH_BAD_TYPE:
|
||||
warningx("%s is not a regular file", sudoers_base);
|
||||
sudo_warnx("%s is not a regular file", sudoers_base);
|
||||
break;
|
||||
case SUDO_PATH_WRONG_OWNER:
|
||||
warningx("%s should be owned by uid %u",
|
||||
sudo_warnx("%s should be owned by uid %u",
|
||||
sudoers_base, (unsigned int) sudoers_uid);
|
||||
break;
|
||||
case SUDO_PATH_WORLD_WRITABLE:
|
||||
warningx("%s is world writable", sudoers_base);
|
||||
sudo_warnx("%s is world writable", sudoers_base);
|
||||
break;
|
||||
case SUDO_PATH_GROUP_WRITABLE:
|
||||
warningx("%s should be owned by gid %u",
|
||||
sudo_warnx("%s should be owned by gid %u",
|
||||
sudoers_base, (unsigned int) sudoers_gid);
|
||||
break;
|
||||
default:
|
||||
|
@@ -195,7 +195,7 @@ found_it:
|
||||
sudo_debug_printf(SUDO_DEBUG_DEBUG|SUDO_DEBUG_LINENO,
|
||||
"short write, truncating partial time stamp record");
|
||||
if (ftruncate(fd, old_eof) != 0) {
|
||||
warning(U_("unable to truncate time stamp file to %lld bytes"),
|
||||
sudo_warn(U_("unable to truncate time stamp file to %lld bytes"),
|
||||
(long long)old_eof);
|
||||
}
|
||||
}
|
||||
@@ -225,13 +225,13 @@ ts_mkdirs(char *path, uid_t owner, mode_t mode, mode_t parent_mode, bool quiet)
|
||||
"mkdir %s, mode 0%o", path, (unsigned int) parent_mode);
|
||||
if (mkdir(path, parent_mode) != 0) {
|
||||
if (!quiet)
|
||||
warning(U_("unable to mkdir %s"), path);
|
||||
sudo_warn(U_("unable to mkdir %s"), path);
|
||||
goto done;
|
||||
}
|
||||
ignore_result(chown(path, (uid_t)-1, parent_gid));
|
||||
} else if (!S_ISDIR(sb.st_mode)) {
|
||||
if (!quiet) {
|
||||
warningx(U_("%s exists but is not a directory (0%o)"),
|
||||
sudo_warnx(U_("%s exists but is not a directory (0%o)"),
|
||||
path, (unsigned int) sb.st_mode);
|
||||
}
|
||||
goto done;
|
||||
@@ -246,7 +246,7 @@ ts_mkdirs(char *path, uid_t owner, mode_t mode, mode_t parent_mode, bool quiet)
|
||||
"mkdir %s, mode 0%o", path, (unsigned int) mode);
|
||||
if (mkdir(path, mode) != 0 && errno != EEXIST) {
|
||||
if (!quiet)
|
||||
warning(U_("unable to mkdir %s"), path);
|
||||
sudo_warn(U_("unable to mkdir %s"), path);
|
||||
goto done;
|
||||
}
|
||||
ignore_result(chown(path, owner, parent_gid));
|
||||
@@ -283,11 +283,11 @@ ts_secure_dir(char *path, bool make_it, bool quiet)
|
||||
case SUDO_PATH_BAD_TYPE:
|
||||
errno = ENOTDIR;
|
||||
if (!quiet)
|
||||
warning("%s", path);
|
||||
sudo_warn("%s", path);
|
||||
break;
|
||||
case SUDO_PATH_WRONG_OWNER:
|
||||
if (!quiet) {
|
||||
warningx(U_("%s is owned by uid %u, should be %u"),
|
||||
sudo_warnx(U_("%s is owned by uid %u, should be %u"),
|
||||
path, (unsigned int) sb.st_uid,
|
||||
(unsigned int) timestamp_uid);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ ts_secure_dir(char *path, bool make_it, bool quiet)
|
||||
break;
|
||||
case SUDO_PATH_GROUP_WRITABLE:
|
||||
if (!quiet)
|
||||
warningx(U_("%s is group writable"), path);
|
||||
sudo_warnx(U_("%s is group writable"), path);
|
||||
errno = EACCES;
|
||||
break;
|
||||
}
|
||||
|
@@ -4036,7 +4036,7 @@ read_dir_files(const char *dirpath, struct path_list ***pathsp)
|
||||
dir = opendir(dirpath);
|
||||
if (dir == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
warning("%s", dirpath);
|
||||
sudo_warn("%s", dirpath);
|
||||
sudoerserror(NULL);
|
||||
}
|
||||
goto bad;
|
||||
@@ -4179,7 +4179,7 @@ _push_include(char *path, bool isdir)
|
||||
new_istack = (struct include_stack *) realloc(istack,
|
||||
sizeof(*istack) * istacksize);
|
||||
if (new_istack == NULL) {
|
||||
warning(NULL);
|
||||
sudo_warn(NULL);
|
||||
sudoerserror(NULL);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -4197,24 +4197,24 @@ _push_include(char *path, bool isdir)
|
||||
case SUDO_PATH_BAD_TYPE:
|
||||
errno = ENOTDIR;
|
||||
if (sudoers_warnings) {
|
||||
warning("%s", path);
|
||||
sudo_warn("%s", path);
|
||||
}
|
||||
debug_return_bool(false);
|
||||
case SUDO_PATH_WRONG_OWNER:
|
||||
if (sudoers_warnings) {
|
||||
warningx(U_("%s is owned by uid %u, should be %u"),
|
||||
sudo_warnx(U_("%s is owned by uid %u, should be %u"),
|
||||
path, (unsigned int) sb.st_uid,
|
||||
(unsigned int) sudoers_uid);
|
||||
}
|
||||
debug_return_bool(false);
|
||||
case SUDO_PATH_WORLD_WRITABLE:
|
||||
if (sudoers_warnings) {
|
||||
warningx(U_("%s is world writable"), path);
|
||||
sudo_warnx(U_("%s is world writable"), path);
|
||||
}
|
||||
debug_return_bool(false);
|
||||
case SUDO_PATH_GROUP_WRITABLE:
|
||||
if (sudoers_warnings) {
|
||||
warningx(U_("%s is owned by gid %u, should be %u"),
|
||||
sudo_warnx(U_("%s is owned by gid %u, should be %u"),
|
||||
path, (unsigned int) sb.st_gid,
|
||||
(unsigned int) sudoers_gid);
|
||||
}
|
||||
@@ -4337,7 +4337,7 @@ parse_include(char *base)
|
||||
len += (int)(ep - cp);
|
||||
path = pp = malloc(len + dirlen + 1);
|
||||
if (path == NULL) {
|
||||
warning(NULL);
|
||||
sudo_warn(NULL);
|
||||
sudoerserror(NULL);
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
|
@@ -777,7 +777,7 @@ read_dir_files(const char *dirpath, struct path_list ***pathsp)
|
||||
dir = opendir(dirpath);
|
||||
if (dir == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
warning("%s", dirpath);
|
||||
sudo_warn("%s", dirpath);
|
||||
sudoerserror(NULL);
|
||||
}
|
||||
goto bad;
|
||||
@@ -920,7 +920,7 @@ _push_include(char *path, bool isdir)
|
||||
new_istack = (struct include_stack *) realloc(istack,
|
||||
sizeof(*istack) * istacksize);
|
||||
if (new_istack == NULL) {
|
||||
warning(NULL);
|
||||
sudo_warn(NULL);
|
||||
sudoerserror(NULL);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -938,24 +938,24 @@ _push_include(char *path, bool isdir)
|
||||
case SUDO_PATH_BAD_TYPE:
|
||||
errno = ENOTDIR;
|
||||
if (sudoers_warnings) {
|
||||
warning("%s", path);
|
||||
sudo_warn("%s", path);
|
||||
}
|
||||
debug_return_bool(false);
|
||||
case SUDO_PATH_WRONG_OWNER:
|
||||
if (sudoers_warnings) {
|
||||
warningx(U_("%s is owned by uid %u, should be %u"),
|
||||
sudo_warnx(U_("%s is owned by uid %u, should be %u"),
|
||||
path, (unsigned int) sb.st_uid,
|
||||
(unsigned int) sudoers_uid);
|
||||
}
|
||||
debug_return_bool(false);
|
||||
case SUDO_PATH_WORLD_WRITABLE:
|
||||
if (sudoers_warnings) {
|
||||
warningx(U_("%s is world writable"), path);
|
||||
sudo_warnx(U_("%s is world writable"), path);
|
||||
}
|
||||
debug_return_bool(false);
|
||||
case SUDO_PATH_GROUP_WRITABLE:
|
||||
if (sudoers_warnings) {
|
||||
warningx(U_("%s is owned by gid %u, should be %u"),
|
||||
sudo_warnx(U_("%s is owned by gid %u, should be %u"),
|
||||
path, (unsigned int) sb.st_gid,
|
||||
(unsigned int) sudoers_gid);
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ parse_include(char *base)
|
||||
len += (int)(ep - cp);
|
||||
path = pp = malloc(len + dirlen + 1);
|
||||
if (path == NULL) {
|
||||
warning(NULL);
|
||||
sudo_warn(NULL);
|
||||
sudoerserror(NULL);
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ fill_txt(const char *src, int len, int olen)
|
||||
|
||||
dst = olen ? realloc(sudoerslval.string, olen + len + 1) : malloc(len + 1);
|
||||
if (dst == NULL) {
|
||||
warning(NULL);
|
||||
sudo_warn(NULL);
|
||||
sudoerserror(NULL);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ fill_cmnd(const char *src, int len)
|
||||
|
||||
dst = sudoerslval.command.cmnd = (char *) malloc(len + 1);
|
||||
if (sudoerslval.command.cmnd == NULL) {
|
||||
warning(NULL);
|
||||
sudo_warn(NULL);
|
||||
sudoerserror(NULL);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ fill_args(const char *s, int len, int addspace)
|
||||
(char *) malloc(arg_size);
|
||||
if (p == NULL) {
|
||||
efree(sudoerslval.command.args);
|
||||
warning(NULL);
|
||||
sudo_warn(NULL);
|
||||
sudoerserror(NULL);
|
||||
debug_return_bool(false);
|
||||
} else
|
||||
@@ -171,7 +171,7 @@ fill_args(const char *s, int len, int addspace)
|
||||
if (addspace)
|
||||
*p++ = ' ';
|
||||
if (strlcpy(p, s, arg_size - (p - sudoerslval.command.args)) != (size_t)len) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
sudoerserror(NULL);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
@@ -167,7 +167,7 @@ main(int argc, char *argv[])
|
||||
usage(1);
|
||||
|
||||
/* Register fatal/fatalx callback. */
|
||||
fatal_callback_register(visudo_cleanup);
|
||||
sudo_fatal_callback_register(visudo_cleanup);
|
||||
|
||||
/* Read sudo.conf. */
|
||||
sudo_conf_read(NULL);
|
||||
@@ -219,7 +219,7 @@ main(int argc, char *argv[])
|
||||
/* Mock up a fake sudo_user struct. */
|
||||
user_cmnd = user_base = "";
|
||||
if ((sudo_user.pw = sudo_getpwuid(getuid())) == NULL)
|
||||
fatalx(U_("you do not exist in the %s database"), "passwd");
|
||||
sudo_fatalx(U_("you do not exist in the %s database"), "passwd");
|
||||
get_hostname();
|
||||
|
||||
/* Setup defaults data structures. */
|
||||
@@ -324,7 +324,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
|
||||
debug_decl(edit_sudoers, SUDO_DEBUG_UTIL)
|
||||
|
||||
if (fstat(sp->fd, &sb) == -1)
|
||||
fatal(U_("unable to stat %s"), sp->path);
|
||||
sudo_fatal(U_("unable to stat %s"), sp->path);
|
||||
orig_size = sb.st_size;
|
||||
mtim_get(&sb, &orig_mtim);
|
||||
|
||||
@@ -333,20 +333,20 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
|
||||
easprintf(&sp->tpath, "%s.tmp", sp->path);
|
||||
tfd = open(sp->tpath, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
if (tfd < 0)
|
||||
fatal("%s", sp->tpath);
|
||||
sudo_fatal("%s", sp->tpath);
|
||||
|
||||
/* Copy sp->path -> sp->tpath and reset the mtime. */
|
||||
if (orig_size != 0) {
|
||||
(void) lseek(sp->fd, (off_t)0, SEEK_SET);
|
||||
while ((nread = read(sp->fd, buf, sizeof(buf))) > 0)
|
||||
if (write(tfd, buf, nread) != nread)
|
||||
fatal(U_("write error"));
|
||||
sudo_fatal(U_("write error"));
|
||||
|
||||
/* Add missing newline at EOF if needed. */
|
||||
if (nread > 0 && buf[nread - 1] != '\n') {
|
||||
buf[0] = '\n';
|
||||
if (write(tfd, buf, 1) != 1)
|
||||
fatal(U_("write error"));
|
||||
sudo_fatal(U_("write error"));
|
||||
}
|
||||
}
|
||||
(void) close(tfd);
|
||||
@@ -430,18 +430,18 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
|
||||
* Sanity checks.
|
||||
*/
|
||||
if (stat(sp->tpath, &sb) < 0) {
|
||||
warningx(U_("unable to stat temporary file (%s), %s unchanged"),
|
||||
sudo_warnx(U_("unable to stat temporary file (%s), %s unchanged"),
|
||||
sp->tpath, sp->path);
|
||||
goto done;
|
||||
}
|
||||
if (sb.st_size == 0 && orig_size != 0) {
|
||||
warningx(U_("zero length temporary file (%s), %s unchanged"),
|
||||
sudo_warnx(U_("zero length temporary file (%s), %s unchanged"),
|
||||
sp->tpath, sp->path);
|
||||
sp->modified = true;
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
warningx(U_("editor (%s) failed, %s unchanged"), editor, sp->path);
|
||||
sudo_warnx(U_("editor (%s) failed, %s unchanged"), editor, sp->path);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
|
||||
if (modified)
|
||||
sp->modified = modified;
|
||||
else
|
||||
warningx(U_("%s unchanged"), sp->tpath);
|
||||
sudo_warnx(U_("%s unchanged"), sp->tpath);
|
||||
|
||||
rval = true;
|
||||
done:
|
||||
@@ -488,7 +488,7 @@ reparse_sudoers(char *editor, char *args, bool strict, bool quiet)
|
||||
last = TAILQ_LAST(&sudoerslist, sudoersfile_list);
|
||||
fp = fopen(sp->tpath, "r+");
|
||||
if (fp == NULL)
|
||||
fatalx(U_("unable to re-open temporary file (%s), %s unchanged."),
|
||||
sudo_fatalx(U_("unable to re-open temporary file (%s), %s unchanged."),
|
||||
sp->tpath, sp->path);
|
||||
|
||||
/* Clean slate for each parse */
|
||||
@@ -498,7 +498,7 @@ reparse_sudoers(char *editor, char *args, bool strict, bool quiet)
|
||||
/* Parse the sudoers temp file(s) */
|
||||
sudoersrestart(fp);
|
||||
if (sudoersparse() && !parse_error) {
|
||||
warningx(U_("unabled to parse temporary file (%s), unknown error"),
|
||||
sudo_warnx(U_("unabled to parse temporary file (%s), unknown error"),
|
||||
sp->tpath);
|
||||
parse_error = true;
|
||||
errorfile = sp->path;
|
||||
@@ -534,7 +534,7 @@ reparse_sudoers(char *editor, char *args, bool strict, bool quiet)
|
||||
}
|
||||
}
|
||||
if (errorfile != NULL && sp == NULL) {
|
||||
fatalx(U_("internal error, unable to find %s in list!"),
|
||||
sudo_fatalx(U_("internal error, unable to find %s in list!"),
|
||||
sudoers);
|
||||
}
|
||||
break;
|
||||
@@ -590,23 +590,23 @@ install_sudoers(struct sudoersfile *sp, bool oldperms)
|
||||
if (oldperms) {
|
||||
/* Use perms of the existing file. */
|
||||
if (fstat(sp->fd, &sb) == -1)
|
||||
fatal(U_("unable to stat %s"), sp->path);
|
||||
sudo_fatal(U_("unable to stat %s"), sp->path);
|
||||
if (chown(sp->tpath, sb.st_uid, sb.st_gid) != 0) {
|
||||
warning(U_("unable to set (uid, gid) of %s to (%u, %u)"),
|
||||
sudo_warn(U_("unable to set (uid, gid) of %s to (%u, %u)"),
|
||||
sp->tpath, (unsigned int)sb.st_uid, (unsigned int)sb.st_gid);
|
||||
}
|
||||
if (chmod(sp->tpath, sb.st_mode & 0777) != 0) {
|
||||
warning(U_("unable to change mode of %s to 0%o"), sp->tpath,
|
||||
sudo_warn(U_("unable to change mode of %s to 0%o"), sp->tpath,
|
||||
(unsigned int)(sb.st_mode & 0777));
|
||||
}
|
||||
} else {
|
||||
if (chown(sp->tpath, SUDOERS_UID, SUDOERS_GID) != 0) {
|
||||
warning(U_("unable to set (uid, gid) of %s to (%u, %u)"),
|
||||
sudo_warn(U_("unable to set (uid, gid) of %s to (%u, %u)"),
|
||||
sp->tpath, SUDOERS_UID, SUDOERS_GID);
|
||||
goto done;
|
||||
}
|
||||
if (chmod(sp->tpath, SUDOERS_MODE) != 0) {
|
||||
warning(U_("unable to change mode of %s to 0%o"), sp->tpath,
|
||||
sudo_warn(U_("unable to change mode of %s to 0%o"), sp->tpath,
|
||||
SUDOERS_MODE);
|
||||
goto done;
|
||||
}
|
||||
@@ -623,7 +623,7 @@ install_sudoers(struct sudoersfile *sp, bool oldperms)
|
||||
} else {
|
||||
if (errno == EXDEV) {
|
||||
char *av[4];
|
||||
warningx(U_("%s and %s not on the same file system, using mv to rename"),
|
||||
sudo_warnx(U_("%s and %s not on the same file system, using mv to rename"),
|
||||
sp->tpath, sp->path);
|
||||
|
||||
/* Build up argument vector for the command */
|
||||
@@ -637,7 +637,7 @@ install_sudoers(struct sudoersfile *sp, bool oldperms)
|
||||
|
||||
/* And run it... */
|
||||
if (run_command(_PATH_MV, av)) {
|
||||
warningx(U_("command failed: '%s %s %s', %s unchanged"),
|
||||
sudo_warnx(U_("command failed: '%s %s %s', %s unchanged"),
|
||||
_PATH_MV, sp->tpath, sp->path, sp->path);
|
||||
(void) unlink(sp->tpath);
|
||||
efree(sp->tpath);
|
||||
@@ -647,7 +647,7 @@ install_sudoers(struct sudoersfile *sp, bool oldperms)
|
||||
efree(sp->tpath);
|
||||
sp->tpath = NULL;
|
||||
} else {
|
||||
warning(U_("error renaming %s, %s unchanged"), sp->tpath, sp->path);
|
||||
sudo_warn(U_("error renaming %s, %s unchanged"), sp->tpath, sp->path);
|
||||
(void) unlink(sp->tpath);
|
||||
goto done;
|
||||
}
|
||||
@@ -764,14 +764,14 @@ run_command(char *path, char **argv)
|
||||
|
||||
switch (pid = sudo_debug_fork()) {
|
||||
case -1:
|
||||
fatal(U_("unable to execute %s"), path);
|
||||
sudo_fatal(U_("unable to execute %s"), path);
|
||||
break; /* NOTREACHED */
|
||||
case 0:
|
||||
sudo_endpwent();
|
||||
sudo_endgrent();
|
||||
closefrom(STDERR_FILENO + 1);
|
||||
execv(path, argv);
|
||||
warning(U_("unable to run %s"), path);
|
||||
sudo_warn(U_("unable to run %s"), path);
|
||||
_exit(127);
|
||||
break; /* NOTREACHED */
|
||||
}
|
||||
@@ -823,13 +823,13 @@ check_syntax(char *sudoers_path, bool quiet, bool strict, bool oldperms)
|
||||
sudoers_path = "stdin";
|
||||
} else if ((sudoersin = fopen(sudoers_path, "r")) == NULL) {
|
||||
if (!quiet)
|
||||
warning(U_("unable to open %s"), sudoers_path);
|
||||
sudo_warn(U_("unable to open %s"), sudoers_path);
|
||||
goto done;
|
||||
}
|
||||
init_parser(sudoers_path, quiet);
|
||||
if (sudoersparse() && !parse_error) {
|
||||
if (!quiet)
|
||||
warningx(U_("failed to parse %s file, unknown error"), sudoers_path);
|
||||
sudo_warnx(U_("failed to parse %s file, unknown error"), sudoers_path);
|
||||
parse_error = true;
|
||||
errorfile = sudoers_path;
|
||||
}
|
||||
@@ -904,23 +904,23 @@ open_sudoers(const char *path, bool doedit, bool *keepopen)
|
||||
/* entry->tpath = NULL; */
|
||||
entry->doedit = doedit;
|
||||
if (entry->fd == -1) {
|
||||
warning("%s", entry->path);
|
||||
sudo_warn("%s", entry->path);
|
||||
efree(entry);
|
||||
debug_return_ptr(NULL);
|
||||
}
|
||||
if (!checkonly && !sudo_lock_file(entry->fd, SUDO_TLOCK))
|
||||
fatalx(U_("%s busy, try again later"), entry->path);
|
||||
sudo_fatalx(U_("%s busy, try again later"), entry->path);
|
||||
if ((fp = fdopen(entry->fd, "r")) == NULL)
|
||||
fatal("%s", entry->path);
|
||||
sudo_fatal("%s", entry->path);
|
||||
TAILQ_INSERT_TAIL(&sudoerslist, entry, entries);
|
||||
} else {
|
||||
/* Already exists, open .tmp version if there is one. */
|
||||
if (entry->tpath != NULL) {
|
||||
if ((fp = fopen(entry->tpath, "r")) == NULL)
|
||||
fatal("%s", entry->tpath);
|
||||
sudo_fatal("%s", entry->tpath);
|
||||
} else {
|
||||
if ((fp = fdopen(entry->fd, "r")) == NULL)
|
||||
fatal("%s", entry->path);
|
||||
sudo_fatal("%s", entry->path);
|
||||
rewind(fp);
|
||||
}
|
||||
}
|
||||
@@ -953,7 +953,7 @@ get_editor(char **args)
|
||||
} else {
|
||||
if (def_env_editor) {
|
||||
/* If we are honoring $EDITOR this is a fatal error. */
|
||||
fatalx(U_("specified editor (%s) doesn't exist"), UserEditor);
|
||||
sudo_fatalx(U_("specified editor (%s) doesn't exist"), UserEditor);
|
||||
} else {
|
||||
/* Otherwise, just ignore $EDITOR. */
|
||||
UserEditor = NULL;
|
||||
@@ -976,7 +976,7 @@ get_editor(char **args)
|
||||
|
||||
if (stat(UserEditor, &user_editor_sb) != 0) {
|
||||
/* Should never happen since we already checked above. */
|
||||
fatal(U_("unable to stat editor (%s)"), UserEditor);
|
||||
sudo_fatal(U_("unable to stat editor (%s)"), UserEditor);
|
||||
}
|
||||
EditorPath = estrdup(def_editor);
|
||||
Editor = strtok(EditorPath, ":");
|
||||
@@ -1024,7 +1024,7 @@ get_editor(char **args)
|
||||
|
||||
/* Bleah, none of the editors existed! */
|
||||
if (Editor == NULL || *Editor == '\0')
|
||||
fatalx(U_("no editor found (editor path = %s)"), def_editor);
|
||||
sudo_fatalx(U_("no editor found (editor path = %s)"), def_editor);
|
||||
}
|
||||
*args = EditorArgs;
|
||||
debug_return_str(Editor);
|
||||
@@ -1116,14 +1116,14 @@ check_alias(char *name, int type, int strict, int quiet)
|
||||
} else {
|
||||
if (!quiet) {
|
||||
if (errno == ELOOP) {
|
||||
warningx(strict ?
|
||||
sudo_warnx(strict ?
|
||||
U_("Error: cycle in %s_Alias `%s'") :
|
||||
U_("Warning: cycle in %s_Alias `%s'"),
|
||||
type == HOSTALIAS ? "Host" : type == CMNDALIAS ? "Cmnd" :
|
||||
type == USERALIAS ? "User" : type == RUNASALIAS ? "Runas" :
|
||||
"Unknown", name);
|
||||
} else {
|
||||
warningx(strict ?
|
||||
sudo_warnx(strict ?
|
||||
U_("Error: %s_Alias `%s' referenced but not defined") :
|
||||
U_("Warning: %s_Alias `%s' referenced but not defined"),
|
||||
type == HOSTALIAS ? "Host" : type == CMNDALIAS ? "Cmnd" :
|
||||
@@ -1267,7 +1267,7 @@ print_unused(void *v1, void *v2)
|
||||
struct alias *a = (struct alias *)v1;
|
||||
char *prefix = (char *)v2;
|
||||
|
||||
warningx_nodebug(U_("%s: unused %s_Alias %s"), prefix,
|
||||
sudo_warnx_nodebug(U_("%s: unused %s_Alias %s"), prefix,
|
||||
a->type == HOSTALIAS ? "Host" : a->type == CMNDALIAS ? "Cmnd" :
|
||||
a->type == USERALIAS ? "User" : a->type == RUNASALIAS ? "Runas" :
|
||||
"Unknown", a->name);
|
||||
|
@@ -193,10 +193,10 @@ print_pair_json(FILE *fp, const char *pre, const char *name,
|
||||
fputs(value->u.boolean ? "true" : "false", fp);
|
||||
break;
|
||||
case JSON_OBJECT:
|
||||
fatalx("internal error: can't print JSON_OBJECT");
|
||||
sudo_fatalx("internal error: can't print JSON_OBJECT");
|
||||
break;
|
||||
case JSON_ARRAY:
|
||||
fatalx("internal error: can't print JSON_ARRAY");
|
||||
sudo_fatalx("internal error: can't print JSON_ARRAY");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ alias_to_word_type(int alias_type)
|
||||
case USERALIAS:
|
||||
return TYPE_USERNAME;
|
||||
default:
|
||||
fatalx_nodebug("unexpected alias type %d", alias_type);
|
||||
sudo_fatalx_nodebug("unexpected alias type %d", alias_type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ defaults_to_word_type(int defaults_type)
|
||||
case DEFAULTS_USER:
|
||||
return TYPE_USERNAME;
|
||||
default:
|
||||
fatalx_nodebug("unexpected defaults type %d", defaults_type);
|
||||
sudo_fatalx_nodebug("unexpected defaults type %d", defaults_type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ print_member_json(FILE *fp, struct member *m, enum word_type word_type,
|
||||
if (*value.u.string == '#') {
|
||||
id = atoid(m->name + 3, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx("internal error: non-Unix group ID %s: \"%s\"",
|
||||
sudo_warnx("internal error: non-Unix group ID %s: \"%s\"",
|
||||
errstr, m->name);
|
||||
} else {
|
||||
value.type = JSON_ID;
|
||||
@@ -390,7 +390,7 @@ print_member_json(FILE *fp, struct member *m, enum word_type word_type,
|
||||
if (*value.u.string == '#') {
|
||||
id = atoid(m->name + 2, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx("internal error: group ID %s: \"%s\"",
|
||||
sudo_warnx("internal error: group ID %s: \"%s\"",
|
||||
errstr, m->name);
|
||||
} else {
|
||||
value.type = JSON_ID;
|
||||
@@ -424,7 +424,7 @@ print_member_json(FILE *fp, struct member *m, enum word_type word_type,
|
||||
if (*value.u.string == '#') {
|
||||
id = atoid(m->name + 1, NULL, NULL, &errstr);
|
||||
if (errstr != NULL) {
|
||||
warningx("internal error: user ID %s: \"%s\"",
|
||||
sudo_warnx("internal error: user ID %s: \"%s\"",
|
||||
errstr, m->name);
|
||||
} else {
|
||||
value.type = JSON_ID;
|
||||
@@ -434,7 +434,7 @@ print_member_json(FILE *fp, struct member *m, enum word_type word_type,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fatalx("unexpected word type %d", word_type);
|
||||
sudo_fatalx("unexpected word type %d", word_type);
|
||||
}
|
||||
break;
|
||||
case ALL:
|
||||
@@ -456,11 +456,11 @@ print_member_json(FILE *fp, struct member *m, enum word_type word_type,
|
||||
typestr = "useralias";
|
||||
break;
|
||||
default:
|
||||
fatalx("unexpected word type %d", word_type);
|
||||
sudo_fatalx("unexpected word type %d", word_type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fatalx("unexpected member type %d", m->type);
|
||||
sudo_fatalx("unexpected member type %d", m->type);
|
||||
}
|
||||
|
||||
if (m->negated) {
|
||||
@@ -571,7 +571,7 @@ print_defaults_list_json(FILE *fp, struct defaults *def, int indent)
|
||||
value.u.string = "list_assign";
|
||||
break;
|
||||
default:
|
||||
warningx("internal error: unexpected list op %d", def->op);
|
||||
sudo_warnx("internal error: unexpected list op %d", def->op);
|
||||
value.u.string = "unsupported";
|
||||
break;
|
||||
}
|
||||
@@ -639,7 +639,7 @@ print_defaults_json(FILE *fp, int indent, bool need_comma)
|
||||
TAILQ_FOREACH_SAFE(def, &defaults, entries, next) {
|
||||
type = get_defaults_type(def);
|
||||
if (type == -1) {
|
||||
warningx(U_("unknown defaults entry `%s'"), def->var);
|
||||
sudo_warnx(U_("unknown defaults entry `%s'"), def->var);
|
||||
/* XXX - just pass it through as a string anyway? */
|
||||
continue;
|
||||
}
|
||||
@@ -674,7 +674,7 @@ print_defaults_json(FILE *fp, int indent, bool need_comma)
|
||||
def = next;
|
||||
type = get_defaults_type(def);
|
||||
if (type == -1) {
|
||||
warningx(U_("unknown defaults entry `%s'"), def->var);
|
||||
sudo_warnx(U_("unknown defaults entry `%s'"), def->var);
|
||||
/* XXX - just pass it through as a string anyway? */
|
||||
break;;
|
||||
}
|
||||
@@ -1022,27 +1022,27 @@ export_sudoers(const char *sudoers_path, const char *export_path,
|
||||
sudoers_path = "stdin";
|
||||
} else if ((sudoersin = fopen(sudoers_path, "r")) == NULL) {
|
||||
if (!quiet)
|
||||
warning(U_("unable to open %s"), sudoers_path);
|
||||
sudo_warn(U_("unable to open %s"), sudoers_path);
|
||||
goto done;
|
||||
}
|
||||
if (strcmp(export_path, "-") != 0) {
|
||||
if (strcmp(sudoers_path, export_path) == 0) {
|
||||
if (!quiet) {
|
||||
warningx(U_("%s: input and output files must be different"),
|
||||
sudo_warnx(U_("%s: input and output files must be different"),
|
||||
sudoers_path);
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
if ((export_fp = fopen(export_path, "w")) == NULL) {
|
||||
if (!quiet)
|
||||
warning(U_("unable to open %s"), export_path);
|
||||
sudo_warn(U_("unable to open %s"), export_path);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
init_parser(sudoers_path, quiet);
|
||||
if (sudoersparse() && !parse_error) {
|
||||
if (!quiet)
|
||||
warningx(U_("failed to parse %s file, unknown error"), sudoers_path);
|
||||
sudo_warnx(U_("failed to parse %s file, unknown error"), sudoers_path);
|
||||
parse_error = true;
|
||||
errorfile = sudoers_path;
|
||||
}
|
||||
@@ -1051,10 +1051,10 @@ export_sudoers(const char *sudoers_path, const char *export_path,
|
||||
if (parse_error) {
|
||||
if (!quiet) {
|
||||
if (errorlineno != -1)
|
||||
warningx(_("parse error in %s near line %d\n"),
|
||||
sudo_warnx(_("parse error in %s near line %d\n"),
|
||||
errorfile, errorlineno);
|
||||
else if (errorfile != NULL)
|
||||
warningx(_("parse error in %s\n"), errorfile);
|
||||
sudo_warnx(_("parse error in %s\n"), errorfile);
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
32
src/exec.c
32
src/exec.c
@@ -130,12 +130,12 @@ static int fork_cmnd(struct command_details *details, int sv[2])
|
||||
* or certain pam modules won't be able to track their state.
|
||||
*/
|
||||
if (policy_init_session(details) != true)
|
||||
fatalx(U_("policy plugin failed session initialization"));
|
||||
sudo_fatalx(U_("policy plugin failed session initialization"));
|
||||
|
||||
cmnd_pid = sudo_debug_fork();
|
||||
switch (cmnd_pid) {
|
||||
case -1:
|
||||
fatal(U_("unable to fork"));
|
||||
sudo_fatal(U_("unable to fork"));
|
||||
break;
|
||||
case 0:
|
||||
/* child */
|
||||
@@ -300,29 +300,29 @@ exec_event_setup(int backchannel, struct exec_closure *ec)
|
||||
|
||||
evbase = sudo_ev_base_alloc();
|
||||
if (evbase == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
|
||||
/* Event for incoming signals via signal_pipe. */
|
||||
signal_event = sudo_ev_alloc(signal_pipe[0],
|
||||
SUDO_EV_READ|SUDO_EV_PERSIST, signal_pipe_cb, ec);
|
||||
if (signal_event == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
if (sudo_ev_add(evbase, signal_event, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
|
||||
/* Event for command status via backchannel. */
|
||||
backchannel_event = sudo_ev_alloc(backchannel,
|
||||
SUDO_EV_READ|SUDO_EV_PERSIST, backchannel_cb, ec);
|
||||
if (backchannel_event == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
if (sudo_ev_add(evbase, backchannel_event, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
|
||||
/* The signal forwarding event gets added on demand. */
|
||||
sigfwd_event = sudo_ev_alloc(backchannel,
|
||||
SUDO_EV_WRITE, forward_signals, NULL);
|
||||
if (sigfwd_event == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "signal pipe fd %d\n", signal_pipe[0]);
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "backchannel fd %d\n", backchannel);
|
||||
@@ -396,7 +396,7 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
|
||||
* Parent sends signal info to child and child sends back wait status.
|
||||
*/
|
||||
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) == -1)
|
||||
fatal(U_("unable to create sockets"));
|
||||
sudo_fatal(U_("unable to create sockets"));
|
||||
|
||||
/*
|
||||
* Signals to forward to the child process (excluding SIGALRM and SIGCHLD).
|
||||
@@ -482,7 +482,7 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
|
||||
if (log_io)
|
||||
add_io_events(evbase);
|
||||
if (sudo_ev_loop(evbase, 0) == -1)
|
||||
warning(U_("error in event loop"));
|
||||
sudo_warn(U_("error in event loop"));
|
||||
if (sudo_ev_got_break(evbase)) {
|
||||
/* error from callback */
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR, "event loop exited prematurely");
|
||||
@@ -500,7 +500,7 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
|
||||
if (ISSET(details->flags, CD_RBAC_ENABLED)) {
|
||||
/* This is probably not needed in log_io mode. */
|
||||
if (selinux_restore_tty() != 0)
|
||||
warningx(U_("unable to restore tty label"));
|
||||
sudo_warnx(U_("unable to restore tty label"));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -569,7 +569,7 @@ dispatch_signal(struct sudo_event_base *evbase, pid_t child,
|
||||
if (child_pgrp != ppgrp) {
|
||||
if (tcsetpgrp(fd, child_pgrp) == 0) {
|
||||
if (killpg(child_pgrp, SIGCONT) != 0) {
|
||||
warning("kill(%d, SIGCONT)",
|
||||
sudo_warn("kill(%d, SIGCONT)",
|
||||
(int)child_pgrp);
|
||||
}
|
||||
close(fd);
|
||||
@@ -587,7 +587,7 @@ dispatch_signal(struct sudo_event_base *evbase, pid_t child,
|
||||
sudo_sigaction(SIGTSTP, &sa, &osa);
|
||||
}
|
||||
if (kill(getpid(), signo) != 0)
|
||||
warning("kill(%d, SIG%s)", (int)getpid(), signame);
|
||||
sudo_warn("kill(%d, SIG%s)", (int)getpid(), signame);
|
||||
if (signo == SIGTSTP)
|
||||
sudo_sigaction(SIGTSTP, &osa, NULL);
|
||||
if (fd != -1) {
|
||||
@@ -612,7 +612,7 @@ dispatch_signal(struct sudo_event_base *evbase, pid_t child,
|
||||
if (signo == SIGALRM) {
|
||||
terminate_command(child, false);
|
||||
} else if (kill(child, signo) != 0) {
|
||||
warning("kill(%d, SIG%s)", (int)child, signame);
|
||||
sudo_warn("kill(%d, SIG%s)", (int)child, signame);
|
||||
}
|
||||
}
|
||||
rc = 0;
|
||||
@@ -774,7 +774,7 @@ dispatch_pending_signals(struct command_status *cstat)
|
||||
sa.sa_handler = SIG_DFL;
|
||||
sudo_sigaction(SIGTSTP, &sa, NULL);
|
||||
if (kill(getpid(), SIGTSTP) != 0)
|
||||
warning("kill(%d, SIGTSTP)", (int)getpid());
|
||||
sudo_warn("kill(%d, SIGTSTP)", (int)getpid());
|
||||
/* No need to reinstall SIGTSTP handler. */
|
||||
}
|
||||
debug_return_int(rval);
|
||||
@@ -849,7 +849,7 @@ schedule_signal(struct sudo_event_base *evbase, int signo)
|
||||
TAILQ_INSERT_TAIL(&sigfwd_list, sigfwd, entries);
|
||||
|
||||
if (sudo_ev_add(evbase, sigfwd_event, NULL, true) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
|
||||
debug_return;
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ disable_execute(char *const envp[])
|
||||
(void)priv_set(PRIV_ON, PRIV_INHERITABLE, "PRIV_FILE_DAC_SEARCH", NULL);
|
||||
if (priv_set(PRIV_OFF, PRIV_LIMIT, "PRIV_PROC_EXEC", NULL) == 0)
|
||||
debug_return_const_ptr(envp);
|
||||
warning(U_("unable to remove PRIV_PROC_EXEC from PRIV_LIMIT"));
|
||||
sudo_warn(U_("unable to remove PRIV_PROC_EXEC from PRIV_LIMIT"));
|
||||
#endif /* HAVE_PRIV_SET */
|
||||
|
||||
#ifdef _PATH_SUDO_NOEXEC
|
||||
@@ -112,7 +112,7 @@ disable_execute(char *const envp[])
|
||||
preload = sudo_new_key_val(RTLD_PRELOAD_VAR, sudo_conf_noexec_path());
|
||||
# endif
|
||||
if (preload == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
nenvp[env_len++] = preload;
|
||||
nenvp[env_len] = NULL;
|
||||
} else {
|
||||
|
@@ -108,7 +108,7 @@ static void ev_free_by_fd(struct sudo_event_base *evbase, int fd);
|
||||
static void check_foreground(void);
|
||||
|
||||
/*
|
||||
* Cleanup hook for fatal()/fatalx()
|
||||
* Cleanup hook for sudo_fatal()/sudo_fatalx()
|
||||
*/
|
||||
static void
|
||||
pty_cleanup(void)
|
||||
@@ -191,7 +191,7 @@ pty_setup(uid_t uid, const char *tty, const char *utmp_user)
|
||||
if (io_fds[SFD_USERTTY] != -1) {
|
||||
if (!get_pty(&io_fds[SFD_MASTER], &io_fds[SFD_SLAVE],
|
||||
slavename, sizeof(slavename), uid))
|
||||
fatal(U_("unable to allocate pty"));
|
||||
sudo_fatal(U_("unable to allocate pty"));
|
||||
/* Add entry to utmp/utmpx? */
|
||||
if (utmp_user != NULL)
|
||||
utmp_login(tty, slavename, io_fds[SFD_SLAVE], utmp_user);
|
||||
@@ -393,7 +393,7 @@ suspend_parent(int signo)
|
||||
}
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "kill parent SIG%s", signame);
|
||||
if (killpg(ppgrp, signo) != 0)
|
||||
warning("killpg(%d, SIG%s)", (int)ppgrp, signame);
|
||||
sudo_warn("killpg(%d, SIG%s)", (int)ppgrp, signame);
|
||||
|
||||
/* Check foreground/background status on resume. */
|
||||
check_foreground();
|
||||
@@ -511,12 +511,12 @@ io_callback(int fd, int what, void *v)
|
||||
if (iob->wevent != NULL &&
|
||||
(foreground || !USERTTY_EVENT(iob->wevent))) {
|
||||
if (sudo_ev_add(evbase, iob->wevent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
/* Re-enable reader if buffer is not full. */
|
||||
if (iob->len != sizeof(iob->buf)) {
|
||||
if (sudo_ev_add(evbase, iob->revent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -574,14 +574,14 @@ io_callback(int fd, int what, void *v)
|
||||
/* Re-enable writer if buffer is not empty. */
|
||||
if (iob->len > iob->off) {
|
||||
if (sudo_ev_add(evbase, iob->wevent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
/* Enable reader if buffer is not full. */
|
||||
if (iob->revent != NULL &&
|
||||
(ttymode == TERM_RAW || !USERTTY_EVENT(iob->revent))) {
|
||||
if (iob->len != sizeof(iob->buf)) {
|
||||
if (sudo_ev_add(evbase, iob->revent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -613,7 +613,7 @@ io_buf_new(int rfd, int wfd, bool (*action)(const char *, unsigned int),
|
||||
iob->action = action;
|
||||
iob->buf[0] = '\0';
|
||||
if (iob->revent == NULL || iob->wevent == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
SLIST_INSERT_HEAD(head, iob, entries);
|
||||
|
||||
debug_return;
|
||||
@@ -686,7 +686,7 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "stdin not a tty, creating a pipe");
|
||||
pipeline = true;
|
||||
if (pipe(io_pipe[STDIN_FILENO]) != 0)
|
||||
fatal(U_("unable to create pipe"));
|
||||
sudo_fatal(U_("unable to create pipe"));
|
||||
io_buf_new(STDIN_FILENO, io_pipe[STDIN_FILENO][1],
|
||||
log_stdin, &iobufs);
|
||||
io_fds[SFD_STDIN] = io_pipe[STDIN_FILENO][0];
|
||||
@@ -695,7 +695,7 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "stdout not a tty, creating a pipe");
|
||||
pipeline = true;
|
||||
if (pipe(io_pipe[STDOUT_FILENO]) != 0)
|
||||
fatal(U_("unable to create pipe"));
|
||||
sudo_fatal(U_("unable to create pipe"));
|
||||
io_buf_new(io_pipe[STDOUT_FILENO][0], STDOUT_FILENO,
|
||||
log_stdout, &iobufs);
|
||||
io_fds[SFD_STDOUT] = io_pipe[STDOUT_FILENO][1];
|
||||
@@ -703,7 +703,7 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||
if (io_fds[SFD_STDERR] == -1 || !isatty(STDERR_FILENO)) {
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "stderr not a tty, creating a pipe");
|
||||
if (pipe(io_pipe[STDERR_FILENO]) != 0)
|
||||
fatal(U_("unable to create pipe"));
|
||||
sudo_fatal(U_("unable to create pipe"));
|
||||
io_buf_new(io_pipe[STDERR_FILENO][0], STDERR_FILENO,
|
||||
log_stderr, &iobufs);
|
||||
io_fds[SFD_STDERR] = io_pipe[STDERR_FILENO][1];
|
||||
@@ -739,7 +739,7 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||
n = sudo_term_raw(io_fds[SFD_USERTTY], 0);
|
||||
} while (!n && errno == EINTR);
|
||||
if (!n)
|
||||
fatal(U_("unable to set terminal to raw mode"));
|
||||
sudo_fatal(U_("unable to set terminal to raw mode"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||
* or certain pam modules won't be able to track their state.
|
||||
*/
|
||||
if (policy_init_session(details) != true)
|
||||
fatalx(U_("policy plugin failed session initialization"));
|
||||
sudo_fatalx(U_("policy plugin failed session initialization"));
|
||||
|
||||
/*
|
||||
* Block some signals until cmnd_pid is set in the parent to avoid a
|
||||
@@ -764,7 +764,7 @@ fork_pty(struct command_details *details, int sv[], sigset_t *omask)
|
||||
child = sudo_debug_fork();
|
||||
switch (child) {
|
||||
case -1:
|
||||
fatal(U_("unable to fork"));
|
||||
sudo_fatal(U_("unable to fork"));
|
||||
break;
|
||||
case 0:
|
||||
/* child */
|
||||
@@ -868,7 +868,7 @@ add_io_events(struct sudo_event_base *evbase)
|
||||
"added I/O revent %p, fd %d, events %d",
|
||||
iob->revent, iob->revent->fd, iob->revent->events);
|
||||
if (sudo_ev_add(evbase, iob->revent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
}
|
||||
if (iob->wevent != NULL &&
|
||||
@@ -878,7 +878,7 @@ add_io_events(struct sudo_event_base *evbase)
|
||||
"added I/O wevent %p, fd %d, events %d",
|
||||
iob->wevent, iob->wevent->fd, iob->wevent->events);
|
||||
if (sudo_ev_add(evbase, iob->wevent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -915,7 +915,7 @@ del_io_events(void)
|
||||
/* Create temporary event base for flushing. */
|
||||
evbase = sudo_ev_base_alloc();
|
||||
if (evbase == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
|
||||
/* Avoid reading from /dev/tty, just flush existing data. */
|
||||
SLIST_FOREACH(iob, &iobufs, entries) {
|
||||
@@ -923,14 +923,14 @@ del_io_events(void)
|
||||
if (iob->revent != NULL && !USERTTY_EVENT(iob->revent)) {
|
||||
if (iob->len != sizeof(iob->buf)) {
|
||||
if (sudo_ev_add(evbase, iob->revent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
}
|
||||
/* Flush any write buffers with data in them. */
|
||||
if (iob->wevent != NULL) {
|
||||
if (iob->len > iob->off) {
|
||||
if (sudo_ev_add(evbase, iob->wevent, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1099,7 +1099,7 @@ mon_signal_pipe_cb(int fd, int what, void *v)
|
||||
n = read(fd, &signo, sizeof(signo));
|
||||
if (n == -1) {
|
||||
if (errno != EINTR && errno != EAGAIN) {
|
||||
warning(U_("error reading from signal pipe"));
|
||||
sudo_warn(U_("error reading from signal pipe"));
|
||||
sudo_ev_loopbreak(mc->evbase);
|
||||
}
|
||||
} else {
|
||||
@@ -1132,7 +1132,7 @@ mon_errpipe_cb(int fd, int what, void *v)
|
||||
n = read(fd, mc->cstat, sizeof(struct command_status));
|
||||
if (n == -1) {
|
||||
if (errno != EINTR && errno != EAGAIN) {
|
||||
warning(U_("error reading from pipe"));
|
||||
sudo_warn(U_("error reading from pipe"));
|
||||
sudo_ev_loopbreak(mc->evbase);
|
||||
}
|
||||
} else {
|
||||
@@ -1157,7 +1157,7 @@ mon_backchannel_cb(int fd, int what, void *v)
|
||||
if (n == -1) {
|
||||
if (errno == EINTR || errno == EAGAIN)
|
||||
debug_return;
|
||||
warning(U_("error reading from socketpair"));
|
||||
sudo_warn(U_("error reading from socketpair"));
|
||||
} else {
|
||||
/* short read or EOF, parent process died? */
|
||||
}
|
||||
@@ -1166,7 +1166,7 @@ mon_backchannel_cb(int fd, int what, void *v)
|
||||
if (cstmp.type == CMD_SIGNO) {
|
||||
deliver_signal(cmnd_pid, cstmp.val, true);
|
||||
} else {
|
||||
warningx(U_("unexpected reply type on backchannel: %d"), cstmp.type);
|
||||
sudo_warnx(U_("unexpected reply type on backchannel: %d"), cstmp.type);
|
||||
}
|
||||
}
|
||||
debug_return;
|
||||
@@ -1200,7 +1200,7 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
* the event loop.
|
||||
*/
|
||||
if (pipe_nonblock(signal_pipe) != 0)
|
||||
fatal(U_("unable to create pipe"));
|
||||
sudo_fatal(U_("unable to create pipe"));
|
||||
|
||||
/* Reset SIGWINCH and SIGALRM. */
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
@@ -1250,13 +1250,13 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
* This allows us to be notified when the command has been suspended.
|
||||
*/
|
||||
if (setsid() == -1) {
|
||||
warning("setsid");
|
||||
sudo_warn("setsid");
|
||||
goto bad;
|
||||
}
|
||||
if (io_fds[SFD_SLAVE] != -1) {
|
||||
#ifdef TIOCSCTTY
|
||||
if (ioctl(io_fds[SFD_SLAVE], TIOCSCTTY, NULL) != 0)
|
||||
fatal(U_("unable to set controlling tty"));
|
||||
sudo_fatal(U_("unable to set controlling tty"));
|
||||
#else
|
||||
/* Set controlling tty by reopening slave. */
|
||||
if ((n = open(slavename, O_RDWR)) >= 0)
|
||||
@@ -1277,10 +1277,10 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
|
||||
/* Start command and wait for it to stop or exit */
|
||||
if (pipe(errpipe) == -1)
|
||||
fatal(U_("unable to create pipe"));
|
||||
sudo_fatal(U_("unable to create pipe"));
|
||||
cmnd_pid = sudo_debug_fork();
|
||||
if (cmnd_pid == -1) {
|
||||
warning(U_("unable to fork"));
|
||||
sudo_warn(U_("unable to fork"));
|
||||
goto bad;
|
||||
}
|
||||
if (cmnd_pid == 0) {
|
||||
@@ -1332,7 +1332,7 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
*/
|
||||
evbase = sudo_ev_base_alloc();
|
||||
if (evbase == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
|
||||
memset(&cstat, 0, sizeof(cstat));
|
||||
mc.cstat = &cstat;
|
||||
@@ -1343,23 +1343,23 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
mc.signal_pipe_event = sudo_ev_alloc(signal_pipe[0],
|
||||
SUDO_EV_READ|SUDO_EV_PERSIST, mon_signal_pipe_cb, &mc);
|
||||
if (mc.signal_pipe_event == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
if (sudo_ev_add(evbase, mc.signal_pipe_event, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
|
||||
mc.errpipe_event = sudo_ev_alloc(errpipe[0],
|
||||
SUDO_EV_READ|SUDO_EV_PERSIST, mon_errpipe_cb, &mc);
|
||||
if (mc.errpipe_event == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
if (sudo_ev_add(evbase, mc.errpipe_event, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
|
||||
mc.backchannel_event = sudo_ev_alloc(backchannel,
|
||||
SUDO_EV_READ|SUDO_EV_PERSIST, mon_backchannel_cb, &mc);
|
||||
if (mc.backchannel_event == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
if (sudo_ev_add(evbase, mc.backchannel_event, NULL, false) == -1)
|
||||
fatal(U_("unable to add event to queue"));
|
||||
sudo_fatal(U_("unable to add event to queue"));
|
||||
|
||||
/*
|
||||
* Wait for errno on pipe, signal on backchannel or for SIGCHLD.
|
||||
@@ -1395,7 +1395,7 @@ exec_pty(struct command_details *details,
|
||||
debug_decl(exec_pty, SUDO_DEBUG_EXEC);
|
||||
|
||||
/* Register cleanup function */
|
||||
fatal_callback_register(pty_cleanup);
|
||||
sudo_fatal_callback_register(pty_cleanup);
|
||||
|
||||
/* Set command process group here too to avoid a race. */
|
||||
setpgid(0, self);
|
||||
@@ -1404,7 +1404,7 @@ exec_pty(struct command_details *details,
|
||||
if (dup2(io_fds[SFD_STDIN], STDIN_FILENO) == -1 ||
|
||||
dup2(io_fds[SFD_STDOUT], STDOUT_FILENO) == -1 ||
|
||||
dup2(io_fds[SFD_STDERR], STDERR_FILENO) == -1)
|
||||
fatal("dup2");
|
||||
sudo_fatal("dup2");
|
||||
|
||||
/* Wait for parent to grant us the tty if we are foreground. */
|
||||
if (foreground && !ISSET(details->flags, CD_EXEC_BG)) {
|
||||
|
@@ -83,7 +83,7 @@ process_hooks_setenv(const char *name, const char *value, int overwrite)
|
||||
case SUDO_HOOK_RET_STOP:
|
||||
goto done;
|
||||
default:
|
||||
warningx_nodebug("invalid setenv hook return value: %d", rc);
|
||||
sudo_warnx_nodebug("invalid setenv hook return value: %d", rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ process_hooks_putenv(char *string)
|
||||
case SUDO_HOOK_RET_STOP:
|
||||
goto done;
|
||||
default:
|
||||
warningx_nodebug("invalid putenv hook return value: %d", rc);
|
||||
sudo_warnx_nodebug("invalid putenv hook return value: %d", rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ process_hooks_getenv(const char *name, char **value)
|
||||
case SUDO_HOOK_RET_STOP:
|
||||
goto done;
|
||||
default:
|
||||
warningx_nodebug("invalid getenv hook return value: %d", rc);
|
||||
sudo_warnx_nodebug("invalid getenv hook return value: %d", rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ process_hooks_unsetenv(const char *name)
|
||||
case SUDO_HOOK_RET_STOP:
|
||||
goto done;
|
||||
default:
|
||||
warningx_nodebug("invalid unsetenv hook return value: %d", rc);
|
||||
sudo_warnx_nodebug("invalid unsetenv hook return value: %d", rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -58,9 +58,9 @@ sudo_stat_plugin(struct plugin_info *info, char *fullpath,
|
||||
|
||||
if (info->path[0] == '/') {
|
||||
if (strlcpy(fullpath, info->path, pathsize) >= pathsize) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("%s: %s"), info->path, strerror(ENAMETOOLONG));
|
||||
sudo_warnx(U_("%s: %s"), info->path, strerror(ENAMETOOLONG));
|
||||
goto done;
|
||||
}
|
||||
status = stat(fullpath, sb);
|
||||
@@ -71,9 +71,9 @@ sudo_stat_plugin(struct plugin_info *info, char *fullpath,
|
||||
/* Check static symbols. */
|
||||
if (strcmp(info->path, SUDOERS_PLUGIN) == 0) {
|
||||
if (strlcpy(fullpath, info->path, pathsize) >= pathsize) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("%s: %s"), info->path, strerror(ENAMETOOLONG));
|
||||
sudo_warnx(U_("%s: %s"), info->path, strerror(ENAMETOOLONG));
|
||||
goto done;
|
||||
}
|
||||
/* Plugin is static, fake up struct stat. */
|
||||
@@ -88,9 +88,9 @@ sudo_stat_plugin(struct plugin_info *info, char *fullpath,
|
||||
len = snprintf(fullpath, pathsize, "%s%s", _PATH_SUDO_PLUGIN_DIR,
|
||||
info->path);
|
||||
if (len <= 0 || (size_t)len >= pathsize) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
|
||||
sudo_warnx(U_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
|
||||
strerror(ENAMETOOLONG));
|
||||
goto done;
|
||||
}
|
||||
@@ -141,21 +141,21 @@ sudo_check_plugin(struct plugin_info *info, char *fullpath, size_t pathsize)
|
||||
debug_decl(sudo_check_plugin, SUDO_DEBUG_PLUGIN)
|
||||
|
||||
if (sudo_stat_plugin(info, fullpath, pathsize, &sb) != 0) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warning("%s%s", _PATH_SUDO_PLUGIN_DIR, info->path);
|
||||
sudo_warn("%s%s", _PATH_SUDO_PLUGIN_DIR, info->path);
|
||||
goto done;
|
||||
}
|
||||
if (sb.st_uid != ROOT_UID) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("%s must be owned by uid %d"), fullpath, ROOT_UID);
|
||||
sudo_warnx(U_("%s must be owned by uid %d"), fullpath, ROOT_UID);
|
||||
goto done;
|
||||
}
|
||||
if ((sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("%s must be only be writable by owner"), fullpath);
|
||||
sudo_warnx(U_("%s must be only be writable by owner"), fullpath);
|
||||
goto done;
|
||||
}
|
||||
rval = true;
|
||||
@@ -194,29 +194,29 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
|
||||
/* Open plugin and map in symbol */
|
||||
handle = sudo_dso_load(path, SUDO_DSO_LAZY|SUDO_DSO_GLOBAL);
|
||||
if (!handle) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("unable to load %s: %s"), path, sudo_dso_strerror());
|
||||
sudo_warnx(U_("unable to load %s: %s"), path, sudo_dso_strerror());
|
||||
goto done;
|
||||
}
|
||||
plugin = sudo_dso_findsym(handle, info->symbol_name);
|
||||
if (!plugin) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("unable to find symbol `%s' in %s"), info->symbol_name, path);
|
||||
sudo_warnx(U_("unable to find symbol `%s' in %s"), info->symbol_name, path);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (plugin->type != SUDO_POLICY_PLUGIN && plugin->type != SUDO_IO_PLUGIN) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("unknown policy type %d found in %s"), plugin->type, path);
|
||||
sudo_warnx(U_("unknown policy type %d found in %s"), plugin->type, path);
|
||||
goto done;
|
||||
}
|
||||
if (SUDO_API_VERSION_GET_MAJOR(plugin->version) != SUDO_API_VERSION_MAJOR) {
|
||||
warningx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
sudo_warnx(U_("error in %s, line %d while loading plugin `%s'"),
|
||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||
warningx(U_("incompatible plugin major version %d (expected %d) found in %s"),
|
||||
sudo_warnx(U_("incompatible plugin major version %d (expected %d) found in %s"),
|
||||
SUDO_API_VERSION_GET_MAJOR(plugin->version),
|
||||
SUDO_API_VERSION_MAJOR, path);
|
||||
goto done;
|
||||
@@ -225,12 +225,12 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
|
||||
if (policy_plugin->handle) {
|
||||
/* Ignore duplicate entries. */
|
||||
if (strcmp(policy_plugin->name, info->symbol_name) != 0) {
|
||||
warningx(U_("ignoring policy plugin `%s' in %s, line %d"),
|
||||
sudo_warnx(U_("ignoring policy plugin `%s' in %s, line %d"),
|
||||
info->symbol_name, _PATH_SUDO_CONF, info->lineno);
|
||||
warningx(U_("only a single policy plugin may be specified"));
|
||||
sudo_warnx(U_("only a single policy plugin may be specified"));
|
||||
goto done;
|
||||
}
|
||||
warningx(U_("ignoring duplicate policy plugin `%s' in %s, line %d"),
|
||||
sudo_warnx(U_("ignoring duplicate policy plugin `%s' in %s, line %d"),
|
||||
info->symbol_name, _PATH_SUDO_CONF, info->lineno);
|
||||
sudo_dso_unload(handle);
|
||||
handle = NULL;
|
||||
@@ -245,7 +245,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
|
||||
/* Check for duplicate entries. */
|
||||
TAILQ_FOREACH(container, io_plugins, entries) {
|
||||
if (strcmp(container->name, info->symbol_name) == 0) {
|
||||
warningx(U_("ignoring duplicate I/O plugin `%s' in %s, line %d"),
|
||||
sudo_warnx(U_("ignoring duplicate I/O plugin `%s' in %s, line %d"),
|
||||
info->symbol_name, _PATH_SUDO_CONF, info->lineno);
|
||||
sudo_dso_unload(handle);
|
||||
handle = NULL;
|
||||
@@ -316,7 +316,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
|
||||
}
|
||||
}
|
||||
if (policy_plugin->u.policy->check_policy == NULL) {
|
||||
warningx(U_("policy plugin %s does not include a check_policy method"),
|
||||
sudo_warnx(U_("policy plugin %s does not include a check_policy method"),
|
||||
policy_plugin->name);
|
||||
rval = false;
|
||||
goto done;
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
/* No need to swap locales in the front end. */
|
||||
char *
|
||||
warning_gettext(const char *msgid)
|
||||
sudo_warn_gettext(const char *msgid)
|
||||
{
|
||||
return gettext(msgid);
|
||||
}
|
||||
|
@@ -159,7 +159,7 @@ get_net_ifs(char **addrinfo)
|
||||
"%s%s/", cp == *addrinfo ? "" : " ",
|
||||
inet_ntoa(sin->sin_addr));
|
||||
if (len <= 0 || len >= ailen - (*addrinfo - cp)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
@@ -168,7 +168,7 @@ get_net_ifs(char **addrinfo)
|
||||
len = snprintf(cp, ailen - (*addrinfo - cp),
|
||||
"%s", inet_ntoa(sin->sin_addr));
|
||||
if (len <= 0 || len >= ailen - (*addrinfo - cp)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
@@ -180,7 +180,7 @@ get_net_ifs(char **addrinfo)
|
||||
len = snprintf(cp, ailen - (*addrinfo - cp),
|
||||
"%s%s/", cp == *addrinfo ? "" : " ", addrbuf);
|
||||
if (len <= 0 || len >= ailen - (*addrinfo - cp)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
@@ -189,7 +189,7 @@ get_net_ifs(char **addrinfo)
|
||||
inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, sizeof(addrbuf));
|
||||
len = snprintf(cp, ailen - (*addrinfo - cp), "%s", addrbuf);
|
||||
if (len <= 0 || len >= ailen - (*addrinfo - cp)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
@@ -233,7 +233,7 @@ get_net_ifs(char **addrinfo)
|
||||
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0)
|
||||
fatal(U_("unable to open socket"));
|
||||
sudo_fatal(U_("unable to open socket"));
|
||||
|
||||
/*
|
||||
* Get interface configuration or return.
|
||||
@@ -304,7 +304,7 @@ get_net_ifs(char **addrinfo)
|
||||
"%s%s/", cp == *addrinfo ? "" : " ",
|
||||
inet_ntoa(sin->sin_addr));
|
||||
if (len <= 0 || len >= ailen - (*addrinfo - cp)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
@@ -326,7 +326,7 @@ get_net_ifs(char **addrinfo)
|
||||
len = snprintf(cp, ailen - (*addrinfo - cp),
|
||||
"%s", inet_ntoa(sin->sin_addr));
|
||||
if (len <= 0 || len >= ailen - (*addrinfo - cp)) {
|
||||
warningx(U_("internal error, %s overflow"), __func__);
|
||||
sudo_warnx(U_("internal error, %s overflow"), __func__);
|
||||
goto done;
|
||||
}
|
||||
cp += len;
|
||||
|
@@ -244,7 +244,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
break;
|
||||
case 'C':
|
||||
if (strtonum(optarg, 3, INT_MAX, NULL) == 0) {
|
||||
warningx(_("the argument to -C must be a number greater than or equal to 3"));
|
||||
sudo_warnx(_("the argument to -C must be a number greater than or equal to 3"));
|
||||
usage(1);
|
||||
}
|
||||
sudo_settings[ARG_CLOSEFROM].value = optarg;
|
||||
@@ -406,11 +406,11 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
|
||||
if (ISSET(flags, MODE_LOGIN_SHELL)) {
|
||||
if (ISSET(flags, MODE_SHELL)) {
|
||||
warningx(U_("you may not specify both the `-i' and `-s' options"));
|
||||
sudo_warnx(U_("you may not specify both the `-i' and `-s' options"));
|
||||
usage(1);
|
||||
}
|
||||
if (ISSET(flags, MODE_PRESERVE_ENV)) {
|
||||
warningx(U_("you may not specify both the `-i' and `-E' options"));
|
||||
sudo_warnx(U_("you may not specify both the `-i' and `-E' options"));
|
||||
usage(1);
|
||||
}
|
||||
SET(flags, MODE_SHELL);
|
||||
@@ -420,9 +420,9 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
if (mode == MODE_EDIT &&
|
||||
(ISSET(flags, MODE_PRESERVE_ENV) || env_add[0] != NULL)) {
|
||||
if (ISSET(mode, MODE_PRESERVE_ENV))
|
||||
warningx(U_("the `-E' option is not valid in edit mode"));
|
||||
sudo_warnx(U_("the `-E' option is not valid in edit mode"));
|
||||
if (env_add[0] != NULL)
|
||||
warningx(U_("you may not specify environment variables in edit mode"));
|
||||
sudo_warnx(U_("you may not specify environment variables in edit mode"));
|
||||
usage(1);
|
||||
}
|
||||
if ((runas_user != NULL || runas_group != NULL) &&
|
||||
@@ -430,11 +430,11 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
usage(1);
|
||||
}
|
||||
if (list_user != NULL && mode != MODE_LIST && mode != MODE_CHECK) {
|
||||
warningx(U_("the `-U' option may only be used with the `-l' option"));
|
||||
sudo_warnx(U_("the `-U' option may only be used with the `-l' option"));
|
||||
usage(1);
|
||||
}
|
||||
if (ISSET(tgetpass_flags, TGP_STDIN) && ISSET(tgetpass_flags, TGP_ASKPASS)) {
|
||||
warningx(U_("the `-A' and `-S' options may not be used together"));
|
||||
sudo_warnx(U_("the `-A' and `-S' options may not be used together"));
|
||||
usage(1);
|
||||
}
|
||||
if ((argc == 0 && mode == MODE_EDIT) ||
|
||||
@@ -504,7 +504,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
settings[j] = sudo_new_key_val(sudo_settings[i].name,
|
||||
sudo_settings[i].value);
|
||||
if (settings[j] == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -517,7 +517,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
argv--;
|
||||
argv[0] = "sudoedit";
|
||||
#else
|
||||
fatalx(U_("sudoedit is not supported on this platform"));
|
||||
sudo_fatalx(U_("sudoedit is not supported on this platform"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ usage_excl(int fatal)
|
||||
{
|
||||
debug_decl(usage_excl, SUDO_DEBUG_ARGS)
|
||||
|
||||
warningx(U_("Only one of the -e, -h, -i, -K, -l, -s, -v or -V options may be specified"));
|
||||
sudo_warnx(U_("Only one of the -e, -h, -i, -K, -l, -s, -v or -V options may be specified"));
|
||||
usage(fatal);
|
||||
}
|
||||
|
||||
|
@@ -74,7 +74,7 @@ audit_role_change(const security_context_t old_context,
|
||||
/* Kernel may not have audit support. */
|
||||
if (errno != EINVAL && errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT
|
||||
)
|
||||
fatal(U_("unable to open audit system"));
|
||||
sudo_fatal(U_("unable to open audit system"));
|
||||
} else {
|
||||
/* audit role change using the same format as newrole(1) */
|
||||
easprintf(&message, "newrole: old-context=%s new-context=%s",
|
||||
@@ -82,7 +82,7 @@ audit_role_change(const security_context_t old_context,
|
||||
rc = audit_log_user_message(au_fd, AUDIT_USER_ROLE_CHANGE,
|
||||
message, NULL, NULL, ttyn, 1);
|
||||
if (rc <= 0)
|
||||
warning(U_("unable to send audit message"));
|
||||
sudo_warn(U_("unable to send audit message"));
|
||||
efree(message);
|
||||
close(au_fd);
|
||||
}
|
||||
@@ -110,17 +110,17 @@ selinux_restore_tty(void)
|
||||
|
||||
/* Verify that the tty still has the context set by sudo. */
|
||||
if ((retval = fgetfilecon(se_state.ttyfd, &chk_tty_context)) < 0) {
|
||||
warning(U_("unable to fgetfilecon %s"), se_state.ttyn);
|
||||
sudo_warn(U_("unable to fgetfilecon %s"), se_state.ttyn);
|
||||
goto skip_relabel;
|
||||
}
|
||||
|
||||
if ((retval = strcmp(chk_tty_context, se_state.new_tty_context))) {
|
||||
warningx(U_("%s changed labels"), se_state.ttyn);
|
||||
sudo_warnx(U_("%s changed labels"), se_state.ttyn);
|
||||
goto skip_relabel;
|
||||
}
|
||||
|
||||
if ((retval = fsetfilecon(se_state.ttyfd, se_state.tty_context)) < 0)
|
||||
warning(U_("unable to restore context for %s"), se_state.ttyn);
|
||||
sudo_warn(U_("unable to restore context for %s"), se_state.ttyn);
|
||||
|
||||
skip_relabel:
|
||||
if (se_state.ttyfd != -1) {
|
||||
@@ -160,7 +160,7 @@ relabel_tty(const char *ttyn, int ptyfd)
|
||||
if (ptyfd == -1) {
|
||||
se_state.ttyfd = open(ttyn, O_RDWR|O_NONBLOCK);
|
||||
if (se_state.ttyfd == -1) {
|
||||
warning(U_("unable to open %s, not relabeling tty"), ttyn);
|
||||
sudo_warn(U_("unable to open %s, not relabeling tty"), ttyn);
|
||||
if (se_state.enforcing)
|
||||
goto bad;
|
||||
}
|
||||
@@ -169,21 +169,21 @@ relabel_tty(const char *ttyn, int ptyfd)
|
||||
}
|
||||
|
||||
if (fgetfilecon(se_state.ttyfd, &tty_con) < 0) {
|
||||
warning(U_("unable to get current tty context, not relabeling tty"));
|
||||
sudo_warn(U_("unable to get current tty context, not relabeling tty"));
|
||||
if (se_state.enforcing)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (tty_con && (security_compute_relabel(se_state.new_context, tty_con,
|
||||
SECCLASS_CHR_FILE, &new_tty_con) < 0)) {
|
||||
warning(U_("unable to get new tty context, not relabeling tty"));
|
||||
sudo_warn(U_("unable to get new tty context, not relabeling tty"));
|
||||
if (se_state.enforcing)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (new_tty_con != NULL) {
|
||||
if (fsetfilecon(se_state.ttyfd, new_tty_con) < 0) {
|
||||
warning(U_("unable to set new tty context"));
|
||||
sudo_warn(U_("unable to set new tty context"));
|
||||
if (se_state.enforcing)
|
||||
goto bad;
|
||||
}
|
||||
@@ -193,12 +193,12 @@ relabel_tty(const char *ttyn, int ptyfd)
|
||||
/* Reopen pty that was relabeled, std{in,out,err} are reset later. */
|
||||
se_state.ttyfd = open(ttyn, O_RDWR|O_NOCTTY, 0);
|
||||
if (se_state.ttyfd == -1) {
|
||||
warning(U_("unable to open %s"), ttyn);
|
||||
sudo_warn(U_("unable to open %s"), ttyn);
|
||||
if (se_state.enforcing)
|
||||
goto bad;
|
||||
}
|
||||
if (dup2(se_state.ttyfd, ptyfd) == -1) {
|
||||
warning("dup2");
|
||||
sudo_warn("dup2");
|
||||
goto bad;
|
||||
}
|
||||
} else {
|
||||
@@ -206,14 +206,14 @@ relabel_tty(const char *ttyn, int ptyfd)
|
||||
close(se_state.ttyfd);
|
||||
se_state.ttyfd = open(ttyn, O_RDWR|O_NONBLOCK);
|
||||
if (se_state.ttyfd == -1) {
|
||||
warning(U_("unable to open %s"), ttyn);
|
||||
sudo_warn(U_("unable to open %s"), ttyn);
|
||||
goto bad;
|
||||
}
|
||||
(void)fcntl(se_state.ttyfd, F_SETFL,
|
||||
fcntl(se_state.ttyfd, F_GETFL, 0) & ~O_NONBLOCK);
|
||||
for (fd = STDIN_FILENO; fd <= STDERR_FILENO; fd++) {
|
||||
if (isatty(fd) && dup2(se_state.ttyfd, fd) == -1) {
|
||||
warning("dup2");
|
||||
sudo_warn("dup2");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
@@ -249,13 +249,13 @@ get_exec_context(security_context_t old_context, const char *role, const char *t
|
||||
|
||||
/* We must have a role, the type is optional (we can use the default). */
|
||||
if (!role) {
|
||||
warningx(U_("you must specify a role for type %s"), type);
|
||||
sudo_warnx(U_("you must specify a role for type %s"), type);
|
||||
errno = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
if (!type) {
|
||||
if (get_default_type(role, &typebuf)) {
|
||||
warningx(U_("unable to get default type for role %s"), role);
|
||||
sudo_warnx(U_("unable to get default type for role %s"), role);
|
||||
errno = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
@@ -273,11 +273,11 @@ get_exec_context(security_context_t old_context, const char *role, const char *t
|
||||
* type we will be running the command as.
|
||||
*/
|
||||
if (context_role_set(context, role)) {
|
||||
warning(U_("failed to set new role %s"), role);
|
||||
sudo_warn(U_("failed to set new role %s"), role);
|
||||
goto bad;
|
||||
}
|
||||
if (context_type_set(context, type)) {
|
||||
warning(U_("failed to set new type %s"), type);
|
||||
sudo_warn(U_("failed to set new type %s"), type);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -286,13 +286,13 @@ get_exec_context(security_context_t old_context, const char *role, const char *t
|
||||
*/
|
||||
new_context = estrdup(context_str(context));
|
||||
if (security_check_context(new_context) < 0) {
|
||||
warningx(U_("%s is not a valid context"), new_context);
|
||||
sudo_warnx(U_("%s is not a valid context"), new_context);
|
||||
errno = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
warningx("Your new context is %s", new_context);
|
||||
sudo_warnx("Your new context is %s", new_context);
|
||||
#endif
|
||||
|
||||
context_free(context);
|
||||
@@ -321,32 +321,32 @@ selinux_setup(const char *role, const char *type, const char *ttyn,
|
||||
|
||||
/* Store the caller's SID in old_context. */
|
||||
if (getprevcon(&se_state.old_context)) {
|
||||
warning(U_("failed to get old_context"));
|
||||
sudo_warn(U_("failed to get old_context"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
se_state.enforcing = security_getenforce();
|
||||
if (se_state.enforcing < 0) {
|
||||
warning(U_("unable to determine enforcing mode."));
|
||||
sudo_warn(U_("unable to determine enforcing mode."));
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
warningx("your old context was %s", se_state.old_context);
|
||||
sudo_warnx("your old context was %s", se_state.old_context);
|
||||
#endif
|
||||
se_state.new_context = get_exec_context(se_state.old_context, role, type);
|
||||
if (!se_state.new_context)
|
||||
goto done;
|
||||
|
||||
if (relabel_tty(ttyn, ptyfd) < 0) {
|
||||
warning(U_("unable to set tty context to %s"), se_state.new_context);
|
||||
sudo_warn(U_("unable to set tty context to %s"), se_state.new_context);
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (se_state.ttyfd != -1) {
|
||||
warningx("your old tty context is %s", se_state.tty_context);
|
||||
warningx("your new tty context is %s", se_state.new_tty_context);
|
||||
sudo_warnx("your old tty context is %s", se_state.tty_context);
|
||||
sudo_warnx("your new tty context is %s", se_state.new_tty_context);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -372,20 +372,20 @@ selinux_execve(const char *path, char *const argv[], char *const envp[],
|
||||
|
||||
sesh = sudo_conf_sesh_path();
|
||||
if (sesh == NULL) {
|
||||
warningx("internal error: sesh path not set");
|
||||
sudo_warnx("internal error: sesh path not set");
|
||||
errno = EINVAL;
|
||||
debug_return;
|
||||
}
|
||||
|
||||
if (setexeccon(se_state.new_context)) {
|
||||
warning(U_("unable to set exec context to %s"), se_state.new_context);
|
||||
sudo_warn(U_("unable to set exec context to %s"), se_state.new_context);
|
||||
if (se_state.enforcing)
|
||||
debug_return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETKEYCREATECON
|
||||
if (setkeycreatecon(se_state.new_context)) {
|
||||
warning(U_("unable to set key creation context to %s"), se_state.new_context);
|
||||
sudo_warn(U_("unable to set key creation context to %s"), se_state.new_context);
|
||||
if (se_state.enforcing)
|
||||
debug_return;
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
textdomain(PACKAGE_NAME);
|
||||
|
||||
if (argc < 2)
|
||||
fatalx(U_("requires at least one argument"));
|
||||
sudo_fatalx(U_("requires at least one argument"));
|
||||
|
||||
/* Read sudo.conf. */
|
||||
sudo_conf_read(NULL);
|
||||
@@ -79,7 +79,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
*cp = '-';
|
||||
}
|
||||
sudo_execve(cmnd, argv, envp, noexec);
|
||||
warning(U_("unable to execute %s"), argv[0]);
|
||||
sudo_warn(U_("unable to execute %s"), argv[0]);
|
||||
sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, EXIT_FAILURE);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ init_signals(void)
|
||||
* the select() loop without races (we may not have pselect()).
|
||||
*/
|
||||
if (pipe_nonblock(signal_pipe) != 0)
|
||||
fatal(U_("unable to create pipe"));
|
||||
sudo_fatal(U_("unable to create pipe"));
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sigfillset(&sa.sa_mask);
|
||||
|
@@ -85,43 +85,43 @@ set_project(struct passwd *pw)
|
||||
case SETPROJ_ERR_TASK:
|
||||
switch (errno) {
|
||||
case EAGAIN:
|
||||
warningx(U_("resource control limit has been reached"));
|
||||
sudo_warnx(U_("resource control limit has been reached"));
|
||||
break;
|
||||
case ESRCH:
|
||||
warningx(U_("user \"%s\" is not a member of project \"%s\""),
|
||||
sudo_warnx(U_("user \"%s\" is not a member of project \"%s\""),
|
||||
pw->pw_name, proj.pj_name);
|
||||
break;
|
||||
case EACCES:
|
||||
warningx(U_("the invoking task is final"));
|
||||
sudo_warnx(U_("the invoking task is final"));
|
||||
break;
|
||||
default:
|
||||
warningx(U_("could not join project \"%s\""), proj.pj_name);
|
||||
sudo_warnx(U_("could not join project \"%s\""), proj.pj_name);
|
||||
}
|
||||
case SETPROJ_ERR_POOL:
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
warningx(U_("no resource pool accepting default bindings "
|
||||
sudo_warnx(U_("no resource pool accepting default bindings "
|
||||
"exists for project \"%s\""), proj.pj_name);
|
||||
break;
|
||||
case ESRCH:
|
||||
warningx(U_("specified resource pool does not exist for "
|
||||
sudo_warnx(U_("specified resource pool does not exist for "
|
||||
"project \"%s\""), proj.pj_name);
|
||||
break;
|
||||
default:
|
||||
warningx(U_("could not bind to default resource pool for "
|
||||
sudo_warnx(U_("could not bind to default resource pool for "
|
||||
"project \"%s\""), proj.pj_name);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (errval <= 0) {
|
||||
warningx(U_("setproject failed for project \"%s\""), proj.pj_name);
|
||||
sudo_warnx(U_("setproject failed for project \"%s\""), proj.pj_name);
|
||||
} else {
|
||||
warningx(U_("warning, resource control assignment failed for "
|
||||
sudo_warnx(U_("warning, resource control assignment failed for "
|
||||
"project \"%s\""), proj.pj_name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warning("getdefaultproj");
|
||||
sudo_warn("getdefaultproj");
|
||||
}
|
||||
endprojent();
|
||||
debug_return;
|
||||
|
98
src/sudo.c
98
src/sudo.c
@@ -200,7 +200,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
|
||||
/* Load plugins. */
|
||||
if (!sudo_load_plugins(&policy_plugin, &io_plugins))
|
||||
fatalx(U_("fatal error, unable to load plugins"));
|
||||
sudo_fatalx(U_("fatal error, unable to load plugins"));
|
||||
|
||||
/* Open policy plugin. */
|
||||
ok = policy_open(&policy_plugin, settings, user_info, envp);
|
||||
@@ -208,7 +208,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
if (ok == -2)
|
||||
usage(1);
|
||||
else
|
||||
fatalx(U_("unable to initialize policy plugin"));
|
||||
sudo_fatalx(U_("unable to initialize policy plugin"));
|
||||
}
|
||||
|
||||
init_signals();
|
||||
@@ -264,7 +264,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
usage(1);
|
||||
break;
|
||||
default:
|
||||
fatalx(U_("error initializing I/O plugin %s"),
|
||||
sudo_fatalx(U_("error initializing I/O plugin %s"),
|
||||
plugin->name);
|
||||
}
|
||||
}
|
||||
@@ -276,7 +276,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
SET(command_details.flags, CD_BACKGROUND);
|
||||
/* Become full root (not just setuid) so user cannot kill us. */
|
||||
if (setuid(ROOT_UID) == -1)
|
||||
warning("setuid(%d)", ROOT_UID);
|
||||
sudo_warn("setuid(%d)", ROOT_UID);
|
||||
/* Restore coredumpsize resource limit before running. */
|
||||
#ifdef RLIMIT_CORE
|
||||
if (sudo_conf_disable_coredump())
|
||||
@@ -290,7 +290,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
/* The close method was called by sudo_edit/run_command. */
|
||||
break;
|
||||
default:
|
||||
fatalx(U_("unexpected sudo mode 0x%x"), sudo_mode);
|
||||
sudo_fatalx(U_("unexpected sudo mode 0x%x"), sudo_mode);
|
||||
}
|
||||
sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, exitcode);
|
||||
exit(exitcode);
|
||||
@@ -325,13 +325,13 @@ fix_fds(void)
|
||||
miss[STDERR_FILENO] = fcntl(STDERR_FILENO, F_GETFL, 0) == -1;
|
||||
if (miss[STDIN_FILENO] || miss[STDOUT_FILENO] || miss[STDERR_FILENO]) {
|
||||
if ((devnull = open(_PATH_DEVNULL, O_RDWR, 0644)) == -1)
|
||||
fatal(U_("unable to open %s"), _PATH_DEVNULL);
|
||||
sudo_fatal(U_("unable to open %s"), _PATH_DEVNULL);
|
||||
if (miss[STDIN_FILENO] && dup2(devnull, STDIN_FILENO) == -1)
|
||||
fatal("dup2");
|
||||
sudo_fatal("dup2");
|
||||
if (miss[STDOUT_FILENO] && dup2(devnull, STDOUT_FILENO) == -1)
|
||||
fatal("dup2");
|
||||
sudo_fatal("dup2");
|
||||
if (miss[STDERR_FILENO] && dup2(devnull, STDERR_FILENO) == -1)
|
||||
fatal("dup2");
|
||||
sudo_fatal("dup2");
|
||||
if (devnull > STDERR_FILENO)
|
||||
close(devnull);
|
||||
}
|
||||
@@ -410,7 +410,7 @@ get_user_groups(struct user_details *ud)
|
||||
* Typically, this is because NFS can only support up to 16 groups.
|
||||
*/
|
||||
if (fill_group_list(ud, maxgroups) == -1)
|
||||
fatal(U_("unable to get group vector"));
|
||||
sudo_fatal(U_("unable to get group vector"));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -462,11 +462,11 @@ get_user_info(struct user_details *ud)
|
||||
|
||||
pw = getpwuid(ud->uid);
|
||||
if (pw == NULL)
|
||||
fatalx(U_("unknown uid %u: who are you?"), (unsigned int)ud->uid);
|
||||
sudo_fatalx(U_("unknown uid %u: who are you?"), (unsigned int)ud->uid);
|
||||
|
||||
user_info[i] = sudo_new_key_val("user", pw->pw_name);
|
||||
if (user_info[i] == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
ud->username = user_info[i] + sizeof("user=") - 1;
|
||||
|
||||
/* Stash user's shell for use with the -s flag; don't pass to plugin. */
|
||||
@@ -492,14 +492,14 @@ get_user_info(struct user_details *ud)
|
||||
if (getcwd(cwd, sizeof(cwd)) != NULL) {
|
||||
user_info[++i] = sudo_new_key_val("cwd", cwd);
|
||||
if (user_info[i] == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
ud->cwd = user_info[i] + sizeof("cwd=") - 1;
|
||||
}
|
||||
|
||||
if ((cp = get_process_ttyname()) != NULL) {
|
||||
user_info[++i] = sudo_new_key_val("tty", cp);
|
||||
if (user_info[i] == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
ud->tty = user_info[i] + sizeof("tty=") - 1;
|
||||
efree(cp);
|
||||
}
|
||||
@@ -510,7 +510,7 @@ get_user_info(struct user_details *ud)
|
||||
strlcpy(host, "localhost", sizeof(host));
|
||||
user_info[++i] = sudo_new_key_val("host", host);
|
||||
if (user_info[i] == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
ud->host = user_info[i] + sizeof("host=") - 1;
|
||||
|
||||
sudo_get_ttysize(&ud->ts_lines, &ud->ts_cols);
|
||||
@@ -556,7 +556,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("closefrom=") - 1;
|
||||
details->closefrom = strtonum(cp, 0, INT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -575,7 +575,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("nice=") - 1;
|
||||
details->priority = strtonum(cp, INT_MIN, INT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
SET(details->flags, CD_SET_PRIORITY);
|
||||
break;
|
||||
}
|
||||
@@ -602,7 +602,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("runas_egid=") - 1;
|
||||
id = atoid(cp, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
details->egid = (gid_t)id;
|
||||
SET(details->flags, CD_SET_EGID);
|
||||
break;
|
||||
@@ -611,7 +611,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("runas_euid=") - 1;
|
||||
id = atoid(cp, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
details->euid = (uid_t)id;
|
||||
SET(details->flags, CD_SET_EUID);
|
||||
break;
|
||||
@@ -620,7 +620,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("runas_gid=") - 1;
|
||||
id = atoid(cp, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
details->gid = (gid_t)id;
|
||||
SET(details->flags, CD_SET_GID);
|
||||
break;
|
||||
@@ -637,7 +637,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("runas_uid=") - 1;
|
||||
id = atoid(cp, NULL, NULL, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
details->uid = (uid_t)id;
|
||||
SET(details->flags, CD_SET_UID);
|
||||
break;
|
||||
@@ -649,7 +649,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
if (*cp != '\0') {
|
||||
details->privs = priv_str_to_set(cp, ",", &endp);
|
||||
if (details->privs == NULL)
|
||||
warning("invalid runas_privs %s", endp);
|
||||
sudo_warn("invalid runas_privs %s", endp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -659,7 +659,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
if (*cp != '\0') {
|
||||
details->limitprivs = priv_str_to_set(cp, ",", &endp);
|
||||
if (details->limitprivs == NULL)
|
||||
warning("invalid runas_limitprivs %s", endp);
|
||||
sudo_warn("invalid runas_limitprivs %s", endp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -684,7 +684,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("timeout=") - 1;
|
||||
details->timeout = strtonum(cp, 0, INT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
SET(details->flags, CD_SET_TIMEOUT);
|
||||
break;
|
||||
}
|
||||
@@ -694,7 +694,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
cp = info[i] + sizeof("umask=") - 1;
|
||||
details->umask = atomode(cp, &errstr);
|
||||
if (errstr != NULL)
|
||||
fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
sudo_fatalx(U_("%s: %s"), info[i], U_(errstr));
|
||||
SET(details->flags, CD_SET_UMASK);
|
||||
break;
|
||||
}
|
||||
@@ -716,7 +716,7 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
#endif
|
||||
details->pw = getpwuid(details->euid);
|
||||
if (details->pw != NULL && (details->pw = pw_dup(details->pw)) == NULL)
|
||||
fatal(NULL);
|
||||
sudo_fatal(NULL);
|
||||
#ifdef HAVE_SETAUTHDB
|
||||
aix_restoreauthdb();
|
||||
#endif
|
||||
@@ -766,16 +766,16 @@ sudo_check_suid(const char *sudo)
|
||||
if (qualified && stat(sudo, &sb) == 0) {
|
||||
/* Try to determine why sudo was not running as root. */
|
||||
if (sb.st_uid != ROOT_UID || !ISSET(sb.st_mode, S_ISUID)) {
|
||||
fatalx(
|
||||
sudo_fatalx(
|
||||
U_("%s must be owned by uid %d and have the setuid bit set"),
|
||||
sudo, ROOT_UID);
|
||||
} else {
|
||||
fatalx(U_("effective uid is not %d, is %s on a file system "
|
||||
sudo_fatalx(U_("effective uid is not %d, is %s on a file system "
|
||||
"with the 'nosuid' option set or an NFS file system without"
|
||||
" root privileges?"), ROOT_UID, sudo);
|
||||
}
|
||||
} else {
|
||||
fatalx(
|
||||
sudo_fatalx(
|
||||
U_("effective uid is not %d, is sudo installed setuid root?"),
|
||||
ROOT_UID);
|
||||
}
|
||||
@@ -871,18 +871,18 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
#ifdef HAVE_PRIV_SET
|
||||
if (details->privs != NULL) {
|
||||
if (setppriv(PRIV_SET, PRIV_INHERITABLE, details->privs) != 0) {
|
||||
warning("unable to set privileges");
|
||||
sudo_warn("unable to set privileges");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
if (details->limitprivs != NULL) {
|
||||
if (setppriv(PRIV_SET, PRIV_LIMIT, details->limitprivs) != 0) {
|
||||
warning("unable to set limit privileges");
|
||||
sudo_warn("unable to set limit privileges");
|
||||
goto done;
|
||||
}
|
||||
} else if (details->privs != NULL) {
|
||||
if (setppriv(PRIV_SET, PRIV_LIMIT, details->privs) != 0) {
|
||||
warning("unable to set limit privileges");
|
||||
sudo_warn("unable to set limit privileges");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -905,7 +905,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
*/
|
||||
lc = login_getclass((char *)details->login_class);
|
||||
if (!lc) {
|
||||
warningx(U_("unknown login class %s"), details->login_class);
|
||||
sudo_warnx(U_("unknown login class %s"), details->login_class);
|
||||
errno = ENOENT;
|
||||
goto done;
|
||||
}
|
||||
@@ -918,7 +918,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
flags = LOGIN_SETRESOURCES|LOGIN_SETPRIORITY;
|
||||
}
|
||||
if (setusercontext(lc, details->pw, details->pw->pw_uid, flags)) {
|
||||
warning(U_("unable to set user context"));
|
||||
sudo_warn(U_("unable to set user context"));
|
||||
if (details->pw->pw_uid != ROOT_UID)
|
||||
goto done;
|
||||
}
|
||||
@@ -932,27 +932,27 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
if (!ISSET(details->flags, CD_PRESERVE_GROUPS)) {
|
||||
if (details->ngroups >= 0) {
|
||||
if (sudo_setgroups(details->ngroups, details->groups) < 0) {
|
||||
warning(U_("unable to set supplementary group IDs"));
|
||||
sudo_warn(U_("unable to set supplementary group IDs"));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_SETEUID
|
||||
if (ISSET(details->flags, CD_SET_EGID) && setegid(details->egid)) {
|
||||
warning(U_("unable to set effective gid to runas gid %u"),
|
||||
sudo_warn(U_("unable to set effective gid to runas gid %u"),
|
||||
(unsigned int)details->egid);
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
if (ISSET(details->flags, CD_SET_GID) && setgid(details->gid)) {
|
||||
warning(U_("unable to set gid to runas gid %u"),
|
||||
sudo_warn(U_("unable to set gid to runas gid %u"),
|
||||
(unsigned int)details->gid);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ISSET(details->flags, CD_SET_PRIORITY)) {
|
||||
if (setpriority(PRIO_PROCESS, 0, details->priority) != 0) {
|
||||
warning(U_("unable to set process priority"));
|
||||
sudo_warn(U_("unable to set process priority"));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -960,7 +960,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
(void) umask(details->umask);
|
||||
if (details->chroot) {
|
||||
if (chroot(details->chroot) != 0 || chdir("/") != 0) {
|
||||
warning(U_("unable to change root to %s"), details->chroot);
|
||||
sudo_warn(U_("unable to change root to %s"), details->chroot);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -973,19 +973,19 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
|
||||
#ifdef HAVE_SETRESUID
|
||||
if (setresuid(details->uid, details->euid, details->euid) != 0) {
|
||||
warning(U_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
sudo_warn(U_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
details->euid);
|
||||
goto done;
|
||||
}
|
||||
#elif defined(HAVE_SETREUID)
|
||||
if (setreuid(details->uid, details->euid) != 0) {
|
||||
warning(U_("unable to change to runas uid (%u, %u)"),
|
||||
sudo_warn(U_("unable to change to runas uid (%u, %u)"),
|
||||
(unsigned int)details->uid, (unsigned int)details->euid);
|
||||
goto done;
|
||||
}
|
||||
#else
|
||||
if (seteuid(details->euid) != 0 || setuid(details->euid) != 0) {
|
||||
warning(U_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
sudo_warn(U_("unable to change to runas uid (%u, %u)"), details->uid,
|
||||
details->euid);
|
||||
goto done;
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
if (details->chroot || strcmp(details->cwd, user_details.cwd) != 0) {
|
||||
/* Note: cwd is relative to the new root, if any. */
|
||||
if (chdir(details->cwd) != 0) {
|
||||
warning(U_("unable to change directory to %s"), details->cwd);
|
||||
sudo_warn(U_("unable to change directory to %s"), details->cwd);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -1059,7 +1059,7 @@ run_command(struct command_details *details)
|
||||
exitcode = WTERMSIG(cstat.val) | 128;
|
||||
break;
|
||||
default:
|
||||
warningx(U_("unexpected child termination condition: %d"), cstat.type);
|
||||
sudo_warnx(U_("unexpected child termination condition: %d"), cstat.type);
|
||||
break;
|
||||
}
|
||||
debug_return_int(exitcode);
|
||||
@@ -1096,7 +1096,7 @@ policy_close(struct plugin_container *plugin, int exit_status, int error)
|
||||
if (plugin->u.policy->close != NULL)
|
||||
plugin->u.policy->close(exit_status, error);
|
||||
else
|
||||
warning(U_("unable to execute %s"), command_details.command);
|
||||
sudo_warn(U_("unable to execute %s"), command_details.command);
|
||||
debug_return;
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,7 @@ policy_check(struct plugin_container *plugin, int argc, char * const argv[],
|
||||
{
|
||||
debug_decl(policy_check, SUDO_DEBUG_PCOMM)
|
||||
if (plugin->u.policy->check_policy == NULL) {
|
||||
fatalx(U_("policy plugin %s is missing the `check_policy' method"),
|
||||
sudo_fatalx(U_("policy plugin %s is missing the `check_policy' method"),
|
||||
plugin->name);
|
||||
}
|
||||
debug_return_bool(plugin->u.policy->check_policy(argc, argv, env_add,
|
||||
@@ -1129,7 +1129,7 @@ policy_list(struct plugin_container *plugin, int argc, char * const argv[],
|
||||
{
|
||||
debug_decl(policy_list, SUDO_DEBUG_PCOMM)
|
||||
if (plugin->u.policy->list == NULL) {
|
||||
warningx(U_("policy plugin %s does not support listing privileges"),
|
||||
sudo_warnx(U_("policy plugin %s does not support listing privileges"),
|
||||
plugin->name);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -1141,7 +1141,7 @@ policy_validate(struct plugin_container *plugin)
|
||||
{
|
||||
debug_decl(policy_validate, SUDO_DEBUG_PCOMM)
|
||||
if (plugin->u.policy->validate == NULL) {
|
||||
warningx(U_("policy plugin %s does not support the -v option"),
|
||||
sudo_warnx(U_("policy plugin %s does not support the -v option"),
|
||||
plugin->name);
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -1153,7 +1153,7 @@ policy_invalidate(struct plugin_container *plugin, int remove)
|
||||
{
|
||||
debug_decl(policy_invalidate, SUDO_DEBUG_PCOMM)
|
||||
if (plugin->u.policy->invalidate == NULL) {
|
||||
fatalx(U_("policy plugin %s does not support the -k/-K options"),
|
||||
sudo_fatalx(U_("policy plugin %s does not support the -k/-K options"),
|
||||
plugin->name);
|
||||
}
|
||||
plugin->u.policy->invalidate(remove);
|
||||
|
@@ -62,17 +62,17 @@ switch_user(uid_t euid, gid_t egid, int ngroups, GETGROUPS_T *groups)
|
||||
/* When restoring root, change euid first; otherwise change it last. */
|
||||
if (euid == ROOT_UID) {
|
||||
if (seteuid(ROOT_UID) != 0)
|
||||
fatal("seteuid(ROOT_UID)");
|
||||
sudo_fatal("seteuid(ROOT_UID)");
|
||||
}
|
||||
if (setegid(egid) != 0)
|
||||
fatal("setegid(%d)", (int)egid);
|
||||
sudo_fatal("setegid(%d)", (int)egid);
|
||||
if (ngroups != -1) {
|
||||
if (sudo_setgroups(ngroups, groups) != 0)
|
||||
fatal("setgroups");
|
||||
sudo_fatal("setgroups");
|
||||
}
|
||||
if (euid != ROOT_UID) {
|
||||
if (seteuid(euid) != 0)
|
||||
fatal("seteuid(%d)", (int)euid);
|
||||
sudo_fatal("seteuid(%d)", (int)euid);
|
||||
}
|
||||
errno = serrno;
|
||||
|
||||
@@ -107,7 +107,7 @@ sudo_edit(struct command_details *command_details)
|
||||
* We will change the euid as needed below.
|
||||
*/
|
||||
if (setuid(ROOT_UID) != 0) {
|
||||
warning(U_("unable to change uid to root (%u)"), ROOT_UID);
|
||||
sudo_warn(U_("unable to change uid to root (%u)"), ROOT_UID);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ sudo_edit(struct command_details *command_details)
|
||||
editor_argc++;
|
||||
}
|
||||
if (nfiles == 0) {
|
||||
warningx(U_("plugin error: missing file list for sudoedit"));
|
||||
sudo_warnx(U_("plugin error: missing file list for sudoedit"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -165,9 +165,9 @@ sudo_edit(struct command_details *command_details)
|
||||
user_details.ngroups, user_details.groups);
|
||||
if (rc || (ofd != -1 && !S_ISREG(sb.st_mode))) {
|
||||
if (rc)
|
||||
warning("%s", files[i]);
|
||||
sudo_warn("%s", files[i]);
|
||||
else
|
||||
warningx(U_("%s: not a regular file"), files[i]);
|
||||
sudo_warnx(U_("%s: not a regular file"), files[i]);
|
||||
if (ofd != -1)
|
||||
close(ofd);
|
||||
continue;
|
||||
@@ -187,21 +187,21 @@ sudo_edit(struct command_details *command_details)
|
||||
easprintf(&tf[j].tfile, "%.*s/%s.XXXXXXXX", tmplen, tmpdir, cp);
|
||||
}
|
||||
if (seteuid(user_details.uid) != 0)
|
||||
fatal("seteuid(%d)", (int)user_details.uid);
|
||||
sudo_fatal("seteuid(%d)", (int)user_details.uid);
|
||||
tfd = mkstemps(tf[j].tfile, suff ? strlen(suff) : 0);
|
||||
if (seteuid(ROOT_UID) != 0)
|
||||
fatal("seteuid(ROOT_UID)");
|
||||
sudo_fatal("seteuid(ROOT_UID)");
|
||||
if (tfd == -1) {
|
||||
warning("mkstemps");
|
||||
sudo_warn("mkstemps");
|
||||
goto cleanup;
|
||||
}
|
||||
if (ofd != -1) {
|
||||
while ((nread = read(ofd, buf, sizeof(buf))) != 0) {
|
||||
if ((nwritten = write(tfd, buf, nread)) != nread) {
|
||||
if (nwritten == -1)
|
||||
warning("%s", tf[j].tfile);
|
||||
sudo_warn("%s", tf[j].tfile);
|
||||
else
|
||||
warningx(U_("%s: short write"), tf[j].tfile);
|
||||
sudo_warnx(U_("%s: short write"), tf[j].tfile);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@@ -259,18 +259,18 @@ sudo_edit(struct command_details *command_details)
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
rc = -1;
|
||||
if (seteuid(user_details.uid) != 0)
|
||||
fatal("seteuid(%d)", (int)user_details.uid);
|
||||
sudo_fatal("seteuid(%d)", (int)user_details.uid);
|
||||
if ((tfd = open(tf[i].tfile, O_RDONLY, 0644)) != -1) {
|
||||
rc = fstat(tfd, &sb);
|
||||
}
|
||||
if (seteuid(ROOT_UID) != 0)
|
||||
fatal("seteuid(ROOT_UID)");
|
||||
sudo_fatal("seteuid(ROOT_UID)");
|
||||
if (rc || !S_ISREG(sb.st_mode)) {
|
||||
if (rc)
|
||||
warning("%s", tf[i].tfile);
|
||||
sudo_warn("%s", tf[i].tfile);
|
||||
else
|
||||
warningx(U_("%s: not a regular file"), tf[i].tfile);
|
||||
warningx(U_("%s left unmodified"), tf[i].ofile);
|
||||
sudo_warnx(U_("%s: not a regular file"), tf[i].tfile);
|
||||
sudo_warnx(U_("%s left unmodified"), tf[i].ofile);
|
||||
if (tfd != -1)
|
||||
close(tfd);
|
||||
continue;
|
||||
@@ -282,7 +282,7 @@ sudo_edit(struct command_details *command_details)
|
||||
* time in the editor we can't tell if the file was changed.
|
||||
*/
|
||||
if (sudo_timevalcmp(×[0], ×[1], !=)) {
|
||||
warningx(U_("%s unchanged"), tf[i].ofile);
|
||||
sudo_warnx(U_("%s unchanged"), tf[i].ofile);
|
||||
unlink(tf[i].tfile);
|
||||
close(tfd);
|
||||
continue;
|
||||
@@ -294,17 +294,17 @@ sudo_edit(struct command_details *command_details)
|
||||
switch_user(ROOT_UID, user_details.egid,
|
||||
user_details.ngroups, user_details.groups);
|
||||
if (ofd == -1) {
|
||||
warning(U_("unable to write to %s"), tf[i].ofile);
|
||||
warningx(U_("contents of edit session left in %s"), tf[i].tfile);
|
||||
sudo_warn(U_("unable to write to %s"), tf[i].ofile);
|
||||
sudo_warnx(U_("contents of edit session left in %s"), tf[i].tfile);
|
||||
close(tfd);
|
||||
continue;
|
||||
}
|
||||
while ((nread = read(tfd, buf, sizeof(buf))) > 0) {
|
||||
if ((nwritten = write(ofd, buf, nread)) != nread) {
|
||||
if (nwritten == -1)
|
||||
warning("%s", tf[i].ofile);
|
||||
sudo_warn("%s", tf[i].ofile);
|
||||
else
|
||||
warningx(U_("%s: short write"), tf[i].ofile);
|
||||
sudo_warnx(U_("%s: short write"), tf[i].ofile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -312,11 +312,11 @@ sudo_edit(struct command_details *command_details)
|
||||
/* success, got EOF */
|
||||
unlink(tf[i].tfile);
|
||||
} else if (nread < 0) {
|
||||
warning(U_("unable to read temporary file"));
|
||||
warningx(U_("contents of edit session left in %s"), tf[i].tfile);
|
||||
sudo_warn(U_("unable to read temporary file"));
|
||||
sudo_warnx(U_("contents of edit session left in %s"), tf[i].tfile);
|
||||
} else {
|
||||
warning(U_("unable to write to %s"), tf[i].ofile);
|
||||
warningx(U_("contents of edit session left in %s"), tf[i].tfile);
|
||||
sudo_warn(U_("unable to write to %s"), tf[i].ofile);
|
||||
sudo_warnx(U_("contents of edit session left in %s"), tf[i].tfile);
|
||||
}
|
||||
close(ofd);
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ tgetpass(const char *prompt, int timeout, int flags)
|
||||
if (!ISSET(flags, TGP_STDIN|TGP_ECHO|TGP_ASKPASS|TGP_NOECHO_TRY) &&
|
||||
!tty_present()) {
|
||||
if (askpass == NULL || getenv_unhooked("DISPLAY") == NULL) {
|
||||
warningx(U_("no tty present and no askpass program specified"));
|
||||
sudo_warnx(U_("no tty present and no askpass program specified"));
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
SET(flags, TGP_ASKPASS);
|
||||
@@ -96,7 +96,7 @@ tgetpass(const char *prompt, int timeout, int flags)
|
||||
/* If using a helper program to get the password, run it instead. */
|
||||
if (ISSET(flags, TGP_ASKPASS)) {
|
||||
if (askpass == NULL || *askpass == '\0')
|
||||
fatalx(U_("no askpass program specified, try setting SUDO_ASKPASS"));
|
||||
sudo_fatalx(U_("no askpass program specified, try setting SUDO_ASKPASS"));
|
||||
debug_return_str_masked(sudo_askpass(askpass, prompt));
|
||||
}
|
||||
|
||||
@@ -215,30 +215,30 @@ sudo_askpass(const char *askpass, const char *prompt)
|
||||
debug_decl(sudo_askpass, SUDO_DEBUG_CONV)
|
||||
|
||||
if (pipe(pfd) == -1)
|
||||
fatal(U_("unable to create pipe"));
|
||||
sudo_fatal(U_("unable to create pipe"));
|
||||
|
||||
if ((pid = fork()) == -1)
|
||||
fatal(U_("unable to fork"));
|
||||
sudo_fatal(U_("unable to fork"));
|
||||
|
||||
if (pid == 0) {
|
||||
/* child, point stdout to output side of the pipe and exec askpass */
|
||||
if (dup2(pfd[1], STDOUT_FILENO) == -1) {
|
||||
warning("dup2");
|
||||
sudo_warn("dup2");
|
||||
_exit(255);
|
||||
}
|
||||
if (setuid(ROOT_UID) == -1)
|
||||
warning("setuid(%d)", ROOT_UID);
|
||||
sudo_warn("setuid(%d)", ROOT_UID);
|
||||
if (setgid(user_details.gid)) {
|
||||
warning(U_("unable to set gid to %u"), (unsigned int)user_details.gid);
|
||||
sudo_warn(U_("unable to set gid to %u"), (unsigned int)user_details.gid);
|
||||
_exit(255);
|
||||
}
|
||||
if (setuid(user_details.uid)) {
|
||||
warning(U_("unable to set uid to %u"), (unsigned int)user_details.uid);
|
||||
sudo_warn(U_("unable to set uid to %u"), (unsigned int)user_details.uid);
|
||||
_exit(255);
|
||||
}
|
||||
closefrom(STDERR_FILENO + 1);
|
||||
execl(askpass, askpass, prompt, (char *)NULL);
|
||||
warning(U_("unable to run %s"), askpass);
|
||||
sudo_warn(U_("unable to run %s"), askpass);
|
||||
_exit(255);
|
||||
}
|
||||
|
||||
|
@@ -207,7 +207,7 @@ sudo_ttyname_scan(const char *dir, dev_t rdev, bool builtin)
|
||||
sdlen--;
|
||||
if (sdlen + 1 >= sizeof(pathbuf)) {
|
||||
errno = ENAMETOOLONG;
|
||||
warning("%.*s/", (int)sdlen, dir);
|
||||
sudo_warn("%.*s/", (int)sdlen, dir);
|
||||
goto done;
|
||||
}
|
||||
memcpy(pathbuf, dir, sdlen);
|
||||
|
@@ -275,12 +275,12 @@ utmp_slot(const char *line, int ttyfd)
|
||||
* doesn't take an argument.
|
||||
*/
|
||||
if ((sfd = dup(STDIN_FILENO)) == -1)
|
||||
fatal(U_("unable to save stdin"));
|
||||
sudo_fatal(U_("unable to save stdin"));
|
||||
if (dup2(ttyfd, STDIN_FILENO) == -1)
|
||||
fatal(U_("unable to dup2 stdin"));
|
||||
sudo_fatal(U_("unable to dup2 stdin"));
|
||||
slot = ttyslot();
|
||||
if (dup2(sfd, STDIN_FILENO) == -1)
|
||||
fatal(U_("unable to restore stdin"));
|
||||
sudo_fatal(U_("unable to restore stdin"));
|
||||
close(sfd);
|
||||
|
||||
debug_return_int(slot);
|
||||
|
Reference in New Issue
Block a user