All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jcifs.Configuration Maven / Gradle / Ivy

Go to download

JCIFS is an Open Source client library that implements the CIFS/SMB networking protocol in 100% Java

There is a newer version: 2.1.39
Show newest version
/*
 * © 2016 AgNO3 Gmbh & Co. KG
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package jcifs;


import java.net.InetAddress;
import java.security.SecureRandom;
import java.util.List;
import java.util.TimeZone;


/**
 * 
 * 
 * Implementors of this interface should extend {@link jcifs.config.BaseConfiguration} or
 * {@link jcifs.config.DelegatingConfiguration} to get forward compatibility.
 * 
 * @author mbechler
 *
 */
public interface Configuration {

    /**
     * 
     * @return random source to use
     */
    SecureRandom getRandom ();


    /**
     * 
     * 
     * Property jcifs.smb.client.dfs.ttl (int, default 300)
     * 
     * @return title to live, in seconds, for DFS cache entries
     */
    long getDfsTtl ();


    /**
     * 
     * Property jcifs.smb.client.dfs.strictView (boolean, default false)
     * 
     * @return whether a authentication failure during DFS resolving will throw an exception
     */
    boolean isDfsStrictView ();


    /**
     * 
     * Property jcifs.smb.client.dfs.disabled (boolean, default false)
     * 
     * @return whether DFS lookup is disabled
     */
    boolean isDfsDisabled ();


    /**
     * 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)
     * 
     * @return whether to convert NetBIOS names returned by DFS to FQDNs
     */
    boolean isDfsConvertToFQDN ();


    /**
     * Minimum protocol version
     * 
     * Property jcifs.smb.client.minVersion (string, default SMB1)
     * 
     * @see DialectVersion
     * @return minimum protocol version to use/allow
     * @since 2.1
     */
    DialectVersion getMinimumVersion ();


    /**
     * Maximum protocol version
     * 
     * Property jcifs.smb.client.maxVersion (string, default SMB210)
     * 
     * @see DialectVersion
     * @return maximum protocol version to use/allow
     * @since 2.1
     */
    DialectVersion getMaximumVersion ();


    /**
     * Use SMB2 non-backward compatible negotiation style
     * 
     * Property jcifs.smb.client.useSMB2Negotiation (boolean, default false)
     * 
     * @return whether to use non-backward compatible protocol negotiation
     */
    boolean isUseSMB2OnlyNegotiation ();


    /**
     * 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.
     * 
     * @return whether to enforce the use of secure negotiation.
     */
    boolean isRequireSecureNegotiate ();


    /**
     * Enable port 139 failover
     * 
     * Property jcifs.smb.client.port139.enabled (boolean, default false)
     * 
     * @return whether to failover to legacy transport on port 139
     */
    boolean isPort139FailoverEnabled ();


    /**
     * 
     * Property jcifs.smb.client.useUnicode (boolean, default true)
     * 
     * @return whether to announce support for unicode
     */
    boolean isUseUnicode ();


    /**
     *
     * Property jcifs.smb.client.forceUnicode (boolean, default false)
     * 
     * @return whether to use unicode, even if the server does not announce it
     */
    boolean isForceUnicode ();


    /**
     * 
     * Property jcifs.smb.client.useBatching (boolean, default true)
     * 
     * @return whether to enable support for SMB1 AndX command batching
     */
    boolean isUseBatching ();


    /**
     * 
     * Property jcifs.smb.client.nativeOs (string, default os.name)
     * 
     * @return OS string to report
     */
    String getNativeOs ();


    /**
     * 
     * Property jcifs.smb.client.nativeLanMan (string, default jCIFS)
     * 
     * @return Lanman string to report
     */
    String getNativeLanman ();


    /**
     * 
     * Property jcifs.smb.client.rcv_buf_size (int, default 65535)
     * 
     * @return receive buffer size, in bytes
     * @deprecated use getReceiveBufferSize instead
     */
    @Deprecated
    int getRecieveBufferSize ();


    /**
     * 
     * Property jcifs.smb.client.rcv_buf_size (int, default 65535)
     * 
     * @return receive buffer size, in bytes
     */
    int getReceiveBufferSize ();


    /**
     * 
     * Property jcifs.smb.client.snd_buf_size (int, default 65535)
     * 
     * @return send buffer size, in bytes
     */
    int getSendBufferSize ();


    /**
     * 
     * Property jcifs.smb.client.soTimeout (int, default 35000)
     * 
     * @return socket timeout, in milliseconds
     */
    int getSoTimeout ();


    /**
     * 
     * Property jcifs.smb.client.connTimeout (int, default 35000)
     * 
     * @return timeout for establishing a socket connection, in milliseconds
     */
    int getConnTimeout ();


