ldap server can not replace the order of login, why?

From: jiing (jiing.deng_at_gmail.com)
Date: 01/31/05


Date: 30 Jan 2005 18:46:22 -0800


<?php
$ldapServer="ldap://192.168.1.211";
$ldapPort="389";
$ldapconn=ldap_connect($ldapServer,$ldapPort);
$ldaprdn="uid=root, ou=People, dc=aitc, dc=com, dc=tw";
$ldappass="abcd";

   if($ldapconn){
            echo "connect to ".$ldapServer." successfully \n<br>";
   }else{
      echo "can't connect to LDAP server!\n<br>";
   }
   if ($ldapconn) {
      // binding to ldap server to give update access
      $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
      // verify binding
      if ($ldapbind) {
          echo "LDAP binding successful...\n";
      } else {
          echo "LDAP binding failed...\n";
      }
   }
   //data preparation
   //I am not very sure what attribute should be filled
   $data["uid"]="tester";
   $data["cn"]="Tester 1";
   $data["objectclass"][0]="account";
   $data["objectclass"][1]="posixAccount";
   $data["objectclass"][2]="top";
   $data["userpassword"]="tester";
   $data["loginshell"]="/usr/local/bin/bash";
   $data["uidnumber"]=3100;
   $data["gidnumber"]=3100;
   $data["homedirectory"]="/home/tester";
   $data["gecos"]="Tester 1";
  
   // Before ldap_add(), should check the user already exists or not
   if(!ldap_add($ldapconn,"uid=tester, ou=People, dc=aitc, dc=com,
dc=tw", $data)){
     echo "There is a problem to create the account\n";
     echo "Please contact your administrator!\n";
     exit;
    }else{
     echo "account creation successfully";
    }
   ldap_close($ldapconn);
?>

I used ldapbrowser to connect LDAP server(openldap), and I can see all
the user&#65292;but I can not Add Entry&#65292;but I can Delete Entry
Then I wrote the php code above to add a new user tester&#65288;the
$data fields are all the fields of LDAP, but some fields were filled
by me randomly&#65292;like uidnumber&#21644;gidnumber&#65289;, but if
I do not fill those fields, it will occurs the following warning
message

Warning: ldap_add(): Add: Object class violation in
d:\AppServ\www\LDAP_test1.ph
p on line 74
There is a problem to create the account
Please contact your administrator!

But I found the biggest problem is : my ldap server can not replace
the login order, i.e, I want to build accounts/passwords in openldap
server, then users can use the account/password in ldap server and
login freebsd server. But when I use the above php code to create a
tester account, the user "tester" still can not use tester/tester to
login freebsd host, why? Could you tell me.

Thanks in advanced.

-jiing-



Relevant Pages

  • ldap server can not replace the order of login, why?
    ... Then I wrote the php code above to add a new user tester(the ... There is a problem to create the account ... But I found the biggest problem is: my ldap server can not replace ... tester account, the user "tester" still can not use tester/tester to ...
    (comp.lang.php)
  • Re: write with cURL
    ... reading each other's files using PHP, ... shared hosting account and I will promptly remit payment. ... not as secure as you believe it to be. ...
    (alt.php)
  • Re: write with cURL
    ... each other's files using PHP, you've stated that I would have to pay ... shared hosting account and I will promptly remit payment. ... but to example how your PHP setup is not as secure as ...
    (alt.php)
  • Re: [PHP] RE:[PHP] Client Computer Registration
    ... Council) to increase security... ... access the account using that computer. ... Can PHP record the MAC Address of the NIC in the computer? ...
    (php.general)
  • Re: write with cURL
    ... each other's files using PHP, you've stated that I would have to pay ... shared hosting account and I will promptly remit payment. ... to illustrate that your PHP setup would allow one user on one account ... information regarding the server name, login, or IP publicly. ...
    (alt.php)