The sample plugin doesn't support being run with no args so return

a usage error in this case.
This commit is contained in:
Todd C. Miller
2010-05-21 14:56:31 -04:00
parent f59669fc20
commit b628e15dc4

View File

@@ -153,6 +153,11 @@ policy_open(unsigned int version, sudo_conv_t conversation,
if (strcasecmp(*ui + sizeof("sudoedit=") - 1, "true") == 0) if (strcasecmp(*ui + sizeof("sudoedit=") - 1, "true") == 0)
use_sudoedit = TRUE; use_sudoedit = TRUE;
} }
/* This plugin doesn't support running sudo with no arguments. */
if (strncmp(*ui, "implied_shell=", sizeof("implied_shell=") - 1) == 0) {
if (strcasecmp(*ui + sizeof("implied_shell=") - 1, "true") == 0)
return -2; /* usage error */
}
} }
if (runas_user != NULL) { if (runas_user != NULL) {
if ((pw = getpwnam(runas_user)) == NULL) { if ((pw = getpwnam(runas_user)) == NULL) {