[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: modify DNs in PHP



If this is the case the same thing can be accomplished with a little elbow grease. I mentioned in an earlier posting but my message came through as garbage so I thought it worth mentioning again. To accomplish a dn change you can: $filter = "(objectclass=*)"; $basedn = "cn=john,ou=marketing,dc=company,dc=country"; $server = "servername"; $bindas = "name"; $bindpassword = "password"; $Server = ldap_connect.... $bind = ldap_bind(.... $searchresult = ldap_search($Server, $basedn, $filter); $info = get_ldap_entries($Server,$searchresult); $newdn = "cn=john,ou=support,dc=company,dc=country"; $newinfo = $info[0]; $newinfo["dn"] = $newdn; // you may want to make some other changes to $newinfo as well .... $addresult = ldap_add ($Server, $newdn, $newinfo); $delresult = ldap_delete($Server, $info[0]["dn"]); That should more or less do what you need (once the syntax is cleaned up and filled in :)). Daniell Freed MATS Luspa wrote: Hello! I must make a note here. There isn't a function that is called ldap_modrdn2 in PHP. But in C API there is. /Regards Mats -- -------------------------------------------------------------------- Mats Luspa Phone: +46 (0)980 79 022 Institutet foer Rymdfysik Fax: +46 (0)980 79 050 Swedish Institute of Space Physics email: mats.luspa@irf.se Box 812 SE-981 28 Kiruna, Sweden -------------------------------------------------------------------- On Tue, 19 Dec 2000, Trotta, Johathan R. wrote: > ldap_modrdn2() > > int ldap_modrdn2( LDAP *ld, char *entrydn, char *newrdn, int deleteoldrdn ); > > or > > ldap_modrdn2_s() > > (usage is the same) > > J.Trotta > Pratt & Whitney > > -----Original Message----- > From: Tomas Kucera [mailto:tom.kucera@sh.cvut.cz] > Sent: Tuesday, December 19, 2000 5:17 AM > To: LDAP > Subject: modify DNs in PHP > > > hi, > does anybody know how to change DNs to another one? > I have this dn: > > cn=john,ou=marketing,dc=company,dc=country > > and I would change it to: > > cn=john,ou=support,dc=company,dc=country > > but when I dont know how to do it in php > there is a function ldap_modify but its seems to work only with common > attributes. > > thanks > > -- > -------------------------------------------------------------------------- > (o> Tomas Kucera (kuca) student 6.rocniku FEL CVUT > // \ tom.kucera@sh.cvut.cz, tomas@globe.cz > V_/_ ICQ: 33297193, TEL: 0604 704983 > http://symuro.webzdarma.cz > -------------------------------------------------------------------------- > Linux is like fantasy game: you can kill zombies and invoke daemons > -------------------------------------------------------------------------- > -- Daniell Freed Computer Services Dewitt, Ross, & Stevens S.C. He who fights with monsters might take care lest he thereby become a monster. And if you gaze for long into an abyss, the abyss gazes also into you. Beyond Good and Evil Friedrich Wilhelm Nietzche