Skip to content

Commit cf1b87c

Browse files
committed
Sync sed scripts that add back troff conditionals.
The sudo manuals contain conditional to avoid describing system-specific behavior on systems that don't support it. When we convert from mdoc to man format we lose those conditionals, these sed scripts add them back. Changes to the mdoc files can prevent the regexps from matching so they need to be updated periodically.
1 parent 4d331e6 commit cf1b87c

File tree

6 files changed

+92
-29
lines changed

6 files changed

+92
-29
lines changed

docs/sudo.conf.man.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ The default directory to use when searching for plugins
375375
that are specified without a fully qualified path name.
376376
The default value is
377377
\fI@plugindir@\fR.
378+
.if \n(SL \{\
378379
.TP 6n
379380
sesh
380381
The fully-qualified path to the

docs/sudo.conf.man.in.sed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
s/^\(.TH .*\)/.nr SL @SEMAN@\
22
\1/
33

4-
/^\.TP 10n$/ {
4+
/^\.TP 6n$/ {
55
N
6-
/^.TP 10n\nsesh$/ {
6+
/^.TP 6n\nsesh$/ {
77
i\
88
.if \\n(SL \\{\\
99
}

docs/sudo.man.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ If no askpass program is available,
214214
\fBsudo\fR
215215
will exit with an error.
216216
.RE
217+
.if \n(BA \{\
217218
.TP 8n
218219
\fB\-a\fR \fItype\fR, \fB\--auth-type\fR=\fItype\fR
219220
Use the specified
@@ -230,6 +231,7 @@ entry in
230231
This option is only available on systems that support
231232
BSD
232233
authentication.
234+
.\}
233235
.TP 8n
234236
\fB\-B\fR, \fB\--bell\fR
235237
Ring the bell as part of the password prompt when a terminal is present.
@@ -265,6 +267,7 @@ policy only permits use of the
265267
option when the administrator has enabled the
266268
\fIclosefrom_override\fR
267269
option.
270+
.if \n(LC \{\
268271
.TP 8n
269272
\fB\-c\fR \fIclass\fR, \fB\--login-class\fR=\fIclass\fR
270273
Run the
@@ -297,6 +300,7 @@ be applied, if present.
297300
This option is only available on systems with
298301
BSD
299302
login classes.
303+
.\}
300304
.TP 8n
301305
\fB\-D\fR \fIdirectory\fR, \fB\--chdir\fR=\fIdirectory\fR
302306
Run the
@@ -708,12 +712,14 @@ before running the
708712
\fIcommand\fR.
709713
The security policy may return an error if the user does not have
710714
permission to specify the root directory.
715+
.if \n(SL \{\
711716
.TP 8n
712717
\fB\-r\fR \fIrole\fR, \fB\--role\fR=\fIrole\fR
713718
Run the
714719
\fIcommand\fR
715720
with an SELinux security context that includes the specified
716721
\fIrole\fR.
722+
.\}
717723
.TP 8n
718724
\fB\-S\fR, \fB\--stdin\fR
719725
Write the prompt to the standard error and read the password from the
@@ -746,6 +752,7 @@ Most shells behave differently when a
746752
\fIcommand\fR
747753
is specified as compared to an interactive session; consult the shell's manual
748754
for details.
755+
.if \n(SL \{\
749756
.TP 8n
750757
\fB\-t\fR \fItype\fR, \fB\--type\fR=\fItype\fR
751758
Run the
@@ -755,6 +762,7 @@ with an SELinux security context that includes the specified
755762
If no
756763
\fItype\fR
757764
is specified, the default type is derived from the role.
765+
.\}
758766
.TP 8n
759767
\fB\-U\fR \fIuser\fR, \fB\--other-user\fR=\fIuser\fR
760768
Used in conjunction with the

docs/sudo.man.in.sed

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ s/^\(\[\\fB\\-c\\fR.*\\fIclass\\fR\]\) *$/.if \\n(LC \1/
99
s/^\(\[\\fB\\-r\\fR.*\\fIrole\\fR\]\) *$/.if \\n(SL \1/
1010
s/^\(\[\\fB\\-t\\fR.*\\fItype\\fR\]\) *$/.if \\n(SL \1/
1111

12-
/^\.TP 12n$/ {
12+
/^\.TP 8n$/ {
1313
N
14-
/^\.TP 12n\n\\fB\\-a\\fR.*\\fItype\\fR$/,/^\.TP 12n/ {
15-
/^\.TP 12n/ {
16-
/^\.TP 12n\n\\fB\\-a\\fR.*\\fItype\\fR$/i\
14+
/^\.TP 8n\n\\fB\\-a\\fR.*\\fItype\\fR$/,/^\.TP 8n/ {
15+
/^\.TP 8n/ {
16+
/^\.TP 8n\n\\fB\\-a\\fR.*\\fItype\\fR$/i\
1717
.if \\n(BA \\{\\
18-
/^\.TP 12n\n\\fB\\-a\\fR.*\\fItype\\fR$/!i\
18+
/^\.TP 8n\n\\fB\\-a\\fR.*\\fItype\\fR$/!i\
1919
.\\}
2020
}
2121
}
22-
/^\.TP 12n\n\\fB\\-c\\fR.*\\fIclass\\fR$/,/^\.TP 12n/ {
23-
/^\.TP 12n/ {
24-
/^\.TP 12n\n\\fB\\-c\\fR.*\\fIclass\\fR$/i\
22+
/^\.TP 8n\n\\fB\\-c\\fR.*\\fIclass\\fR$/,/^\.TP 8n/ {
23+
/^\.TP 8n/ {
24+
/^\.TP 8n\n\\fB\\-c\\fR.*\\fIclass\\fR$/i\
2525
.if \\n(LC \\{\\
26-
/^\.TP 12n\n\\fB\\-c\\fR.*\\fIclass\\fR$/!i\
26+
/^\.TP 8n\n\\fB\\-c\\fR.*\\fIclass\\fR$/!i\
2727
.\\}
2828
}
2929
}
30-
/^\.TP 12n\n\\fB\\-r\\fR.*\\fIrole\\fR$/,/^\.TP 12n/ {
31-
/^\.TP 12n/ {
32-
/^\.TP 12n\n\\fB\\-r\\fR.*\\fIrole\\fR$/i\
30+
/^\.TP 8n\n\\fB\\-r\\fR.*\\fIrole\\fR$/,/^\.TP 8n/ {
31+
/^\.TP 8n/ {
32+
/^\.TP 8n\n\\fB\\-r\\fR.*\\fIrole\\fR$/i\
3333
.if \\n(SL \\{\\
34-
/^\.TP 12n\n\\fB\\-r\\fR.*\\fIrole\\fR$/!i\
34+
/^\.TP 8n\n\\fB\\-r\\fR.*\\fIrole\\fR$/!i\
3535
.\\}
3636
}
3737
}
38-
/^\.TP 12n\n\\fB\\-t\\fR.*\\fItype\\fR$/,/^\.TP 12n/ {
39-
/^\.TP 12n/ {
40-
/^\.TP 12n\n\\fB\\-t\\fR.*\\fItype\\fR$/i\
38+
/^\.TP 8n\n\\fB\\-t\\fR.*\\fItype\\fR$/,/^\.TP 8n/ {
39+
/^\.TP 8n/ {
40+
/^\.TP 8n\n\\fB\\-t\\fR.*\\fItype\\fR$/i\
4141
.if \\n(SL \\{\\
42-
/^\.TP 12n\n\\fB\\-t\\fR.*\\fItype\\fR$/!i\
42+
/^\.TP 8n\n\\fB\\-t\\fR.*\\fItype\\fR$/!i\
4343
.\\}
4444
}
4545
}

docs/sudoers.man.in

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
2323
.\"
2424
.nr SL @SEMAN@
25+
.nr AA @AAMAN@
2526
.nr BA @BAMAN@
2627
.nr LC @LCMAN@
2728
.nr PS @PSMAN@
@@ -1387,20 +1388,28 @@ Cmnd_Spec ::= Runas_Spec? Option_Spec* (Tag_Spec ':')* Cmnd
13871388
Runas_Spec ::= '(' Runas_List? (':' Runas_List)? ')'
13881389

13891390
.ie \n(SL \{\
1390-
.ie \n(PS Option_Spec ::= (SELinux_Spec | Solaris_Priv_Spec | Date_Spec | Timeout_Spec)
1391-
.el Option_Spec ::= (SELinux_Spec | Date_Spec | Timeout_Spec)
1391+
.ie \n(PS Option_Spec ::= (SELinux_Spec | Solaris_Priv_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)
1392+
.el Option_Spec ::= (SELinux_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)
13921393
.\}
13931394
.el \{\
1394-
.ie \n(PS Option_Spec ::= (Solaris_Priv_Spec | Date_Spec | Timeout_Spec)
1395-
.el Option_Spec ::= (Date_Spec | Timeout_Spec)
1395+
.ie \n(AA \{\
1396+
.ie \n(PS Option_Spec ::= (AppArmor_Spec | Solaris_Priv_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)
1397+
.el Option_Spec ::= (AppArmor_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)
1398+
.\}
1399+
.el \{\
1400+
.ie \n(PS Option_Spec ::= (Solaris_Priv_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)
1401+
.el Option_Spec ::= (Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)
1402+
.\}
13961403
.\}
13971404

13981405
.if \n(SL \{\
13991406
SELinux_Spec ::= ('ROLE=role' | 'TYPE=type')
14001407

14011408
.\}
1409+
.if \n(AA \{\
14021410
AppArmor_Spec ::= 'APPARMOR_PROFILE=profile'
14031411

1412+
.\}
14041413
.if \n(PS \{\
14051414
Solaris_Priv_Spec ::= ('PRIVS=privset' | 'LIMITPRIVS=privset')
14061415

@@ -1622,7 +1631,9 @@ Options may consist of
16221631
.if \n(SL \{\
16231632
SELinux roles and/or types,
16241633
.\}
1634+
.if \n(AA \{\
16251635
AppArmor profiles,
1636+
.\}
16261637
.if \n(PS \{\
16271638
Solaris privileges sets,
16281639
.\}
@@ -1653,6 +1664,7 @@ A role or type specified on the command line,
16531664
however, will supersede the values in
16541665
\fIsudoers\fR.
16551666
.\}
1667+
.if \n(AA \{\
16561668
.SS "AppArmor_Spec"
16571669
On systems supporting AppArmor,
16581670
\fIsudoers\fR
@@ -1711,6 +1723,7 @@ and user
17111723
to run
17121724
\fI/bin/ls\fR
17131725
without any confinement at all.
1726+
.\}
17141727
.if \n(PS \{\
17151728
.SS "Solaris_Priv_Spec"
17161729
On Solaris systems,
@@ -4255,7 +4268,7 @@ will set the umask to be the union of the user's umask and what is specified in
42554268
This flag is
42564269
\fI@umask_override@\fR
42574270
by default.
4258-
.if \n(BA \{\
4271+
.if \n(LC \{\
42594272
.TP 18n
42604273
use_loginclass
42614274
If set,
@@ -4519,6 +4532,7 @@ The umask setting in PAM is not used for
45194532
which does not create a new PAM session.
45204533
.PP
45214534
\fBStrings\fR:
4535+
.if \n(AA \{\
45224536
.TP 18n
45234537
apparmor_profile
45244538
The default AppArmor profile to transition into when executing the
@@ -4532,6 +4546,7 @@ entries by specifying the
45324546
option.
45334547
This option is only available when sudo is built with AppArmor
45344548
support.
4549+
.\}
45354550
.TP 18n
45364551
cmddenial_message
45374552
.br

docs/sudoers.man.in.sed

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
s/^\(.TH .*\)/.nr SL @SEMAN@\
2+
.nr AA @AAMAN@\
23
.nr BA @BAMAN@\
34
.nr LC @LCMAN@\
45
.nr PS @PSMAN@\
@@ -21,6 +22,15 @@ s/^\(.TH .*\)/.nr SL @SEMAN@\
2122
}
2223
}
2324

25+
/^\.SS "AppArmor_Spec"$/,/^\.SS/ {
26+
/^\.SS / {
27+
/^\.SS "AppArmor_Spec"$/i\
28+
.if \\n(AA \\{\\
29+
/^\.SS "AppArmor_Spec"$/!i\
30+
.\\}
31+
}
32+
}
33+
2434
/^\.SS "Solaris_Priv_Spec"$/,/^\.SS/ {
2535
/^\.SS / {
2636
/^\.SS "Solaris_Priv_Spec"$/i\
@@ -32,12 +42,18 @@ s/^\(.TH .*\)/.nr SL @SEMAN@\
3242

3343
/^Option_Spec ::= / {
3444
s/^.*$/.ie \\n(SL \\{\\\
35-
.ie \\n(PS Option_Spec ::= (SELinux_Spec | Solaris_Priv_Spec | Date_Spec | Timeout_Spec)\
36-
.el Option_Spec ::= (SELinux_Spec | Date_Spec | Timeout_Spec)\
45+
.ie \\n(PS Option_Spec ::= (SELinux_Spec | Solaris_Priv_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)\
46+
.el Option_Spec ::= (SELinux_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)\
47+
.\\}\
48+
.el \\{\\\
49+
.ie \\n(AA \\{\\\
50+
.ie \\n(PS Option_Spec ::= (AppArmor_Spec | Solaris_Priv_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)\
51+
.el Option_Spec ::= (AppArmor_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)\
3752
.\\}\
3853
.el \\{\\\
39-
.ie \\n(PS Option_Spec ::= (Solaris_Priv_Spec | Date_Spec | Timeout_Spec)\
40-
.el Option_Spec ::= (Date_Spec | Timeout_Spec)\
54+
.ie \\n(PS Option_Spec ::= (Solaris_Priv_Spec | Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)\
55+
.el Option_Spec ::= (Date_Spec | Timeout_Spec | Chdir_Spec | Chroot_Spec)\
56+
.\\}\
4157
.\\}/
4258
}
4359

@@ -49,6 +65,14 @@ s/^\(.TH .*\)/.nr SL @SEMAN@\
4965
.\\}
5066
}
5167

68+
/^AppArmor_Spec ::=/ {
69+
i\
70+
.if \\n(AA \\{\\
71+
N
72+
a\
73+
.\\}
74+
}
75+
5276
/^Solaris_Priv_Spec ::=/ {
5377
i\
5478
.if \\n(PS \\{\\
@@ -64,6 +88,13 @@ s/^\(.TH .*\)/.nr SL @SEMAN@\
6488
.\\}
6589
}
6690

91+
/^AppArmor profiles,/ {
92+
i\
93+
.if \\n(AA \\{\\
94+
a\
95+
.\\}
96+
}
97+
6798
/^Solaris privileges sets,/ {
6899
i\
69100
.if \\n(PS \\{\\
@@ -76,8 +107,16 @@ s/^\(.TH .*\)/.nr SL @SEMAN@\
76107
/^\.TP 18n\nuse_loginclass$/,/^\.TP 18n/ {
77108
/^\.TP 18n/ {
78109
/^\.TP 18n\nuse_loginclass$/i\
79-
.if \\n(BA \\{\\
110+
.if \\n(LC \\{\\
80111
/^\.TP 18n\nuse_loginclass$/!i\
112+
.\\}
113+
}
114+
}
115+
/^\.TP 18n\napparmor_profile$/,/^\.TP 18n/ {
116+
/^\.TP 18n/ {
117+
/^\.TP 18n\napparmor_profile$/i\
118+
.if \\n(AA \\{\\
119+
/^\.TP 18n\napparmor_profile$/!i\
81120
.\\}
82121
}
83122
}

0 commit comments

Comments
 (0)