Index: openacs-4/packages/acs-tcl/tcl/security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/security-procs.tcl,v diff -u -r1.126.2.71 -r1.126.2.72 --- openacs-4/packages/acs-tcl/tcl/security-procs.tcl 25 Aug 2022 11:25:10 -0000 1.126.2.71 +++ openacs-4/packages/acs-tcl/tcl/security-procs.tcl 25 Aug 2022 12:37:13 -0000 1.126.2.72 @@ -1172,7 +1172,10 @@ host_node_id $host_node_id] } -ad_proc security::safe_tmpfile_p {tmpfile} { +ad_proc security::safe_tmpfile_p { + -must_exist:boolean + tmpfile +} { Checks that a file is a safe tmpfile, that is, it belongs to the configured tmpdir. @@ -1182,6 +1185,7 @@ - file must be readable and writeable by the current system user @param tmpfile absolute path to a possibly existing tmpfile + @param must_exist make sure the file exists @return boolean } { @@ -1194,9 +1198,10 @@ if {![ad_file exists $tmpfile]} { # - # File does not exist yet: safe + # File does not exist yet: safe, unless we demand for the file + # to exist. # - return true + return [expr {!$must_exist_p}] } if {![ad_file owned $tmpfile]} {