log.debug("Authentication failed", sae); if ( t.getSession().getCredentials().isAnonymous() ) { // anonymous session, refresh try ( SmbSessionInternal s = trans.getSmbSession(this.ctx.withAnonymousCredentials()).unwrap(SmbSessionInternal.class); SmbTreeImpl tr = s.getSmbTree(null, null).unwrap(SmbTreeImpl.class) ) { tr.treeConnect(null, null); log.debug("Trying to renew credentials after auth error"); try ( SmbSessionInternal s = trans.getSmbSession(this.ctx, t.getSession().getTargetHost(), t.getSession().getTargetDomain()) .unwrap(SmbSessionInternal.class); SmbTreeImpl tr = s.getSmbTree(share, null).unwrap(SmbTreeImpl.class) ) { if ( referral != null ) {
log.debug("Authentication failed", sae); if ( t.getSession().getCredentials().isAnonymous() ) { // anonymous session, refresh try ( SmbSessionInternal s = trans.getSmbSession(this.ctx.withAnonymousCredentials()).unwrap(SmbSessionInternal.class); SmbTreeImpl tr = s.getSmbTree(null, null).unwrap(SmbTreeImpl.class) ) { tr.treeConnect(null, null); log.debug("Trying to renew credentials after auth error"); try ( SmbSessionInternal s = trans.getSmbSession(this.ctx, t.getSession().getTargetHost(), t.getSession().getTargetDomain()) .unwrap(SmbSessionInternal.class); SmbTreeImpl tr = s.getSmbTree(share, null).unwrap(SmbTreeImpl.class) ) { if ( referral != null ) {
@Override public void logon ( CIFSContext tf, Address dc, int port ) throws SmbException { try ( SmbTransportInternal smbTransport = tf.getTransportPool().getSmbTransport(tf, dc, port, false, tf.getConfig().isIpcSigningEnforced()) .unwrap(SmbTransportInternal.class); SmbSessionInternal smbSession = smbTransport.getSmbSession(tf, dc.getHostName(), null).unwrap(SmbSessionInternal.class); SmbTreeInternal tree = smbSession.getSmbTree(tf.getConfig().getLogonShare(), null).unwrap(SmbTreeInternal.class) ) { tree.connectLogon(tf); } }
@Override public void logon ( CIFSContext tf, Address dc, int port ) throws SmbException { try ( SmbTransportInternal smbTransport = tf.getTransportPool().getSmbTransport(tf, dc, port, false, tf.getConfig().isIpcSigningEnforced()) .unwrap(SmbTransportInternal.class); SmbSessionInternal smbSession = smbTransport.getSmbSession(tf, dc.getHostName(), null).unwrap(SmbSessionInternal.class); SmbTreeInternal tree = smbSession.getSmbTree(tf.getConfig().getLogonShare(), null).unwrap(SmbTreeInternal.class) ) { tree.connectLogon(tf); } }
private static NtlmChallenge interrogate ( CIFSContext tf, Address addr ) throws SmbException { UniAddress dc = new UniAddress(addr); try ( SmbTransportInternal trans = tf.getTransportPool() .getSmbTransport(tf, dc, 0, false, tf.hasDefaultCredentials() && tf.getConfig().isIpcSigningEnforced()) .unwrap(SmbTransportInternal.class) ) { if ( !tf.hasDefaultCredentials() ) { trans.ensureConnected(); log.warn( "Default credentials (jcifs.smb.client.username/password)" + " not specified. SMB signing may not work propertly." + " Skipping DC interrogation."); } else { try ( SmbSessionInternal ssn = trans.getSmbSession(tf.withDefaultCredentials()).unwrap(SmbSessionInternal.class) ) { ssn.treeConnectLogon(); } } return new NtlmChallenge(trans.getServerEncryptionKey(), dc); } catch ( SmbException e ) { throw e; } catch ( IOException e ) { throw new SmbException("Connection failed", e); } }
private static NtlmChallenge interrogate ( CIFSContext tf, Address addr ) throws SmbException { UniAddress dc = new UniAddress(addr); try ( SmbTransportInternal trans = tf.getTransportPool() .getSmbTransport(tf, dc, 0, false, tf.hasDefaultCredentials() && tf.getConfig().isIpcSigningEnforced()) .unwrap(SmbTransportInternal.class) ) { if ( !tf.hasDefaultCredentials() ) { trans.ensureConnected(); log.warn( "Default credentials (jcifs.smb.client.username/password)" + " not specified. SMB signing may not work propertly." + " Skipping DC interrogation."); } else { try ( SmbSessionInternal ssn = trans.getSmbSession(tf.withDefaultCredentials()).unwrap(SmbSessionInternal.class) ) { ssn.treeConnectLogon(); } } return new NtlmChallenge(trans.getServerEncryptionKey(), dc); } catch ( SmbException e ) { throw e; } catch ( IOException e ) { throw new SmbException("Connection failed", e); } }
.getSmbTransport(this.ctx, host, loc.getPort(), true, loc.shouldForceSigning()).unwrap(SmbTransportInternal.class); SmbTransportInternal trans = this.exclusiveTransport; try ( SmbSessionInternal smbSession = trans.getSmbSession(this.ctx, host, targetDomain).unwrap(SmbSessionInternal.class); SmbTreeImpl uct = smbSession.getSmbTree(share, null).unwrap(SmbTreeImpl.class); SmbTreeImpl ct = connectTree(loc, host, share, trans, uct, dr) ) { SmbSessionInternal smbSession = trans.getSmbSession(this.ctx, host, targetDomain).unwrap(SmbSessionInternal.class); SmbTreeImpl uct = smbSession.getSmbTree(share, null).unwrap(SmbTreeImpl.class); SmbTreeImpl ct = connectTree(loc, host, share, trans, uct, dr) ) {
.getSmbTransport(this.ctx, host, loc.getPort(), true, loc.shouldForceSigning()).unwrap(SmbTransportInternal.class); SmbTransportInternal trans = this.exclusiveTransport; try ( SmbSessionInternal smbSession = trans.getSmbSession(this.ctx, host, targetDomain).unwrap(SmbSessionInternal.class); SmbTreeImpl uct = smbSession.getSmbTree(share, null).unwrap(SmbTreeImpl.class); SmbTreeImpl ct = connectTree(loc, host, share, trans, uct, dr) ) { SmbSessionInternal smbSession = trans.getSmbSession(this.ctx, host, targetDomain).unwrap(SmbSessionInternal.class); SmbTreeImpl uct = smbSession.getSmbTree(share, null).unwrap(SmbTreeImpl.class); SmbTreeImpl ct = connectTree(loc, host, share, trans, uct, dr) ) {