3 // this file defines all the messages used by gaaasd
5 // there are only really two status messages at this point - "init" meaning we have no been defined yet
6 // and "running" meaning we have been defined
7 function gaasStatus_server($messages)
9 global $initState, $backEnd;
12 if($initState != false && $backEnd != "") {
20 function gaasInitServer_server($msg)
22 global $initState, $backEnd;
24 // here we "init" the server, if we're ad, we attempt to connect to AD and if it all works
25 // we then create the db
26 // $m["backend"] = "AD|IN";
28 // $m["domain"] = "somedomain.com";
29 // $m["user"] = "someuser";
30 // $m["pass"] = "somepassword";
31 // $m["userdef"] = "user definition paramaters";
33 // $m["user"] = "someuser";
34 // $m["pass"] = "somepass";
35 if($initState != "init") {
39 if($msg["backend"] == "AD") {
41 // attempt connect to AD, verify creds
42 $addom = $msg["domain"];
43 $adlogin = $msg["user"];
44 $adpass = $msg["pass"];
45 $adclientdef = $msg["clientdef"];
46 $adadmindef = $msg["admindef"];
47 // now wee test our logins...
52 confSetVal("ad.domain", $addom);
53 confSetVal("ad.user", $adlogin);
54 confSetVal("ad.pass", $adpass);
55 confSetVal("ad.encryptionkey", generateHexString(32));
56 confSetVal("ad.clientdef", $adclientdef);
57 confSetVal("ad.admindef", $adadmindef);
59 $initState = "running";
62 // and that should be it... i think cept im in a forked erg.. lets assume it works, need pain i do not.
65 } else if($msg["backend"] == "IN") {
70 // create the user in the db
71 $username = $msg["user"];
72 $password = $msg["pass"];
74 $myga = new gaasdGA();
75 $myga->setUser($username);
77 if($password == "") $pass = "";
78 else $pass = hash('sha512', $password);
81 $db->query($sql = "update users set users_password='$pass' where users_username='$username'");
83 $initState = "running";