Overload -h option to specify an optional hostname for remote access.
This is future-proofing; no policy plugins currently support this.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
/* API version major/minor */
|
||||
#define SUDO_API_VERSION_MAJOR 1
|
||||
#define SUDO_API_VERSION_MINOR 3
|
||||
#define SUDO_API_VERSION_MINOR 4
|
||||
#define SUDO_API_MKVERSION(x, y) ((x << 16) | y)
|
||||
#define SUDO_API_VERSION SUDO_API_MKVERSION(SUDO_API_VERSION_MAJOR, SUDO_API_VERSION_MINOR)
|
||||
|
||||
|
@@ -111,7 +111,9 @@ static struct sudo_settings {
|
||||
{ "max_groups" },
|
||||
#define ARG_PLUGIN_DIR 21
|
||||
{ "plugin_dir" },
|
||||
#define NUM_SETTINGS 22
|
||||
#define ARG_REMOTE_HOST 22
|
||||
{ "remote_host" },
|
||||
#define NUM_SETTINGS 23
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -181,7 +183,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
* Some trickiness is required to allow environment variables
|
||||
* to be interspersed with command line options.
|
||||
*/
|
||||
if ((ch = getopt(argc, argv, "+Aa:bC:c:D:Eeg:HhiKklnPp:r:Sst:U:u:Vv")) != -1) {
|
||||
if ((ch = getopt(argc, argv, "+Aa:bC:c:D:Eeg:Hh::iKklnPp:r:Sst:U:u:Vv")) != -1) {
|
||||
switch (ch) {
|
||||
case 'A':
|
||||
SET(tgetpass_flags, TGP_ASKPASS);
|
||||
@@ -227,12 +229,16 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
||||
sudo_settings[ARG_SET_HOME].value = "true";
|
||||
break;
|
||||
case 'h':
|
||||
if (mode && mode != MODE_HELP) {
|
||||
if (strcmp(getprogname(), "sudoedit") != 0)
|
||||
usage_excl(1);
|
||||
if (optarg != NULL) {
|
||||
sudo_settings[ARG_REMOTE_HOST].value = optarg;
|
||||
} else {
|
||||
if (mode && mode != MODE_HELP) {
|
||||
if (strcmp(getprogname(), "sudoedit") != 0)
|
||||
usage_excl(1);
|
||||
}
|
||||
mode = MODE_HELP;
|
||||
valid_flags = 0;
|
||||
}
|
||||
mode = MODE_HELP;
|
||||
valid_flags = 0;
|
||||
break;
|
||||
case 'i':
|
||||
sudo_settings[ARG_LOGIN_SHELL].value = "true";
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2010 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 2007-2010, 2013 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -24,10 +24,10 @@
|
||||
* need to be able to substitute values from configure.
|
||||
*/
|
||||
#define SUDO_USAGE1 " [-D level] -h | -K | -k | -V"
|
||||
#define SUDO_USAGE2 " -v [-AknS] @BSDAUTH_USAGE@[-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid]"
|
||||
#define SUDO_USAGE3 " -l[l] [-AknS] @BSDAUTH_USAGE@[-D level] [-g groupname|#gid] [-p prompt] [-U user name] [-u user name|#uid] [-g groupname|#gid] [command]"
|
||||
#define SUDO_USAGE4 " [-AbEHknPS] @BSDAUTH_USAGE@@SELINUX_USAGE@[-C fd] [-D level] @LOGINCAP_USAGE@[-g groupname|#gid] [-p prompt] [-u user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]"
|
||||
#define SUDO_USAGE5 " -e [-AknS] @BSDAUTH_USAGE@@SELINUX_USAGE@[-C fd] [-D level] @LOGINCAP_USAGE@[-g groupname|#gid] [-p prompt] [-u user name|#uid] file ..."
|
||||
#define SUDO_USAGE2 " -v [-AknS] @BSDAUTH_USAGE@[-D level] [-g groupname|#gid] [-h hostname] [-p prompt] [-u user name|#uid]"
|
||||
#define SUDO_USAGE3 " -l[l] [-AknS] @BSDAUTH_USAGE@[-D level] [-g groupname|#gid] [-h hostname] [-p prompt] [-U user name] [-u user name|#uid] [command]"
|
||||
#define SUDO_USAGE4 " [-AbEHknPS] @BSDAUTH_USAGE@@SELINUX_USAGE@[-C fd] [-D level] @LOGINCAP_USAGE@[-g groupname|#gid] [-h hostname] [-p prompt] [-u user name|#uid] [VAR=value] [-i|-s] [<command>]"
|
||||
#define SUDO_USAGE5 " -e [-AknS] @BSDAUTH_USAGE@@SELINUX_USAGE@[-C fd] [-D level] @LOGINCAP_USAGE@[-g groupname|#gid] [-h hostname] [-p prompt] [-u user name|#uid] file ..."
|
||||
|
||||
/*
|
||||
* Configure script arguments used to build sudo.
|
||||
|
Reference in New Issue
Block a user