예제 #1
0
require 'common.php';
$dn = rawurldecode($_POST['dn']);
$server_id = $_POST['server_id'];
$attr = $_POST['attr'];
$val = $_POST['val'];
$val = utf8_encode($val);
$encoded_dn = rawurlencode($dn);
$encoded_attr = rawurlencode($attr);
$is_binary_val = isset($_POST['binary']) ? true : false;
if (!$is_binary_val && $val == "") {
    pla_error("You left the attribute value blank. Please go back and try again.");
}
if (is_server_read_only($server_id)) {
    pla_error("You cannot perform updates while server is in read-only mode");
}
check_server_id($server_id) or pla_error("Bad server_id: " . htmlspecialchars($server_id));
have_auth_info($server_id) or pla_error("Not enough information to login to server. Please check your configuration.");
// special case for binary attributes (like jpegPhoto and userCertificate):
// we must go read the data from the file and override $val with the binary data
if ($is_binary_val) {
    $file = $_FILES['val']['tmp_name'];
    $f = fopen($file, 'r');
    $binary_data = fread($f, filesize($file));
    fclose($f);
    $val = $binary_data;
}
// Automagically hash new userPassword attributes according to the
// chosen in config.php.
if (0 == strcasecmp($attr, 'userpassword')) {
    if ($servers[$server_id]['default_hash'] != '') {
        $enc_type = $servers[$server_id]['default_hash'];
<?php

require 'common.php';
// Common to all templates
$container = $_POST['container'];
$server_id = $_POST['server_id'];
// Unique to this template
$step = $_POST['step'];
if (!$step) {
    $step = 1;
}
check_server_id($server_id) or die("Bad server_id: " . htmlspecialchars($server_id));
have_auth_info($server_id) or die("Not enough information to login to server. Please check your configuration.");
?>

	<center><h2>New DNS Entry</h2></center>

	<?php 
if ($step == 1) {
    ?>

	<form action="creation_template.php" method="post" name="dns_form">
	<input type="hidden" name="step" value="2" />
	<input type="hidden" name="server_id" value="<?php 
    echo $server_id;
    ?>
" />
	<input type="hidden" name="template" value="<?php 
    echo $_POST['template'];
    ?>
" />
예제 #3
0
<?php

/*
 * refresh.php
 * This script alters the session variable 'tree', by re-querying
 * the LDAP server to grab the contents of every expanded container.
 *
 * Variables that come in as GET vars:
 *  - server_id
 */
require 'common.php';
$server_id = $_GET['server_id'];
if (!check_server_id($server_id) || !have_auth_info($server_id)) {
    header("Location: tree.php");
}
session_start();
if (!session_is_registered('tree')) {
    header("Location: tree.php");
}
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
// Get the icon for the base object for this server
$base_dn = $servers[$server_id]['base'];
$tree_icons[$server_id][$base_dn] = get_icon($server_id, $base_dn);
// get all the icons and container contents for all expanded entries
if ($tree[$server_id] && is_array($tree[$server_id])) {
    foreach ($tree[$server_id] as $dn => $children) {
        $tree[$server_id][$dn] = get_container_contents($server_id, $dn);
        foreach ($tree[$server_id][$dn] as $child_dn) {
            $tree_icons[$server_id][$child_dn] = get_icon($server_id, $child_dn);
        }
 * Vars that come in as POST:
 *  - dn (rawurlencoded)
 *  - server_id
 *  - new_oclass
 *  - new_attrs (array, if any)
 */
require 'common.php';
$dn = rawurldecode($_POST['dn']);
$encoded_dn = rawurlencode($dn);
$new_oclass = $_POST['new_oclass'];
$server_id = $_POST['server_id'];
$new_attrs = $_POST['new_attrs'];
if (is_server_read_only($server_id)) {
    pla_error($lang['no_updates_in_read_only_mode']);
}
check_server_id($server_id) or pla_error($lang['bad_server_id']);
have_auth_info($server_id) or pla_error($lang['not_enough_login_info']);
$new_entry = array();
$new_entry['objectClass'] = $new_oclass;
$new_attrs_entry = array();
$new_oclass_entry = array('objectClass' => $new_oclass);
if (is_array($new_attrs) && count($new_attrs) > 0) {
    foreach ($new_attrs as $attr => $val) {
        $new_entry[$attr] = $val;
    }
}
//echo "<pre>";
//print_r( $new_entry );
//exit;
$ds = pla_ldap_connect($server_id) or pla_error($lang['could_not_connect']);
$add_res = @ldap_mod_add($ds, $dn, $new_entry);
예제 #5
0
function dn_exists($server_id, $dn)
{
    if (!check_server_id($server_id)) {
        return false;
    }
    $ds = pla_ldap_connect($server_id);
    if (!$ds) {
        return false;
    }
    $search_result = @ldap_read($ds, $dn, 'objectClass=*', array('dn'));
    if (!$search_result) {
        return false;
    }
    $num_entries = ldap_count_entries($ds, $search_result);
    if ($num_entries > 0) {
        return true;
    } else {
        return false;
    }
}