diff options
author | Troels Liebe Bentsen <tlb@rapanden.dk> | 2006-02-24 22:16:55 +0100 |
---|---|---|
committer | Troels Liebe Bentsen <tlb@rapanden.dk> | 2006-02-24 22:16:55 +0100 |
commit | 44881d272282937c9bb745f462c947319d404dd0 (patch) | |
tree | 186d932116e04b1271ad22a3bd628d6617a49c49 /lib/exe | |
parent | b687885519897ab2959bb0540ec822b96f722fd6 (diff) | |
download | rpg-44881d272282937c9bb745f462c947319d404dd0.tar.gz rpg-44881d272282937c9bb745f462c947319d404dd0.tar.bz2 |
Fix umask bug and do a code cleanup of chmod/mkdir usage so set the correct permissions, this should also fix problems with dokuwiki making setuid files on some umasks.
* Don't set the umask() anymore, this is not good form and we don't really know what is it in the old code anyway as it was not done properly.
* Retire the dmask config option introduce 2 new ones called fmode and dmode, this is more in line with posix and should make more sense.
* Use chmod for setting the correct permissions but only if it's needed.
* Set changing of permissions off by default as i should work properly in most Apache setups without and it does not make sense on windows anyway.
darcs-hash:20060224211655-ee6b9-68f7bb59417d6f0033cfd3764146923daa4dcf1b.gz
Diffstat (limited to 'lib/exe')
-rw-r--r-- | lib/exe/detail.php | 3 | ||||
-rw-r--r-- | lib/exe/indexer.php | 1 | ||||
-rw-r--r-- | lib/exe/media.php | 7 |
3 files changed, 2 insertions, 9 deletions
diff --git a/lib/exe/detail.php b/lib/exe/detail.php index 0b6af379b..2907acfbf 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -55,7 +55,4 @@ header('Content-Type: text/html; charset=utf-8'); include(template('detail.php')); - //restore old umask - umask($conf['oldumask']); - ?> diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 19eea767f..8fe9e35d4 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -60,6 +60,7 @@ function runIndexer(){ return false; } } + if(isset($conf['dmask'])) { chmod($lock, $conf['dmask']); } require_once(DOKU_INC.'inc/indexer.php'); diff --git a/lib/exe/media.php b/lib/exe/media.php index 47af3c4d3..bbdf1814e 100644 --- a/lib/exe/media.php +++ b/lib/exe/media.php @@ -68,9 +68,6 @@ }else{ include(template('media.php')); } - - //restore old umask - umask($conf['oldumask']); /**********************************************/ @@ -116,9 +113,7 @@ function media_upload($NS,$AUTH){ $types = array_map(create_function('$q','return preg_quote($q,"/");'),$types); $regex = join('|',$types); - // we set the umask here but this doesn't really help // because a temp file was created already - umask($conf['umask']); if(preg_match('/\.('.$regex.')$/i',$fn)){ //check for overwrite if(@file_exists($fn) && (!$_POST['ow'] || $AUTH < AUTH_DELETE)){ @@ -129,7 +124,7 @@ function media_upload($NS,$AUTH){ io_makeFileDir($fn); if(move_uploaded_file($file['tmp_name'], $fn)) { // set the correct permission here - chmod($fn, $conf['fmode'] & ~$conf['umask']); + if(isset($conf['fmask'])) { chmod($fn, $conf['fmask']); } msg($lang['uploadsucc'],1); return true; }else{ |