Ejemplo n.º 1
0
 function createDavSuexec()
 {
     $string = null;
     $uid = os_get_uid_from_user($this->main->__var_system_username);
     $gid = os_get_gid_from_user($this->main->__var_system_username);
     $string .= "#!/bin/sh\n";
     $string .= "export MUID={$uid}\n";
     $string .= "export GID={$gid}\n";
     $string .= " export PHPRC=/usr/local/lxlabs/ext/php/etc/php.ini\n";
     $string .= "export TARGET=<%program%>\n";
     $string .= "export NON_RESIDENT=1\n";
     $string .= "exec lxsuexec \$*\n";
     $st = str_replace("<%program%>", "/usr/local/lxlabs/ext/php/bin/php_cgi", $string);
     lfile_put_contents("__path_httpd_root/{$this->main->getParentName()}/davsuexec.sh", $st);
     lxfile_unix_chmod("__path_httpd_root/{$this->main->getParentName()}/davsuexec.sh", "0755");
 }
Ejemplo n.º 2
0
function new_process_cmd($user, $dir, $cmd)
{
    global $sgbl;
    if (csa($user, ':')) {
        list($user, $group) = explode(':', $user);
    } else {
        $group = $user;
    }
    if ($user === 'root') {
        $user = '******';
    }
    if ($dir) {
        $olddir = getcwd();
        chdir($dir);
    }
    if ($user !== '__system__') {
        $uid = is_numeric($user) ? (int) $user : os_get_uid_from_user($user);
        $gid = is_numeric($group) ? (int) $group : os_get_gid_from_user($user);
        exec("{$sgbl->__path_php_path} {$sgbl->__path_program_root}/bin/phpexec.php {$uid} {$gid} {$cmd} 2>&1", $output, $retval);
    } else {
        exec("{$cmd} 2>&1", $output, $retval);
    }
    if ($dir) {
        chdir($olddir);
    }
    $output = implode("\n", $output);
    log_log('user_cmd', "({$dir}) {$user} {$cmd} {$output}");
    return $retval;
}
Ejemplo n.º 3
0
 function createSuexec()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $string = null;
     $uid = os_get_uid_from_user($this->main->username);
     $gid = os_get_gid_from_user($this->main->username);
     $phprc = null;
     $phprc .= "export PHPRC=/home/httpd/{$this->main->nname}\n";
     $string .= "#!/bin/sh\n";
     $string .= "### Username: {$this->main->username}\n";
     $string .= "export MUID={$uid}\n";
     $string .= "export GID={$gid}\n";
     $string .= $phprc;
     $string .= "export TARGET=<%program%>\n";
     $string .= "export NON_RESIDENT=1\n";
     $string .= "exec lxsuexec \$*\n";
     $st = str_replace("<%program%>", "/usr/bin/php-cgi", $string);
     lfile_put_contents("{$sgbl->__path_httpd_root}/{$this->main->nname}/phpsuexec.sh", $st);
     $st = str_replace("<%program%>", "/usr/bin/lxexec", $string);
     lfile_put_contents("{$sgbl->__path_httpd_root}/{$this->main->nname}/shsuexec.sh", $st);
     $st = str_replace("<%program%>", "/usr/bin/perl", $string);
     lfile_put_contents("{$sgbl->__path_httpd_root}/{$this->main->nname}/perlsuexec.sh", $st);
     lxfile_unix_chmod("{$sgbl->__path_httpd_root}/{$this->main->nname}/shsuexec.sh", "0755");
     lxfile_unix_chmod("{$sgbl->__path_httpd_root}/{$this->main->nname}/phpsuexec.sh", "0755");
     lxfile_unix_chmod("{$sgbl->__path_httpd_root}/{$this->main->nname}/perlsuexec.sh", "0755");
 }
Ejemplo n.º 4
0
Archivo: lib.php Proyecto: zseand/kloxo
function setInitialNobodyScript()
{
    log_cleanup("Initialize nobody.sh script");
    log_cleanup("- Initialize process");
    $string = null;
    $uid = os_get_uid_from_user("lxlabs");
    $gid = os_get_gid_from_user("lxlabs");
    $string .= "#!/bin/sh\n";
    $string .= "export MUID={$uid}\n";
    $string .= "export GID={$gid}\n";
    $string .= "export TARGET=/usr/bin/php-cgi\n";
    $string .= "export NON_RESIDENT=1\n";
    $string .= "exec lxsuexec \$*\n";
    lfile_put_contents("/home/httpd/nobody.sh", $string);
    lxfile_unix_chmod("/home/httpd/nobody.sh", "0755");
}