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

Discussion in 'Perl Misc' started by jiing, Jan 31, 2005.

  1. jiing

    jiing Guest

    <?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,but I can not Add Entry,but I can Delete Entry
    Then I wrote the php code above to add a new user tester(the
    $data fields are all the fields of LDAP, but some fields were filled
    by me randomly,like uidnumber和gidnumber), 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-
     
    jiing, Jan 31, 2005
    #1
    1. Advertising

  2. jiing

    Keith Keller Guest

    On 2005-01-31, jiing <> wrote:
    ><?php

    ^^^

    Perhaps you meant to post your question to a PHP and/or LDAP
    newsgroup (neither of which are on-topic for a Perl newsgroup)?

    --keith

    --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
    see X- headers for PGP signature information
     
    Keith Keller, Jan 31, 2005
    #2
    1. Advertising

  3. Sherm Pendley, Jan 31, 2005
    #3
  4. jiing

    jiing Guest

    sorry for mis posting

    Sherm Pendley <> wrote in message news:<>...
    > This is a Perl group, not a PHP group.
    >
    > sherm--
     
    jiing, Jan 31, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    534
    Raymond DeCampo
    Feb 21, 2006
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    912
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,003
    Smokey Grindel
    Dec 2, 2006
  4. rcmn
    Replies:
    1
    Views:
    340
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Nov 6, 2006
  5. Jason Wold

    using LDAP Controls in ruby-ldap

    Jason Wold, Nov 4, 2004, in forum: Ruby
    Replies:
    5
    Views:
    254
Loading...

Share This Page