Add sudo_gai_fatal, sudo_gai_vfatal, sudo_gai_vwarn, sudo_gai_warn

and gai_log_warning that use gai_strerror() instead of strerror().
This commit is contained in:
Todd C. Miller
2018-11-05 09:08:05 -07:00
parent cfa4879dbd
commit cdd5bb32eb
11 changed files with 238 additions and 81 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2005, 2009-2017
* Copyright (c) 1999-2005, 2009-2018
* Todd C. Miller <Todd.Miller@sudo.ws>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -37,10 +37,11 @@
/* Flags for log_warning()/log_warningx() */
#define SLOG_USE_ERRNO 0x01 /* internal use only */
#define SLOG_RAW_MSG 0x02 /* do not format msg before logging */
#define SLOG_SEND_MAIL 0x04 /* log via mail */
#define SLOG_NO_STDERR 0x08 /* do not log via stderr */
#define SLOG_NO_LOG 0x10 /* do not log via file or syslog */
#define SLOG_GAI_ERRNO 0x02 /* internal use only */
#define SLOG_RAW_MSG 0x04 /* do not format msg before logging */
#define SLOG_SEND_MAIL 0x08 /* log via mail */
#define SLOG_NO_STDERR 0x10 /* do not log via stderr */
#define SLOG_NO_LOG 0x20 /* do not log via file or syslog */
/*
* Maximum number of characters to log per entry. The syslogger
@@ -74,6 +75,7 @@ bool log_denial(int status, bool inform_user);
bool log_failure(int status, int flags);
bool log_warning(int flags, const char *fmt, ...) __printflike(2, 3);
bool log_warningx(int flags, const char *fmt, ...) __printflike(2, 3);
bool gai_log_warning(int flags, int errnum, const char *fmt, ...) __printflike(3, 4);
bool sudoers_initlocale(const char *ulocale, const char *slocale);
bool sudoers_locale_callback(const union sudo_defs_val *);
int writeln_wrap(FILE *fp, char *line, size_t len, size_t maxlen);