Package jcifs.config

Class BaseConfiguration

    • Field Detail

      • localPid

        protected int localPid
      • localTimeZone

        protected TimeZone localTimeZone
      • useBatching

        protected boolean useBatching
      • useUnicode

        protected boolean useUnicode
      • forceUnicode

        protected boolean forceUnicode
      • signingPreferred

        protected boolean signingPreferred
      • signingEnforced

        protected boolean signingEnforced
      • ipcSigningEnforced

        protected boolean ipcSigningEnforced
      • encryptionEnabled

        protected boolean encryptionEnabled
      • useNtStatus

        protected boolean useNtStatus
      • useExtendedSecurity

        protected boolean useExtendedSecurity
      • forceExtendedSecurity

        protected boolean forceExtendedSecurity
      • smb2OnlyNegotiation

        protected boolean smb2OnlyNegotiation
      • port139FailoverEnabled

        protected boolean port139FailoverEnabled
      • useNTSmbs

        protected boolean useNTSmbs
      • useLargeReadWrite

        protected boolean useLargeReadWrite
      • lanmanCompatibility

        protected int lanmanCompatibility
      • allowNTLMFallback

        protected boolean allowNTLMFallback
      • useRawNTLM

        protected boolean useRawNTLM
      • disableSpnegoIntegrity

        protected boolean disableSpnegoIntegrity
      • enforceSpnegoIntegrity

        protected boolean enforceSpnegoIntegrity
      • disablePlainTextPasswords

        protected boolean disablePlainTextPasswords
      • oemEncoding

        protected String oemEncoding
      • flags2

        protected int flags2
      • capabilities

        protected int capabilities
      • sessionLimit

        protected int sessionLimit
      • smbTcpNoDelay

        protected boolean smbTcpNoDelay
      • smbResponseTimeout

        protected int smbResponseTimeout
      • smbSocketTimeout

        protected int smbSocketTimeout
      • smbConnectionTimeout

        protected int smbConnectionTimeout
      • smbSessionTimeout

        protected int smbSessionTimeout
      • idleTimeoutDisabled

        protected boolean idleTimeoutDisabled
      • smbLocalAddress

        protected InetAddress smbLocalAddress
      • smbLocalPort

        protected int smbLocalPort
      • maxMpxCount

        protected int maxMpxCount
      • smbSendBufferSize

        protected int smbSendBufferSize
      • smbRecvBufferSize

        protected int smbRecvBufferSize
      • smbNotifyBufferSize

        protected int smbNotifyBufferSize
      • nativeOs

        protected String nativeOs
      • nativeLanMan

        protected String nativeLanMan
      • vcNumber

        protected int vcNumber
      • dfsDisabled

        protected boolean dfsDisabled
      • dfsTTL

        protected long dfsTTL
      • dfsStrictView

        protected boolean dfsStrictView
      • dfsConvertToFqdn

        protected boolean dfsConvertToFqdn
      • logonShare

        protected String logonShare
      • defaultDomain

        protected String defaultDomain
      • defaultUserName

        protected String defaultUserName
      • defaultPassword

        protected String defaultPassword
      • netbiosHostname

        protected String netbiosHostname
      • netbiosCachePolicy

        protected int netbiosCachePolicy
      • netbiosSocketTimeout

        protected int netbiosSocketTimeout
      • netbiosSendBufferSize

        protected int netbiosSendBufferSize
      • netbiosRevcBufferSize

        protected int netbiosRevcBufferSize
      • netbiosRetryCount

        protected int netbiosRetryCount
      • netbiosRetryTimeout

        protected int netbiosRetryTimeout
      • netbiosScope

        protected String netbiosScope
      • netbiosLocalPort

        protected int netbiosLocalPort
      • netbiosLocalAddress

        protected InetAddress netbiosLocalAddress
      • lmhostsFilename

        protected String lmhostsFilename
      • broadcastAddress

        protected InetAddress broadcastAddress
      • maximumBufferSize

        protected int maximumBufferSize
      • transactionBufferSize

        protected int transactionBufferSize
      • bufferCacheSize

        protected int bufferCacheSize
      • smbListSize

        protected int smbListSize
      • smbListCount

        protected int smbListCount
      • smbAttributeExpiration

        protected long smbAttributeExpiration
      • ignoreCopyToException

        protected boolean ignoreCopyToException
      • maxRequestRetries

        protected int maxRequestRetries
      • traceResourceUsage

        protected boolean traceResourceUsage
      • strictResourceLifecycle

        protected boolean strictResourceLifecycle
      • disallowCompound

        protected Set<String> disallowCompound
      • requireSecureNegotiate

        protected boolean requireSecureNegotiate
      • sendNTLMTargetName

        protected boolean sendNTLMTargetName
      • guestUsername

        protected String guestUsername
      • guestPassword

        protected String guestPassword
      • allowGuestFallback

        protected boolean allowGuestFallback
    • Constructor Detail

      • BaseConfiguration

        public BaseConfiguration​(boolean initDefaults)
                          throws CIFSException
        Parameters:
        initDefaults - whether to initialize defaults based on other settings
        Throws:
        CIFSException
    • Method Detail

      • getNetbiosHostname

        public String getNetbiosHostname()
        Description copied from interface: Configuration
        Property jcifs.netbios.hostname (string)
        Specified by:
        getNetbiosHostname in interface Configuration
        Returns:
        local NETBIOS/short name to announce
      • getLocalAddr

        public InetAddress getLocalAddr()
        Description copied from interface: Configuration
        Property jcifs.smb.client.laddr (string)
        Specified by:
        getLocalAddr in interface Configuration
        Returns:
        local address to use for outgoing connections
      • getLocalPort

        public int getLocalPort()
        Description copied from interface: Configuration
        Property jcifs.smb.client.lport (int)
        Specified by:
        getLocalPort in interface Configuration
        Returns:
        local port to use for outgoing connections
      • getConnTimeout

        public int getConnTimeout()
        Description copied from interface: Configuration
        Property jcifs.smb.client.connTimeout (int, default 35000)
        Specified by:
        getConnTimeout in interface Configuration
        Returns:
        timeout for establishing a socket connection, in milliseconds
      • getResponseTimeout

        public int getResponseTimeout()
        Description copied from interface: Configuration
        Property jcifs.smb.client.responseTimeout (int, default 30000)
        Specified by:
        getResponseTimeout in interface Configuration
        Returns:
        timeout for SMB responses, in milliseconds
      • getSoTimeout

        public int getSoTimeout()
        Description copied from interface: Configuration
        Property jcifs.smb.client.soTimeout (int, default 35000)
        Specified by:
        getSoTimeout in interface Configuration
        Returns:
        socket timeout, in milliseconds
      • getSessionTimeout

        public int getSessionTimeout()
        Description copied from interface: Configuration
        Property jcifs.smb.client.sessionTimeout (int, default 35000)
        Specified by:
        getSessionTimeout in interface Configuration
        Returns:
        timeout for SMB sessions, in milliseconds
      • getSendBufferSize

        public int getSendBufferSize()
        Description copied from interface: Configuration
        Property jcifs.smb.client.snd_buf_size (int, default 65535)
        Specified by:
        getSendBufferSize in interface Configuration
        Returns:
        send buffer size, in bytes
      • getRecieveBufferSize

        @Deprecated
        public int getRecieveBufferSize()
        Deprecated.
        Description copied from interface: Configuration
        Property jcifs.smb.client.rcv_buf_size (int, default 65535)
        Specified by:
        getRecieveBufferSize in interface Configuration
        Returns:
        receive buffer size, in bytes
      • getReceiveBufferSize

        public int getReceiveBufferSize()
        Description copied from interface: Configuration
        Property jcifs.smb.client.rcv_buf_size (int, default 65535)
        Specified by:
        getReceiveBufferSize in interface Configuration
        Returns:
        receive buffer size, in bytes
      • getNotifyBufferSize

        public int getNotifyBufferSize()
        Description copied from interface: Configuration
        Property jcifs.smb.client.notify_buf_size (int, default 1024)
        Specified by:
        getNotifyBufferSize in interface Configuration
        Returns:
        the size of the requested server notify buffer
      • getMaxMpxCount

        public int getMaxMpxCount()
        Description copied from interface: Configuration
        Property jcifs.smb.client.maxMpxCount (int, default 10)
        Specified by:
        getMaxMpxCount in interface Configuration
        Returns:
        maximum count of concurrent commands to announce
      • getNativeLanman

        public String getNativeLanman()
        Description copied from interface: Configuration
        Property jcifs.smb.client.nativeLanMan (string, default jCIFS)
        Specified by:
        getNativeLanman in interface Configuration
        Returns:
        Lanman string to report
      • getNativeOs

        public String getNativeOs()
        Description copied from interface: Configuration
        Property jcifs.smb.client.nativeOs (string, default os.name)
        Specified by:
        getNativeOs in interface Configuration
        Returns:
        OS string to report
      • getVcNumber

        public int getVcNumber()
        Specified by:
        getVcNumber in interface Configuration
        Returns:
        virtual circuit number to use
      • getCapabilities

        public int getCapabilities()
        Description copied from interface: Configuration
        Property jcifs.smb.client.capabilities (int)
        Specified by:
        getCapabilities in interface Configuration
        Returns:
        custom capabilities
      • isUseSMB2OnlyNegotiation

        public boolean isUseSMB2OnlyNegotiation()
        Description copied from interface: Configuration
        Use SMB2 non-backward compatible negotiation style Property jcifs.smb.client.useSMB2Negotiation (boolean, default false)
        Specified by:
        isUseSMB2OnlyNegotiation in interface Configuration
        Returns:
        whether to use non-backward compatible protocol negotiation
      • isRequireSecureNegotiate

        public boolean isRequireSecureNegotiate()
        Description copied from interface: Configuration
        Enforce secure negotiation Property jcifs.smb.client.requireSecureNegotiate (boolean, default true) This does not provide any actual downgrade protection if SMB1 is allowed. It will also break connections with SMB2 servers that do not properly sign error responses.
        Specified by:
        isRequireSecureNegotiate in interface Configuration
        Returns:
        whether to enforce the use of secure negotiation.
      • isPort139FailoverEnabled

        public boolean isPort139FailoverEnabled()
        Description copied from interface: Configuration
        Enable port 139 failover Property jcifs.smb.client.port139.enabled (boolean, default false)
        Specified by:
        isPort139FailoverEnabled in interface Configuration
        Returns:
        whether to failover to legacy transport on port 139
      • isUseBatching

        public boolean isUseBatching()
        Description copied from interface: Configuration
        Property jcifs.smb.client.useBatching (boolean, default true)
        Specified by:
        isUseBatching in interface Configuration
        Returns:
        whether to enable support for SMB1 AndX command batching
      • isUseUnicode

        public boolean isUseUnicode()
        Description copied from interface: Configuration
        Property jcifs.smb.client.useUnicode (boolean, default true)
        Specified by:
        isUseUnicode in interface Configuration
        Returns:
        whether to announce support for unicode
      • isForceUnicode

        public boolean isForceUnicode()
        Description copied from interface: Configuration
        Property jcifs.smb.client.forceUnicode (boolean, default false)
        Specified by:
        isForceUnicode in interface Configuration
        Returns:
        whether to use unicode, even if the server does not announce it
      • isDfsDisabled

        public boolean isDfsDisabled()
        Description copied from interface: Configuration
        Property jcifs.smb.client.dfs.disabled (boolean, default false)
        Specified by:
        isDfsDisabled in interface Configuration
        Returns:
        whether DFS lookup is disabled
      • isDfsStrictView

        public boolean isDfsStrictView()
        Description copied from interface: Configuration
        Property jcifs.smb.client.dfs.strictView (boolean, default false)
        Specified by:
        isDfsStrictView in interface Configuration
        Returns:
        whether a authentication failure during DFS resolving will throw an exception
      • getDfsTtl

        public long getDfsTtl()
        Description copied from interface: Configuration
        Property jcifs.smb.client.dfs.ttl (int, default 300)
        Specified by:
        getDfsTtl in interface Configuration
        Returns:
        title to live, in seconds, for DFS cache entries
      • isDfsConvertToFQDN

        public boolean isDfsConvertToFQDN()
        Description copied from interface: Configuration
        Enable hack to make kerberos auth work with DFS sending short names This works by appending the domain name to the netbios short name and will fail horribly if this mapping is not correct for your domain. Property jcifs.smb.client.dfs.convertToFQDN (boolean, default false)
        Specified by:
        isDfsConvertToFQDN in interface Configuration
        Returns:
        whether to convert NetBIOS names returned by DFS to FQDNs
      • getLogonShare

        public String getLogonShare()
        Description copied from interface: Configuration
        Property jcifs.smb.client.logonShare
        Specified by:
        getLogonShare in interface Configuration
        Returns:
        share to connect to during authentication, if unset connect to IPC$
      • isDisablePlainTextPasswords

        public boolean isDisablePlainTextPasswords()
        Description copied from interface: Configuration
        Property jcifs.smb.client.disablePlainTextPasswords (boolean, default true)
        Specified by:
        isDisablePlainTextPasswords in interface Configuration
        Returns:
        whether the usage of plaintext passwords is prohibited, defaults to false
      • getLanManCompatibility

        public int getLanManCompatibility()
        Description copied from interface: Configuration
        Lanman compatibility level
        0 or 1 LM and NTLM
        2 NTLM only
        3-5 NTLMv2 only
        Property jcifs.smb.lmCompatibility (int, default 3)
        Specified by:
        getLanManCompatibility in interface Configuration
        Returns:
        lanman compatibility level, defaults to 3 i.e. NTLMv2 only
      • isAllowNTLMFallback

        public boolean isAllowNTLMFallback()
        Description copied from interface: Configuration
        Property jcifs.smb.allowNTLMFallback (boolean, default true)
        Specified by:
        isAllowNTLMFallback in interface Configuration
        Returns:
        whether to allow fallback from kerberos to NTLM
      • isUseRawNTLM

        public boolean isUseRawNTLM()
        Description copied from interface: Configuration
        Property jcifs.smb.useRawNTLM (boolean, default false)
        Specified by:
        isUseRawNTLM in interface Configuration
        Returns:
        whether to use raw NTLMSSP tokens instead of SPNEGO wrapped ones
      • isDisableSpnegoIntegrity

        public boolean isDisableSpnegoIntegrity()
        Description copied from interface: Configuration
        Property jcifs.smb.client.disableSpnegoIntegrity (boolean, false)
        Specified by:
        isDisableSpnegoIntegrity in interface Configuration
        Returns:
        whether to disable sending/verifying SPNEGO mechanismListMIC
      • isEnforceSpnegoIntegrity

        public boolean isEnforceSpnegoIntegrity()
        Description copied from interface: Configuration
        Property jcifs.smb.client.enforceSpnegoIntegrity (boolean, false)
        Specified by:
        isEnforceSpnegoIntegrity in interface Configuration
        Returns:
        whether to enforce verifying SPNEGO mechanismListMIC
      • getNetbiosLocalPort

        public int getNetbiosLocalPort()
        Description copied from interface: Configuration
        Property jcifs.netbios.lport (int)
        Specified by:
        getNetbiosLocalPort in interface Configuration
        Returns:
        local bind port for nebios connections
      • getNetbiosSoTimeout

        public int getNetbiosSoTimeout()
        Description copied from interface: Configuration
        Property jcifs.netbios.soTimeout (int, default 5000)
        Specified by:
        getNetbiosSoTimeout in interface Configuration
        Returns:
        socket timeout for netbios connections, in milliseconds
      • getNetbiosScope

        public String getNetbiosScope()
        Description copied from interface: Configuration
        Property jcifs.netbios.scope (string)
        Specified by:
        getNetbiosScope in interface Configuration
        Returns:
        default netbios scope to set in requests
      • getNetbiosCachePolicy

        public int getNetbiosCachePolicy()
        Description copied from interface: Configuration
        Property jcifs.netbios.cachePolicy in minutes (int, default 600)
        Specified by:
        getNetbiosCachePolicy in interface Configuration
        Returns:
        netbios cache timeout, in seconds, 0 - disable caching, -1 - cache forever
      • getNetbiosRcvBufSize

        public int getNetbiosRcvBufSize()
        Description copied from interface: Configuration
        Property jcifs.netbios.rcv_buf_size (int, default 576)
        Specified by:
        getNetbiosRcvBufSize in interface Configuration
        Returns:
        netbios recieve buffer size
      • getNetbiosRetryCount

        public int getNetbiosRetryCount()
        Description copied from interface: Configuration
        Property jcifs.netbios.retryCount (int, default 2)
        Specified by:
        getNetbiosRetryCount in interface Configuration
        Returns:
        maximum number of retries for netbios requests
      • getNetbiosRetryTimeout

        public int getNetbiosRetryTimeout()
        Description copied from interface: Configuration
        Property jcifs.netbios.retryTimeout (int, default 3000)
        Specified by:
        getNetbiosRetryTimeout in interface Configuration
        Returns:
        timeout of retry requests, in milliseconds
      • getNetbiosSndBufSize

        public int getNetbiosSndBufSize()
        Description copied from interface: Configuration
        Property jcifs.netbios.snd_buf_size (int, default 576)
        Specified by:
        getNetbiosSndBufSize in interface Configuration
        Returns:
        netbios send buffer size
      • getFlags2

        public int getFlags2()
        Description copied from interface: Configuration
        Property jcifs.smb.client.flags2 (int)
        Specified by:
        getFlags2 in interface Configuration
        Returns:
        custom flags2
      • getSessionLimit

        public int getSessionLimit()
        Description copied from interface: Configuration
        Property jcifs.smb.client.ssnLimit (int, 250)
        Specified by:
        getSessionLimit in interface Configuration
        Returns:
        maximum number of sessions on a single connection
      • getOemEncoding

        public String getOemEncoding()
        Description copied from interface: Configuration
        Property jcifs.encoding (string, default Cp850)
        Specified by:
        getOemEncoding in interface Configuration
        Returns:
        OEM encoding to use
      • getPid

        public int getPid()
        Specified by:
        getPid in interface Configuration
        Returns:
        Process id to send, randomized if unset
      • isSigningEnabled

        public boolean isSigningEnabled()
        Description copied from interface: Configuration
        Property jcifs.smb.client.signingPreferred (boolean, default false)
        Specified by:
        isSigningEnabled in interface Configuration
        Returns:
        whether to enable SMB signing (for everything), if available
      • isSigningEnforced

        public boolean isSigningEnforced()
        Description copied from interface: Configuration
        Property jcifs.smb.client.signingEnforced (boolean, default false)
        Specified by:
        isSigningEnforced in interface Configuration
        Returns:
        whether to enforce SMB signing (for everything)
      • isIpcSigningEnforced

        public boolean isIpcSigningEnforced()
        Description copied from interface: Configuration
        Property jcifs.smb.client.ipcSigningEnforced (boolean, default true)
        Specified by:
        isIpcSigningEnforced in interface Configuration
        Returns:
        whether to enforce SMB signing for IPC connections
      • isEncryptionEnabled

        public boolean isEncryptionEnabled()
        Description copied from interface: Configuration
        Property jcifs.smb.client.encryptionEnabled (boolean, default false) This is an experimental option allowing to indicate support during protocol negotiation, SMB encryption is not implemented yet.
        Specified by:
        isEncryptionEnabled in interface Configuration
        Returns:
        whether SMB encryption is enabled
      • isForceExtendedSecurity

        public boolean isForceExtendedSecurity()
        Description copied from interface: Configuration
        Property jcifs.smb.client.forceExtendedSecurity (boolean, default false)
        Specified by:
        isForceExtendedSecurity in interface Configuration
        Returns:
        whether to force extended security usage
      • getTransactionBufferSize

        public int getTransactionBufferSize()
        Description copied from interface: Configuration
        Property jcifs.smb.client.transaction_buf_size (int, default 65535)
        Specified by:
        getTransactionBufferSize in interface Configuration
        Returns:
        maximum data size for SMB transactions
      • getMaximumBufferSize

        public int getMaximumBufferSize()
        Specified by:
        getMaximumBufferSize in interface Configuration
        Returns:
        the maximum size of IO buffers, limits the maximum message size
      • getBufferCacheSize

        public int getBufferCacheSize()
        Description copied from interface: Configuration
        Property jcifs.smb.maxBuffers (int, default 16)
        Specified by:
        getBufferCacheSize in interface Configuration
        Returns:
        number of buffers to keep in cache
      • getListCount

        public int getListCount()
        Description copied from interface: Configuration
        Property jcifs.smb.client.listCount (int, default 200)
        Specified by:
        getListCount in interface Configuration
        Returns:
        maxmimum number of elements to request in a list request
      • getListSize

        public int getListSize()
        Description copied from interface: Configuration
        Property jcifs.smb.client.listSize (int, default 65435)
        Specified by:
        getListSize in interface Configuration
        Returns:
        maximum data size for list/info requests (known overhead is subtracted)
      • getAttributeCacheTimeout

        public long getAttributeCacheTimeout()
        Description copied from interface: Configuration
        Property jcifs.smb.client.attrExpirationPeriod (int, 5000)
        Specified by:
        getAttributeCacheTimeout in interface Configuration
        Returns:
        timeout of file attribute cache
      • isIgnoreCopyToException

        public boolean isIgnoreCopyToException()
        Description copied from interface: Configuration
        Property jcifs.smb.client.ignoreCopyToException (boolean, false)
        Specified by:
        isIgnoreCopyToException in interface Configuration
        Returns:
        whether to ignore exceptions that occur during file copy
      • getMaxRequestRetries

        public int getMaxRequestRetries()
        Description copied from interface: Configuration
        Property jcifs.smb.client.maxRequestRetries (int, default 2)
        Specified by:
        getMaxRequestRetries in interface Configuration
        Returns:
        retry SMB requests on failure up to n times
      • isTraceResourceUsage

        public boolean isTraceResourceUsage()
        Description copied from interface: Configuration
        This is solely intended for debugging
        Specified by:
        isTraceResourceUsage in interface Configuration
        Returns:
        whether to track the locations from which resources were created
      • isStrictResourceLifecycle

        public boolean isStrictResourceLifecycle()
        Description copied from interface: Configuration
        Property jcifs.smb.client.strictResourceLifecycle (bool, default false) If enabled, SmbFile instances starting with their first use will hold a reference to their tree. This means that trees/sessions/connections won't be idle-disconnected even if there are no other active references (currently executing code, file descriptors). Depending on the usage scenario, this may have some benefit as there won't be any delays for restablishing these resources, however comes at the cost of having to properly release all SmbFile instances you no longer need.
        Specified by:
        isStrictResourceLifecycle in interface Configuration
        Returns:
        whether to use strict resource lifecycle
      • isSendNTLMTargetName

        public boolean isSendNTLMTargetName()
        Description copied from interface: Configuration
        Property jcifs.smb.client.SendNTLMTargetName (boolean, true)
        Specified by:
        isSendNTLMTargetName in interface Configuration
        Returns:
        whether to send an AvTargetName with the NTLM exchange
      • getGuestUsername

        public String getGuestUsername()
        Description copied from interface: Configuration
        Property jcifs.smb.client.guestUsername, defaults to GUEST
        Specified by:
        getGuestUsername in interface Configuration
        Returns:
        username used when guest authentication is requested
      • getGuestPassword

        public String getGuestPassword()
        Description copied from interface: Configuration
        Property jcifs.smb.client.guestPassword, defaults to empty string
        Specified by:
        getGuestPassword in interface Configuration
        Returns:
        password used when guest authentication is requested
      • isAllowGuestFallback

        public boolean isAllowGuestFallback()
        Description copied from interface: Configuration
        Property jcifs.smb.client.allowGuestFallback, defaults to false
        Specified by:
        isAllowGuestFallback in interface Configuration
        Returns:
        whether to permit guest logins when user authentication is requested
      • getMachineId

        public byte[] getMachineId()
        Description copied from interface: Configuration
        Machine identifier ClientGuid, ... are derived from this value. Normally this should be randomly assigned for each client instance/configuration.
        Specified by:
        getMachineId in interface Configuration
        Returns:
        machine identifier (32 byte)
      • doGetBatchLimit

        protected Integer doGetBatchLimit​(String cmd)
        Parameters:
        cmd -
        Returns:
      • initResolverOrder

        protected void initResolverOrder​(String ro)
      • initProtocolVersions

        protected void initProtocolVersions​(String minStr,
                                            String maxStr)
      • initDisallowCompound

        protected void initDisallowCompound​(String prop)