Beispiel #1
0
$_REQUEST['go'] = get_request('go', 'none');
if (isset($_REQUEST['save'])) {
    $result = true;
    $hosts = get_request('hosts', array());
    DBstart();
    if (isset($_REQUEST['hostid'])) {
        $result = update_proxy($_REQUEST['hostid'], $_REQUEST['host'], $_REQUEST['status'], $_REQUEST['useip'], $_REQUEST['dns'], $_REQUEST['ip'], $_REQUEST['port'], $hosts);
        $action = AUDIT_ACTION_UPDATE;
        $msg_ok = S_PROXY_UPDATED;
        $msg_fail = S_CANNOT_UPDATE_PROXY;
        $hostid = $_REQUEST['hostid'];
    } else {
        if (!count(get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
            access_deny();
        }
        $result = $hostid = add_proxy($_REQUEST['host'], $_REQUEST['status'], $_REQUEST['useip'], $_REQUEST['dns'], $_REQUEST['ip'], $_REQUEST['port'], $hosts);
        $action = AUDIT_ACTION_ADD;
        $msg_ok = S_PROXY_ADDED;
        $msg_fail = S_CANNOT_ADD_PROXY;
    }
    $result = DBend($result);
    show_messages($result, $msg_ok, $msg_fail);
    if ($result) {
        add_audit($action, AUDIT_RESOURCE_PROXY, '[' . $_REQUEST['host'] . ' ] [' . $hostid . ']');
        unset($_REQUEST['form']);
    }
    unset($_REQUEST['save']);
} else {
    if (isset($_REQUEST['delete'])) {
        $result = false;
        if (isset($_REQUEST['hostid'])) {
Beispiel #2
0
 } else {
     if ($_REQUEST['config'] == 5 && isset($_REQUEST['save'])) {
         $result = true;
         $hosts = get_request('hosts', array());
         DBstart();
         if (isset($_REQUEST['hostid'])) {
             $result = update_proxy($_REQUEST['hostid'], $_REQUEST['host'], $hosts);
             $action = AUDIT_ACTION_UPDATE;
             $msg_ok = S_PROXY_UPDATED;
             $msg_fail = S_CANNOT_UPDATE_PROXY;
             $hostid = $_REQUEST['hostid'];
         } else {
             if (!count(get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
                 access_deny();
             }
             $hostid = add_proxy($_REQUEST['host'], $hosts);
             $action = AUDIT_ACTION_ADD;
             $msg_ok = S_PROXY_ADDED;
             $msg_fail = S_CANNOT_ADD_PROXY;
         }
         $result = DBend($result);
         show_messages($result, $msg_ok, $msg_fail);
         if ($result) {
             add_audit($action, AUDIT_RESOURCE_PROXY, '[' . $_REQUEST['host'] . ' ] [' . $hostid . ']');
             unset($_REQUEST['form']);
         }
         unset($_REQUEST['save']);
     } else {
         if ($_REQUEST['config'] == 5 && isset($_REQUEST['delete'])) {
             $result = false;
             if (isset($_REQUEST['hostid'])) {
Beispiel #3
0
/**
 * \brief replace default repo with new repo
 */
function preparations()
{
    global $SYSCONF_DIR;
    global $REPO_NAME;
    add_proxy();
    // add proxy
    if (is_dir("/srv/fossology/{$REPO_NAME}")) {
        exec("sudo chmod 2770 /srv/fossology/{$REPO_NAME}");
        // change mode to 2770
        exec("sudo chown fossy /srv/fossology/{$REPO_NAME} -R");
        // change owner of REPO to fossy
        exec("sudo chgrp fossy /srv/fossology/{$REPO_NAME} -R");
        // change grp of REPO to fossy
    }
    if (is_dir($SYSCONF_DIR)) {
        exec("sudo chown fossy {$SYSCONF_DIR} -R");
        // change owner of sysconfdir to fossy
        exec("sudo chgrp fossy {$SYSCONF_DIR} -R");
        // change grp of sysconfdir to fossy
    }
}