Bug 929

Summary: sudoedit leaves temporary files in /var/tmp
Product: Sudo Reporter: infmagic2047reg
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.9.0   
Hardware: PC   
OS: Linux   

Description infmagic2047reg 2020-06-14 10:00:42 MDT
Steps to reproduce:

1. Use sudoedit to edit a file, like "sudoedit foo".
2. Edit the file in the editor, save and exit.
3. A temporary file named like "foo.XXvWEXok" will be left in /var/tmp.

This bug only occurs if the file is modified by the editor, that is, if sudoedit thinks the file is changed.

This bug does not occur with 1.8.31.

I believe this bug occurs because in 1.9.0, sudo_edit.c's sudo_edit_copy_tfiles() no longer unlinks the temporary file after a success operation, so the temporary file will not be removed. The same function in 1.8.31 does have an unlink() call after success.
Comment 1 Todd C. Miller 2020-06-14 16:41:23 MDT
Thanks for reporting this.  It is fixed by https://www.sudo.ws/repos/sudo/rev/2bc4822b7382 which will be in sudo 1.9.1.
Comment 2 Todd C. Miller 2020-06-19 05:59:51 MDT
Fixed in sudo 1.9.1