From e07ca146d1e189958c34509d5d94120ef1e921f6 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 25 Mar 2011 09:58:08 -0400 Subject: [PATCH] Print sudo version early, in case policy plugin init fails. --- src/sudo.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sudo.c b/src/sudo.c index e9c9d0f9d..fed5a247a 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -204,6 +204,14 @@ main(int argc, char *argv[], char *envp[]) /* Parse command line arguments. */ sudo_mode = parse_args(argc, argv, &nargc, &nargv, &settings, &env_add); + sudo_debug(9, "sudo_mode %d", sudo_mode); + + /* Print sudo version early, in case policy plugin init fails. */ + if (ISSET(sudo_mode, MODE_VERSION)) { + printf("Sudo version %s\n", PACKAGE_VERSION); + if (user_details.uid == ROOT_UID) + (void) printf("Configure args: %s\n", CONFIGURE_ARGS); + } /* Open policy plugin. */ ok = policy_open(&policy_plugin, settings, user_info, envp); @@ -214,12 +222,8 @@ main(int argc, char *argv[], char *envp[]) errorx(1, "unable to initialize policy plugin"); } - sudo_debug(9, "sudo_mode %d", sudo_mode); switch (sudo_mode & MODE_MASK) { case MODE_VERSION: - printf("Sudo version %s\n", PACKAGE_VERSION); - if (user_details.uid == ROOT_UID) - (void) printf("Configure args: %s\n", CONFIGURE_ARGS); policy_show_version(&policy_plugin, !user_details.uid); tq_foreach_fwd(&io_plugins, plugin) { ok = iolog_open(plugin, settings, user_info, NULL,