]> jfr.im git - irc/evilnet/x3.git/blobdiff - tools/ldap/ldap_convert.php
mod-python: generalised the setting of the PYTHONPATH environment variable
[irc/evilnet/x3.git] / tools / ldap / ldap_convert.php
index 613602677fb4fd2a3c92668d6c0abf90f7f647f7..f589453fcd4aafe38182d0edec4f03541cc4c7cf 100755 (executable)
@@ -32,6 +32,7 @@ if (!extension_loaded('ldap'))
 
 $handle=fopen($db, r);
 $ns = 0;
+$bs = 0;
 $add = 0;
 $parse = 0;
 
@@ -59,13 +60,16 @@ if ($handle) {
         $user = NULL;
         $pass = NULL;
         $email = NULL;
-        if ($line == "\"NickServ\" {") {
+        if (($line == "\"NickServ\" {") && ($bs == 0)) {
+           echo "SSTARTT\n";
             $ns = 1;
             continue;
         }
 
-        if ($line == "\"ChanServ\" {")
+        if ($line == "\"ChanServ\" {") {
+           $bs = 1;
             $ns = 0;
+       }
 
         if ($ns == 1) {
             $parse++;
@@ -98,13 +102,16 @@ if ($handle) {
                 $info["objectclass"][] = "inetOrgAnonAccount";
                 $info["uid"]=$user;
                 $info["mail"]=$email;
-                $info["userPassword"]='{MD5}'.base64_encode(pack('H*',$pass));
+               if ($pass[0] == "$") {
+                       $info["userPassword"] = "";
+                       echo "ALERT: $user ADDED WITH NO PASSWORD (old crypt style)\n";
+               } else
+                       $info["userPassword"]='{MD5}'.base64_encode(pack('H*',$pass));
 
-#                $r=@ldap_add($ds, "uid=".$user.",$ldap_add", $info);
+                $r=@ldap_add($ds, "uid=".$user.",$ldap_add", $info);
                 if ($r) {
                     $add++;
                     echo "Added $user (email: $email) (pass: $pass)\n";
-                    print_r($info);
                 } else
                     echo "Failed adding $user (email: $email) (pass: $pass) - ". ldap_error($ds) ."\n";