From: Todd C. Miller Date: Fri, 21 May 2010 18:56:31 +0000 (-0400) Subject: The sample plugin doesn't support being run with no args so return X-Git-Tag: SUDO_1_8_0~607 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b628e15dc4c919f108ac02d6a9092af4e0c1c707;p=sudo The sample plugin doesn't support being run with no args so return a usage error in this case. --- diff --git a/plugins/sample/sample_plugin.c b/plugins/sample/sample_plugin.c index 63d9e9158..1b2908db4 100644 --- a/plugins/sample/sample_plugin.c +++ b/plugins/sample/sample_plugin.c @@ -153,6 +153,11 @@ policy_open(unsigned int version, sudo_conv_t conversation, if (strcasecmp(*ui + sizeof("sudoedit=") - 1, "true") == 0) 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 ((pw = getpwnam(runas_user)) == NULL) {