Skip to content

Commit

Permalink
cas maestro
Browse files Browse the repository at this point in the history
  • Loading branch information
briankelleher committed Feb 14, 2016
1 parent f4f9e64 commit cb7184e
Show file tree
Hide file tree
Showing 75 changed files with 17,652 additions and 0 deletions.
21 changes: 21 additions & 0 deletions www/wp-content/plugins/cas-maestro/ajax/validate_cas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
error_reporting(E_ALL ^ E_NOTICE);


if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$version = $_POST['v'];
$server = $_POST['s'];
$port = intval($_POST['p']);
$directory = $_POST['d'];
$lib = __DIR__.'/../phpCAS/CAS.php';

if($fp = @fsockopen($server,$port,$errCode,$errStr,'4')){
echo json_encode(1);
} else {
echo json_encode(0);
}
@fclose($fp);
} else {
echo 'Ajax only.';
}

39 changes: 39 additions & 0 deletions www/wp-content/plugins/cas-maestro/ajax/validate_ldap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
error_reporting(E_ALL ^ E_NOTICE);


if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$version = intval($_POST['v']);
$server = $_POST['s'];
$username = $_POST['u'];
$password = $_POST['pw'];
$basedn = $_POST['bdn'];
$uid = $_POST['uid'];

if($ds=@ldap_connect($server)) {
@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
@ldap_set_option($ds, LDAP_OPT_RESTART, TRUE);

if($r=@ldap_bind($ds,$username,$password)) {
$list = @ldap_list($ds, $basedn,
"uid=$uid");

if ($list !== FALSE && isset($uid)){
$result = @ldap_POST_entries($ds, $list);
if ($result['count'] > 0){
echo json_encode(1);
} else {
echo json_encode(0);
}
} else {
echo json_encode(1);
}
} else {
echo json_encode(0);
}
} else {
//No LDAP connection. Return false;
echo json_encode(0);
}
}

Loading

0 comments on commit cb7184e

Please sign in to comment.