From a7e4a69bb41adf2adc6446f2d9e6302081436673 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 18 Feb 2005 13:39:42 +0000 Subject: [PATCH] fixed plug-ins directory initialization for extremely restricted guest users with no directory listing access to the temporary directory git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3909 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 4 ++-- Source/exehead/fileform.h | 1 + Source/exehead/util.c | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index 23484094..d34f67df 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -3216,8 +3216,8 @@ again: // GetTempFileName $0 ret=add_entry_direct(EW_GETTEMPFILENAME, var_zero, add_string("$TEMP")); if (ret != PS_OK) return ret; - // Delete $0 - the temp file created - ret=add_entry_direct(EW_DELETEFILE, zero_offset); + // Delete $0 [simple, nothing that could clash with special temp permissions] + ret=add_entry_direct(EW_DELETEFILE, zero_offset, DEL_SIMPLE); if (ret != PS_OK) return ret; // CraeteDirectory $0 - a dir instead of that temp file ret=add_entry_direct(EW_CREATEDIR, zero_offset); diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 9f1b7b45..3e741ea1 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -442,6 +442,7 @@ typedef struct { #define DEL_DIR 1 #define DEL_RECURSE 2 #define DEL_REBOOT 4 +#define DEL_SIMPLE 8 // $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value. // Added by ramon 3 jun 2003 diff --git a/Source/exehead/util.c b/Source/exehead/util.c index ef81acc1..ac150b3e 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -103,6 +103,12 @@ void NSISCALL myDelete(char *buf, int flags) char *fn; int valid_dir=is_valid_instpath(buf); + if ((flags & DEL_SIMPLE)) + { + g_exec_flags.exec_error += !DeleteFile(buf); + return; + } + #ifdef NSIS_SUPPORT_RMDIR if (!(flags & DEL_DIR) || (valid_dir && (flags & DEL_RECURSE))) #endif//NSIS_SUPPORT_RMDIR