From dd545f38ca4be8c9187de60c18608cada605be32 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 28 Mar 2018 17:43:58 -0600 Subject: [PATCH] Add support for "cvtsudoers -d all" --- doc/cvtsudoers.cat | 7 +++++-- doc/cvtsudoers.man.in | 10 +++++++--- doc/cvtsudoers.mdoc.in | 7 +++++-- plugins/sudoers/cvtsudoers.c | 4 +++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/doc/cvtsudoers.cat b/doc/cvtsudoers.cat index 14ce460dc..e5d05153d 100644 --- a/doc/cvtsudoers.cat +++ b/doc/cvtsudoers.cat @@ -38,7 +38,10 @@ DDEESSCCRRIIPPTTIIOONN more Defaults types may be specified, separated by a comma (`,'). The supported types are: - global Defaults entries that always match. + all All Defaults entries. + + global Gobal Defaults entries that are applied regardless + of user, runas, host or command. user Per-user Defaults entries. @@ -46,7 +49,7 @@ DDEESSCCRRIIPPTTIIOONN host Per-host Defaults entries. - commands Per-command Defaults entries. + command Per-command Defaults entries. See the DDeeffaauullttss section in sudoers(4) for more information. diff --git a/doc/cvtsudoers.man.in b/doc/cvtsudoers.man.in index 360d95ed5..a1ce4171d 100644 --- a/doc/cvtsudoers.man.in +++ b/doc/cvtsudoers.man.in @@ -87,10 +87,14 @@ The supported types are: .RS 12n .PD 0 .TP 10n -global -Defaults entries that always match. +all +All Defaults entries. .PD .TP 10n +global +Gobal Defaults entries that are applied regardless of +user, runas, host or command. +.TP 10n user Per-user Defaults entries. .TP 10n @@ -100,7 +104,7 @@ Per-runas user Defaults entries. host Per-host Defaults entries. .TP 10n -commands +command Per-command Defaults entries. .PP See the diff --git a/doc/cvtsudoers.mdoc.in b/doc/cvtsudoers.mdoc.in index c3571234e..da3b21c2c 100644 --- a/doc/cvtsudoers.mdoc.in +++ b/doc/cvtsudoers.mdoc.in @@ -79,15 +79,18 @@ types may be specified, separated by a comma .Pq Ql \&, . The supported types are: .Bl -tag -width 8n +.It all +All Defaults entries. .It global -Defaults entries that always match. +Gobal Defaults entries that are applied regardless of +user, runas, host or command. .It user Per-user Defaults entries. .It runas Per-runas user Defaults entries. .It host Per-host Defaults entries. -.It commands +.It command Per-command Defaults entries. .El .Pp diff --git a/plugins/sudoers/cvtsudoers.c b/plugins/sudoers/cvtsudoers.c index 208c1ce51..e890a6cae 100644 --- a/plugins/sudoers/cvtsudoers.c +++ b/plugins/sudoers/cvtsudoers.c @@ -466,7 +466,9 @@ cvtsudoers_parse_defaults(char *expression) debug_decl(cvtsudoers_parse_defaults, SUDOERS_DEBUG_UTIL) for ((cp = strtok_r(cp, ",", &last)); cp != NULL; (cp = strtok_r(NULL, ",", &last))) { - if (strcasecmp(cp, "global") == 0) { + if (strcasecmp(cp, "all") == 0) { + SET(flags, CVT_DEFAULTS_ALL); + } else if (strcasecmp(cp, "global") == 0) { SET(flags, CVT_DEFAULTS_GLOBAL); } else if (strcasecmp(cp, "user") == 0) { SET(flags, CVT_DEFAULTS_USER); -- 2.40.0