robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:8f2cd47: runtime(sudoers): update filetype plugin and syntax script (#38262)4558fc02de

master
38.2 KiB578 linesraw
1" Vim syntax file
2" Language:             sudoers(5) configuration files
3" Maintainer:           Eisuke Kawashima ( e.kawaschima+vim AT gmail.com )
4" Previous Maintainer:  Nikolai Weibull <now@bitwi.se>
5" Latest Change:        2026 Mar 11
6
7if exists("b:current_syntax")
8  finish
9endif
10
11let s:cpo_save = &cpo
12set cpo&vim
13
14" TODO: instead of 'skipnl', we would like to match a specific group that would
15" match \\$ and then continue with the nextgroup, actually, the skipnl doesn't
16" work...
17" TODO: treat 'ALL' like a special (yay, a bundle of new rules!!!)
18
19syn match   sudoersUserSpec '^' nextgroup=@sudoersUserInSpec skipwhite
20
21syn match   sudoersSpecEquals         contained '=' nextgroup=@sudoersCmndSpecList skipwhite
22
23syn cluster sudoersCmndSpecList       contains=sudoersUserRunasBegin,sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec
24
25syn keyword sudoersTodo               contained TODO FIXME XXX NOTE
26
27syn region  sudoersComment            display oneline start='#' end='$' contains=sudoersTodo
28syn region  sudoersInclude            display oneline start='[#@]\%(include\|includedir\)\s\+\S\+' end='$'
29
30syn keyword sudoersAlias              User_Alias Runas_Alias nextgroup=sudoersUserAlias skipwhite skipnl
31syn keyword sudoersAlias              Host_Alias nextgroup=sudoersHostAlias skipwhite skipnl
32syn keyword sudoersAlias              Cmnd_Alias nextgroup=sudoersCmndAlias skipwhite skipnl
33
34syn match   sudoersUserAlias          contained '\<\u[A-Z0-9_]*\>'  nextgroup=sudoersUserAliasEquals  skipwhite skipnl
35syn match   sudoersUserNameInList     contained '\<\l[-a-z0-9_]*\>' nextgroup=@sudoersUserList        skipwhite skipnl
36syn match   sudoersUIDInList          contained '#\d\+\>'           nextgroup=@sudoersUserList        skipwhite skipnl
37syn match   sudoersGroupInList        contained '%\l[-a-z0-9_]*\>'  nextgroup=@sudoersUserList        skipwhite skipnl
38syn match   sudoersGIDInList          contained '%#\d\+\>'          nextgroup=@sudoersUserList        skipwhite skipnl
39syn match   sudoersUserNetgroupInList contained '+\l[-a-z0-9_]*\>'  nextgroup=@sudoersUserList        skipwhite skipnl
40syn match   sudoersUserAliasInList    contained '\<\u[A-Z0-9_]*\>'  nextgroup=@sudoersUserList        skipwhite skipnl
41syn keyword sudoersUserAllInList      contained ALL                 nextgroup=@sudoersUserList        skipwhite skipnl
42
43syn match   sudoersUserName           contained '\<\l[-a-z0-9_]*\>' nextgroup=sudoersUserComma,@sudoersParameter       skipwhite skipnl
44syn match   sudoersUID                contained '#\d\+\>'           nextgroup=sudoersUserComma,@sudoersParameter       skipwhite skipnl
45syn match   sudoersGroup              contained '%\l[-a-z0-9_]*\>'  nextgroup=sudoersUserComma,@sudoersParameter       skipwhite skipnl
46syn match   sudoersGID                contained '%#\d\+\>'          nextgroup=sudoersUserComma,@sudoersParameter       skipwhite skipnl
47syn match   sudoersUserNetgroup       contained '+\l[-a-z0-9_]*\>'  nextgroup=sudoersUserComma,@sudoersParameter       skipwhite skipnl
48syn match   sudoersUserAliasRef       contained '\<\u[A-Z0-9_]*\>'  nextgroup=sudoersUserComma,@sudoersParameter       skipwhite skipnl
49syn keyword sudoersUserAll            contained ALL                 nextgroup=sudoersUserComma,@sudoersParameter       skipwhite skipnl
50syn match   sudoersUserComma          contained ','                 nextgroup=sudoersUserNegation,sudoersUserName,sudoersUID,sudoersGroup,sudoersGID,sudoersUserNetgroup,sudoersUserAliasRef,sudoersUserAll skipwhite skipnl
51
52syn match   sudoersUserNameInSpec     contained '\<\l[-a-z0-9_]*\>' nextgroup=@sudoersUserSpec        skipwhite skipnl
53syn region  sudoersUIDInSpec          display oneline start='#\d\+\>' end='' nextgroup=@sudoersUserSpec skipwhite skipnl
54syn match   sudoersGroupInSpec        contained '%\l[-a-z0-9_]*\>'  nextgroup=@sudoersUserSpec        skipwhite skipnl
55syn match   sudoersGIDInSpec          contained '%#\d\+\>'          nextgroup=@sudoersUserSpec        skipwhite skipnl
56syn match   sudoersUserNetgroupInSpec contained '+\l[-a-z0-9_]*\>'  nextgroup=@sudoersUserSpec        skipwhite skipnl
57syn match   sudoersUserAliasInSpec    contained '\<\u[A-Z0-9_]*\>'  nextgroup=@sudoersUserSpec        skipwhite skipnl
58syn keyword sudoersUserAllInSpec      contained ALL                 nextgroup=@sudoersUserSpec        skipwhite skipnl
59
60syn match   sudoersUserNameInRunas    contained '\<\l[-a-z0-9_]*\>' nextgroup=@sudoersUserRunas       skipwhite skipnl
61syn match   sudoersUIDInRunas         contained '#\d\+\>'           nextgroup=@sudoersUserRunas       skipwhite skipnl
62syn match   sudoersGroupInRunas       contained '%\l[-a-z0-9_]*\>'  nextgroup=@sudoersUserRunas       skipwhite skipnl
63syn match   sudoersGIDInRunas         contained '%#\d\+\>'          nextgroup=@sudoersUserRunas       skipwhite skipnl
64syn match   sudoersUserNetgroupInRunas contained '+\l[-a-z0-9_]*\>' nextgroup=@sudoersUserRunas       skipwhite skipnl
65syn match   sudoersUserAliasInRunas   contained '\<\u[A-Z0-9_]*\>'  nextgroup=@sudoersUserRunas       skipwhite skipnl
66syn keyword sudoersUserAllInRunas     contained ALL                 nextgroup=@sudoersUserRunas       skipwhite skipnl
67
68syn match   sudoersHostAlias          contained '\<\u[A-Z0-9_]*\>'  nextgroup=sudoersHostAliasEquals  skipwhite skipnl
69syn match   sudoersHostNameInList     contained '\<\l[a-z0-9_-]*\>' nextgroup=@sudoersHostList        skipwhite skipnl
70syn match   sudoersIPAddrInList       contained '\<\%(\d\{1,3}\.\)\{3}\d\{1,3}\>' nextgroup=@sudoersHostList skipwhite skipnl
71syn match   sudoersNetworkInList      contained '\<\%(\d\{1,3}\.\)\{3}\d\{1,3}\%(/\%(\%(\d\{1,3}\.\)\{3}\d\{1,3}\|\d\+\)\)\=\>' nextgroup=@sudoersHostList skipwhite skipnl
72syn match   sudoersHostNetgroupInList contained '+\l\+\>'           nextgroup=@sudoersHostList        skipwhite skipnl
73syn match   sudoersHostAliasInList    contained '\<\u[A-Z0-9_]*\>'  nextgroup=@sudoersHostList        skipwhite skipnl
74
75syn match   sudoersHostName           contained '\<\l[a-z0-9_-]*\>'           nextgroup=sudoersHostComma,@sudoersParameter skipwhite skipnl
76syn match   sudoersIPAddr             contained '\<\%(\d\{1,3}\.\)\{3}\d\{1,3}\>' nextgroup=sudoersHostComma,@sudoersParameter skipwhite skipnl
77syn match   sudoersNetwork            contained '\<\%(\d\{1,3}\.\)\{3}\d\{1,3}/\%(\%(\d\{1,3}\.\)\{3}\d\{1,3}\|\d\+\)\>' nextgroup=sudoersHostComma,@sudoersParameter skipwhite skipnl
78syn match   sudoersHostNetgroup       contained '+\l\+\>'           nextgroup=sudoersHostComma,@sudoersParameter       skipwhite skipnl
79syn match   sudoersHostAliasRef       contained '\<\u[A-Z0-9_]*\>'  nextgroup=sudoersHostComma,@sudoersParameter       skipwhite skipnl
80syn keyword sudoersHostAll            contained ALL                 nextgroup=sudoersHostComma,@sudoersParameter       skipwhite skipnl
81syn match   sudoersHostComma          contained ','                 nextgroup=sudoersHostNegation,sudoersHostName,sudoersIPAddr,sudoersNetwork,sudoersHostNetgroup,sudoersHostAliasRef,sudoersHostAll skipwhite skipnl
82
83syn match   sudoersCmndName           contained '/[/A-Za-z0-9._-]\+' nextgroup=sudoersCmndComma,@sudoersParameter skipwhite skipnl
84syn keyword sudoersCmndSpecial        contained list sudoedit ALL    nextgroup=sudoersCmndComma,@sudoersParameter skipwhite skipnl
85syn match   sudoersCmndAliasRef       contained '\<\u[A-Z0-9_]*\>'   nextgroup=sudoersCmndComma,@sudoersParameter skipwhite skipnl
86syn match   sudoersCmndComma          contained ','                  nextgroup=sudoersCmndNegation,sudoersCmndName,sudoersCmndSpecial,sudoersCmndAliasRef skipwhite skipnl
87
88syn match   sudoersHostNameInSpec     contained '\<\l[a-z0-9_-]*\>' nextgroup=@sudoersHostSpec        skipwhite skipnl
89syn match   sudoersIPAddrInSpec       contained '\<\%(\d\{1,3}\.\)\{3}\d\{1,3}\>' nextgroup=@sudoersHostSpec skipwhite skipnl
90syn match   sudoersNetworkInSpec      contained '\<\%(\d\{1,3}\.\)\{3}\d\{1,3}/\%(\%(\d\{1,3}\.\)\{3}\d\{1,3}\|\d\+\)\>' nextgroup=@sudoersHostSpec skipwhite skipnl
91syn match   sudoersHostNetgroupInSpec contained '+\l\+\>'           nextgroup=@sudoersHostSpec        skipwhite skipnl
92syn match   sudoersHostAliasInSpec    contained '\<\u[A-Z0-9_]*\>'  nextgroup=@sudoersHostSpec        skipwhite skipnl
93syn keyword sudoersHostAllInSpec      contained ALL                 nextgroup=@sudoersHostSpec        skipwhite skipnl
94
95syn match   sudoersCmndAlias          contained '\<\u[A-Z0-9_]*\>'  nextgroup=sudoersCmndAliasEquals  skipwhite skipnl
96syn match   sudoersCmndNameInList     contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=@sudoersCmndList,sudoersCommandEmpty,sudoersCommandArgs skipwhite
97syn match   sudoersCmndAliasInList    contained '\<\u[A-Z0-9_]*\>'  nextgroup=@sudoersCmndList        skipwhite skipnl
98
99syn match   sudoersCmndNameInSpec     contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=@sudoersCmndSpec,sudoersCommandEmptyInSpec,sudoersCommandArgsInSpec skipwhite
100syn match   sudoersCmndAliasInSpec    contained '\<\u[A-Z0-9_]*\>'  nextgroup=@sudoersCmndSpec        skipwhite skipnl
101syn keyword sudoersCmndSpecialInSpec  contained list sudoedit ALL   nextgroup=@sudoersCmndSpec        skipwhite skipnl
102
103syn keyword sudoersCmndDigestInList   contained sha224 sha256 sha384 sha512 nextgroup=sudoersCmndDigestColon  skipwhite skipnl
104syn match   sudoersCmndDigestColon    contained ':' nextgroup=sudoersDigestHex,sudoersDigestBase64 skipwhite skipnl
105syn match   sudoersDigestHex          contained '\<\x\+\>'            nextgroup=sudoersCmndDigestComma,sudoersCmndNegationInList,sudoersCmndNameInList,sudoersCmndAliasInList skipwhite skipnl
106syn match   sudoersDigestBase64       contained '\<[A-Za-z0-9+/]\+=*' nextgroup=sudoersCmndDigestComma,sudoersCmndNegationInList,sudoersCmndNameInList,sudoersCmndAliasInList skipwhite skipnl
107syn match   sudoersCmndDigestComma    contained ',' nextgroup=sudoersCmndDigestInList skipwhite skipnl
108
109syn match   sudoersUserAliasEquals  contained '=' nextgroup=@sudoersUserInList  skipwhite skipnl
110syn match   sudoersUserListComma    contained ',' nextgroup=@sudoersUserInList  skipwhite skipnl
111syn match   sudoersUserListColon    contained ':' nextgroup=sudoersUserAlias    skipwhite skipnl
112syn cluster sudoersUserList         contains=sudoersUserListComma,sudoersUserListColon
113
114syn match   sudoersUserSpecComma    contained ',' nextgroup=@sudoersUserInSpec  skipwhite skipnl
115syn cluster sudoersUserSpec         contains=sudoersUserSpecComma,@sudoersHostInSpec
116
117syn match   sudoersUserRunasBegin   contained '(' nextgroup=@sudoersUserInRunas,sudoersUserRunasColon,sudoersUserRunasEnd skipwhite skipnl
118syn match   sudoersUserRunasComma   contained ',' nextgroup=@sudoersUserInRunas skipwhite skipnl
119syn match   sudoersUserRunasColon   contained ':' nextgroup=@sudoersUserInRunas,sudoersUserRunasEnd skipwhite skipnl
120syn match   sudoersUserRunasEnd     contained ')' nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
121syn cluster sudoersUserRunas        contains=sudoersUserRunasComma,sudoersUserRunasColon,@sudoersUserInRunas,sudoersUserRunasEnd
122
123
124syn match   sudoersHostAliasEquals  contained '=' nextgroup=@sudoersHostInList  skipwhite skipnl
125syn match   sudoersHostListComma    contained ',' nextgroup=@sudoersHostInList  skipwhite skipnl
126syn match   sudoersHostListColon    contained ':' nextgroup=sudoersHostAlias    skipwhite skipnl
127syn cluster sudoersHostList         contains=sudoersHostListComma,sudoersHostListColon
128
129syn match   sudoersHostSpecComma    contained ',' nextgroup=@sudoersHostInSpec  skipwhite skipnl
130syn cluster sudoersHostSpec         contains=sudoersHostSpecComma,sudoersSpecEquals
131
132
133syn match   sudoersCmndAliasEquals  contained '=' nextgroup=@sudoersCmndInList  skipwhite skipnl
134syn match   sudoersCmndListComma    contained ',' nextgroup=@sudoersCmndInList  skipwhite skipnl
135syn match   sudoersCmndListColon    contained ':' nextgroup=sudoersCmndAlias    skipwhite skipnl
136syn cluster sudoersCmndList         contains=sudoersCmndListComma,sudoersCmndListColon
137
138syn match   sudoersCmndSpecComma    contained ',' nextgroup=@sudoersCmndSpecList skipwhite skipnl
139syn match   sudoersCmndSpecColon    contained ':' nextgroup=@sudoersHostInSpec   skipwhite skipnl
140syn cluster sudoersCmndSpec         contains=sudoersCmndSpecComma,sudoersCmndSpecColon
141
142syn cluster sudoersUserInList       contains=sudoersUserNegationInList,sudoersUserNameInList,sudoersUIDInList,sudoersGroupInList,sudoersGIDInList,sudoersUserNetgroupInList,sudoersUserAliasInList,sudoersUserAllInList
143syn cluster sudoersHostInList       contains=sudoersHostNegationInList,sudoersHostNameInList,sudoersIPAddrInList,sudoersNetworkInList,sudoersHostNetgroupInList,sudoersHostAliasInList
144syn cluster sudoersCmndInList       contains=sudoersCmndDigestInList,sudoersCmndNegationInList,sudoersCmndNameInList,sudoersCmndAliasInList
145
146syn cluster sudoersUser             contains=sudoersUserNegation,sudoersUserName,sudoersUID,sudoersGroup,sudoersGID,sudoersUserNetgroup,sudoersUserAliasRef,sudoersUserAll
147syn cluster sudoersHost             contains=sudoersHostNegation,sudoersHostName,sudoersIPAddr,sudoersNetwork,sudoersHostNetgroup,sudoersHostAll,sudoersHostAliasRef
148syn cluster sudoersCmnd             contains=sudoersCmndNegation,sudoersCmndName,sudoersCmndSpecial,sudoersCmndAliasRef
149
150syn cluster sudoersUserInSpec       contains=sudoersUserNegationInSpec,sudoersUserNameInSpec,sudoersUIDInSpec,sudoersGroupInSpec,sudoersGIDInSpec,sudoersUserNetgroupInSpec,sudoersUserAliasInSpec,sudoersUserAllInSpec
151syn cluster sudoersHostInSpec       contains=sudoersHostNegationInSpec,sudoersHostNameInSpec,sudoersIPAddrInSpec,sudoersNetworkInSpec,sudoersHostNetgroupInSpec,sudoersHostAliasInSpec,sudoersHostAllInSpec
152syn cluster sudoersUserInRunas      contains=sudoersUserNegationInRunas,sudoersUserNameInRunas,sudoersUIDInRunas,sudoersGroupInRunas,sudoersGIDInRunas,sudoersUserNetgroupInRunas,sudoersUserAliasInRunas,sudoersUserAllInRunas
153syn cluster sudoersCmndInSpec       contains=sudoersCmndNegationInSpec,sudoersCmndNameInSpec,sudoersCmndAliasInSpec,sudoersCmndSpecialInSpec
154
155syn match   sudoersUserNegationInList contained '!\+' nextgroup=@sudoersUserInList  skipwhite skipnl
156syn match   sudoersHostNegationInList contained '!\+' nextgroup=@sudoersHostInList  skipwhite skipnl
157syn match   sudoersCmndNegationInList contained '!\+' nextgroup=@sudoersCmndInList  skipwhite skipnl
158
159syn match   sudoersUserNegation       contained '!\+' nextgroup=@sudoersUser        skipwhite skipnl
160syn match   sudoersHostNegation       contained '!\+' nextgroup=@sudoersHost        skipwhite skipnl
161syn match   sudoersCmndNegation       contained '!\+' nextgroup=@sudoersCmnd        skipwhite skipnl
162
163syn match   sudoersUserNegationInSpec contained '!\+' nextgroup=@sudoersUserInSpec  skipwhite skipnl
164syn match   sudoersHostNegationInSpec contained '!\+' nextgroup=@sudoersHostInSpec  skipwhite skipnl
165syn match   sudoersUserNegationInRunas contained '!\+' nextgroup=@sudoersUserInRunas skipwhite skipnl
166syn match   sudoersCmndNegationInSpec contained '!\+' nextgroup=@sudoersCmndInSpec  skipwhite skipnl
167
168syn match   sudoersCommandArgs      contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersCommandArgs,@sudoersCmndList skipwhite
169syn match   sudoersCommandEmpty     contained '""' nextgroup=@sudoersCmndList skipwhite skipnl
170
171syn match   sudoersCommandArgsInSpec contained '[^[:space:],:=\\]\+\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersCommandArgsInSpec,@sudoersCmndSpec skipwhite
172syn match   sudoersCommandEmptyInSpec contained '""' nextgroup=@sudoersCmndSpec skipwhite skipnl
173
174syn keyword sudoersDefaultEntry Defaults nextgroup=sudoersDefaultTypeAt,sudoersDefaultTypeColon,sudoersDefaultTypeGreaterThan,sudoersDefaultTypeBang,sudoersDefaultTypeAny
175syn match   sudoersDefaultTypeAt          contained '@' nextgroup=@sudoersHost skipwhite skipnl
176syn match   sudoersDefaultTypeColon       contained ':' nextgroup=@sudoersUser skipwhite skipnl
177syn match   sudoersDefaultTypeGreaterThan contained '>' nextgroup=@sudoersUser skipwhite skipnl
178syn match   sudoersDefaultTypeBang        contained '!' nextgroup=@sudoersCmnd skipwhite skipnl
179syn match   sudoersDefaultTypeAny         contained '\s' nextgroup=@sudoersParameter skipwhite skipnl
180
181" TODO: could also deal with special characters here
182syn match   sudoersParameterNegation contained '!\+' nextgroup=sudoersBooleanParameter,sudoersIntegerOrBooleanParameter,sudoersModeOrBooleanParameter,sudoersFloatOrBooleanParameter,sudoersTimeoutOrBooleanParameter,sudoersStringOrBooleanParameter,sudoersListParameter skipwhite skipnl
183syn keyword sudoersBooleanParameter contained skipwhite skipnl
184                                  \ nextgroup=sudoersParameterListComma
185                                  \ always_query_group_plugin
186                                  \ always_set_home
187                                  \ authenticate
188                                  \ case_insensitive_group
189                                  \ case_insensitive_user
190                                  \ closefrom_override
191                                  \ compress_io
192                                  \ env_editor
193                                  \ env_reset
194                                  \ exec_background
195                                  \ fast_glob
196                                  \ fqdn
197                                  \ ignore_audit_errors
198                                  \ ignore_dot
199                                  \ ignore_iolog_errors
200                                  \ ignore_local_sudoers
201                                  \ ignore_logfile_errors
202                                  \ ignore_unknown_defaults
203                                  \ insults
204                                  \ intercept
205                                  \ intercept_allow_setid
206                                  \ intercept_authenticate
207                                  \ intercept_verify
208                                  \ iolog_flush
209                                  \ log_allowed
210                                  \ log_denied
211                                  \ log_exit_status
212                                  \ log_host
213                                  \ log_input
214                                  \ log_output
215                                  \ log_passwords
216                                  \ log_server_keepalive
217                                  \ log_server_verify
218                                  \ log_stderr
219                                  \ log_stdin
220                                  \ log_stdout
221                                  \ log_subcmds
222                                  \ log_ttyin
223                                  \ log_ttyout
224                                  \ log_year
225                                  \ long_otp_prompt
226                                  \ mail_all_cmnds
227                                  \ mail_always
228                                  \ mail_badpass
229                                  \ mail_no_host
230                                  \ mail_no_perms
231                                  \ mail_no_user
232                                  \ match_group_by_gid
233                                  \ netgroup_tuple
234                                  \ noexec
235                                  \ noninteractive_auth
236                                  \ pam_acct_mgmt
237                                  \ pam_rhost
238                                  \ pam_ruser
239                                  \ pam_session
240                                  \ pam_setcred
241                                  \ pam_silent
242                                  \ passprompt_override
243                                  \ path_info
244                                  \ preserve_groups
245                                  \ pwfeedback
246                                  \ requiretty
247                                  \ root_sudo
248                                  \ rootpw
249                                  \ runas_allow_unknown_id
250                                  \ runas_check_shell
251                                  \ runaspw
252                                  \ selinux
253                                  \ set_home
254                                  \ set_logname
255                                  \ set_utmp
256                                  \ setenv
257                                  \ shell_noargs
258                                  \ stay_setuid
259                                  \ sudoedit_checkdir
260                                  \ sudoedit_follow
261                                  \ syslog_pid
262                                  \ targetpw
263                                  \ tty_tickets
264                                  \ umask_override
265                                  \ use_loginclass
266                                  \ use_netgroups
267                                  \ use_pty
268                                  \ user_command_timeouts
269                                  \ utmp_runas
270                                  \ visiblepw
271
272syn keyword sudoersIntegerParameter contained
273                                  \ nextgroup=sudoersIntegerParameterEquals
274                                  \ skipwhite skipnl
275                                  \ closefrom
276                                  \ maxseq
277                                  \ passwd_tries
278                                  \ syslog_maxlen
279
280syn keyword sudoersIntegerOrBooleanParameter contained
281                                  \ nextgroup=sudoersIntegerParameterEquals,sudoersParameterListComma
282                                  \ skipwhite skipnl
283                                  \ loglinelen
284
285syn keyword sudoersFloatOrBooleanParameter contained
286                                  \ nextgroup=sudoersFloatParameterEquals,sudoersParameterListComma
287                                  \ skipwhite skipnl
288                                  \ passwd_timeout
289                                  \ timestamp_timeout
290
291syn keyword sudoersModeParameter contained
292                                  \ nextgroup=sudoersModeParameterEquals
293                                  \ skipwhite skipnl
294                                  \ iolog_mode
295
296syn keyword sudoersModeOrBooleanParameter contained
297                                  \ nextgroup=sudoersModeParameterEquals,sudoersParameterListComma
298                                  \ skipwhite skipnl
299                                  \ umask
300
301syn keyword sudoersTimeoutOrBooleanParameter contained
302                                  \ nextgroup=sudoersTimeoutParameterEquals,sudoersParameterListComma
303                                  \ skipwhite skipnl
304                                  \ command_timeout
305                                  \ log_server_timeout
306
307syn keyword sudoersStringParameter  contained
308                                  \ nextgroup=sudoersStringParameterEquals
309                                  \ skipwhite skipnl
310                                  \ apparmor_profile
311                                  \ askpass
312                                  \ authfail_message
313                                  \ badpass_message
314                                  \ cmddenial_message
315                                  \ group_plugin
316                                  \ intercept_type
317                                  \ iolog_file
318                                  \ limitprivs
319                                  \ log_format
320                                  \ mailsub
321                                  \ noexec_file
322                                  \ pam_askpass_service
323                                  \ pam_login_service
324                                  \ pam_service
325                                  \ passprompt
326                                  \ privs
327                                  \ role
328                                  \ runas_default
329                                  \ sudoers_locale
330                                  \ timestamp_type
331                                  \ timestampowner
332                                  \ type
333
334syn keyword sudoersStringOrBooleanParameter contained
335                                  \ nextgroup=sudoersStringParameterEquals,sudoersParameterListComma
336                                  \ skipwhite skipnl
337                                  \ admin_flag
338                                  \ editor
339                                  \ env_file
340                                  \ exempt_group
341                                  \ fdexec
342                                  \ iolog_dir
343                                  \ iolog_group
344                                  \ iolog_user
345                                  \ lecture
346                                  \ lecture_file
347                                  \ lecture_status_dir
348                                  \ listpw
349                                  \ log_server_cabundle
350                                  \ log_server_peer_cert
351                                  \ log_server_peer_key
352                                  \ logfile
353                                  \ mailerflags
354                                  \ mailerpath
355                                  \ mailfrom
356                                  \ mailto
357                                  \ restricted_env_file
358                                  \ rlimit_as
359                                  \ rlimit_core
360                                  \ rlimit_cpu
361                                  \ rlimit_data
362                                  \ rlimit_fsize
363                                  \ rlimit_locks
364                                  \ rlimit_memlock
365                                  \ rlimit_nofile
366                                  \ rlimit_nproc
367                                  \ rlimit_rss
368                                  \ rlimit_stack
369                                  \ runcwd
370                                  \ secure_path
371                                  \ syslog
372                                  \ syslog_badpri
373                                  \ syslog_goodpri
374                                  \ timestampdir
375                                  \ verifypw
376
377syn keyword sudoersListParameter    contained
378                                  \ nextgroup=sudoersListParameterEquals,sudoersParameterListComma
379                                  \ skipwhite skipnl
380                                  \ env_check
381                                  \ env_delete
382                                  \ env_keep
383                                  \ log_servers
384                                  \ passprompt_regex
385
386syn match   sudoersParameterListComma contained ',' nextgroup=@sudoersParameter skipwhite skipnl
387
388syn cluster sudoersParameter        contains=sudoersParameterNegation,sudoersBooleanParameter,sudoersIntegerParameter,sudoersIntegerOrBooleanParameter,sudoersModeParameter,sudoersModeOrBooleanParameter,sudoersFloatOrBooleanParameter,sudoersTimeoutOrBooleanParameter,sudoersStringParameter,sudoersStringOrBooleanParameter,sudoersListParameter
389
390syn match   sudoersIntegerParameterEquals contained       '=' nextgroup=sudoersIntegerValue skipwhite skipnl
391syn match   sudoersModeParameterEquals    contained       '=' nextgroup=sudoersModeValue    skipwhite skipnl
392syn match   sudoersFloatParameterEquals   contained       '=' nextgroup=sudoersFloatValue   skipwhite skipnl
393syn match   sudoersTimeoutParameterEquals contained       '=' nextgroup=sudoersTimeoutValue skipwhite skipnl
394syn match   sudoersStringParameterEquals  contained       '=' nextgroup=sudoersStringValue  skipwhite skipnl
395syn match   sudoersListParameterEquals    contained '[+-]\==' nextgroup=sudoersListValue    skipwhite skipnl
396
397syn match   sudoersIntegerValue contained '\<\d\+\>' nextgroup=sudoersParameterListComma skipwhite skipnl
398syn match   sudoersModeValue    contained '\<\o\+\>' nextgroup=sudoersParameterListComma skipwhite skipnl
399syn match   sudoersFloatValue   contained '-\?\%(\<\d\+\>\|\<\d\+\%(\.\%(\d\+\>\)\?\)\?\|\.\d\+\>\)' nextgroup=sudoersParameterListComma skipwhite skipnl
400syn match   sudoersTimeoutValue contained '\<\d\+\>' nextgroup=sudoersParameterListComma skipwhite skipnl
401syn match   sudoersTimeoutValue contained '\<\%(\d\+[dDhHmMsS]\)\+\>' nextgroup=sudoersParameterListComma skipwhite skipnl
402syn match   sudoersStringValue  contained '\s*\zs[^[:space:],:=\\]*\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersParameterListComma skipwhite skipnl
403syn region  sudoersStringValue  contained start=+\s*\zs"+ skip=+\\"+ end=+"+ nextgroup=sudoersParameterListComma skipwhite skipnl
404syn match   sudoersListValue    contained '\s*\zs[^[:space:],:=\\]*\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersParameterListComma skipwhite skipnl
405syn region  sudoersListValue    contained start=+\s*\zs"+ skip=+\\"+ end=+"+ nextgroup=sudoersParameterListComma skipwhite skipnl
406
407syn keyword sudoersOptionSpec contained ROLE TYPE nextgroup=sudoersSELinuxSpecEquals skipwhite
408syn keyword sudoersOptionSpec contained APPARMOR_PROFILE nextgroup=sudoersAppArmorSpecEquals skipwhite
409syn keyword sudoersOptionSpec contained PRIVS LIMITPRIVS nextgroup=sudoersSolarisPrivSpecEquals skipwhite
410syn keyword sudoersOptionSpec contained NOTBEFORE NOTAFTER nextgroup=sudoersDateSpecEquals skipwhite
411syn keyword sudoersOptionSpec contained TIMEOUT nextgroup=sudoersTimeoutSpecEquals skipwhite
412syn keyword sudoersOptionSpec contained CWD CHROOT nextgroup=sudoersDirectorySpecEquals skipwhite
413
414syn match sudoersSELinuxSpecEquals     contained '=' nextgroup=sudoersSELinuxSpecParam skipwhite skipnl
415syn match sudoersAppArmorSpecEquals    contained '=' nextgroup=sudoersAppArmorSpecParam skipwhite skipnl
416syn match sudoersSolarisPrivSpecEquals contained '=' nextgroup=sudoersSolarisPrivSpecParam skipwhite skipnl
417syn match sudoersDateSpecEquals        contained '=' nextgroup=sudoersDateSpecParam skipwhite skipnl
418syn match sudoersTimeoutSpecEquals     contained '=' nextgroup=sudoersTimeoutSpecParam skipwhite skipnl
419syn match sudoersDirectorySpecEquals   contained '=' nextgroup=sudoersDirectorySpecParam,sudoersDirectorySpecParamError skipwhite skipnl
420
421syn match sudoersSELinuxSpecParam contained /\<[A-Za-z0-9_]\+\>/ nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
422syn match sudoersAppArmorSpecParam contained /\S\+/ nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
423syn match sudoersSolarisPrivSpecParam contained /\S\+/ nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
424syn match sudoersDateSpecParam    contained /\<\d\{10\}\%(\d\d\)\{0,2\}\%(Z\|[+-]\d\{4\}\)\?\>/ nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
425syn match sudoersTimeoutSpecParam contained /\<\d\+\>\|\<\%(\d\+[dDhHmMsS]\)\+\>/ nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
426syn match sudoersDirectorySpecParam contained '[/~]\f*\|\*' nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
427syn match sudoersDirectorySpecParam contained '"\%([/~]\f\{-}\|\*\)"' nextgroup=sudoersOptionSpec,sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
428
429syn keyword sudoersTagSpec contained EXEC NOEXEC FOLLOW NOFOLLOW LOG_INPUT NOLOG_INPUT LOG_OUTPUT NOLOG_OUTPUT MAIL NOMAIL INTERCEPT NOINTERCEPT PASSWD NOPASSWD SETENV NOSETENV nextgroup=sudoersTagSpecColon skipwhite
430syn match sudoersTagSpecColon contained /:/ nextgroup=sudoersTagSpec,@sudoersCmndInSpec skipwhite
431
432hi def link sudoersSpecEquals               Operator
433hi def link sudoersTodo                     Todo
434hi def link sudoersComment                  Comment
435hi def link sudoersAlias                    Keyword
436hi def link sudoersUserAlias                Identifier
437hi def link sudoersUserNameInList           String
438hi def link sudoersUIDInList                Number
439hi def link sudoersGroupInList              PreProc
440hi def link sudoersGIDInList                Number
441hi def link sudoersUserNetgroupInList       PreProc
442hi def link sudoersUserAliasInList          PreProc
443hi def link sudoersUserAllInList            Special
444hi def link sudoersUserName                 String
445hi def link sudoersUID                      Number
446hi def link sudoersGroup                    PreProc
447hi def link sudoersGID                      Number
448hi def link sudoersUserNetgroup             PreProc
449hi def link sudoersUserAliasRef             PreProc
450hi def link sudoersUserAll                  Special
451hi def link sudoersUserComma                Delimiter
452hi def link sudoersUserNameInSpec           String
453hi def link sudoersUIDInSpec                Number
454hi def link sudoersGroupInSpec              PreProc
455hi def link sudoersGIDInSpec                Number
456hi def link sudoersUserNetgroupInSpec       PreProc
457hi def link sudoersUserAliasInSpec          PreProc
458hi def link sudoersUserAllInSpec            Special
459hi def link sudoersUserNameInRunas          String
460hi def link sudoersUIDInRunas               Number
461hi def link sudoersGroupInRunas             PreProc
462hi def link sudoersGIDInRunas               Number
463hi def link sudoersUserNetgroupInRunas      PreProc
464hi def link sudoersUserAliasInRunas         PreProc
465hi def link sudoersUserAllInRunas           Special
466hi def link sudoersHostAlias                Identifier
467hi def link sudoersHostNameInList           String
468hi def link sudoersIPAddrInList             Number
469hi def link sudoersNetworkInList            Number
470hi def link sudoersHostNetgroupInList       PreProc
471hi def link sudoersHostAliasInList          PreProc
472hi def link sudoersHostName                 String
473hi def link sudoersIPAddr                   Number
474hi def link sudoersNetwork                  Number
475hi def link sudoersHostNetgroup             PreProc
476hi def link sudoersHostAll                  Special
477hi def link sudoersHostComma                Delimiter
478hi def link sudoersHostAliasRef             PreProc
479hi def link sudoersCmndName                 String
480hi def link sudoersCmndSpecial              Special
481hi def link sudoersCmndAliasRef             PreProc
482hi def link sudoersCmndComma                Delimiter
483hi def link sudoersHostNameInSpec           String
484hi def link sudoersIPAddrInSpec             Number
485hi def link sudoersNetworkInSpec            Number
486hi def link sudoersHostNetgroupInSpec       PreProc
487hi def link sudoersHostAliasInSpec          PreProc
488hi def link sudoersHostAllInSpec            Special
489hi def link sudoersCmndAlias                Identifier
490hi def link sudoersCmndNameInList           String
491hi def link sudoersCmndAliasInList          PreProc
492hi def link sudoersCmndNameInSpec           String
493hi def link sudoersCmndAliasInSpec          PreProc
494hi def link sudoersCmndSpecialInSpec        Special
495hi def link sudoersCmndDigestInList         Type
496hi def link sudoersCmndDigestColon          Operator
497hi def link sudoersDigestHex                Number
498hi def link sudoersDigestBase64             Number
499hi def link sudoersCmndDigestComma          Delimiter
500hi def link sudoersUserAliasEquals          Operator
501hi def link sudoersUserListComma            Delimiter
502hi def link sudoersUserListColon            Delimiter
503hi def link sudoersUserSpecComma            Delimiter
504hi def link sudoersUserRunasBegin           Delimiter
505hi def link sudoersUserRunasComma           Delimiter
506hi def link sudoersUserRunasColon           Delimiter
507hi def link sudoersUserRunasEnd             Delimiter
508hi def link sudoersHostAliasEquals          Operator
509hi def link sudoersHostListComma            Delimiter
510hi def link sudoersHostListColon            Delimiter
511hi def link sudoersHostSpecComma            Delimiter
512hi def link sudoersCmndAliasEquals          Operator
513hi def link sudoersCmndListComma            Delimiter
514hi def link sudoersCmndListColon            Delimiter
515hi def link sudoersCmndSpecComma            Delimiter
516hi def link sudoersCmndSpecColon            Delimiter
517hi def link sudoersUserNegationInList       Operator
518hi def link sudoersHostNegationInList       Operator
519hi def link sudoersCmndNegationInList       Operator
520hi def link sudoersUserNegation             Operator
521hi def link sudoersHostNegation             Operator
522hi def link sudoersCmndNegation             Operator
523hi def link sudoersUserNegationInSpec       Operator
524hi def link sudoersHostNegationInSpec       Operator
525hi def link sudoersUserNegationInRunas      Operator
526hi def link sudoersCmndNegationInSpec       Operator
527hi def link sudoersCommandArgs              String
528hi def link sudoersCommandEmpty             Special
529hi def link sudoersDefaultEntry             Keyword
530hi def link sudoersDefaultTypeAt            Special
531hi def link sudoersDefaultTypeColon         Special
532hi def link sudoersDefaultTypeGreaterThan   Special
533hi def link sudoersDefaultTypeBang          Special
534hi def link sudoersParameterNegation        Operator
535hi def link sudoersBooleanParameter         Identifier
536hi def link sudoersIntegerParameter         Identifier
537hi def link sudoersIntegerOrBooleanParameter Identifier
538hi def link sudoersModeParameter            Identifier
539hi def link sudoersModeOrBooleanParameter   Identifier
540hi def link sudoersFloatOrBooleanParameter  Identifier
541hi def link sudoersTimeoutOrBooleanParameter Identifier
542hi def link sudoersStringParameter          Identifier
543hi def link sudoersStringOrBooleanParameter Identifier
544hi def link sudoersListParameter            Identifier
545hi def link sudoersParameterListComma       Delimiter
546hi def link sudoersIntegerParameterEquals   Operator
547hi def link sudoersModeParameterEquals      Operator
548hi def link sudoersFloatParameterEquals     Operator
549hi def link sudoersTimeoutParameterEquals   Operator
550hi def link sudoersStringParameterEquals    Operator
551hi def link sudoersListParameterEquals      Operator
552hi def link sudoersIntegerValue             Number
553hi def link sudoersModeValue                Number
554hi def link sudoersFloatValue               Float
555hi def link sudoersTimeoutValue             Number
556hi def link sudoersStringValue              String
557hi def link sudoersListValue                String
558hi def link sudoersOptionSpec               Special
559hi def link sudoersSELinuxSpecEquals        Operator
560hi def link sudoersAppArmorSpecEquals       Operator
561hi def link sudoersSolarisPrivSpecEquals    Operator
562hi def link sudoersDateSpecEquals           Operator
563hi def link sudoersTimeoutSpecEquals        Operator
564hi def link sudoersDirectorySpecEquals      Operator
565hi def link sudoersSELinuxSpecParam         String
566hi def link sudoersAppArmorSpecParam        String
567hi def link sudoersSolarisPrivSpecParam     String
568hi def link sudoersDateSpecParam            Number
569hi def link sudoersTimeoutSpecParam         Number
570hi def link sudoersDirectorySpecParam       String
571hi def link sudoersTagSpec                  Special
572hi def link sudoersTagSpecColon             Delimiter
573hi def link sudoersInclude                  Statement
574
575let b:current_syntax = "sudoers"
576
577let &cpo = s:cpo_save
578unlet s:cpo_save