@@ -118,6 +118,7 @@ pub struct Tag {
118118 pub ( super ) env : EnvironmentControl ,
119119 pub ( super ) apparmor_profile : Option < String > ,
120120 pub ( super ) noexec : ExecControl ,
121+ pub ( super ) ignored : Vec < Span > ,
121122}
122123
123124impl Tag {
@@ -388,25 +389,6 @@ impl Parse for MetaOrTag {
388389 } ;
389390
390391 let result: Modifier = match keyword. as_str ( ) {
391- // we do not support this, and that should make sudo-rs "fail safe"
392- "INTERCEPT" => unrecoverable ! (
393- pos = start_pos,
394- stream,
395- "INTERCEPT is not supported by sudo-rs"
396- ) ,
397- // this is less fatal
398- "LOG_INPUT" | "NOLOG_INPUT" | "LOG_OUTPUT" | "NOLOG_OUTPUT" | "MAIL" | "NOMAIL"
399- | "FOLLOW" => {
400- eprintln_ignore_io_error ! (
401- "sudo-rs: {} tags in the sudoers policy are ignored" ,
402- keyword. as_str( )
403- ) ;
404- switch ( |_| { } ) ?
405- }
406-
407- // 'NOFOLLOW' and 'NOINTERCEPT' are the default behaviour.
408- "NOFOLLOW" | "NOINTERCEPT" => switch ( |_| { } ) ?,
409-
410392 "EXEC" => switch ( |tag| tag. noexec = ExecControl :: Exec ) ?,
411393 "NOEXEC" => switch ( |tag| tag. noexec = ExecControl :: Noexec ) ?,
412394
@@ -420,18 +402,35 @@ impl Parse for MetaOrTag {
420402 let path: ChDir = expect_nonterminal ( stream) ?;
421403 Box :: new ( move |tag| tag. cwd = Some ( path. clone ( ) ) )
422404 }
405+
423406 // we do not support these, and that should make sudo-rs "fail safe"
424- spec @ ( "CHROOT" | "TIMEOUT" | "NOTBEFORE" | "NOTAFTER" ) => unrecoverable ! (
425- pos = start_pos,
426- stream,
427- "{spec} is not supported by sudo-rs"
428- ) ,
407+ spec @ ( "INTERCEPT" | "CHROOT" | "TIMEOUT" | "NOTBEFORE" | "NOTAFTER" ) => {
408+ unrecoverable ! (
409+ pos = start_pos,
410+ stream,
411+ "{spec} is not supported by sudo-rs"
412+ )
413+ }
429414 "ROLE" | "TYPE" => unrecoverable ! (
430415 pos = start_pos,
431416 stream,
432417 "SELinux role based access control is not yet supported by sudo-rs"
433418 ) ,
434419
420+ // this is less fatal
421+ "LOG_INPUT" | "NOLOG_INPUT" | "LOG_OUTPUT" | "NOLOG_OUTPUT" | "MAIL" | "NOMAIL"
422+ | "FOLLOW" => {
423+ let ignored_location = Span {
424+ start : start_pos,
425+ end : stream. get_pos ( ) ,
426+ } ;
427+ expect_syntax ( ':' , stream) ?;
428+ Box :: new ( move |tag| tag. ignored . push ( ignored_location) )
429+ }
430+
431+ // 'NOFOLLOW' and 'NOINTERCEPT' are the default behaviour.
432+ "NOFOLLOW" | "NOINTERCEPT" => switch ( |_| { } ) ?,
433+
435434 "APPARMOR_PROFILE" => {
436435 expect_syntax ( '=' , stream) ?;
437436 let StringParameter ( profile) = expect_nonterminal ( stream) ?;
0 commit comments