    /**
     * Property jcifs.smb.client.sessionTimeout (int, default 35000)
     * 
     * 
     * @return timeout for SMB sessions, in milliseconds
     */
    int getSessionTimeout ();


    /**
     * 
     * Property jcifs.smb.client.responseTimeout (int, default 30000)
     * 
     * @return timeout for SMB responses, in milliseconds
     */
    int getResponseTimeout ();


    /**
     * 
     * Property jcifs.smb.client.lport (int)
     * 
     * @return local port to use for outgoing connections
     */
    int getLocalPort ();


    /**
     * 
     * Property jcifs.smb.client.laddr (string)
     * 
     * @return local address to use for outgoing connections
     */
    InetAddress getLocalAddr ();


    /**
     * 
     * Property jcifs.netbios.hostname (string)
     * 
     * @return local NETBIOS/short name to announce
     */
    String getNetbiosHostname ();


    /**
     * 
     * Property jcifs.smb.client.logonShare
     * 
     * @return share to connect to during authentication, if unset connect to IPC$
     */
    String getLogonShare ();


    /**
     * 
     * 
     * Property jcifs.smb.client.domain
     * 
     * @return default credentials, domain name
     */
    String getDefaultDomain ();


    /**
     * 
     * Property jcifs.smb.client.username
     * 
     * @return default credentials, user name
     */
    String getDefaultUsername ();


    /**
     * 
     * Property jcifs.smb.client.password
     * 
     * @return default credentials, password
     */
    String getDefaultPassword ();


