Changeset 3388

Show
Ignore:
Timestamp:
01/02/06 02:50:59 (3 years ago)
Author:
ryan
Message:

Preserve suid and sgid bits when creating new directories. fixes #2190

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/cache.php

    r3386 r3388  
    206206 
    207207            if (!file_exists($this->cache_dir.$make_dir."index.php")) { 
     208                $file_perms = $perms & 0000666; 
    208209                @ touch($this->cache_dir.$make_dir."index.php"); 
     210                @ chmod($this->cache_dir.$make_dir."index.php", $file_perms); 
    209211            } 
    210212        } 
     
    269271        // Give the new dirs the same perms as wp-content. 
    270272        $stat = stat(ABSPATH.'wp-content'); 
    271         $dir_perms = $stat['mode'] & 0000777; // Get the permission bits. 
     273        $dir_perms = $stat['mode'] & 0007777; // Get the permission bits. 
     274        $file_perms = $dir_perms & 0000666; // Remove execute bits for files. 
    272275 
    273276        // Make the base cache dir. 
     
    280283        if (!file_exists($this->cache_dir."index.php")) { 
    281284            @ touch($this->cache_dir."index.php"); 
     285            @ chmod($this->cache_dir."index.php", $file_perms); 
    282286        } 
    283287 
     
    315319                    } 
    316320                } 
     321                @ chmod($cache_file, $file_perms); 
    317322            } 
    318323        } 
  • trunk/wp-includes/functions-post.php

    r3386 r3388  
    863863    // Give the new dirs the same perms as wp-content. 
    864864    $stat = stat(ABSPATH . 'wp-content'); 
    865     $dir_perms = $stat['mode'] & 0000777;  // Get the permission bits. 
     865    $dir_perms = $stat['mode'] & 0007777;  // Get the permission bits. 
    866866 
    867867        // Make sure we have an uploads dir 
     
    930930    // Set correct file permissions 
    931931    $stat = @ stat(dirname($new_file)); 
    932     $perms = $stat['mode'] & 0000777; 
     932    $perms = $stat['mode'] & 0007777; 
     933    $perms = $perms & 0000666; 
    933934    @ chmod($new_file, $perms); 
    934935