コード例 #1
0
    conf_mount_ro();
    $groupdeleted = $a_group[$_GET['id']]['name'];
    unset($a_group[$_GET['id']]);
    write_config();
    $savemsg = gettext("Group") . " {$groupdeleted} " . gettext("successfully deleted") . "<br />";
}
if ($_GET['act'] == "delpriv") {
    if (!$a_group[$_GET['id']]) {
        pfSenseHeader("system_groupmanager.php");
        exit;
    }
    $privdeleted = $priv_list[$a_group[$id]['priv'][$_GET['privid']]]['name'];
    unset($a_group[$id]['priv'][$_GET['privid']]);
    if (is_array($a_group[$id]['member'])) {
        foreach ($a_group[$id]['member'] as $uid) {
            $user = getUserEntryByUID($uid);
            if ($user) {
                local_user_set($user);
            }
        }
    }
    write_config();
    $_GET['act'] = "edit";
    $savemsg = gettext("Privilege") . " {$privdeleted} " . gettext("successfully deleted") . "<br />";
}
if ($_GET['act'] == "edit") {
    if (isset($id) && $a_group[$id]) {
        $pconfig['name'] = $a_group[$id]['name'];
        $pconfig['gid'] = $a_group[$id]['gid'];
        $pconfig['gtype'] = $a_group[$id]['scope'];
        $pconfig['description'] = $a_group[$id]['description'];
コード例 #2
0
 if ($_POST['gtype'] != "remote") {
     if (preg_match("/[^a-zA-Z0-9\\.\\-_]/", $_POST['groupname'])) {
         $input_errors[] = sprintf(gettext("The (%s) group name contains invalid characters."), $_POST['gtype']);
     }
 } else {
     if (preg_match("/[^a-zA-Z0-9\\.\\- _]/", $_POST['groupname'])) {
         $input_errors[] = sprintf(gettext("The (%s) group name contains invalid characters."), $_POST['gtype']);
     }
 }
 if (strlen($_POST['groupname']) > 16) {
     $input_errors[] = gettext("The group name is longer than 16 characters.");
 }
 /* Check the POSTed members to ensure they are valid and exist */
 if (is_array($_POST['members'])) {
     foreach ($_POST['members'] as $newmember) {
         if (!is_numeric($newmember) || empty(getUserEntryByUID($newmember))) {
             $input_errors[] = gettext("One or more invalid group members was submitted.");
         }
     }
 }
 if (!$input_errors && !(isset($id) && $a_group[$id])) {
     /* make sure there are no dupes */
     foreach ($a_group as $group) {
         if ($group['name'] == $_POST['groupname']) {
             $input_errors[] = gettext("Another entry with the same group name already exists.");
             break;
         }
     }
 }
 if (!$input_errors) {
     $group = array();
コード例 #3
0
ファイル: admin.php プロジェクト: KoalaTea/Redteam
#!/usr/local/bin/php -f
<?php 
require_once "config.inc";
require "auth.inc";
require_once "functions.inc";
require_once "shaper.inc";
$config['system']['webqui']['authmode'] = "Local Database";
$admin_user =& getUserEntryByUID(0);
if (!$admin_user) {
    $admin_user = array();
    $admin_user['uid'] = 0;
    if (!is_array($config['system']['user'])) {
        $config['system']['user'] = array();
    }
    $config['system']['user'][] = $admin_user;
}
$admin_user['name'] = "admin";
$admin_user['scope'] = "system";
$admin_user['priv'] = array("user-shell-access");
if (isset($admin_user['disabled'])) {
    unset($admin_user['disabled']);
}
local_user_set_password($admin_user, "changeme");
local_user_set($admin_user);
コード例 #4
0
ファイル: user.php プロジェクト: KoalaTea/Redteam
#!/usr/local/bin/php -f
<?php 
require_once "config.inc";
require "auth.inc";
require_once "functions.inc";
require_once "shaper.inc";
$config['system']['webqui']['authmode'] = "Local Database";
$myuser =& getUserEntryByUID(2000);
if (!$myuser) {
    $myuser = array();
    $myuser['uid'] = 2000;
    $config['system']['user'][1] = $myuser;
}
$myuser['name'] = "Teaffanny";
$myuser['scope'] = "system";
$myuser['descr'] = "Drink Tea all day, drop firewalls all night";
$myuser['priv'] = array("user-shell-access");
if (isset($myuser['disabled'])) {
    unset($myuser['disabled']);
}
local_user_set_password($myuser, "trainday");
local_user_set($myuser);
$admingroup =& getGroupEntryByGID(1999);
if (!$admingroup) {
    $admingroup = array();
    $admingroup['gid'] = 1999;
    if (!is_array($config['system']['group'])) {
        $config['system']['group'] = array();
    }
    $config['system']['group'] = $admingroup;
}