From 93d2420de9415f34d9078ac4f0ba042543ce9e8b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 12 Oct 2010 10:47:16 -0400 Subject: [PATCH] Fix complilation on systems with set_auth_parameters() Sprinkle volatile to quiet warnings from gcc 2.8.0 --- plugins/sudoers/sudoers.c | 23 +++-------------------- src/sudo.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index c3ee6b4f8..be63fb6c9 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -65,15 +65,6 @@ #endif #include #include -#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS) -# ifdef __hpux -# undef MAXINT -# include -# else -# include -# endif /* __hpux */ -# include -#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */ #ifdef HAVE_LOGIN_CAP_H # include # ifndef LOGIN_DEFROOTCLASS @@ -152,18 +143,10 @@ sudoers_policy_open(unsigned int version, sudo_conv_t conversation, sudo_printf_t plugin_printf, char * const settings[], char * const user_info[], char * const envp[]) { - int sources = 0; + volatile int sources = 0; sigaction_t sa; struct sudo_nss *nss; - /* Must be done before we do any password lookups */ -#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS) - (void) set_auth_parameters(Argc, Argv); -# ifdef HAVE_INITPRIVS - initprivs(); -# endif -#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */ - if (!sudo_conv) sudo_conv = conversation; if (!sudo_printf) @@ -297,8 +280,8 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], char **edit_argv = NULL; struct sudo_nss *nss; int cmnd_status = -1, validated; - int info_len = 0; - int rval = FALSE; + volatile int info_len = 0; + volatile int rval = FALSE; /* Is root even allowed to run sudo? */ if (user_uid == 0 && !def_root_sudo) { diff --git a/src/sudo.c b/src/sudo.c index 3d45e3f2a..370e993ff 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -76,6 +76,15 @@ #ifdef HAVE_SETAUTHDB # include #endif /* HAVE_SETAUTHDB */ +#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS) +# ifdef __hpux +# undef MAXINT +# include +# else +# include +# endif /* __hpux */ +# include +#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */ #include "sudo.h" #include "sudo_plugin.h" @@ -131,6 +140,14 @@ main(int argc, char *argv[], char *envp[]) setprogname(argv[0]); #endif + /* Must be done before we do any password lookups */ +#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS) + (void) set_auth_parameters(argc, argv); +# ifdef HAVE_INITPRIVS + initprivs(); +# endif +#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */ + if (geteuid() != 0) errorx(1, "must be setuid root"); -- 2.40.0