Example #1
0
 static function check_for_break($root, $path)
 {
     if (lis_link($path)) {
         $rpath = lreadlink($path);
     } else {
         $rpath = $path;
     }
     dprint("{$rpath} {$root}\n");
     if (!csb($rpath, $root)) {
         throw new lxException("you_are_trying_to_go_outside_your_root", '', '');
     }
 }
Example #2
0
function lxfile_unix_chown($file, $mod)
{
    $file = expand_real_root($file);
    log_filesys("Chown {$file} to {$mod}");
    $stat = stat($file);
    //dprintr($stat);
    if (!is_dir($file) && $stat['nlink'] > 1) {
        log_log("link_error", "{$file} is a hard link not chowning");
        return;
    }
    if (lis_link($file)) {
        log_log("link_error", "{$file} is link so no chown to {$mod}");
        return;
    }
    $group = null;
    if (csa($mod, ':')) {
        list($user, $group) = explode(':', $mod);
    } else {
        $user = $mod;
    }
    if (is_numeric($group)) {
        $group = (int) $group;
    }
    if ($group) {
        chgrp($file, $group);
    }
    if (is_numeric($user)) {
        $user = (int) $user;
    }
    $ret = chown($file, $user);
    if (!$ret) {
        dprint("Chown Error in file {$file}\n");
    }
    return $ret;
}
Example #3
0
function is_soft_or_hardlink($file)
{
    if (!lxfile_exists($file)) {
        return false;
    }
    if (lis_link($file) || lis_hardlink($file)) {
        return true;
    }
    return false;
}