From b222defc2743d7003f3eaa95864e93cbe5bbea66 Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij
This documentation is distributed under the GNU General Public License (GPL) version 2. A copy of the license is included with the Samba source -distribution. A copy can be found on-line at http://www.fsf.org/licenses/gpl.txt -
Table of Contents
Table of Contents
Definition of NetBIOS Protocol and Name Resolution Modes
Luke Leighton
Dan Shearer
Chris Hertel
Steve French
Simo Sorce
Andrew Bartlett
Tim Potter
Martin Pool
David Chappell <David.Chappell@mail.trincoll.edu>
Chris Hertel
Andrew Tridgell
Andrew Tridgell
Finding useful information on windows
Jelmer R. Vernooij <jelmer@samba.org>
Andrew Tridgell <tridge@samba.org>
Luke Leighton <lkcl@switchboard.net>
Paul Ashton <paul@argo.demon.co.uk>
Duncan Stansfield <duncans@sco.com>
Gerald Carter
Gerald Carter
Andrew Bartlett
LanMan and NT Password Encryption
Jeremy Allison <samba@samba.org>
Jelmer Vernooij <jelmer@samba.org>
Anthony Liguori <aliguor@us.ibm.com>
Jelmer Vernooij <jelmer@samba.org>
Alexander Bokovoy <ab@samba.org>
Stefan Metzmacher <metze@metzemix.de>
Jelmer Vernooij
Jelmer R. Vernooij <jelmer@samba.org>
Table of Contents
+
Luke Leighton
Dan Shearer
Chris Hertel
Steve French
Simo Sorce
Andrew Bartlett
Tim Potter
Martin Pool
David Chappell <
Chris Hertel
Andrew Tridgell
Andrew Tridgell
Jelmer R. Vernooij <
Andrew Tridgell <
Luke Leighton <
Paul Ashton <
Duncan Stansfield <
Gerald Carter
Gerald Carter
Andrew Bartlett
Jeremy Allison <
Jelmer Vernooij <
Anthony Liguori <
Jelmer Vernooij <
Alexander Bokovoy <
Stefan Metzmacher <
Jelmer Vernooij
Jelmer R. Vernooij <
Table of Contents
NetBIOS runs over the following tranports: TCP/IP; NetBEUI and IPX/SPX. Samba only uses NetBIOS over TCP/IP. For details on the TCP/IP NetBIOS Session Service NetBIOS Datagram Service, and NetBIOS Names, see @@ -75,7 +75,7 @@ NetBIOS names are either UNIQUE or GROUP. Only one application can claim a UNIQUE NetBIOS name on a network.
There are two kinds of NetBIOS Name resolution: Broadcast and Point-to-Point. -
Clients can claim names, and therefore offer services on successfully claimed names, on their broadcast-isolated subnet. One way to get NetBIOS services (such as browsing: see ftp.microsoft.com/drg/developr/CIFS/browdiff.txt; and @@ -87,7 +87,7 @@ find that some of your hosts spend 95 percent of their time dealing with broadcast traffic. [If you have IPX/SPX on your LAN or WAN, you will find that this is already happening: a packet analyzer will show, roughly every twelve minutes, great swathes of broadcast traffic!]. -
rfc1001.txt describes, amongst other things, the implementation and use of, a 'NetBIOS Name Service'. NT/AS offers 'Windows Internet Name Service' which is fully rfc1001/2 compliant, but has had to take specific action @@ -128,7 +128,7 @@ WINS Clients therefore claim names from the WINS server. If the WINS server allows them to register a name, the client's NetBIOS session service can then offer services on this name. Other WINS clients will then contact the WINS server to resolve a NetBIOS name. -
This document gives a general overview of how Samba works internally. The Samba Team has tried to come up with a model which is the best possible compromise between elegance, portability, security @@ -139,7 +139,7 @@ It also tries to answer some of the frequently asked questions such as:
Is Samba secure when running on Unix? The xyz platform? What about the root priveliges issue? -
Pros and cons of multithreading in various parts of Samba
Why not have a separate process for name resolution, WINS, and browsing?
People sometimes tout threads as a uniformly good thing. They are very nice in their place but are quite inappropriate for smbd. nmbd is another matter, and multi-threading it would be very nice. @@ -156,7 +156,7 @@ smbd multi-threaded. Multi-threading would actually make Samba much slower, less scalable, less portable and much less robust. The fact that we use a separate process for each connection is one of Samba's biggest advantages. -
A few problems that would arise from a threaded smbd are:
It's not only to create threads instead of processes, but you @@ -181,7 +181,7 @@ A few problems that would arise from a threaded smbd are:
we couldn't use the system locking calls as the locking context of fcntl() is a process, not a thread. -
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test threads library for nmbd that used only @@ -208,7 +208,7 @@ packet that arrives. Having a pool of processes is possible but is nasty to program cleanly due to the enormous amount of shared data (in complex structures) between the processes. We can't rely on each platform having a shared memory system. -
Originally Andrew used recursion to simulate a multi-threaded environment, which use the stack enormously and made for really confusing debugging sessions. Luke Leighton rewrote it to use a @@ -229,7 +229,7 @@ keeps the idea of a distinct packet. See "struct packet_struct" in nameserv.h. It has all the detail but none of the on-the-wire mess. This makes it ideal for using in disk or memory-based databases for browsing and WINS support. -
Table of Contents
Table of Contents
The syntax of a debugging log file is represented as:
>debugfile< :== { >debugmsg< } @@ -282,7 +282,7 @@ by a newline. Note that in the above example the function names are not listed on the header line. That's because the example above was generated on an SGI Indy, and the SGI compiler doesn't support the __FUNCTION__ macro. -
Use of the DEBUG() macro is unchanged. DEBUG() takes two parameters. The first is the message level, the second is the body of a function call to the Debug1() function. @@ -333,7 +333,7 @@ would look like this: [1998/07/30 16:00:51, 0] file.c:function(261) .
Which isn't much use. The format buffer kludge fixes this problem. -
In addition to the kludgey solution to the broken line problem described above, there is a clean solution. The DEBUGADD() macro never generates a header. It will append new text to the current debug @@ -347,7 +347,7 @@ DEBUGADD() macro is the same as that of the DEBUG() macro. This is the first line. This is the second line. This is the third line. -
One of the problems with the DEBUG() macro was that DEBUG() lines tended to get a bit long. Consider this example from nmbd_sendannounce.c: @@ -382,7 +382,7 @@ within the DEBUGLVL() block.
Processing that is only relevant to debug output can be contained within the DEBUGLVL() block. -
This function prints debug message text to the debug file (and possibly to syslog) via the format buffer. The function uses a variable argument list just like printf() or Debug1(). The @@ -391,7 +391,7 @@ and then passed to format_debug_text(). If you use DEBUGLVL() you will probably print the body of the message using dbgtext(). -
This is the function that writes a debug message header. Headers are not processed via the format buffer. Also note that if the format buffer is not empty, a call to dbghdr() will not @@ -399,7 +399,7 @@ produce any output. See the comments in dbghdr() for more info.
It is not likely that this function will be called directly. It is used by DEBUG() and DEBUGADD(). -
This is a static function in debug.c. It stores the output text for the body of the message in a buffer until it encounters a newline. When the newline character is found, the buffer is @@ -429,9 +429,9 @@ have observed that eight character tabs seem to be preferred in Samba source. If you are interested in the topic of coding style, two oft-quoted documents are:
-http://lxr.linux.no/source/Documentation/CodingStyle
+
-http://www.fsf.org/prep/standards_toc.html
+
But note that coding style in Samba varies due to the many different programmers who have contributed. @@ -550,7 +550,7 @@ The suggestions above are simply that, suggestions, but the information may help in reducing the routine rework done on new code. The preceeding list is expected to change routinely as new support routines and macros are added. -
Table of Contents
Table of Contents
This section describes character set handling in Samba, as implemented in Samba 3.0 and above
@@ -560,7 +560,7 @@ strings to/from DOS codepages. The problem is that there was no way of telling if a particular char* is in dos codepage or unix codepage. This led to a nightmare of code that tried to cope with particular cases without handlingt the general case. -
The new system works like this:
all char* strings inside Samba are "unix" strings. These are @@ -622,28 +622,28 @@ The new system works like this: parameters is gone.
all vfs functions take unix strings. Don't convert when passing to them -
This section describes the macros defined in byteorder.h. These macros are used extensively in the Samba code. -
+
returns the value of the unsigned short (16 bit) little-endian integer at offset pos within buffer buf. An integer of this type is sometimes refered to as "USHORT". -
returns the value of the unsigned 32 bit little-endian integer at offset -pos within buffer buf.
returns the value of the signed short (16 bit) little-endian integer at -offset pos within buffer buf.
returns the value of the signed 32 bit little-endian integer at offset pos -within buffer buf.
sets the unsigned short (16 bit) little-endian integer at offset pos within -buffer buf to value val.
sets the unsigned 32 bit little-endian integer at offset pos within buffer -buf to the value val.
sets the short (16 bit) signed little-endian integer at offset pos within -buffer buf to the value val.
sets the signed 32 bit little-endian integer at offset pos withing buffer -buf to the value val.
returns the value of the unsigned short (16 bit) big-endian integer at -offset pos within buffer buf.
returns the value of the unsigned 32 bit big-endian integer at offset -pos within buffer buf.
returns the value of the unsigned 32 bit little-endian integer at offset +pos within buffer buf.
returns the value of the signed short (16 bit) little-endian integer at +offset pos within buffer buf.
returns the value of the signed 32 bit little-endian integer at offset pos +within buffer buf.
sets the unsigned short (16 bit) little-endian integer at offset pos within +buffer buf to value val.
sets the unsigned 32 bit little-endian integer at offset pos within buffer +buf to the value val.
sets the short (16 bit) signed little-endian integer at offset pos within +buffer buf to the value val.
sets the signed 32 bit little-endian integer at offset pos withing buffer +buf to the value val.
returns the value of the unsigned short (16 bit) big-endian integer at +offset pos within buffer buf.
returns the value of the unsigned 32 bit big-endian integer at offset +pos within buffer buf.
sets the value of the unsigned short (16 bit) big-endian integer at offset pos within buffer buf to value val. -refered to as "USHORT".
This section describes the functions need to make a LAN Manager RPC call. This information had been obtained by examining the Samba code and the LAN Manager 2.0 API documentation. It should not be considered entirely @@ -656,7 +656,7 @@ call_api(int prcnt, int drcnt, int mprcnt, int mdrcnt,
This function is defined in client.c. It uses an SMB transaction to call a remote api. -
The parameters are as follows:
+
The parameters are as follows:
prcnt: the number of bytes of parameters begin sent.
drcnt: the number of bytes of data begin sent. @@ -701,7 +701,7 @@ substructures apply, this string is of zero length.
The code in client.c always calls call_api() with no data. It is unclear when a non-zero length data buffer would be sent. -
The returned parameters (pointed to by rparam), in their order of appearance are:
An unsigned 16 bit integer which contains the API function's return code. @@ -732,7 +732,7 @@ fix_char_ptr() in client.c can be used for this purpose. The third parameter (which may be read as "SVAL(rparam,4)") has something to do with indicating the amount of data returned or possibly the amount of data which can be returned if enough buffer space is allowed. -
Table of Contents
Table of Contents
Basically, the file is processed on a line by line basis. There are four types of lines that are recognized by the lexical analyzer (params.c): @@ -782,7 +782,7 @@ ignores them. The latter two line types are scanned for These are the only tokens passed to the parameter loader (loadparm.c). Parameter names and values are divided from one another by an equal sign: '='. -
+
Whitespace is defined as all characters recognized by the isspace() function (see ctype(3C)) except for the newline character ('\n') The newline is excluded because it identifies the end of the line. @@ -797,7 +797,7 @@ the exception of carriage return characters ('\r'), all of which are removed.
Leading and trailing whitespace is removed from names and values. -
Long section header and parameter lines may be extended across multiple lines by use of the backslash character ('\\'). Line continuation is ignored for blank and comment lines. @@ -820,7 +820,7 @@ line, plus the four preceeding the word 'with' in the second line. Line continuation characters are ignored on blank lines and at the end of comments. They are *only* recognized within section and parameter lines. -
The syntax of the smb.conf file is as follows:
<file> :== { <section> } EOF <section> :== <section header> { <parameter line> } <section header> :== '[' NAME ']' @@ -863,12 +863,12 @@ terminating character, and the rest of the line is ignored. The lines A parameter line is divided into a NAME and a VALUE. The *first* equal sign on the line separates the NAME from the VALUE. The VALUE is terminated by a newline character (NL = '\n'). -
Table of Contents
Table of Contents
This is a short document that describes some of the issues that confront a SMB implementation on unix, and how Samba copes with them. They may help people who are looking at unix<->PC @@ -876,7 +876,7 @@ interoperability.
It was written to help out a person who was writing a paper on unix to PC connectivity. -
The SMB protocol has only a loose username concept. Early SMB protocols (such as CORE and COREPLUS) have no username concept at all. Even in later protocols clients often attempt operations @@ -913,7 +913,7 @@ in the vast majority of cases. The methods include username maps, the service%user syntax, the saving of session setup usernames for later validation and the derivation of the username from the service name (either directly or via the user= option). -
The commonly used SMB protocols have no way of saying "you can't do that because you don't own the file". They have, in fact, no concept of file ownership at all. @@ -931,7 +931,7 @@ file time comparisons right. There are several possible solutions to this problem, including username mapping, and forcing a specific username for particular shares. -
Many SMB clients uppercase passwords before sending them. I have no idea why they do this. Interestingly WfWg uppercases the password only if the server is running a protocol greater than COREPLUS, so @@ -953,7 +953,7 @@ This means that it is *VERY* important to ensure that the Samba smbpasswd file containing these password hashes is only readable by the root user. See the documentation ENCRYPTION.txt for more details. -
Since samba 2.2, samba supports other types of locking as well. This section is outdated.
@@ -984,7 +984,7 @@ asking the server to notify it if anyone else tries to do something on the same file, at which time the client will say if it is willing to give up its lock. Unix has no simple way of implementing opportunistic locking, and currently Samba has no support for it. -
When a SMB client opens a file it asks for a particular "deny mode" to be placed on the file. These modes (DENY_NONE, DENY_READ, DENY_WRITE, DENY_ALL, DENY_FCB and DENY_DOS) specify what actions should be @@ -998,7 +998,7 @@ directory or a shared memory implementation. The lock file method is clumsy and consumes processing and file resources, the shared memory implementation is vastly prefered and is turned on by default for those systems that support it. -
A SMB session can run with several uids on the one socket. This happens when a user connects to two shares with different usernames. To cope with this the unix server needs to switch uids @@ -1008,7 +1008,7 @@ a single uid.
Note that you can also get the "trapdoor uid" message for other reasons. Please see the FAQ for details. -
There is a convention that clients on sockets use high "unprivilaged" port numbers (>1000) and connect to servers on low "privilaged" port numbers. This is enforced in Unix as non-root users can't open a @@ -1031,7 +1031,7 @@ to any of these OSes unless they are running as root. The answer comes back, but it goes to port 137 which the unix user can't listen on. Interestingly WinNT3.1 got this right - it sends node status responses back to the source port in the request. -
There are many "protocol levels" in the SMB protocol. It seems that each time new functionality was added to a Microsoft operating system, they added the equivalent functions in a new protocol level of the SMB @@ -1145,9 +1145,9 @@ causes printing to fail with Samba: The process is trying to first open /dev/null read-write then read-only. Both fail. This means /dev/null has incorrect permissions. -
Table of Contents
Table of Contents
Table of Contents
Table of Contents
This document contains information to provide an NT workstation with login
-services, without the need for an NT server. It is the sgml version of http://mailhost.cb1.com/~lkcl/cifsntdomain.txt, controlled by Luke.
+services, without the need for an NT server. It is the sgml version of
It should be possible to select a domain instead of a workgroup (in the NT workstation's TCP/IP settings) and after the obligatory reboot, type in a @@ -1169,10 +1169,10 @@ This document is available from comp.protocols.smb; from the ntsecurity.net digest and from the samba digest, amongst other sources.
A copy is available from: -
http://ntbugtraq.rc.on.ca/SCRIPTS/WA.EXE?A2=ind9708;L=ntbugtraq;O=A;P=2935
http://mailhost.cb1.com/~lkcl/crypt.html
-A c-code implementation, provided by Linus Nordberg +
+A c-code implementation, provided by
http://samba.org/cgi-bin/mfs/01/digest/1997/97aug/0391.html
http://mailhost.cb1.com/~lkcl/crypt.txt
+
Also used to provide debugging information is the Check Build version of NT workstation, and enabling full debugging in NETLOGON. This is achieved by setting the following REG_SZ registry key to 0x1ffffff: @@ -1191,7 +1191,7 @@ Failure to return this error code will make the workstation report that it is already a member of the domain.
the cryptographic side of the NetrServerPasswordSet command, which would allow the workstation to change its password. This password is used to generate the long-term session key. [It is possible to reject this -command, and keep the default workstation password].
cket Traces from Netmonitor (Service Pack 1 and above) |
ul Ashton and Luke Leighton's other "NT Domain" doc. |
FS documentation - cifs6.txt |
FS documentation - cifsrap2.txt |
Paul Ashton: loads of work with Net Monitor; understanding the NT authentication system; reference implementation of the NT domain support on which this document is originally based. |
Duncan Stansfield: low-level analysis of MSRPC Pipes. |
Linus Nordberg: producing c-code from Paul's crypto spec. |
Windows Sourcer development team |
+command, and keep the default workstation password].
cket Traces from Netmonitor (Service Pack 1 and above) |
ul Ashton and Luke Leighton's other "NT Domain" doc. |
FS documentation - cifs6.txt |
FS documentation - cifsrap2.txt |
Paul Ashton: loads of work with Net Monitor; understanding the NT authentication system; reference implementation of the NT domain support on which this document is originally based. |
Duncan Stansfield: low-level analysis of MSRPC Pipes. |
Linus Nordberg: producing c-code from Paul's crypto spec. |
Windows Sourcer development team |
In the SMB Transact pipes, some "Structures", described here, appear to be 4-byte aligned with the SMB header, at their start. Exactly which "Structures" need aligning is not precisely known or documented. @@ -1219,15 +1219,15 @@ into or taken out of the SMB data stream. if the count is non-zero, then the pointer is also non-zero. immediately following the pointer is the count again, followed by an array of container sub-structures. the count appears a third time after the last sub-structure. -
command number in the msrpc packet header
0x00
0x02
0x0B
0x0C
UTIME is 32 bits, indicating time in seconds since 01jan1970. documented in cifs6.txt (section 3.5 page, page 30).
num of sub-authorities in domain SID
SID revision number
num of sub-authorities in domain SID
6 bytes for domain SID - Identifier Authority.
domain SID sub-authorities
Note: the domain SID is documented elsewhere. -
length of unicode string
max length of unicode string
4 - undocumented.
unicode string header
undocumented buffer pointer
length of unicode string
null-terminated string of unicode characters.
padding to get unicode string 4-byte aligned with the start of the SMB header.
max length of unicode string
0 - undocumented
length of unicode string
string of uncode characters
0x18 - length (in bytes) including the length field.
0 - root directory (pointer)
0 - object name (pointer)
0 - attributes (undocumented)
0 - security descriptior (pointer)
0 - security quality of service
5 - SID type
0 - undocumented
domain SID unicode string header
domain SID unicode string
Note: there is a conflict between the unicode string header and the unicode string itself as to which to use to indicate string length. this will need to be resolved.
Note: the SID type indicates, for example, an alias; a well-known group etc. this is documented somewhere.
5 - well-known SID. 1 - user SID (see ShowACLs)
5 - undocumented
domain RID
0 - domain index out of above reference domains
Note: logon server name starts with two '\' characters and is upper case.
Note: account name is the logon client name from the LSA Request Challenge, with a $ on the end of it, in upper case.
undocumented buffer pointer
logon server unicode string
account name unicode string
sec_chan - security channel type
logon client machine unicode string
Note: logon server name starts with two '\' characters and is upper case.
undocumented buffer pointer
logon server unicode string
undocumented buffer pointer
logon client machine unicode string
Note: whenever this structure appears in a request, you must take a copy of the client-calculated credentials received, because they will beused in subsequent credential checks. the presumed intention is to - maintain an authenticated request/response trail.
client and server names
???? padding, for 4-byte alignment with SMB header.
pointer to client credentials.
client-calculated credentials + client time
Note: whenever this structure appears in a request, you must take a copy of the client-calculated credentials received, because they will be used in subsequent credential checks. the presumed intention is to maintain an authenticated request/response trail.
logon account info
client-calculated credentials + client time
ptr_id_info_1
domain name unicode header
param control
logon ID
user name unicode header
workgroup name unicode header
arc4 LM OWF Password
arc4 NT OWF Password
domain name unicode string
user name unicode string
workstation name unicode string
Note: presumably, the return credentials is supposedly for the server to verify that the credential chain hasn't been compromised.
client identification/authentication info
pointer to return credentials.
return credentials - ignored.
logon level
switch value
+
command number in the msrpc packet header
0x00
0x02
0x0B
0x0C
UTIME is 32 bits, indicating time in seconds since 01jan1970. documented in cifs6.txt (section 3.5 page, page 30).
num of sub-authorities in domain SID
SID revision number
num of sub-authorities in domain SID
6 bytes for domain SID - Identifier Authority.
domain SID sub-authorities
Note: the domain SID is documented elsewhere. +
length of unicode string
max length of unicode string
4 - undocumented.
unicode string header
undocumented buffer pointer
length of unicode string
null-terminated string of unicode characters.
padding to get unicode string 4-byte aligned with the start of the SMB header.
max length of unicode string
0 - undocumented
length of unicode string
string of uncode characters
0x18 - length (in bytes) including the length field.
0 - root directory (pointer)
0 - object name (pointer)
0 - attributes (undocumented)
0 - security descriptior (pointer)
0 - security quality of service
5 - SID type
0 - undocumented
domain SID unicode string header
domain SID unicode string
Note: there is a conflict between the unicode string header and the unicode string itself as to which to use to indicate string length. this will need to be resolved.
Note: the SID type indicates, for example, an alias; a well-known group etc. this is documented somewhere.
5 - well-known SID. 1 - user SID (see ShowACLs)
5 - undocumented
domain RID
0 - domain index out of above reference domains
Note: logon server name starts with two '\' characters and is upper case.
Note: account name is the logon client name from the LSA Request Challenge, with a $ on the end of it, in upper case.
undocumented buffer pointer
logon server unicode string
account name unicode string
sec_chan - security channel type
logon client machine unicode string
Note: logon server name starts with two '\' characters and is upper case.
undocumented buffer pointer
logon server unicode string
undocumented buffer pointer
logon client machine unicode string
Note: whenever this structure appears in a request, you must take a copy of the client-calculated credentials received, because they will beused in subsequent credential checks. the presumed intention is to + maintain an authenticated request/response trail.
client and server names
???? padding, for 4-byte alignment with SMB header.
pointer to client credentials.
client-calculated credentials + client time
Note: whenever this structure appears in a request, you must take a copy of the client-calculated credentials received, because they will be used in subsequent credential checks. the presumed intention is to maintain an authenticated request/response trail.
logon account info
client-calculated credentials + client time
ptr_id_info_1
domain name unicode header
param control
logon ID
user name unicode header
workgroup name unicode header
arc4 LM OWF Password
arc4 NT OWF Password
domain name unicode string
user name unicode string
workstation name unicode string
Note: presumably, the return credentials is supposedly for the server to verify that the credential chain hasn't been compromised.
client identification/authentication info
pointer to return credentials.
return credentials - ignored.
logon level
switch value
switch (switch_value) case 1: { ID_INFO_1 id_info_1; } -
undocumented buffer pointer.
num referenced domains?
undocumented domain name buffer pointer.
32 - max number of entries
4 - num referenced domains?
domain name unicode string header
referenced domain unicode string headers
domain name unicode string
referenced domain SIDs
??? padding to get 4-byte alignment with start of SMB header
domain name string length * 2
domain name string length * 2
undocumented domain name string buffer pointer
undocumented domain SID string buffer pointer
domain name (unicode string)
domain SID
Note: it would be nice to know what the 16 byte user session key is for.
logon time
logoff time
kickoff time
password last set time
password can change time
password must change time
username unicode string header
user's full name unicode string header
logon script unicode string header
profile path unicode string header
home directory unicode string header
home directory drive unicode string header
logon count
bad password count
User ID
Group ID
num groups
undocumented buffer pointer to groups.
user flags
user session key
logon server unicode string header
logon domain unicode string header
undocumented logon domain id pointer
40 undocumented padding bytes. future expansion?
0 - num_other_sids?
NULL - undocumented pointer to other domain SIDs.
username unicode string
user's full name unicode string
logon script unicode string
profile path unicode string
home directory unicode string
home directory drive unicode string
num groups
group info
logon server unicode string
logon domain unicode string
domain SID
other domain SIDs?
Note: see cifsrap2.txt section5, page 10.
0 for shi1_type indicates a Disk. |
1 for shi1_type indicates a Print Queue. |
2 for shi1_type indicates a Device. |
3 for shi1_type indicates an IPC pipe. |
0x8000 0000 (top bit set in shi1_type) indicates a hidden share. |
shi1_netname - pointer to net name
shi1_type - type of share. 0 - undocumented.
shi1_remark - pointer to comment.
shi1_netname - unicode string of net name
shi1_remark - unicode string of comment.
share container with 0 entries:
0 - EntriesRead
0 - Buffer
share container with > 0 entries:
EntriesRead
non-zero - Buffer
EntriesRead
share entry pointers
share entry strings
padding to get unicode string 4-byte aligned with start of the SMB header.
EntriesRead
0 - padding
Note: see cifs6.txt section 6.4 - the fields described therein will be of assistance here. for example, the type listed below is the same as fServerType, which is described in 6.4.1.
0x00000001 All workstations
0x00000002 All servers
0x00000004 Any server running with SQL server
0x00000008 Primary domain controller
0x00000010 Backup domain controller
0x00000020 Server running the timesource service
0x00000040 Apple File Protocol servers
0x00000080 Novell servers
0x00000100 Domain Member
0x00000200 Server sharing print queue
0x00000400 Server running dialin service.
0x00000800 Xenix server
0x00001000 NT server
0x00002000 Server running Windows for
0x00008000 Windows NT non DC server
0x00010000 Server that can run the browser service
0x00020000 Backup browser server
0x00040000 Master browser server
0x00080000 Domain Master Browser server
0x40000000 Enumerate only entries marked "local"
0x80000000 Enumerate Domains. The pszServer and pszDomain parameters must be NULL.
500 - platform_id
pointer to name
5 - major version
4 - minor version
type (SV_TYPE_... bit field)
pointer to comment
sv101_name - unicode string of server name
sv_101_comment - unicode string of server comment.
padding to get unicode string 4-byte aligned with start of the SMB header.
For details on the SMB Transact Named Pipe, see cifs6.txt
undocumented buffer pointer.
num referenced domains?
undocumented domain name buffer pointer.
32 - max number of entries
4 - num referenced domains?
domain name unicode string header
referenced domain unicode string headers
domain name unicode string
referenced domain SIDs
??? padding to get 4-byte alignment with start of SMB header
domain name string length * 2
domain name string length * 2
undocumented domain name string buffer pointer
undocumented domain SID string buffer pointer
domain name (unicode string)
domain SID
Note: it would be nice to know what the 16 byte user session key is for.
logon time
logoff time
kickoff time
password last set time
password can change time
password must change time
username unicode string header
user's full name unicode string header
logon script unicode string header
profile path unicode string header
home directory unicode string header
home directory drive unicode string header
logon count
bad password count
User ID
Group ID
num groups
undocumented buffer pointer to groups.
user flags
user session key
logon server unicode string header
logon domain unicode string header
undocumented logon domain id pointer
40 undocumented padding bytes. future expansion?
0 - num_other_sids?
NULL - undocumented pointer to other domain SIDs.
username unicode string
user's full name unicode string
logon script unicode string
profile path unicode string
home directory unicode string
home directory drive unicode string
num groups
group info
logon server unicode string
logon domain unicode string
domain SID
other domain SIDs?
Note: see cifsrap2.txt section5, page 10.
0 for shi1_type indicates a Disk. |
1 for shi1_type indicates a Print Queue. |
2 for shi1_type indicates a Device. |
3 for shi1_type indicates an IPC pipe. |
0x8000 0000 (top bit set in shi1_type) indicates a hidden share. |
shi1_netname - pointer to net name
shi1_type - type of share. 0 - undocumented.
shi1_remark - pointer to comment.
shi1_netname - unicode string of net name
shi1_remark - unicode string of comment.
share container with 0 entries:
0 - EntriesRead
0 - Buffer
share container with > 0 entries:
EntriesRead
non-zero - Buffer
EntriesRead
share entry pointers
share entry strings
padding to get unicode string 4-byte aligned with start of the SMB header.
EntriesRead
0 - padding
Note: see cifs6.txt section 6.4 - the fields described therein will be of assistance here. for example, the type listed below is the same as fServerType, which is described in 6.4.1.
0x00000001 All workstations
0x00000002 All servers
0x00000004 Any server running with SQL server
0x00000008 Primary domain controller
0x00000010 Backup domain controller
0x00000020 Server running the timesource service
0x00000040 Apple File Protocol servers
0x00000080 Novell servers
0x00000100 Domain Member
0x00000200 Server sharing print queue
0x00000400 Server running dialin service.
0x00000800 Xenix server
0x00001000 NT server
0x00002000 Server running Windows for
0x00008000 Windows NT non DC server
0x00010000 Server that can run the browser service
0x00020000 Backup browser server
0x00040000 Master browser server
0x00080000 Domain Master Browser server
0x40000000 Enumerate only entries marked "local"
0x80000000 Enumerate Domains. The pszServer and pszDomain parameters must be NULL.
500 - platform_id
pointer to name
5 - major version
4 - minor version
type (SV_TYPE_... bit field)
pointer to comment
sv101_name - unicode string of server name
sv_101_comment - unicode string of server comment.
padding to get unicode string 4-byte aligned with start of the SMB header.
For details on the SMB Transact Named Pipe, see cifs6.txt
The MSRPC is conducted over an SMB Transact Pipe with a name of \PIPE\. You must first obtain a 16 bit file handle, by sending a SMBopenX with the pipe name \PIPE\srvsvc for @@ -1268,11 +1268,11 @@ listed below:
initial SMBopenX request: RPC API command 0x26 params: "\\PIPE\\lsarpc" 0x65 0x63; 0x72 0x70; 0x44 0x65; "\\PIPE\\srvsvc" 0x73 0x76; 0x4E 0x00; 0x5C 0x43; -
[section to be rewritten, following receipt of work by Duncan Stansfield]
Interesting note: if you set packed data representation to 0x0100 0000 -then all 4-byte and 2-byte word ordering is turned around!
The start of each of the NTLSA and NETLOGON named pipes begins with:
offset: 00
Variable type: UINT8
Variable data: 5 - RPC major version
offset: 01
Variable type: UINT8
Variable data: 0 - RPC minor version
offset: 02
Variable type: UINT8
Variable data: 2 - RPC response packet
offset: 03
Variable type: UINT8
Variable data: 3 - (FirstFrag bit-wise or with LastFrag)
offset: 04
Variable type: UINT32
Variable data: 0x1000 0000 - packed data representation
offset: 08
Variable type: UINT16
Variable data: fragment length - data size (bytes) inc header and tail.
offset: 0A
Variable type: UINT16
Variable data: 0 - authentication length
offset: 0C
Variable type: UINT32
Variable data: call identifier. matches 12th UINT32 of incoming RPC data.
offset: 10
Variable type: UINT32
Variable data: allocation hint - data size (bytes) minus header and tail.
offset: 14
Variable type: UINT16
Variable data: 0 - presentation context identifier
offset: 16
Variable type: UINT8
Variable data: 0 - cancel count
offset: 17
Variable type: UINT8
Variable data: in replies: 0 - reserved; in requests: opnum - see #defines.
offset: 18
Variable type: ......
Variable data: start of data (goes on for allocation_hint bytes)
reply same as request (0x05)
reply same as request (0x00)
one of the MSRPC_Type enums
reply same as request (0x00 for Bind, 0x03 for Request)
reply same as request (0x00000010)
the length of the data section of the SMB trans packet
call identifier. (e.g. 0x00149594)
the remainder of the packet depending on the "type"
the interfaces are numbered. as yet I haven't seen more than one interface used on the same pipe name srvsvc
+
[section to be rewritten, following receipt of work by Duncan Stansfield]
Interesting note: if you set packed data representation to 0x0100 0000 +then all 4-byte and 2-byte word ordering is turned around!
The start of each of the NTLSA and NETLOGON named pipes begins with:
offset: 00
Variable type: UINT8
Variable data: 5 - RPC major version
offset: 01
Variable type: UINT8
Variable data: 0 - RPC minor version
offset: 02
Variable type: UINT8
Variable data: 2 - RPC response packet
offset: 03
Variable type: UINT8
Variable data: 3 - (FirstFrag bit-wise or with LastFrag)
offset: 04
Variable type: UINT32
Variable data: 0x1000 0000 - packed data representation
offset: 08
Variable type: UINT16
Variable data: fragment length - data size (bytes) inc header and tail.
offset: 0A
Variable type: UINT16
Variable data: 0 - authentication length
offset: 0C
Variable type: UINT32
Variable data: call identifier. matches 12th UINT32 of incoming RPC data.
offset: 10
Variable type: UINT32
Variable data: allocation hint - data size (bytes) minus header and tail.
offset: 14
Variable type: UINT16
Variable data: 0 - presentation context identifier
offset: 16
Variable type: UINT8
Variable data: 0 - cancel count
offset: 17
Variable type: UINT8
Variable data: in replies: 0 - reserved; in requests: opnum - see #defines.
offset: 18
Variable type: ......
Variable data: start of data (goes on for allocation_hint bytes)
reply same as request (0x05)
reply same as request (0x00)
one of the MSRPC_Type enums
reply same as request (0x00 for Bind, 0x03 for Request)
reply same as request (0x00000010)
the length of the data section of the SMB trans packet
call identifier. (e.g. 0x00149594)
the remainder of the packet depending on the "type"
the interfaces are numbered. as yet I haven't seen more than one interface used on the same pipe name srvsvc
abstract (0x4B324FC8, 0x01D31670, 0x475A7812, 0x88E16EBF, 0x00000003) transfer (0x8A885D04, 0x11C91CEB, 0x0008E89F, 0x6048102B, 0x00000002) -
the remainder of the packet after the header if "type" was Bind in the response header, "type" should be BindAck
maximum transmission fragment size (0x1630)
max receive fragment size (0x1630)
associated group id (0x0)
the number of elements (0x1)
presentation context identifier (0x0)
the number of syntaxes (has always been 1?)(0x1)
4-byte alignment padding, against SMB header
num and vers. of interface client is using
num and vers. of interface to use for replies
length of the string including null terminator
the string above in single byte, null terminated form
the response to place after the header in the reply packet
same as request
same as request
zero
the address string, as described earlier
4-byte alignment padding, against SMB header
the number of results (0x01)
4-byte alignment padding, against SMB header
result (0x00 = accept)
reason (0x00 = no reason specified)
the transfer syntax from the request
the remainder of the packet after the header for every other other request
the size of the stub data in bytes
presentation context identifier (0x0)
operation number (0x15)
a packet dependent on the pipe name (probably the interface) and the op number)
The end of each of the NTLSA and NETLOGON named pipes ends with:
end of data
return code
the remainder of the packet after the header if "type" was Bind in the response header, "type" should be BindAck
maximum transmission fragment size (0x1630)
max receive fragment size (0x1630)
associated group id (0x0)
the number of elements (0x1)
presentation context identifier (0x0)
the number of syntaxes (has always been 1?)(0x1)
4-byte alignment padding, against SMB header
num and vers. of interface client is using
num and vers. of interface to use for replies
length of the string including null terminator
the string above in single byte, null terminated form
the response to place after the header in the reply packet
same as request
same as request
zero
the address string, as described earlier
4-byte alignment padding, against SMB header
the number of results (0x01)
4-byte alignment padding, against SMB header
result (0x00 = accept)
reason (0x00 = no reason specified)
the transfer syntax from the request
the remainder of the packet after the header for every other other request
the size of the stub data in bytes
presentation context identifier (0x0)
operation number (0x15)
a packet dependent on the pipe name (probably the interface) and the op number)
The end of each of the NTLSA and NETLOGON named pipes ends with:
end of data
return code
RPC Binds are the process of associating an RPC pipe (e.g \PIPE\lsarpc) with a "transfer syntax" (see RPC_Iface structure). The purpose for doing this is unknown. @@ -1280,7 +1280,7 @@ this is unknown. returned by the SMBopenX Transact response.
Note: The RPC_ResBind members maxtsize, maxrsize and assocgid are the same in the response as the same members in the RPC_ReqBind. The RPC_ResBind member transfersyntax is the same in the response as the
Note: The RPC_ResBind response member secondaddr contains the name of what is presumed to be the service behind the RPC pipe. The - mapping identified so far is:
RPC_ResBind response:
"\\PIPE\\ntsvcs"
"\\PIPE\\lsass"
"\\PIPE\\lsass"
"\\PIPE\\wksvcs"
"\\PIPE\\NETLOGON"
Note: The RPC_Packet fraglength member in both the Bind Request and Bind Acknowledgment must contain the length of the entire RPC data, including the RPC_Packet header.
Request:
RPC_Packet |
RPC_ReqBind |
Response:
RPC_Packet |
RPC_ResBind |
The sequence of actions taken on this pipe are:
Establish a connection to the IPC$ share (SMBtconX). use encrypted passwords. |
Open an RPC Pipe with the name "\\PIPE\\lsarpc". Store the file handle. |
Using the file handle, send a Set Named Pipe Handle state to 0x4300. |
Send an LSA Open Policy request. Store the Policy Handle. |
Using the Policy Handle, send LSA Query Info Policy requests, etc. |
Using the Policy Handle, send an LSA Close. |
Close the IPC$ share. |
Defines for this pipe, identifying the query are:
0x2c
0x07
0x0d
0xff
0xfe
0xfd
0x00
Note: The policy handle can be anything you like.
buffer pointer
server name - unicode string starting with two '\'s
object attributes
1 - desired access
Note: The info class in response must be the same as that in the request.
undocumented buffer pointer
info class (same as info class in request).
+ mapping identified so far is:
- initial SMBopenX request:
RPC_ResBind response:
- "\\PIPE\\srvsvc"
"\\PIPE\\ntsvcs"
- "\\PIPE\\samr"
"\\PIPE\\lsass"
- "\\PIPE\\lsarpc"
"\\PIPE\\lsass"
- "\\PIPE\\wkssvc"
"\\PIPE\\wksvcs"
- "\\PIPE\\NETLOGON"
"\\PIPE\\NETLOGON"
Note: The RPC_Packet fraglength member in both the Bind Request and Bind Acknowledgment must contain the length of the entire RPC data, including the RPC_Packet header.
Request:
RPC_Packet |
RPC_ReqBind |
Response:
RPC_Packet |
RPC_ResBind |
The sequence of actions taken on this pipe are:
Establish a connection to the IPC$ share (SMBtconX). use encrypted passwords. |
Open an RPC Pipe with the name "\\PIPE\\lsarpc". Store the file handle. |
Using the file handle, send a Set Named Pipe Handle state to 0x4300. |
Send an LSA Open Policy request. Store the Policy Handle. |
Using the Policy Handle, send LSA Query Info Policy requests, etc. |
Using the Policy Handle, send an LSA Close. |
Close the IPC$ share. |
Defines for this pipe, identifying the query are:
0x2c
0x07
0x0d
0xff
0xfe
0xfd
0x00
Note: The policy handle can be anything you like.
buffer pointer
server name - unicode string starting with two '\'s
object attributes
1 - desired access
Note: The info class in response must be the same as that in the request.
Note: num_entries in response must be same as num_entries in request.
LSA policy handle
num_entries
undocumented domain SID buffer pointer
undocumented domain name buffer pointer
DOM_SID[num_entries] domain SIDs to be looked up.
completely undocumented 16 bytes.
Note: num_entries in response must be same as num_entries in request.
LSA policy handle
num_entries
num_entries
undocumented domain SID buffer pointer
undocumented domain name buffer pointer
names to be looked up.
undocumented bytes - falsely translated SID structure?
The sequence of actions taken on this pipe are:
tablish a connection to the IPC$ share (SMBtconX). use encrypted passwords. |
en an RPC Pipe with the name "\\PIPE\\NETLOGON". Store the file handle. |
ing the file handle, send a Set Named Pipe Handle state to 0x4300. |
eate Client Challenge. Send LSA Request Challenge. Store Server Challenge. |
lculate Session Key. Send an LSA Auth 2 Challenge. Store Auth2 Challenge. |
lc/Verify Client Creds. Send LSA Srv PW Set. Calc/Verify Server Creds. |
lc/Verify Client Creds. Send LSA SAM Logon . Calc/Verify Server Creds. |
lc/Verify Client Creds. Send LSA SAM Logoff. Calc/Verify Server Creds. |
ose the IPC$ share. |
Defines for this pipe, identifying the query are
0x04
0x06
0x02
0x03
0x0f
0x0e
Note: logon server name starts with two '\' characters and is upper case.
Note: logon client is the machine, not the user.
Note: the initial LanManager password hash, against which the challenge is issued, is the machine name itself (lower case). there will becalls issued (LSA Server Password Set) which will change this, later. refusing these calls allows you to always deal with the same password (i.e the LM# of the machine name in lower case).
undocumented buffer pointer
logon server unicode string
logon client unicode string
client challenge
Note: in between request and response, calculate the client credentials, and check them against the client-calculated credentials (this process uses the previously received client credentials).
Note: neg_flags in the response is the same as that in the request.
Note: you must take a copy of the client-calculated credentials received here, because they will be used in subsequent authentication packets.
client identification info
client-calculated credentials
padding to 4-byte align with start of SMB header.
neg_flags - negotiated flags (usual value is 0x0000 01ff)
Note: the new password is suspected to be a DES encryption using the old password to generate the key.
Note: in between request and response, calculate the client credentials, and check them against the client-calculated credentials (this process uses the previously received client credentials).
Note: the server credentials are constructed from the client-calculated credentials and the client time + 1 second.
Note: you must take a copy of the client-calculated credentials received here, because they will be used in subsequent authentication packets.
Note: num_entries in response must be same as num_entries in request.
LSA policy handle
num_entries
undocumented domain SID buffer pointer
undocumented domain name buffer pointer
DOM_SID[num_entries] domain SIDs to be looked up.
completely undocumented 16 bytes.
Note: num_entries in response must be same as num_entries in request.
LSA policy handle
num_entries
num_entries
undocumented domain SID buffer pointer
undocumented domain name buffer pointer
names to be looked up.
undocumented bytes - falsely translated SID structure?
The sequence of actions taken on this pipe are:
tablish a connection to the IPC$ share (SMBtconX). use encrypted passwords. |
en an RPC Pipe with the name "\\PIPE\\NETLOGON". Store the file handle. |
ing the file handle, send a Set Named Pipe Handle state to 0x4300. |
eate Client Challenge. Send LSA Request Challenge. Store Server Challenge. |
lculate Session Key. Send an LSA Auth 2 Challenge. Store Auth2 Challenge. |
lc/Verify Client Creds. Send LSA Srv PW Set. Calc/Verify Server Creds. |
lc/Verify Client Creds. Send LSA SAM Logon . Calc/Verify Server Creds. |
lc/Verify Client Creds. Send LSA SAM Logoff. Calc/Verify Server Creds. |
ose the IPC$ share. |
Defines for this pipe, identifying the query are
0x04
0x06
0x02
0x03
0x0f
0x0e
Note: logon server name starts with two '\' characters and is upper case.
Note: logon client is the machine, not the user.
Note: the initial LanManager password hash, against which the challenge is issued, is the machine name itself (lower case). there will becalls issued (LSA Server Password Set) which will change this, later. refusing these calls allows you to always deal with the same password (i.e the LM# of the machine name in lower case).
undocumented buffer pointer
logon server unicode string
logon client unicode string
client challenge
Note: in between request and response, calculate the client credentials, and check them against the client-calculated credentials (this process uses the previously received client credentials).
Note: neg_flags in the response is the same as that in the request.
Note: you must take a copy of the client-calculated credentials received here, because they will be used in subsequent authentication packets.
client identification info
client-calculated credentials
padding to 4-byte align with start of SMB header.
neg_flags - negotiated flags (usual value is 0x0000 01ff)
Note: the new password is suspected to be a DES encryption using the old password to generate the key.
Note: in between request and response, calculate the client credentials, and check them against the client-calculated credentials (this process uses the previously received client credentials).
Note: the server credentials are constructed from the client-calculated credentials and the client time + 1 second.
Note: you must take a copy of the client-calculated credentials received here, because they will be used in subsequent authentication packets.
Note: valid_user is True iff the username and password hash are valid for the requested domain. -
undocumented buffer pointer
server credentials. server time stamp appears to be ignored.
+
Note: presumably, the SAM_INFO structure is validated, and a (currently undocumented) error code returned if the Logoff is invalid. -
Note: mailslots will contain a response mailslot, to which the response should be sent. the target NetBIOS name is REQUEST_NAME<20>, where REQUEST_NAME is the name of the machine that sent the request. -
Note: NTversion, LMNTtoken, LM20token in response are the same as those given in the request.
0x0007 - Query for PDC
machine name
response mailslot
padding to 2-byte align with start of mailslot.
machine name
NTversion
LMNTtoken
LM20token
0x000A - Respose to Query for PDC
machine name (in uppercase)
padding to 2-byte align with start of mailslot.
machine name
domain name
NTversion (same as received in request)
LMNTtoken (same as received in request)
LM20token (same as received in request)
Note: machine name in response is preceded by two '\' characters.
Note: NTversion, LMNTtoken, LM20token in response are the same as those given in the request.
Note: user name in the response is presumably the same as that in the request.
0x0012 - SAM Logon
request count
machine name
user name
response mailslot
alloweable account
domain SID size
domain SID, of sid_size bytes.
???? padding to 4? 2? -byte align with start of mailslot.
NTversion
LMNTtoken
LM20token
Defines for this pipe, identifying the query are:
0x0f
0x15
Note: share level and switch value in the response are presumably the same as those in the request.
Note: cifsrap2.txt (section 5) may be of limited assistance here.
pointer (to server name?)
server name
padding to get unicode string 4-byte aligned with the start of the SMB header.
share level
switch value
pointer to SHARE_INFO_1_CTR
share info with 0 entries
preferred maximum length (0xffff ffff)
Intel byte ordered addition of corresponding 4 byte words in arrays A1 and A2
DES ECB encryption of 8 byte data D using 7 byte key K
Lan man hash
NT hash
md4(machine_password) == md4(lsadump $machine.acc) == +
Note: NTversion, LMNTtoken, LM20token in response are the same as those given in the request.
0x0007 - Query for PDC
machine name
response mailslot
padding to 2-byte align with start of mailslot.
machine name
NTversion
LMNTtoken
LM20token
0x000A - Respose to Query for PDC
machine name (in uppercase)
padding to 2-byte align with start of mailslot.
machine name
domain name
NTversion (same as received in request)
LMNTtoken (same as received in request)
LM20token (same as received in request)
Note: machine name in response is preceded by two '\' characters.
Note: NTversion, LMNTtoken, LM20token in response are the same as those given in the request.
Note: user name in the response is presumably the same as that in the request.
0x0012 - SAM Logon
request count
machine name
user name
response mailslot
alloweable account
domain SID size
domain SID, of sid_size bytes.
???? padding to 4? 2? -byte align with start of mailslot.
NTversion
LMNTtoken
LM20token
Defines for this pipe, identifying the query are:
0x0f
0x15
Note: share level and switch value in the response are presumably the same as those in the request.
Note: cifsrap2.txt (section 5) may be of limited assistance here.
pointer (to server name?)
server name
padding to get unicode string 4-byte aligned with the start of the SMB header.
share level
switch value
pointer to SHARE_INFO_1_CTR
share info with 0 entries
preferred maximum length (0xffff ffff)
Intel byte ordered addition of corresponding 4 byte words in arrays A1 and A2
DES ECB encryption of 8 byte data D using 7 byte key K
Lan man hash
NT hash
md4(machine_password) == md4(lsadump $machine.acc) == pwdump(machine$) (initially) == md4(lmowf(unicode(machine))) -
ARC4 encryption of data D of length Ld with key K of length Lk
subset of v from bytes m to n, optionally padded with zeroes to length l
E(K[7..7,7],E(K[0..6],D)) computes a credential
4 byte current time
8 byte client and server challenges Rc,Rs: 8 byte client and server credentials
+
ARC4 encryption of data D of length Ld with key K of length Lk
subset of v from bytes m to n, optionally padded with zeroes to length l
E(K[7..7,7],E(K[0..6],D)) computes a credential
4 byte current time
8 byte client and server challenges Rc,Rs: 8 byte client and server credentials
C->S ReqChal,Cc S->C Cs
@@ -1358,7 +1358,7 @@ S: Ts = Time() S->C Cred(Ks,Cred(Ks,Rc+Tc+1)),userinfo(logon script,UID,SIDs,etc) C: assert(Rs == Cred(Ks,Cred(Rc+Tc+1)) C: Rc = Cred(Ks,Rc+Tc+1) -
On first joining the domain the session key could be computed by anyone listening in on the network as the machine password has a well known value. Until the machine is rebooted it will use this session @@ -1379,30 +1379,30 @@ returned by the server. The password OWFs should NOT be sent over the network reversibly encrypted. They should be sent using ARC4(Ks,md4(owf)) with the server computing the same function using the owf values in the SAM. -
SIDs and RIDs are well documented elsewhere.
A SID is an NT Security ID (see DOM_SID structure). They are of the form:
revision-NN-SubAuth1-SubAuth2-SubAuth3... |
revision-0xNNNNNNNNNNNN-SubAuth1-SubAuth2-SubAuth3... |
currently, the SID revision is 1. The Sub-Authorities are known as Relative IDs (RIDs). -
S-1-0-0
S-1-1-0
S-1-2-0
S-1-3-0
S-1-3-1
S-1-3-2
S-1-3-3
S-1-4
+
S-1-0-0
S-1-1-0
S-1-2-0
S-1-3-0
S-1-3-1
S-1-3-2
S-1-3-3
S-1-4
A RID is a sub-authority value, as part of either a SID, or in the case of Group RIDs, part of the DOM_GID structure, in the USER_INFO_1 structure, in the LSA SAM Logon response. -
Groupname: DOMAIN_USER_RID_ADMIN
????: 0x0000
RID: 01F4
Groupname: DOMAIN_USER_RID_GUEST
????: 0x0000
RID: 01F5
Groupname: DOMAIN_GROUP_RID_ADMINS
????: 0x0000
RID: 0200
Groupname: DOMAIN_GROUP_RID_USERS
????: 0x0000
RID: 0201
Groupname: DOMAIN_GROUP_RID_GUESTS
????: 0x0000
RID: 0202
Groupname: DOMAIN_ALIAS_RID_ADMINS
????: 0x0000
RID: 0220
Groupname: DOMAIN_ALIAS_RID_USERS
????: 0x0000
RID: 0221
Groupname: DOMAIN_ALIAS_RID_GUESTS
????: 0x0000
RID: 0222
Groupname: DOMAIN_ALIAS_RID_POWER_USERS
????: 0x0000
RID: 0223
Groupname: DOMAIN_ALIAS_RID_ACCOUNT_OPS
????: 0x0000
RID: 0224
Groupname: DOMAIN_ALIAS_RID_SYSTEM_OPS
????: 0x0000
RID: 0225
Groupname: DOMAIN_ALIAS_RID_PRINT_OPS
????: 0x0000
RID: 0226
Groupname: DOMAIN_ALIAS_RID_BACKUP_OPS
????: 0x0000
RID: 0227
Groupname: DOMAIN_ALIAS_RID_REPLICATOR
????: 0x0000
RID: 0228
Table of Contents
Groupname: DOMAIN_USER_RID_ADMIN
????: 0x0000
RID: 01F4
Groupname: DOMAIN_USER_RID_GUEST
????: 0x0000
RID: 01F5
Groupname: DOMAIN_GROUP_RID_ADMINS
????: 0x0000
RID: 0200
Groupname: DOMAIN_GROUP_RID_USERS
????: 0x0000
RID: 0201
Groupname: DOMAIN_GROUP_RID_GUESTS
????: 0x0000
RID: 0202
Groupname: DOMAIN_ALIAS_RID_ADMINS
????: 0x0000
RID: 0220
Groupname: DOMAIN_ALIAS_RID_USERS
????: 0x0000
RID: 0221
Groupname: DOMAIN_ALIAS_RID_GUESTS
????: 0x0000
RID: 0222
Groupname: DOMAIN_ALIAS_RID_POWER_USERS
????: 0x0000
RID: 0223
Groupname: DOMAIN_ALIAS_RID_ACCOUNT_OPS
????: 0x0000
RID: 0224
Groupname: DOMAIN_ALIAS_RID_SYSTEM_OPS
????: 0x0000
RID: 0225
Groupname: DOMAIN_ALIAS_RID_PRINT_OPS
????: 0x0000
RID: 0226
Groupname: DOMAIN_ALIAS_RID_BACKUP_OPS
????: 0x0000
RID: 0227
Groupname: DOMAIN_ALIAS_RID_REPLICATOR
????: 0x0000
RID: 0228
Table of Contents
The purpose of this document is to provide some insight into Samba's printing functionality and also to describe the semantics of certain features of Windows client printing. -
Samba uses a table of function pointers to seven functions. The @@ -1413,7 +1413,7 @@ Currently there are only two printing back end implementations defined.
a generic set of functions for working with standard UNIX printing subsystems
a set of CUPS specific functions (this is only enabled if - the CUPS libraries were located at compile time).
Samba provides periodic caching of the output from the "lpq command" @@ -1502,11 +1502,11 @@ and the job has the printer's device mode associated with it by default. Only non-default Device Mode are stored with print jobs in the print queue TDB. Otherwise, the Device Mode is obtained from the printer object when the client issues a GetJob(level == 2) request. -
When working with Windows NT+ clients, it is possible for a @@ -1604,7 +1604,7 @@ handle for notification. Samba currently uses the snum of the printer for this which can break if the list of services has been modified since the notification handle was registered.
The size is either (a) the string length in UNICODE for strings, (b) the size in bytes of the security descriptor, or (c) 0 for -data values.
Table of Contents
Table of Contents
The current Samba codebase possesses the capability to use groups of WINS servers that share a common namespace for NetBIOS name registration and resolution. The formal parameter syntax is @@ -1646,7 +1646,7 @@ If a timeout occurs when querying a specific WINS server, that server is marked prevent further timeouts and the next server in the WINS group is contacted. Once marked as dead, Samba will not attempt to contact that server for name registration/resolution queries for a period of 10 minutes. -
Table of Contents
Table of Contents
One of the biggest problems with passdb is it's implementation of 'security'. Access control is on a 'are you root at the moment' basis, and it has no concept of NT ACLs. Things like ldapsam had to add 'magic' 'are you root' checks.
We took this very seriously when we started work, and the new structure @@ -1706,7 +1706,7 @@ actual data store (like the LDAP server).
Finally, we have generic get_sec_desc() and set_sec_desc() routines to allow external ACL manipulation. These do lookups based on SID. -
One of the primary tenants of the 'new SAM' is that it would not attempt to deal with 'what unix id for that'. This would be left to the 'SMS' (Sid Mapping System') or SID farm, and probably administered via @@ -1716,7 +1716,7 @@ Accounts not preexisting in unix would be served up via winbind.
This is an *optional* part, and my preferred end-game. We have a fare way to go before things like winbind up to it however. -
One of the things that the 'new SAM' work has tried to face is both compatibility with existing code, and a closer alignment to the SAMR interface. I consider SAMR to be a 'primary customer' to the this work, @@ -1741,11 +1741,11 @@ have *really* changed. 'conflicting' updates: Currently we don't deal with this (in passdb or the new sam stuff), but the design is sufficiently flexible to 'deny' a second update. I don't foresee locking records however. -
This is where smbd, samtest and whatever end-user replacement we have for pdbedit sits. They use only the SAM interface, and do not get 'special knowledge' of what is below them. -
This level 'owns' the various handle structures, the get/set routines on those structures and provides the public interface. The application layer may initialize a 'context' to be passed to all interface routines, @@ -1756,7 +1756,7 @@ abstraction to the modules below, and arrange for their initial loading.
We could possibly add ACL checking at this layer, to avoid discrepancies in implementation modules. -
These do not communicate with the application directly, only by setting values in the handles, and receiving requests from the interface. These modules are responsible for translating values from the handle's @@ -1764,13 +1764,13 @@ modules are responsible for translating values from the handle's to 'know' things like it's own domain SID, domain name, and any other state attached to the SAM. Simpler modules may call back to some helper routine. -
In order for there to be a smooth transition, kai is writing a module that reads existing passdb backends, and translates them into SAM replies. (Also pulling data from the account policy DB etc). We also intend to write a module that does the reverse - gives the SAM a passdb interface. -
This is the first of the SAM modules to be committed to the tree - mainly because I needed to coordinate work with metze (who authored most of it). This module aims to use Samba's libads code to provide an @@ -1782,7 +1782,7 @@ the construction of an Samba AD DC.
We also intend to construct a Samba 2.2/3.0 compatible ldap module, again using libads code. -
The 'new SAM' development effort also concerned itself with getting a sane implementation of memory management. It was decided that we would be (as much as possible) talloc based, using an 'internal talloc @@ -1811,7 +1811,7 @@ NT_USER_TOKEN *access_token, uint32 access_desired, const DOM_SID NTSTATUS sam_enum_accounts(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const DOM_SID *domainsid, uint16 acct_ctrl, int32 *account_count, SAM_ACCOUNT_ENUM **accounts) -
Testing is vital in any piece of software, and Samba is certainly no exception. In designing this new subsystem, we have taken care to ensure it is easily tested, independent of outside protocols. @@ -1840,13 +1840,13 @@ Because the 'new SAM' is NT ACL based, there will be a command to specify an arbitrary NT ACL, but for now it uses 'system' by default.
Table of Contents
19 Apr 1999
Table of Contents
With the development of LanManager and Windows NT compatible password encryption for Samba, it is now able to validate user connections in exactly the same way as a LanManager or Windows NT server.
This document describes how the SMB password encryption algorithm works and what issues there are in choosing whether you want to use it. You should read it carefully, especially - the part about security and the "PROS and CONS" section.
LanManager encryption is somewhat similar to UNIX + the part about security and the "PROS and CONS" section.
LanManager encryption is somewhat similar to UNIX password encryption. The server uses a file containing a hashed value of a user's password. This is created by taking the user's plaintext password, capitalising it, and either @@ -1883,7 +1883,7 @@ specify an arbitrary NT ACL, but for now it uses 'system' by default. know the correct password and is denied access.
Note that the Samba server never knows or stores the cleartext of the user's password - just the 16 byte hashed values derived from it. Also note that the cleartext password or 16 byte hashed values - are never transmitted over the network - thus increasing security.
In order for Samba to participate in the above protocol + are never transmitted over the network - thus increasing security.
In order for Samba to participate in the above protocol it must be able to look up the 16 byte hashed values given a user name. Unfortunately, as the UNIX password value is also a one way hash function (ie. it is impossible to retrieve the cleartext of the user's @@ -1940,10 +1940,10 @@ bob:100:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX: to enable this on your server.
Note : This file should be protected very carefully. Anyone with access to this file can (with enough knowledge of the protocols) gain access to your SMB server. The file is thus more - sensitive than a normal unix /etc/passwd file.
Table of Contents
Table of Contents
The new modules system has the following advantages:
Transparent loading of static and shared modules (no need -for a subsystem to know about modules) |
Simple selection between shared and static modules at configure time |
"preload modules" option for increasing performance for stable modules |
No nasty #define stuff anymore |
All backends are available as plugin now (including pdb_ldap and pdb_tdb) |
+for a subsystem to know about modules)
Some subsystems in samba use different backends. These backends can be either statically linked in to samba or available as a plugin. A subsystem should have a function that allows a module to register itself. For example, @@ -1953,7 +1953,7 @@ NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function in
This function will be called by the initialisation function of the module to register itself. -
+
The modules system compiles a list of initialisation functions for the static modules of each subsystem. This is a define. For example, it is here currently (from include/config.h): @@ -1963,7 +1963,7 @@ it is here currently (from include/config.h):
These functions should be called before the subsystem is used. That should be done when the subsystem is initialised or first used. -
If a subsystem needs a certain backend, it should check if it has already been registered. If the backend hasn't been registered already, the subsystem should call smb_probe_module(char *subsystem, char *backend). @@ -1973,7 +1973,7 @@ is a slash, smb_probe_module() tries to load the module from the absolute path specified in 'backend'.
After smb_probe_module() has been executed, the subsystem should check again if the module has been registered. -
Each module has an initialisation function. For modules that are included with samba this name is 'subsystem_backend_init'. For external modules (that will never be built-in, but only available as a module) this name is always 'init_module'. (In the case of modules included with samba, the configure system will add a #define subsystem_backend_init() init_module()). The prototype for these functions is: @@ -1988,7 +1988,7 @@ smb_register_passdb(PASSDB_INTERFACE_VERSION, "ldapsam", pdb_init_ldapsam); smb_register_passdb(PASSDB_INTERFACE_VERSION, "ldapsam_nua", pdb_init_ldapsam_nua); return NT_STATUS_OK; } -
+
Some macros in configure.in generate the various defines and substs that are necessary for the system to work correct. All modules that should be built by default have to be added to the variable 'default_modules'. @@ -2009,13 +2009,13 @@ Practically, this means all c files that contain static_init_
There currently also is a configure.in command called SMB_MODULE_PROVIVES(). This is used for modules that register multiple things. It should not -be used as probing will most likely disappear in the future.
Table of Contents
Table of Contents
This document describes how to make use the new RPC Pluggable Modules features of Samba 3.0. This architecture was added to increase the maintainability of Samba allowing RPC Pipes to be worked on separately from the main CVS branch. The RPM architecture will also allow third-party vendors to add functionality to Samba through plug-ins. -
When an RPC call is sent to smbd, smbd tries to load a shared library by the name librpc_<pipename>.so to handle the call if it doesn't know how to handle the call internally. For instance, LSA calls @@ -2032,7 +2032,7 @@ NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, const char *s argument.
the Client name of the named pipe
the Server name of the named pipe
a list of api_structs that map RPC ordinal numbers to function calls
the number of api_structs contained in cmds
See rpc_server/srv_reg.c and rpc_server/srv_reg_nt.c for a small example of how to use this library. -
Table of Contents
Table of Contents
Each VFS operation has a vfs_op_type, a function pointer and a handle pointer in the struct vfs_ops and tree macros to make it easier to call the operations. (Take a look at include/vfs.h and include/vfs_macros.h.) @@ -2128,7 +2128,7 @@ DO NOT ACCESS conn->vfs.ops.* directly !!! (tofd), (fsp), (fromfd), (header), (offset), (count))) ... -
These values are used by the VFS subsystem when building the conn->vfs and conn->vfs_opaque structs for a connection with multiple VFS modules. Internally, Samba differentiates only opaque and transparent layers at this process. @@ -2157,7 +2157,7 @@ typedef enum _vfs_op_layer { SMB_VFS_LAYER_SCANNER /* - Checks data and possibly initiates additional */ /* file activity like logging to files _inside_ samba VFS */ } vfs_op_layer; -
As each Samba module a VFS module should have a
NTSTATUS vfs_example_init(void);
function if it's staticly linked to samba or
NTSTATUS init_module(void);
function if it's a shared module. @@ -2197,7 +2197,7 @@ NTSTATUS init_module(void) { return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "example", example_op_tuples); } -
Each VFS function has as first parameter a pointer to the modules vfs_handle_struct. +
Each VFS function has as first parameter a pointer to the modules vfs_handle_struct.
typedef struct vfs_handle_struct { struct vfs_handle_struct *next, *prev; @@ -2298,7 +2298,7 @@ you can set this function pointer to NULL.
Some useful MAC (handle)->vfs_next.handles.sendfile,\ (tofd), (fsp), (fromfd), (header), (offset), (count))) ... -
Add "vfs_handle_struct *handle, " as first parameter to all vfs operation functions. e.g. example_connect(connection_struct *conn, const char *service, const char *user); -> example_connect(vfs_handle_struct *handle, connection_struct *conn, const char *service, const char *user); @@ -2422,7 +2422,7 @@ remember the struct smb_vfs_handle_struct.
(Only for 3.0alpha* modules) Check if your vfs_done() function contains needed code. -
If NOT you can remove the vfs_done() function. | |||||||
If YES decide if you can move the code to the example_disconnect() operation. Otherwise register a SMB_EXIT_EVENT with smb_register_exit_event(); (Described in the modules section) And then remove vfs_done(). e.g. the freeing of private data should go to example_disconnect().
+
Check if you have any global variables left. @@ -2561,7 +2561,7 @@ for your module. Compiling & Testing...
- Avoid writing functions like this: @@ -2572,7 +2572,7 @@ static int example_close(vfs_handle_struct *handle, files_struct *fsp, int fd) Overload only the functions you really need to! - If you want to just implement a better version of a default samba opaque function (e.g. like a disk_free() function for a special filesystem) @@ -2592,12 +2592,12 @@ static int example_rename(vfs_handle_struct *handle, connection_struct *conn, errno = ENOSYS; return -1; } - Table of Contents Table of Contents Please, please update the version number in source/include/version.h to include the versioning of your package. This makes it easier to distinguish standard samba builds from custom-build samba builds (distributions often patch packages). For example, a good version would be: Version 2.999+3.0.alpha21-5 for Debian - Samba now has support for building parts of samba as plugins. This makes it possible to, for example, put ldap or mysql support in a seperate package, thus making it possible to have a normal samba package not depending on ldap or mysql. To build as much parts of samba @@ -2631,11 +2631,11 @@ as a plugin, run: with one that had issues. | |||||||
Make sure your patch complies to the samba coding style as suggested in the coding-suggestions chapter. |
Bugfixes to bugs in samba should be submitted to samba's
- bugzilla system,
+
Send feature patches along with a description of what the
patch is supposed to do to the
- Samba-technical mailinglist and possibly to a samba team member who is (one of the) 'owners'
+