LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-31-2005, 07:54 PM   #1
wslyhbb
Member
 
Registered: Apr 2002
Location: Chicago, IL
Distribution: Mandriva 2009.0 PowerPack x86_64
Posts: 150

Rep: Reputation: 15
OpenLDAP rootDN fetch with Java


I am using Java, I am messing around with connecting to an OpenLDAP directory, I was wondering how I can query the directory to find out the rootDN. So that I can be given the server name, username and password, without requiring them to provide the rootDN. In otherwords, the use says "localhost", user is cn=Manager, and password is secret, I would like to make an annonymous connection to the directory on localhost, fetch the rootDN, then make a bound connection dc=my-domain,dc=com, on localhost with cn=Manager,dc=my-domain,dc=com.

I tried doing:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost/");
SearchControls contrs = new SearchControls();
contrs.setSearchScope(SearchControls.OBJECT_SCOPE);
NamingEnumeration results = context.search("",
"(|(objectclass=*)(objectclass=ldapsubentry))", null, contrs);
while (results.hasMore())
{
System.out.println((javax.naming.directory.SearchResult)results.next());
}
But all I get is: : null:null:{objectclass=objectClass: top, OpenLDAProotDSE}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fetchmail doesn't fetch linuxhippy Slackware 7 08-27-2005 08:51 PM
Nessus fetch problem skittlebrau Linux - Software 0 04-23-2005 10:41 AM
fetch package? xpcandrew Linux - Newbie 1 02-01-2005 01:32 AM
a broken package, cannot RE-fetch?! b0uncer Arch 2 09-29-2004 09:23 AM
installing fetch mihailolja Linux - Newbie 1 03-10-2004 08:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration