Move version printing, etc. into a separate function.
This commit is contained in:
39
sudo.c
39
sudo.c
@@ -116,6 +116,7 @@ static void set_loginclass __P((struct passwd *));
|
|||||||
static void set_project __P((struct passwd *));
|
static void set_project __P((struct passwd *));
|
||||||
static void set_runasgr __P((char *));
|
static void set_runasgr __P((char *));
|
||||||
static void set_runaspw __P((char *));
|
static void set_runaspw __P((char *));
|
||||||
|
static void show_version __P((void));
|
||||||
static void usage __P((int))
|
static void usage __P((int))
|
||||||
__attribute__((__noreturn__));
|
__attribute__((__noreturn__));
|
||||||
static void usage_excl __P((int))
|
static void usage_excl __P((int))
|
||||||
@@ -234,22 +235,7 @@ main(argc, argv, envp)
|
|||||||
else
|
else
|
||||||
switch (sudo_mode) {
|
switch (sudo_mode) {
|
||||||
case MODE_VERSION:
|
case MODE_VERSION:
|
||||||
(void) printf("Sudo version %s\n", version);
|
show_version();
|
||||||
if (getuid() == 0) {
|
|
||||||
putchar('\n');
|
|
||||||
(void) printf("Sudoers path: %s\n", _PATH_SUDOERS);
|
|
||||||
#ifdef HAVE_LDAP
|
|
||||||
# ifdef _PATH_NSSWITCH_CONF
|
|
||||||
(void) printf("nsswitch path: %s\n", _PATH_NSSWITCH_CONF);
|
|
||||||
# endif
|
|
||||||
(void) printf("ldap.conf path: %s\n", _PATH_LDAP_CONF);
|
|
||||||
(void) printf("ldap.secret path: %s\n", _PATH_LDAP_SECRET);
|
|
||||||
#endif
|
|
||||||
dump_auth_methods();
|
|
||||||
dump_defaults();
|
|
||||||
dump_interfaces();
|
|
||||||
}
|
|
||||||
exit(0);
|
|
||||||
break;
|
break;
|
||||||
case MODE_HELP:
|
case MODE_HELP:
|
||||||
usage(0);
|
usage(0);
|
||||||
@@ -1395,6 +1381,27 @@ cleanup(gotsignal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
show_version()
|
||||||
|
{
|
||||||
|
(void) printf("Sudo version %s\n", version);
|
||||||
|
if (getuid() == 0) {
|
||||||
|
putchar('\n');
|
||||||
|
(void) printf("Sudoers path: %s\n", _PATH_SUDOERS);
|
||||||
|
#ifdef HAVE_LDAP
|
||||||
|
# ifdef _PATH_NSSWITCH_CONF
|
||||||
|
(void) printf("nsswitch path: %s\n", _PATH_NSSWITCH_CONF);
|
||||||
|
# endif
|
||||||
|
(void) printf("ldap.conf path: %s\n", _PATH_LDAP_CONF);
|
||||||
|
(void) printf("ldap.secret path: %s\n", _PATH_LDAP_SECRET);
|
||||||
|
#endif
|
||||||
|
dump_auth_methods();
|
||||||
|
dump_defaults();
|
||||||
|
dump_interfaces();
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tell which options are mutually exclusive and exit.
|
* Tell which options are mutually exclusive and exit.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user