3

I am trying to add groups to an LDAP server

I have used the below code to add groups:

$ldap = new LDAP();
$connection = $ldap->connect($ldap->ldapserver,$ldap->ldapport);
$ldap->bind($connection,'cn=zentyal,dc=test,dc=org','k8ddfffdIsdefdfsdfsfi9');
$groupAtt['cn'] = $group_name;
$groupAtt['description'] = $group_description;
$groupAtt['objectClass'][0] = "posixGroup";
$groupAtt['objectClass'][1] = "zentyalGroup";
$groupAtt['gidNumber'] = "3000";

$addGroup = "cn=".$group_name.",ou=Groups,dc=test,dc=org";
$ldapcreation = $ldap->addRecord($connection,$addGroup,$groupAtt);

The code in the function addRecord is

function addRecord($connection, $adddn, $record){

    $addProcess = ldap_add($connection, $adddn, $record);

    if($addProcess){
       return true;
    } else {
       return false;
    }
}

The group gets added however after sometime the group gets removed from LDAP.

What could cases this action ?

Edison Trutwein
  • 765
  • 5
  • 22
  • 1
    If it gets added and then removed it only means there's is either a 3rd party doing something with the groups, i.e. some kind of policy-enforcing script someone put in place... Or, you have multiple load-balanced LDAP servers and you create the group on one and then try to read the group on another, but replication has not occured yet. Or something completely different is going on, of course.:) – Robert Rossmann Dec 11 '14 at 17:20

0 Answers0