On Jan 6, 1:15 pm, bgmi...@staff.telkomsa.net (Buchan Milne) wrote: > On Monday 05 January 2009 19:56:03 omkar wrote: > > > hi all, > > I am trying to write one tool, that could find the all available dc > > values. > > You should pose your problem more precisely. E.g., maybe you would prefer to > find the DC values for all entries of objectclass domain? > > > see example: > > -> base dn: dc=A, dc=B, dc=C > > ou =users, dc=A, dc=B, dc=C > > ou= groups,dc=A, dc=B, dc=C > > dc=D, dc=A, dc=B, dc=C > > ou=users, dc=D, dc=A, dc=B, dc=C > > something like structure I have in LDAP DIR, > > now I just want to find out all avalable dc's by accepting base dn as > > input in PERL:LDAP. > > Relying on the DN to be composed of the value you want is not necessarily the > best LDAP practice. > > Why don't you search your base DN with a filter of (objectclass=domain) and > request the DC attribute. It will accomplish the same thing, but in a much > more robust way. > > Regards, > Buchan OK did you mean like this:
I did following but it wont work. my($ldap) = Net::LDAP->new('127.0.0.1') my($mesg) = $ldap->search(filter => '(objectclass=domain)'); foreach $entry ($mesg->all_entries) { my $en_dn = $entry->dn(); } But nothing is get printed. : ( will Please go through this code and tell me what I am missing from code point of view. Thanks, Omi