File tree Expand file tree Collapse file tree 1 file changed +18
-15
lines changed
Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -278,21 +278,7 @@ fn edit_sudoers_file(
278278 )
279279 } ) ?;
280280
281- if errors. is_empty ( ) {
282- if visudo_is_allowed ( sudoers, & host_name) == Some ( false ) {
283- writeln ! ( stderr, "It looks like these changes may lock you out of editing the sudoers file again.\n " ) ?;
284- match ask_response (
285- b"What now? (p)roceed anyway / e(x)it without saving / (e)dit again: " ,
286- b"xep" ,
287- ) ? {
288- b'x' => return Ok ( ( ) ) ,
289- b'p' => { }
290- _ => continue ,
291- }
292- }
293-
294- break ;
295- } else {
281+ let true = errors. is_empty ( ) else {
296282 writeln ! ( stderr, "The provided sudoers file format is not recognized or contains syntax errors. Please review:\n " ) ?;
297283
298284 for crate :: sudoers:: Error {
@@ -311,7 +297,24 @@ fn edit_sudoers_file(
311297 b'x' => return Ok ( ( ) ) ,
312298 _ => continue ,
313299 }
300+ } ;
301+
302+ if visudo_is_allowed ( sudoers, & host_name) == Some ( false ) {
303+ writeln ! (
304+ stderr,
305+ "It looks like these changes may lock you out of editing the sudoers file again.\n "
306+ ) ?;
307+ match ask_response (
308+ b"What now? (p)roceed anyway / e(x)it without saving / (e)dit again: " ,
309+ b"xep" ,
310+ ) ? {
311+ b'x' => return Ok ( ( ) ) ,
312+ b'p' => { }
313+ _ => continue ,
314+ }
314315 }
316+
317+ break ;
315318 }
316319
317320 let tmp_contents = std:: fs:: read ( tmp_path) ?;
You can’t perform that action at this time.
0 commit comments