visudo and testsudoers.
#include "sudo_compat.h"
#include "sudo_fatal.h"
#include "sudoers_debug.h"
+#include "defaults.h"
#include "logging.h"
static int current_locale = SUDOERS_LOCALE_USER;
debug_return_bool(sudoers_setlocale(*cookie, NULL));
debug_return_bool(sudoers_setlocale(SUDOERS_LOCALE_USER, cookie));
}
+
+/*
+ * Callback for sudoers_locale sudoers setting.
+ */
+bool
+sudoers_locale_callback(const union sudo_defs_val *sd_un)
+{
+ debug_decl(sudoers_locale_callback, SUDOERS_DEBUG_UTIL)
+
+ if (sudoers_initlocale(NULL, sd_un->str)) {
+ if (setlocale(LC_ALL, sd_un->str) != NULL)
+ debug_return_bool(true);
+ }
+ debug_return_bool(false);
+}
bool log_warning(int flags, const char *fmt, ...) __printflike(2, 3);
bool log_warningx(int flags, const char *fmt, ...) __printflike(2, 3);
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);
#endif /* SUDOERS_LOGGING_H */
static char *find_editor(int nfiles, char **files, int *argc_out, char ***argv_out);
static bool cb_fqdn(const union sudo_defs_val *);
static bool cb_runas_default(const union sudo_defs_val *);
-static bool cb_sudoers_locale(const union sudo_defs_val *);
static int set_cmnd(void);
static int create_admin_success_flag(void);
static bool init_vars(char * const *);
sudo_defs_table[I_RUNAS_DEFAULT].callback = cb_runas_default;
/* Set locale callback. */
- sudo_defs_table[I_SUDOERS_LOCALE].callback = cb_sudoers_locale;
+ sudo_defs_table[I_SUDOERS_LOCALE].callback = sudoers_locale_callback;
/* Set maxseq callback. */
sudo_defs_table[I_MAXSEQ].callback = cb_maxseq;
debug_return_bool(true);
}
-/*
- * Callback for sudoers_locale sudoers setting.
- */
-static bool
-cb_sudoers_locale(const union sudo_defs_val *sd_un)
-{
- debug_decl(cb_sudoers_locale, SUDOERS_DEBUG_PLUGIN)
-
- if (sudoers_initlocale(NULL, sd_un->str)) {
- if (setlocale(LC_ALL, sd_un->str) != NULL)
- debug_return_bool(true);
- }
- debug_return_bool(false);
-}
-
/*
* Cleanup hook for sudo_fatal()/sudo_fatalx()
*/
/* Set runas callback. */
sudo_defs_table[I_RUNAS_DEFAULT].callback = cb_runas_default;
+ /* Set locale callback. */
+ sudo_defs_table[I_SUDOERS_LOCALE].callback = sudoers_locale_callback;
+
/* Load ip addr/mask for each interface. */
if (get_net_ifs(&p) > 0) {
if (!set_interfaces(p))
/* Register fatal/fatalx callback. */
sudo_fatal_callback_register(visudo_cleanup);
+ /* Set sudoers locale callback. */
+ sudo_defs_table[I_SUDOERS_LOCALE].callback = sudoers_locale_callback;
+
/* Read debug and plugin sections of sudo.conf. */
if (sudo_conf_read(NULL, SUDO_CONF_DEBUG|SUDO_CONF_PLUGINS) == -1)
exit(EXIT_FAILURE);