if($argc < 7) usage();
}
$ret = $myga->MSG_INIT_SERVER("AD", $argv[3], $argv[4], $argv[5], $argv[6], $argv[7]);
- echo "Ret:\n";
- print_r($ret);
- echo "\n";
if($ret) {
echo "initialising server succeeded\n";
} else {
// IN: "IN", "user", "pass"
function gaasInitServer_clientsend($params)
{
- echo "backend:\n";
- print_r($params);
- echo "\n";
$msg["backend"] = $params[0];
$msg["user"] = $params[1];
$msg["pass"] = $params[2];
// pretty simple, it either works or doesnt, we just pass on the result
function gaasInitServer_clientrecv($params)
{
- echo "in recv, params\n";
- print_r($params);
- echo "\n";
return $params;
}
return false;
}
- //echo "component\n";
- //print_r($component);
-
socket_close($socket);
return $component["data"];
// then we check if the config vars we need exist in the db
$backEndType = confGetVal("backend");
+ echo "backend type is $backEndType\n";
+
if($backEndType == "AD") {
+ echo "init state should be true\n";
$backEnd = "AD";
// TODO: we should now check all vars are set, but for now this will surfice
// IN expects
// $m["user"] = "someuser";
// $m["pass"] = "somepass";
- echo "initstate is $initState\n";
+ echo "initstate is $initState";
if($initState) {
echo "true\n";
} else {
}
if($msg["backend"] == "AD") {
- echo "Backend is AD with params of\n";
- print_r($msg);
- echo "\n";
$backEnd = "AD";
// attempt connect to AD, verify creds
$addom = $msg["domain"];
// we should check all servers, but lets just go with 0 for now
$res = adTestLogin($addom, $adlogin, $adpass);
if(!$res) {
- echo "AD login test failed\n";
return false;
- } else {
- echo "AD login test succeeded\n";
}
confSetVal("ad.encryptionkey", generateHexString(32));
confSetVal("ad.clientdef", $adclientdef);
confSetVal("ad.admindef", $adadmindef);
+ confSetVal("backend", "AD");
$initState = true;
$backEnd = "AD";
// and that should be it... i think cept im in a forked erg.. lets assume it works, need pain i do not.
- echo "its all good at the server\n";
-
return true;
} else if($msg["backend"] == "IN") {
// this ones simpler
echo "Connected\n";
$bind = ldap_bind($cnt, "$user@$domain", "$password");
if($bind) {
- echo "bind is true $user@$domain $password\n";
+ echo "login has succeeded\n";
return true;
} else {
- echo "bind is false $user@$domain $password\n";
+ echo "login has failed\n";
return false;
}
}