@Override public Credentials getCredentials () { return this.delegate.getCredentials(); }
@Override public Credentials getCredentials () { return this.delegate.getCredentials(); }
@Override public String toString () { return "SmbSession[credentials=" + this.transportContext.getCredentials() + ",targetHost=" + this.targetHost + ",targetDomain=" + this.targetDomain + ",uid=" + this.uid + ",connectionState=" + this.connectionState + ",usage=" + this.usageCount.get() + "]"; }
@Override public String toString () { return "SmbSession[credentials=" + this.transportContext.getCredentials() + ",targetHost=" + this.targetHost + ",targetDomain=" + this.targetDomain + ",uid=" + this.uid + ",connectionState=" + this.connectionState + ",usage=" + this.usageCount.get() + "]"; }
/** * @param tf * @param tdom * @param thost * @return */ protected boolean matches ( CIFSContext tf, String thost, String tdom ) { return Objects.equals(this.getCredentials(), tf.getCredentials()) && Objects.equals(this.targetHost, thost) && Objects.equals(this.targetDomain, tdom); }
/** * @param tf * @param tdom * @param thost * @return */ protected boolean matches ( CIFSContext tf, String thost, String tdom ) { return Objects.equals(this.getCredentials(), tf.getCredentials()) && Objects.equals(this.targetHost, thost) && Objects.equals(this.targetDomain, tdom); }
@Override protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) { int start = dstIndex; if ( this.server.security == SmbConstants.SECURITY_SHARE && this.ctx.getCredentials() instanceof NtlmPasswordAuthenticator ) { NtlmPasswordAuthenticator pwAuth = (NtlmPasswordAuthenticator) this.ctx.getCredentials(); if ( isExternalAuth(pwAuth) ) { dst[ dstIndex++ ] = (byte) 0x00; } else { System.arraycopy(this.password, 0, dst, dstIndex, this.passwordLength); dstIndex += this.passwordLength; } } else { // no password in tree connect dst[ dstIndex++ ] = (byte) 0x00; } dstIndex += writeString(this.path, dst, dstIndex); try { System.arraycopy(this.service.getBytes("ASCII"), 0, dst, dstIndex, this.service.length()); } catch ( UnsupportedEncodingException uee ) { return 0; } dstIndex += this.service.length(); dst[ dstIndex++ ] = (byte) '\0'; return dstIndex - start; }
@Override protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) { int start = dstIndex; if ( this.server.security == SmbConstants.SECURITY_SHARE && this.ctx.getCredentials() instanceof NtlmPasswordAuthenticator ) { NtlmPasswordAuthenticator pwAuth = (NtlmPasswordAuthenticator) this.ctx.getCredentials(); if ( isExternalAuth(pwAuth) ) { dst[ dstIndex++ ] = (byte) 0x00; } else { System.arraycopy(this.password, 0, dst, dstIndex, this.passwordLength); dstIndex += this.passwordLength; } } else { // no password in tree connect dst[ dstIndex++ ] = (byte) 0x00; } dstIndex += writeString(this.path, dst, dstIndex); try { System.arraycopy(this.service.getBytes("ASCII"), 0, dst, dstIndex, this.service.length()); } catch ( UnsupportedEncodingException uee ) { return 0; } dstIndex += this.service.length(); dst[ dstIndex++ ] = (byte) '\0'; return dstIndex - start; }
SmbSessionImpl ( CIFSContext tf, String targetHost, String targetDomain, SmbTransportImpl transport ) { this.transportContext = tf; this.targetDomain = targetDomain; this.targetHost = targetHost; this.transport = transport.acquire(); this.trees = new ArrayList<>(); this.credentials = tf.getCredentials().unwrap(CredentialsInternal.class).clone(); }
SmbSessionImpl ( CIFSContext tf, String targetHost, String targetDomain, SmbTransportImpl transport ) { this.transportContext = tf; this.targetDomain = targetDomain; this.targetHost = targetHost; this.transport = transport.acquire(); this.trees = new ArrayList<>(); this.credentials = tf.getCredentials().unwrap(CredentialsInternal.class).clone(); }
private static String getRPCTarget ( CIFSContext ctx, SmbResourceLocator loc, Address serverAddress ) { // Try to stick to the same server. However if we are using kerberos authentication we need to use the name. // The comment about composite share lists was wrong, we do not iterate over multiple targets. Credentials creds = ctx.getCredentials(); if ( creds instanceof Kerb5Authenticator && serverAddress.getHostName() != null ) { return serverAddress.getHostName(); } return serverAddress.getHostAddress(); }
private static String getRPCTarget ( CIFSContext ctx, SmbResourceLocator loc, Address serverAddress ) { // Try to stick to the same server. However if we are using kerberos authentication we need to use the name. // The comment about composite share lists was wrong, we do not iterate over multiple targets. Credentials creds = ctx.getCredentials(); if ( creds instanceof Kerb5Authenticator && serverAddress.getHostName() != null ) { return serverAddress.getHostName(); } return serverAddress.getHostAddress(); }
/** * * {@inheritDoc} * * @see jcifs.smb.SmbResourceLocatorInternal#shouldForceSigning() */ @Override public boolean shouldForceSigning () { return this.ctx.getConfig().isIpcSigningEnforced() && !this.ctx.getCredentials().isAnonymous() && isIPC(); }
/** * * {@inheritDoc} * * @see jcifs.smb.SmbResourceLocatorInternal#shouldForceSigning() */ @Override public boolean shouldForceSigning () { return this.ctx.getConfig().isIpcSigningEnforced() && !this.ctx.getCredentials().isAnonymous() && isIPC(); }
private Map<String, Map<String, CacheEntry<DfsReferralDataInternal>>> getTrustedDomains ( CIFSContext tf ) throws SmbAuthException { if ( tf.getConfig().isDfsDisabled() || tf.getCredentials().getUserDomain() == null || tf.getCredentials().getUserDomain().isEmpty() ) { return null; return this._domains.map; try { String authDomain = tf.getCredentials().getUserDomain(); log.debug("getting trusted domains failed: " + tf.getCredentials().getUserDomain(), ioe);
@Override protected int writeParameterWordsWireFormat ( byte[] dst, int dstIndex ) { if ( this.server.security == SmbConstants.SECURITY_SHARE && this.ctx.getCredentials() instanceof NtlmPasswordAuthenticator ) { NtlmPasswordAuthenticator pwAuth = (NtlmPasswordAuthenticator) this.ctx.getCredentials(); if ( isExternalAuth(pwAuth) ) { this.passwordLength = 1;
@Override protected int writeParameterWordsWireFormat ( byte[] dst, int dstIndex ) { if ( this.server.security == SmbConstants.SECURITY_SHARE && this.ctx.getCredentials() instanceof NtlmPasswordAuthenticator ) { NtlmPasswordAuthenticator pwAuth = (NtlmPasswordAuthenticator) this.ctx.getCredentials(); if ( isExternalAuth(pwAuth) ) { this.passwordLength = 1;
0, false, !tf.getCredentials().isAnonymous() && tf.getConfig().isSigningEnabled() && tf.getConfig().isIpcSigningEnforced()) .unwrap(SmbTransportImpl.class); transport.ensureConnected();
@Override public byte[] getChallenge ( CIFSContext tf, Address dc, int port ) throws SmbException { try ( SmbTransportInternal trans = tf.getTransportPool() .getSmbTransport(tf, dc, port, false, !tf.getCredentials().isAnonymous() && tf.getConfig().isIpcSigningEnforced()) .unwrap(SmbTransportInternal.class) ) { trans.ensureConnected(); return trans.getServerEncryptionKey(); } catch ( SmbException e ) { throw e; } catch ( IOException e ) { throw new SmbException("Connection failed", e); } }
@Override public byte[] getChallenge ( CIFSContext tf, Address dc, int port ) throws SmbException { try ( SmbTransportInternal trans = tf.getTransportPool() .getSmbTransport(tf, dc, port, false, !tf.getCredentials().isAnonymous() && tf.getConfig().isIpcSigningEnforced()) .unwrap(SmbTransportInternal.class) ) { trans.ensureConnected(); return trans.getServerEncryptionKey(); } catch ( SmbException e ) { throw e; } catch ( IOException e ) { throw new SmbException("Connection failed", e); } }