System
properties the namespace
- /// is global therefore property names should be unique. Before use,
- /// the load
method should be called with the name of a
- /// Properties
file (or null
indicating no
- /// file) to initialize the Config
. The System
- /// properties will then populate the Config
as well potentially
- /// overwriting properties from the file. Thus properties provided on the
- /// commandline with the -Dproperty.name=value
VM parameter
- /// will override properties from the configuration file.
- ///
- /// There are several ways to set jCIFS properties. See
- /// the overview page of the API
- /// documentation for details.
- /// Properties
.Properties
.- /// Exception MalformedURLException: unknown protocol: smb - /// at java.net.URL.(URL.java:480) - /// at java.net.URL. (URL.java:376) - /// at java.net.URL. (URL.java:330) - /// at jcifs.smb.SmbFile. (SmbFile.java:355) - /// ... - /// - ///
Config
with properties from the stream
- /// in
from a Properties
file.
- /// Config
with properties from the stream
- /// in
from a Properties
file.
- /// Object
.Object
.String
.String
. If the key cannot be found,
- /// the provided def
default parameter will be returned.
- /// String
.String
. If the property is not found, null
is returned.
- /// int
.int
. If the key does not exist or
- /// cannot be converted to an int
, the provided default
- /// argument will be returned.
- /// int
.int
. If the property is not found, -1
is returned.
- /// long
.long
. If the key does not exist or
- /// cannot be converted to a long
, the provided default
- /// argument will be returned.
- /// InetAddress
.InetAddress
. If the address is not
- /// an IP address and cannot be resolved null
will
- /// be returned.
- /// def
is returned.
- /// Applications can use the methods getLocalHost
,
- /// getByName
, and
- /// getAllByAddress
to create a new NbtAddress instance. This
- /// class is symmetric with
- ///
About NetBIOS: The NetBIOS name - /// service is a dynamic distributed service that allows hosts to resolve - /// names by broadcasting a query, directing queries to a server such as - /// Samba or WINS. NetBIOS is currently the primary networking layer for - /// providing name service, datagram service, and session service to the - /// Microsoft Windows platform. A NetBIOS name can be 15 characters long - /// and hosts usually registers several names on the network. From a - /// Windows command prompt you can see - /// what names a host registers with the nbtstat command. - ///
- ///- /// C:\>nbtstat -a 192.168.1.15 - /// NetBIOS Remote Machine Name Table - /// Name Type Status - /// --------------------------------------------- - /// JMORRIS2 <00> UNIQUE Registered - /// BILLING-NY <00> GROUP Registered - /// JMORRIS2 <03> UNIQUE Registered - /// JMORRIS2 <20> UNIQUE Registered - /// BILLING-NY <1E> GROUP Registered - /// JMORRIS <03> UNIQUE Registered - /// MAC Address = 00-B0-34-21-FA-3B - ///
The hostname of this machine is JMORRIS2
. It is
- /// a member of the group(a.k.a workgroup and domain) BILLING-NY
. To
- /// obtain an
- ///
- /// InetAddress addr = NbtAddress.getByName( "jmorris2" ).getInetAddress(); - ///- ///
From a UNIX platform with Samba installed you can perform similar
- /// diagnostics using the nmblookup
utility.
- ///
jcifs.netbios.nameserver
property must
- /// be set.
- /// InetAddress
should be available
- /// getByName
methods can be used for that.
- /// type
. Types(aka Hex Codes)
- /// are used to distiquish the various services on a host. <a
- /// href="../../../nbtcodes.html">Here is
- /// a fairly complete list of NetBIOS hex codes. Scope is not used but is
- /// still functional in other NetBIOS products and so for completeness it has been
- /// implemented. A scope
of null
or ""
- /// signifies no scope.
- /// type
- /// and scope
.
- /// InetAddress
.InetAddress
.int
containing the flags in use for this
- /// message.
- /// NTLMSSP_NEGOTIATE_OEM
).
- /// boolean
indicating whether the flag is set.NTLMSSP_NEGOTIATE_OEM
).
- ///
- ///
- /// Indicates whether to set (true
) or
- /// clear (false
) the specified flag.
- ///
- public virtual void SetFlag(int flag, bool value)
- {
- SetFlags(value ? (GetFlags() | flag) : (GetFlags() & (unchecked((int)(0xffffffff)
- ) ^ flag)));
- }
-
- internal static int ReadULong(byte[] src, int index)
- {
- return (src[index] & unchecked(0xff)) | ((src[index + 1] & unchecked(0xff)) << 8) | ((src[index + 2] & unchecked(0xff)) << 16) | ((src[index
- + 3] & unchecked(0xff)) << 24);
- }
-
- internal static int ReadUShort(byte[] src, int index)
- {
- return (src[index] & unchecked(0xff)) | ((src[index + 1] & unchecked(0xff)) << 8);
- }
-
- internal static byte[] ReadSecurityBuffer(byte[] src, int index)
- {
- int length = ReadUShort(src, index);
- int offset = ReadULong(src, index + 4);
- byte[] buffer = new byte[length];
- Array.Copy(src, offset, buffer, 0, length);
- return buffer;
- }
-
- internal static void WriteULong(byte[] dest, int offset, int value)
- {
- dest[offset] = unchecked((byte)(value & unchecked(0xff)));
- dest[offset + 1] = unchecked((byte)(value >> 8 & unchecked(0xff)));
- dest[offset + 2] = unchecked((byte)(value >> 16 & unchecked(0xff)));
- dest[offset + 3] = unchecked((byte)(value >> 24 & unchecked(0xff)));
- }
-
- internal static void WriteUShort(byte[] dest, int offset, int value)
- {
- dest[offset] = unchecked((byte)(value & unchecked(0xff)));
- dest[offset + 1] = unchecked((byte)(value >> 8 & unchecked(0xff)));
- }
-
- internal static void WriteSecurityBuffer(byte[] dest, int offset, int bodyOffset,
- byte[] src)
- {
- int length = (src != null) ? src.Length : 0;
- if (length == 0)
- {
- return;
- }
- WriteUShort(dest, offset, length);
- WriteUShort(dest, offset + 2, length);
- WriteULong(dest, offset + 4, bodyOffset);
- Array.Copy(src, 0, dest, bodyOffset, length);
- }
-
- internal static string GetOemEncoding()
- {
- return OemEncoding;
- }
-
- /// byte[]
containing the raw message material.String
containing the supplied domain.String
containing the supplied workstation name.int
containing the default flags.String
containing the default domain.String
containing the default workstation.byte[]
containing the challenge.String
containing the authentication target.byte[]
containing the target information block.
- /// The target information block is used by the client to create an
- /// NTLMv2 response.
- /// byte[]
containing the local security
- /// context. This is used by the client to negotiate local
- /// authentication.
- /// int
containing the default flags.int
containing the default flags.String
containing the domain.byte[]
containing the LanManager response.byte[]
containing the NT/NTLMv2 response.String
containing the domain for the user.String
containing the user for this message.String
containing the workstation.byte[]
containing the session key.byte[]
containing the session key.int
containing the default flags.int
containing the default flags.byte[]
containing the LanManager response.byte[]
containing the NT response.- /// To fully understand the information exposed by this class a description - /// of the access check algorithm used by Windows is required. The following - /// is a basic description of the algorithm. For a more complete description - /// we recommend reading the section on Access Control in Keith Brown's - /// "The .NET Developer's Guide to Windows Security" (which is also - /// available online). - ///
- /// Direct ACEs are evaluated first in order. The SID of the user performing - /// the operation and the desired access bits are compared to the SID - /// and access mask of each ACE. If the SID matches, the allow/deny flags - /// and access mask are considered. If the ACE is a "deny" - /// ACE and any of the desired access bits match bits in the access - /// mask of the ACE, the whole access check fails. If the ACE is an "allow" - /// ACE and all of the bits in the desired access bits match bits in - /// the access mask of the ACE, the access check is successful. Otherwise, - /// more ACEs are evaluated until all desired access bits (combined) - /// are "allowed". If all of the desired access bits are not "allowed" - /// the then same process is repeated for inherited ACEs. - ///
- /// For example, if user WNET\alice tries to open a file - /// with desired access bits 0x00000003 (FILE_READ_DATA | - /// FILE_WRITE_DATA) and the target file has the following security - /// descriptor ACEs: - ///
- /// Allow WNET\alice 0x001200A9 Direct - /// Allow Administrators 0x001F01FF Inherited - /// Allow SYSTEM 0x001F01FF Inherited - ///- /// the access check would fail because the direct ACE has an access mask - /// of 0x001200A9 which doesn't have the - /// FILE_WRITE_DATA bit on (bit 0x00000002). Actually, this isn't quite correct. If - /// WNET\alice is in the local Administrators group the access check - /// will succeed because the inherited ACE allows local Administrators - /// both FILE_READ_DATA and FILE_WRITE_DATA access. - ///
- /// Note: For reasons not fully understood, FLAGS_INHERITED may - /// not be set within all security descriptors even though the ACE was in - /// face inherited. If an inherited ACE is added to a parent the Windows - /// ACL editor will rebuild all children ACEs and set this flag accordingly. - ///
- /// Note: This function should probably be changed to return SDDL - /// fragments but currently it does not. - ///