    /**
     * Lanman compatibility level
     * 
     * {@href https://technet.microsoft.com/en-us/library/cc960646.aspx}
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
     * 
0 or 1LM and NTLM
2NTLM only
3-5NTLMv2 only
* * * Property jcifs.smb.lmCompatibility (int, default 3) * * @return lanman compatibility level, defaults to 3 i.e. NTLMv2 only */ int getLanManCompatibility (); /** * * Property jcifs.smb.allowNTLMFallback (boolean, default true) * * @return whether to allow fallback from kerberos to NTLM */ boolean isAllowNTLMFallback (); /** * Property jcifs.smb.useRawNTLM (boolean, default false) * * @return whether to use raw NTLMSSP tokens instead of SPNEGO wrapped ones * @since 2.1 */ boolean isUseRawNTLM (); /** * * Property jcifs.smb.client.disablePlainTextPasswords (boolean, default true) * * @return whether the usage of plaintext passwords is prohibited, defaults to false */ boolean isDisablePlainTextPasswords (); /** * * * Property jcifs.resolveOrder (string, default LMHOSTS,DNS,WINS,BCAST) * * @return order and selection of resolver modules, see {@link ResolverType} */ List getResolveOrder (); /** * * Property jcifs.netbios.baddr (string, default 255.255.255.255) * * @return broadcast address to use */ InetAddress getBroadcastAddress (); /** * * * Property jcifs.netbios.wins (string, comma separated) * * @return WINS server to use */ InetAddress[] getWinsServers (); /** * * Property jcifs.netbios.lport (int) * * @return local bind port for nebios connections */ int getNetbiosLocalPort (); /** * * Property jcifs.netbios.laddr (string) * * @return local bind address for netbios connections */ InetAddress getNetbiosLocalAddress (); /** * * * Property jcifs.netbios.soTimeout (int, default 5000) * * @return socket timeout for netbios connections, in milliseconds */ int getNetbiosSoTimeout (); /** * * * @return virtual circuit number to use */ int getVcNumber (); /** * * Property jcifs.smb.client.capabilities (int) * * @return custom capabilities */ int getCapabilities (); /** * * * Property jcifs.smb.client.flags2 (int) * * @return custom flags2 */ int getFlags2 (); /** * * Property jcifs.smb.client.ssnLimit (int, 250) * * @return maximum number of sessions on a single connection */ int getSessionLimit (); /** * * Property jcifs.encoding (string, default Cp850) * * @return OEM encoding to use */ String getOemEncoding (); /** * @return local timezone */ TimeZone getLocalTimezone (); /** * @return Process id to send, randomized if unset */ int getPid (); /** * * Property jcifs.smb.client.maxMpxCount (int, default 10) * * @return maximum count of concurrent commands to announce */ int getMaxMpxCount (); /** * * Property jcifs.smb.client.signingPreferred (boolean, default false) * * @return whether to enable SMB signing (for everything), if available */ boolean isSigningEnabled (); /** * * Property jcifs.smb.client.ipcSigningEnforced (boolean, default true) * * @return whether to enforce SMB signing for IPC connections */ boolean isIpcSigningEnforced (); /** * * Property jcifs.smb.client.signingEnforced (boolean, default false) * * @return whether to enforce SMB signing (for everything) */ boolean isSigningEnforced (); /** * 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. * * @return whether SMB encryption is enabled * @since 2.1 */ boolean isEncryptionEnabled (); /** * * Property jcifs.smb.client.forceExtendedSecurity (boolean, default false) * * @return whether to force extended security usage */ boolean isForceExtendedSecurity (); /** * * * Property jcifs.netbios.lmhosts (string) * * @return lmhosts file to use */ String getLmHostsFileName (); /** * * Property jcifs.netbios.scope (string) * * @return default netbios scope to set in requests */ String getNetbiosScope (); /** * * Property jcifs.netbios.snd_buf_size (int, default 576) * * @return netbios send buffer size */ int getNetbiosSndBufSize (); /** * * Property jcifs.netbios.rcv_buf_size (int, default 576) * * @return netbios recieve buffer size */ int getNetbiosRcvBufSize (); /** * * Property jcifs.netbios.retryTimeout (int, default 3000) * * @return timeout of retry requests, in milliseconds */ int getNetbiosRetryTimeout (); /** * * Property jcifs.netbios.retryCount (int, default 2) * * @return maximum number of retries for netbios requests */ int getNetbiosRetryCount (); /** * * * Property jcifs.netbios.cachePolicy in minutes (int, default 600) * * @return netbios cache timeout, in seconds, 0 - disable caching, -1 - cache forever */ int getNetbiosCachePolicy (); /** * * @return the maximum size of IO buffers, limits the maximum message size */ int getMaximumBufferSize (); /** * * Property jcifs.smb.client.transaction_buf_size (int, default 65535) * * @return maximum data size for SMB transactions */ int getTransactionBufferSize (); /** * * Property jcifs.smb.maxBuffers (int, default 16) * * @return number of buffers to keep in cache */ int getBufferCacheSize (); /** * * Property jcifs.smb.client.listCount (int, default 200) * * @return maxmimum number of elements to request in a list request */ int getListCount (); /** * * Property jcifs.smb.client.listSize (int, default 65535) * * @return maximum data size for list requests */ int getListSize (); /** * * * Property jcifs.smb.client.attrExpirationPeriod (int, 5000) * * @return timeout of file attribute cache */ long getAttributeCacheTimeout (); /** * * * Property jcifs.smb.client.ignoreCopyToException (boolean, false) * * @return whether to ignore exceptions that occur during file copy */ boolean isIgnoreCopyToException (); /** * @param cmd * @return the batch limit for the given command */ int getBatchLimit ( String cmd ); /** * * Property jcifs.smb.client.notify_buf_size (int, default 1024) * * @return the size of the requested server notify buffer */ int getNotifyBufferSize (); /** * * * Property jcifs.smb.client.maxRequestRetries (int, default 2) * * @return retry SMB requests on failure up to n times */ int getMaxRequestRetries (); /** * 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. * * @return whether to use strict resource lifecycle */ boolean isStrictResourceLifecycle (); /** * This is solely intended for debugging * * @return whether to track the locations from which resources were created */ boolean isTraceResourceUsage (); /** * @param command * @return whether to allow creating compound requests with that command */ boolean isAllowCompound ( String command ); /** * Machine identifier * * ClientGuid, ... are derived from this value. * * Normally this should be randomly assigned for each client instance/configuration. * * @return machine identifier (32 byte) */ byte[] getMachineId (); /** * * * Property jcifs.smb.client.disableSpnegoIntegrity (boolean, false) * * @return whether to disable sending/verifying SPNEGO mechanismListMIC */ boolean isDisableSpnegoIntegrity (); /** * * Property jcifs.smb.client.enforceSpnegoIntegrity (boolean, false) * * @return whether to enforce verifying SPNEGO mechanismListMIC */ boolean isEnforceSpnegoIntegrity (); /** * Property jcifs.smb.client.SendNTLMTargetName (boolean, true) * * @return whether to send an AvTargetName with the NTLM exchange */ boolean isSendNTLMTargetName (); /** * Property jcifs.smb.client.guestPassword, defaults to empty string * * @return password used when guest authentication is requested */ String getGuestPassword (); /** * Property jcifs.smb.client.guestUsername, defaults to GUEST * * @return username used when guest authentication is requested */ String getGuestUsername (); /** * Property jcifs.smb.client.allowGuestFallback, defaults to false * * @return whether to permit guest logins when user authentication is requested */ boolean isAllowGuestFallback (); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy