NTLM + Jcifs SID.getGroupMemberSids()

Hi all,

Is it possible to use JCIFS to return all users from a Domain as well as all groups from that domain?

I have been studying the source code for jcifs 1.3.0 and found a class SID.java. Inside, there are few interesting methods such as getGroupMemberSids.

I have been playing with the code but I did not make much progress. Any comments, suggestions, howtos, pointers, etc are greatly appreciated. Thanks.

import jcifs.UniAddress;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbSession;
import jcifs.smb.NtlmContext;
import jcifs.ntlmssp.NtlmFlags;
import jcifs.smb.SID;
import java.net.InetAddress;
public class simpleJavaAuthenticationTest {
	public static void main(String[] args) {
		try {
			InetAddress ip = InetAddress.getByName("");
			UniAddress myDomain = new UniAddress(ip);
			NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("test.mydomain","carlosscheidecker","test");
			SmbSession.logon(myDomain, auth);
			System.out.println("Hostname: "+ myDomain.getHostName());
			jcifs.smb.SID mySid = jcifs.smb.SID.getServerSid(myDomain.getHostName(), auth);
			System.out.println("Sid Domain Name: "+ auth.getName());
			System.out.println("Sid Domain SID: " +mySid.getDomainSid());
			SID[] groupMembers = mySid.getGroupMemberSids(auth.getName(), auth, SID.SID_TYPE_USER);
			System.out.println("Total SIDs = "+groupMembers.length);
			for (int i = 0; i < groupMembers.length; i++ ) {
				System.out.println("Sid["+i+"] GroupMembersSids: " +mySid.getAccountName());
		} catch (Exception e) {
			System.out.println("Exception : "+e.toString());

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CarlosScheideckerAuthor Commented:
Used LDAP for the needs I have as per talk with JCIFs developers. Not want I wanted but did the trick.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Server Software

From novice to tech pro — start learning today.