使用samaccountname修改AD LDAP对象

I have a php script which works but I need to change it to use an AD account (samaccountname) instead of CN in this sample;

<?php

$base_dn="CN=Peter Parker,OU=Subcontainer,OU=Subcontainer,OU=Container,
DC=domain,DC=com";
$ldapconn = ldap_connect("host.domain.com") or die("Could not connect to LDAP server.");

if ($ldapconn)
{
    $ldapbind = ldap_bind($ldapconn, $ldapusername, $ldappassword);

    if ($ldapbind)
    {
        echo "LDAP bind successful ...";
    }
    else
    {
        echo "LDAP bind failed ...";
    }
}

$newinfo['ipphone']="555";
ldap_modify($ldapconn,$base_dn,$newinfo);
?>

The intention is to modify the ipphone object for users in AD, but I can't use CN because this input is not unique enough for the task. If the CN in the account's base DN is the descriptive name of the user, am I out of luck?

查看全部
dsce23640
dsce23640
2016/02/01 21:03
  • ldap
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复