/** * Authenticate arbitrary credentials represented by the * <tt>NtlmPasswordAuthentication</tt> object against the domain controller * specified by the <tt>UniAddress</tt> parameter. If the credentials are * not accepted, an <tt>SmbAuthException</tt> will be thrown. If an error * occurs an <tt>SmbException</tt> will be thrown. If the credentials are * valid, the method will return without throwing an exception. See the * last <a href="../../../faq.html">FAQ</a> question. * <p> * See also the <tt>jcifs.smb.client.logonShare</tt> property. */ public static void logon( UniAddress dc, NtlmPasswordAuthentication auth ) throws SmbException { logon(dc, 0, auth); }
public static byte[] getChallenge( UniAddress dc ) throws SmbException, UnknownHostException { return getChallenge(dc, 0); }
synchronized SmbSession getSmbSession( NtlmPasswordAuthentication auth ) { SmbSession ssn; long now; ListIterator iter = sessions.listIterator(); while( iter.hasNext() ) { ssn = (SmbSession)iter.next(); if( ssn.matches( auth )) { ssn.auth = auth; return ssn; } } /* logoff old sessions */ if (SO_TIMEOUT > 0 && sessionExpiration < (now = System.currentTimeMillis())) { sessionExpiration = now + SO_TIMEOUT; iter = sessions.listIterator(); while( iter.hasNext() ) { ssn = (SmbSession)iter.next(); if( ssn.expiration < now ) { ssn.logoff( false ); } } } ssn = new SmbSession( address, port, localAddr, localPort, auth ); ssn.transport = this; sessions.add( ssn ); return ssn; } boolean matches( UniAddress address, int port, InetAddress localAddr, int localPort, String hostName ) {
void send( ServerMessageBlock request, ServerMessageBlock response ) throws SmbException { synchronized (transport()) { if( response != null ) { response.received = false; sessionSetup( request, response ); if( response != null && response.received ) { return; } catch (SmbException se) { if (request instanceof SmbComTreeConnectAndX) { logoff(true);
NtlmChallenge chal = (NtlmChallenge)ssn.getAttribute( "NtlmHttpChal" ); if( chal == null ) { chal = SmbSession.getChallengeForDomain(); ssn.setAttribute( "NtlmHttpChal", chal ); } else { dc = UniAddress.getByName( domainController, true ); challenge = SmbSession.getChallenge( dc ); SmbSession.logon( dc, ntlm );
byte[] challenge = SmbSession.getChallenge(dc); ntlm = NtlmSsp.authenticate(request, response, challenge); if (ntlm == null) return; SmbSession.logon(dc, ntlm); } catch (SmbAuthException sae) { response.setHeader("WWW-Authenticate", "NTLM");
void sessionSetup( ServerMessageBlock andx, ServerMessageBlock andxResponse ) throws SmbException { synchronized (transport()) { NtlmContext nctx = null; SmbException ex = null; transport.getSmbSession( NtlmPasswordAuthentication.DEFAULT ).getSmbTree( LOGON_SHARE, null ).treeConnect( null, null ); } else { byte[] signingKey = auth.getSigningKey(transport.server.encryptionKey); logoff(true); connectionState = 0; throw se;
void send( ServerMessageBlock request, ServerMessageBlock response ) throws SmbException { synchronized (session.transport()) { if( response != null ) { response.received = false; request.path = '\\' + session.transport().tconHostName + '\\' + share + request.path; session.send( request, response ); } catch( SmbException se ) { if (se.getNtStatus() == se.NT_STATUS_NETWORK_NAME_DELETED) {
DfsReferral[] __getDfsReferrals(NtlmPasswordAuthentication auth, String path, int rn) throws SmbException { SmbTree ipc = getSmbSession( auth ).getSmbTree( "IPC$", null ); Trans2GetDfsReferralResponse resp = new Trans2GetDfsReferralResponse(); ipc.send( new Trans2GetDfsReferral( path ), resp );
protected void doDisconnect( boolean hard ) throws IOException { ListIterator iter = sessions.listIterator(); while (iter.hasNext()) { SmbSession ssn = (SmbSession)iter.next(); ssn.logoff( hard ); } socket.shutdownOutput(); out.close(); in.close(); socket.close(); digest = null; }
if (dc_list[i] != null) { try { return interrogate( dc_list[i] ); } catch (SmbException se) { if (SmbTransport.log.level >= 2) {
NtlmChallenge chal = (NtlmChallenge)ssn.getAttribute( "NtlmHttpChal" ); if( chal == null ) { chal = SmbSession.getChallengeForDomain(); ssn.setAttribute( "NtlmHttpChal", chal ); } else { dc = UniAddress.getByName( domainController, true ); challenge = SmbSession.getChallenge( dc ); SmbSession.logon( dc, ntlm );
byte[] challenge = SmbSession.getChallenge(dc); ntlm = NtlmSsp.authenticate(request, response, challenge); if (ntlm == null) return; SmbSession.logon(dc, ntlm); } catch (SmbAuthException sae) { response.setHeader("WWW-Authenticate", "NTLM");
void send( ServerMessageBlock request, ServerMessageBlock response ) throws SmbException { synchronized (transport()) { if( response != null ) { response.received = false; sessionSetup( request, response ); if( response != null && response.received ) { return; } catch (SmbException se) { if (request instanceof SmbComTreeConnectAndX) { logoff(true);
void sessionSetup( ServerMessageBlock andx, ServerMessageBlock andxResponse ) throws SmbException { synchronized (transport()) { NtlmContext nctx = null; SmbException ex = null; transport.getSmbSession( NtlmPasswordAuthentication.DEFAULT ).getSmbTree( LOGON_SHARE, null ).treeConnect( null, null ); } else { byte[] signingKey = auth.getSigningKey(transport.server.encryptionKey); logoff(true); connectionState = 0; throw se;
void send( ServerMessageBlock request, ServerMessageBlock response ) throws SmbException { synchronized (session.transport()) { if( response != null ) { response.received = false; request.path = '\\' + session.transport().tconHostName + '\\' + share + request.path; session.send( request, response ); } catch( SmbException se ) { if (se.getNtStatus() == se.NT_STATUS_NETWORK_NAME_DELETED) {
DfsReferral[] __getDfsReferrals(NtlmPasswordAuthentication auth, String path, int rn) throws SmbException { SmbTree ipc = getSmbSession( auth ).getSmbTree( "IPC$", null ); Trans2GetDfsReferralResponse resp = new Trans2GetDfsReferralResponse(); ipc.send( new Trans2GetDfsReferral( path ), resp );
protected void doDisconnect( boolean hard ) throws IOException { ListIterator iter = sessions.listIterator(); try { while (iter.hasNext()) { SmbSession ssn = (SmbSession)iter.next(); ssn.logoff( hard ); } socket.shutdownOutput(); out.close(); in.close(); socket.close(); } finally { digest = null; socket = null; tconHostName = null; } }
if (dc_list[i] != null) { try { return interrogate( dc_list[i] ); } catch (SmbException se) { if (SmbTransport.log.level >= 2) {
NtlmChallenge chal = (NtlmChallenge)ssn.getAttribute( "NtlmHttpChal" ); if( chal == null ) { chal = SmbSession.getChallengeForDomain(); ssn.setAttribute( "NtlmHttpChal", chal ); } else { dc = UniAddress.getByName( domainController, true ); challenge = SmbSession.getChallenge( dc ); SmbSession.logon( dc, ntlm );