trying to figure out how to store data in AD
authorpaulr <me@pjr.cc>
Thu, 10 Feb 2011 16:22:01 +0000 (03:22 +1100)
committerpaulr <me@pjr.cc>
Thu, 10 Feb 2011 16:22:01 +0000 (03:22 +1100)
gaas/gaasd/gaasclient.php
gaas/lib/gaasClientMessages.php
gaas/lib/gaasdClient.php
gaas/lib/gaasdLib.php
gaas/lib/gaasdMessages.php
gaas/lib/globalLib.php

index 8703975..0fd1401 100644 (file)
@@ -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 {
index 9b138a4..f9581f9 100644 (file)
@@ -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;
 }
 
index d5ee3f7..3a990e8 100644 (file)
@@ -67,9 +67,6 @@ class GAASClient {
                        return false;
                }
                
-               //echo "component\n";
-               //print_r($component);
-               
                socket_close($socket);
                
                return $component["data"];
index 9af4dfb..e980986 100644 (file)
@@ -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
index 5ca73a0..3b59931 100644 (file)
@@ -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
index e43cda2..4592618 100644 (file)
@@ -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;
        }       
 }