]> granicus.if.org Git - sudo/commitdiff
The sample plugin doesn't support being run with no args so return
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 21 May 2010 18:56:31 +0000 (14:56 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 21 May 2010 18:56:31 +0000 (14:56 -0400)
a usage error in this case.

plugins/sample/sample_plugin.c

index 63d9e91587753bfdfa82d37d97c8441341a2cd06..1b2908db42a88bba642c440dbb680293cfe36224 100644 (file)
@@ -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) {