[jcifs] Domain Controllers

Jason Bainbridge jbainbridge at gmail.com
Wed Feb 2 19:54:31 GMT 2005


See this thread:

http://lists.samba.org/archive/jcifs/2004-October/004174.html

You want to do something like:

UniAddress dc = new UniAddress( NbtAddress.getByName( domain, 0x1c, null
));
	SmbSession.logon( dc, new NtlmPasswordAuthentication( domain, username,
password );

Regards,
-- 
Jason Bainbridge
KDE - Conquer Your Desktop - http://kde.org
KDE Web Team - webmaster at kde


On Wed, 2 Feb 2005 11:37:25 -0800, MSDean at beckman.com
<MSDean at beckman.com> wrote:
> 
> Thanks Jonathan,
> 
> I understand that this will indicate the WINS server to JCIF.
> 
> Do you know how to retrieve the domain controller from the WINS server
> programatically?
> 
> -Mark
> 
>                       "Jonathan D
>                       Trumbull"                  To:       MSDean at beckman.com
>                       <Jonathan.Trumbull@        cc:       jcifs at lists.samba.org,
>                       abbott.com>                 jcifs-bounces+jonathan.trumbull=abbott.com at lists.samba.org
>                                                  Subject:  Re: [jcifs] Domain Controllers
>                       02/02/2005 11:29 AM
> 
> 
> Mark,
> 
> >>My question is, is it possible to avoid providing hard-coded domain
> controllers
> (dc) to the logon method?<<
> 
> You can also use a WINS server to identify the current domain controller for a
> given domain like this:
> 
> <init-param>
>         <param-name>jcifs.netbios.wins</param-name>
>         <param-value>10.229.249.50,10.229.248.50</param-value>
> </init-param>
> 
> On windows, you find your primary and secondary WINS servers using:
> 
> c:>ipconfig /all
> 
> Not sure what happens when the WINS server changes!  Perhaps there is a way to
> poll through ~DHCP.
> 
> --Jonathan
> 
>    MSDean at beckman.com
>    Sent by:                                               To:
>    jcifs-bounces+jonathan.trumbull=abbott.com at lis jcifs at lists.samba.org
>    ts.samba.org                                           cc:
>                                                           Subject:
>                                                   [jcifs] Domain Controllers
>    02/02/2005 01:18 PM
> 
> I am using JCIFS to perform NTLM authentication in a Weblogic environment. I
> have created a custom authenticator, and the login method is included below.
> 
> My question is, is it possible to avoid providing hard-coded domain controllers
> (dc) to the logon method?
> 
> I have to deal with many domains, each of which may have several associated
> domain controllers. I am trying to find a way to avoid the need to explicitly
> provide domain controllers to the login method, since the controllers may not
> always be available or are subject to change.
> 
> Any suggestions would be appreciated.
> 
> Thanks,
> Mark
> 
>      private boolean login( String userName, String domainName, String
> controller, String password ) throws FailedLoginException {
>            boolean succeeded = false;
>            try {
>                  UniAddress dc = UniAddress.getByName(controller);
>                  NtlmPasswordAuthentication auth = new
> NtlmPasswordAuthentication(domainName + ";" + userName + ":" + password);
>                  SmbSession.logon(dc, auth);
>                  succeeded = true;
>            } catch (SmbException e) {
>                  logger.error("Authentication failed.", e);
>                  return false;
>            } catch (UnknownHostException e) {
>                  logger.error("Authentication failed (unknown host).", e);
>            }
>            logger.info("Authentication succeeded.");
>            return succeeded;
>      }
> 
>


More information about the jcifs mailing list