From 40dc7f97626a703a943e27cdcd1a3d6a332a8f27 Mon Sep 17 00:00:00 2001 From: paulr Date: Fri, 11 Feb 2011 03:22:01 +1100 Subject: [PATCH] trying to figure out how to store data in AD --- gaas/gaasd/gaasclient.php | 3 --- gaas/lib/gaasClientMessages.php | 6 ------ gaas/lib/gaasdClient.php | 3 --- gaas/lib/gaasdLib.php | 3 +++ gaas/lib/gaasdMessages.php | 11 ++--------- gaas/lib/globalLib.php | 4 ++-- 6 files changed, 7 insertions(+), 23 deletions(-) diff --git a/gaas/gaasd/gaasclient.php b/gaas/gaasd/gaasclient.php index 8703975..0fd1401 100644 --- a/gaas/gaasd/gaasclient.php +++ b/gaas/gaasd/gaasclient.php @@ -26,9 +26,6 @@ switch($argv[1]) { 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 { diff --git a/gaas/lib/gaasClientMessages.php b/gaas/lib/gaasClientMessages.php index 9b138a4..f9581f9 100644 --- a/gaas/lib/gaasClientMessages.php +++ b/gaas/lib/gaasClientMessages.php @@ -18,9 +18,6 @@ function gaasStatus_clientrecv($params) // 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]; @@ -42,9 +39,6 @@ function gaasInitServer_clientsend($params) // 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; } diff --git a/gaas/lib/gaasdClient.php b/gaas/lib/gaasdClient.php index d5ee3f7..3a990e8 100644 --- a/gaas/lib/gaasdClient.php +++ b/gaas/lib/gaasdClient.php @@ -67,9 +67,6 @@ class GAASClient { return false; } - //echo "component\n"; - //print_r($component); - socket_close($socket); return $component["data"]; diff --git a/gaas/lib/gaasdLib.php b/gaas/lib/gaasdLib.php index 9af4dfb..e980986 100644 --- a/gaas/lib/gaasdLib.php +++ b/gaas/lib/gaasdLib.php @@ -14,7 +14,10 @@ if(file_exists($BASE_DIR."/gaas/gaasd/gaasd.sqlite")) { // 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 diff --git a/gaas/lib/gaasdMessages.php b/gaas/lib/gaasdMessages.php index 5ca73a0..3b59931 100644 --- a/gaas/lib/gaasdMessages.php +++ b/gaas/lib/gaasdMessages.php @@ -33,7 +33,7 @@ function gaasInitServer_server($msg) // IN expects // $m["user"] = "someuser"; // $m["pass"] = "somepass"; - echo "initstate is $initState\n"; + echo "initstate is $initState"; if($initState) { echo "true\n"; } else { @@ -45,9 +45,6 @@ function gaasInitServer_server($msg) } 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"]; @@ -66,10 +63,7 @@ function gaasInitServer_server($msg) // 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"; } @@ -81,13 +75,12 @@ function gaasInitServer_server($msg) 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 diff --git a/gaas/lib/globalLib.php b/gaas/lib/globalLib.php index e43cda2..4592618 100644 --- a/gaas/lib/globalLib.php +++ b/gaas/lib/globalLib.php @@ -43,10 +43,10 @@ function adTestLogin($domain, $user, $password) 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; } } -- 1.7.0.4