Abstract
Last Update : Fri Oct 10noo:59:58 CEST 2003
This book is a collection of documents that might be useful for people developing samba or those interested in doing so. It's nothing more than a collection of documents written by samba developers about the internals of various parts of samba and the SMB protocol. It's still (and will always be) incomplete. The most recent version of this document can be found at http://devel.samba.org/. Please send updates to 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
Definition of NetBIOS Protocol and Name Resolution Modes
Luke Leighton
Andrew Tridgell
Luke Leighton <lkcl@switchboard.net>
Paul Ashton <paul@argo.demon.co.uk>
Duncan Stansfield <duncans@sco.com>
Dan Shearer
Chris Hertel
David Chappell <David.Chappell@mail.trincoll.edu>
Steve French
Simo Sorce
Andrew Bartlett
Tim Potter
Martin Pool
Jelmer R. Vernooij <jelmer@samba.org>
Jelmer Vernooij <jelmer@samba.org>
Andrew Bartlett
Anthony Liguori <aliguor@us.ibm.com>
Jelmer Vernooij <jelmer@samba.org>
Alexander Bokovoy <ab@samba.org>
Stefan Metzmacher <metze@samba.org>
Jelmer R. Vernooij <jelmer@samba.org>
Chris Hertel
Gerald Carter
LanMan and NT Password Encryption
Jeremy Allison <samba@samba.org>
Andrew Tridgell
Finding useful information on windows
Jelmer R. Vernooij <jelmer@samba.org>
Andrew Tridgell <tridge@samba.org>
Gerald Carter
Jelmer Vernooij
Table of Contents
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 rfc1001.txt and rfc1002.txt.
NetBEUI is a raw NetBIOS frame protocol implementation that allows NetBIOS datagrams to be sent out over the 'wire' embedded within LLC frames. NetBEUI is not required when using NetBIOS over TCP/IP protocols and it is preferable NOT to install NetBEUI if it can be avoided.
IPX/SPX is also not required when using NetBIOS over TCP/IP, and it is preferable NOT to install the IPX/SPX transport unless you are using Novell servers. At the very least, it is recommended that you do not install 'NetBIOS over IPX/SPX'.
[When installing Windows 95, you will find that NetBEUI and IPX/SPX are installed as the default protocols. This is because they are the simplest to manage: no Windows 95 user-configuration is required].
NetBIOS applications (such as samba) offer their services (for example, SMB file and print sharing) on a NetBIOS name. They must claim this name on the network before doing so. The NetBIOS session service will then accept connections on the application's behalf (on the NetBIOS name claimed by the application). A NetBIOS session between the application and the client can then commence.
NetBIOS names consist of 15 characters plus a 'type' character. This is similar, in concept, to an IP address and a TCP port number, respectively. A NetBIOS-aware application on a host will offer different services under different NetBIOS name types, just as a host will offer different TCP/IP services on different port numbers.
NetBIOS names must be claimed on a network, and must be defended. The use of NetBIOS names is most suitable on a single subnet; a Local Area Network or a Wide Area Network.
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 SMB file/print sharing: see cifs4.txt) working on a LAN or WAN is to make your routers forward all broadcast packets from TCP/IP ports 137, 138 and 139.
This, however, is not recommended. If you have a large LAN or WAN, you will 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 with certain NetBIOS names in order to make it useful. (for example, it deals with the registration of <1c> <1d> <1e> names all in different ways. I recommend the reading of the Microsoft WINS Server Help files for full details).
The use of a WINS server cuts down on broadcast network traffic for NetBIOS name resolution. It has the effect of pulling all the broadcast isolated subnets together into a single NetBIOS scope, across your LAN or WAN, while avoiding the use of TCP/IP broadcast packets.
When you have a WINS server on your LAN, WINS clients will be able to contact the WINS server to resolve NetBIOS names. Note that only those WINS clients that have registered with the same WINS server will be visible. The WINS server _can_ have static NetBIOS entries added to its database (usually for security reasons you might want to consider putting your domain controllers or other important servers as static entries, but you should not rely on this as your sole means of security), but for the most part, NetBIOS names are registered dynamically.
This provides some confusion for lots of people, and is worth mentioning here: a Browse Server is NOT a WINS Server, even if these services are implemented in the same application. A Browse Server _needs_ a WINS server because a Browse Server is a WINS client, which is _not_ the same thing].
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 SMB file/print sharing: see cifs6.txt) working on a LAN or WAN is to make your routers forward all broadcast packets from TCP/IP ports 137, 138 and 139. You will find, however, if you do this on a large LAN or a WAN, that your network is completely swamped by NetBIOS and browsing packets, which is why WINS was developed to minimise the necessity of broadcast traffic.
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.
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 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 (particularly printer operations) without first validating a username on the server.
Unix security is based around username/password pairs. A unix box should not allow clients to do any substantive operation without some sort of validation.
The problem mostly manifests itself when the unix server is in "share level" security mode. This is the default mode as the alternative "user level" security mode usually forces a client to connect to the server as the same user for each connected share, which is inconvenient in many sites.
In "share level" security the client normally gives a username in the "session setup" protocol, but does not supply an accompanying password. The client then connects to resources using the "tree connect" protocol, and supplies a password. The problem is that the user on the PC types the username and the password in different contexts, unaware that they need to go together to give access to the server. The username is normally the one the user typed in when they "logged onto" the PC (this assumes Windows for Workgroups). The password is the one they chose when connecting to the disk or printer.
The user often chooses a totally different username for their login as for the drive connection. Often they also want to access different drives as different usernames. The unix server needs some way of divining the correct username to combine with each password.
Samba tries to avoid this problem using several methods. These succeed 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.
This brings up all sorts of interesting problems. For example, when you copy a file to a unix drive, and the file is world writeable but owned by another user the file will transfer correctly but will receive the wrong date. This is because the utime() call under unix only succeeds for the owner of the file, or root, even if the file is world writeable. For security reasons Samba does all file operations as the validated user, not root, so the utime() fails. This can stuff up shared development diectories as programs like "make" will not get 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 obviously it isn't just the data entry routines that are to blame.
Unix passwords are case sensitive. So if users use mixed case passwords they are in trouble.
Samba can try to cope with this by either using the "password level" option which causes Samba to try the offered password with up to the specified number of case changes, or by using the "password server" option which allows Samba to do its validation via another machine (typically a WinNT server).
Samba supports the password encryption method used by SMB clients. Note that the use of password encryption in Microsoft networking leads to password hashes that are "plain text equivalent". 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.
The locking calls available under a DOS/Windows environment are much richer than those available in unix. This means a unix server (like Samba) choosing to use the standard fcntl() based unix locking calls to implement SMB locking has to improvise a bit.
One major problem is that dos locks can be in a 32 bit (unsigned) range. Unix locking calls are 32 bits, but are signed, giving only a 31 bit range. Unfortunately OLE2 clients use the top bit to select a locking range used for OLE semaphores.
To work around this problem Samba compresses the 32 bit range into 31 bits by appropriate bit shifting. This seems to work but is not ideal. In a future version a separate SMB lockd may be added to cope with the problem.
It also doesn't help that many unix lockd daemons are very buggy and crash at the slightest provocation. They normally go mostly unused in a unix environment because few unix programs use byte range locking. The stress of huge numbers of lock requests from dos/windows clients can kill the daemon on some systems.
The second major problem is the "opportunistic locking" requested by some clients. If a client requests opportunistic locking then it is 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 allowed by anyone else who tries to use the file at the same time. If DENY_READ is placed on the file, for example, then any attempt to open the file for reading should fail.
Unix has no equivalent notion. To implement this Samba uses either lock files based on the files inode and placed in a separate lock 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 within the one process. On some unixes (such as SCO) this is not possible. This means that on those unixes the client is restricted to 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 socket for listening on port numbers less than 1000.
Most PC based SMB clients (such as WfWg and WinNT) don't follow this convention completely. The main culprit is the netbios nameserving on udp port 137. Name query requests come from a source port of 137. This is a problem when you combine it with the common firewalling technique of not allowing incoming packets on low port numbers. This means that these clients can't query a netbios nameserver on the other side of a low port based firewall.
The problem is more severe with netbios node status queries. I've found that WfWg, Win95 and WinNT3.5 all respond to netbios node status queries on port 137 no matter what the source port was in the request. This works between machines that are both using port 137, but it means it's not possible for a unix user to do a node status request 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 protocol to "externalise" the new capabilities.
This means the protocol is very "rich", offering many ways of doing each file operation. This means SMB servers need to be complex and large. It also means it is very difficult to make them bug free. It is not just Samba that suffers from this problem, other servers such as WinNT don't support every variation of every call and it has almost certainly been a headache for MS developers to support the myriad of SMB calls that are available.
There are about 65 "top level" operations in the SMB protocol (things like SMBread and SMBwrite). Some of these include hundreds of sub-functions (SMBtrans has at least 120 sub-functions, like DosPrintQAdd and NetSessionEnum). All of them take several options that can change the way they work. Many take dozens of possible "information levels" that change the structures that need to be returned. Samba supports all but 2 of the "top level" functions. It supports only 8 (so far) of the SMBtrans sub-functions. Even NT doesn't support them all.
Samba currently supports up to the "NT LM 0.12" protocol, which is the one preferred by Win95 and WinNT3.5. Luckily this protocol level has a "capabilities" field which specifies which super-duper new-fangled options the server suports. This helps to make the implementation of this protocol level much easier.
There is also a problem with the SMB specications. SMB is a X/Open spec, but the X/Open book is far from ideal, and fails to cover many important issues, leaving much to the imagination. Microsoft recently renamed the SMB protocol CIFS (Common Internet File System) and have published new specifications. These are far superior to the old X/Open documents but there are still undocumented calls and features. This specification is actively being worked on by a CIFS developers mailing list hosted by Microsft.
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.
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 username, password, select a domain and successfully log in. I would appreciate any feedback on your experiences with this process, and any comments, corrections and additions to this document.
The packets described here can be easily derived from (and are probably better understood using) Netmon.exe. You will need to use the version of Netmon that matches your system, in order to correctly decode the NETLOGON, lsarpc and srvsvc Transact pipes. This document is derived from NT Service Pack 1 and its corresponding version of Netmon. It is intended that an annotated packet trace be produced, which will likely be more instructive than this document.
Also needed, to fully implement NT Domain Login Services, is the document describing the cryptographic part of the NT authentication. 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 of this protocol is available from:
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:
HKLM\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters
Incorrect direct editing of the registry can cause your machine to fail. Then again, so can incorrect implementation of this protocol. See "Liability:" above.
Bear in mind that each packet over-the-wire will have its origin in an API call. Therefore, there are likely to be structures, enumerations and defines that are usefully documented elsewhere.
This document is by no means complete or authoritative. Missing sections include, but are not limited to:
Mappings of RIDs to usernames (and vice-versa).
What a User ID is and what a Group ID is.
The exact meaning/definition of various magic constants or enumerations.
The reply error code and use of that error code when a workstation becomes a member of a domain (to be described later). 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 |
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.
In the UDP NTLOGON Mailslots, some "Structures", described here, appear to be 2-byte aligned with the start of the mailslot, at their start.
Domain SID is of the format S-revision-version-auth1-auth2...authN. e.g S-1-5-123-456-789-123-456. the 5 could be a sub-revision.
any undocumented buffer pointers must be non-zero if the string buffer it refers to contains characters. exactly what value they should be is unknown. 0x0000 0002 seems to do the trick to indicate that the buffer exists. a NULL buffer pointer indicates that the string buffer is of zero length. If the buffer pointer is NULL, then it is suspected that the structure it refers to is NOT put into (or taken out of) the SMB data stream. This is empirically derived from, for example, the LSA SAM Logon response packet, where if the buffer pointer is NULL, the user information is not inserted into the data stream. Exactly what happens with an array of buffer pointers is not known, although an educated guess can be made.
an array of structures (a container) appears to have a count and a pointer. if the count is zero, the pointer is also zero. no further data is put 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
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
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 example. You can then perform an SMB Trans, and must carry out an SMBclose on the file handle once you are finished.
Trans Requests must be sent with two setup UINT16s, no UINT16 params (none known about), and UINT8 data parameters sufficient to contain the MSRPC header, and MSRPC data. The first UINT16 setup parameter must be either 0x0026 to indicate an RPC, or 0x0001 to indicate Set Named Pipe Handle state. The second UINT16 parameter must be the file handle for the pipe, obtained above.
The Data section for an API Command of 0x0026 (RPC pipe) in the Trans Request is the RPC Header, followed by the RPC Data. The Data section for an API Command of 0x0001 (Set Named Pipe Handle state) is two bytes. The only value seen for these two bytes is 0x00 0x43.
MSRPC Responses are sent as response data inside standard SMB Trans responses, with the MSRPC Header, MSRPC Data and MSRPC tail.
It is suspected that the Trans Requests will need to be at least 2-byte aligned (probably 4-byte). This is standard practice for SMBs. It is also independent of the observed 4-byte alignments with the start of the MSRPC header, including the 4-byte alignment between the MSRPC header and the MSRPC data.
First, an SMBtconX connection is made to the IPC$ share. The connection must be made using encrypted passwords, not clear-text. Then, an SMBopenX is made on the pipe. Then, a Set Named Pipe Handle State must be sent, after which the pipe is ready to accept API commands. Lastly, and SMBclose is sent.
To be resolved:
lkcl/01nov97 there appear to be two additional bytes after the null-terminated \PIPE\ name for the RPC pipe. Values seen so far are 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
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
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.
Note: The RPC_ResBind SMB Transact request is sent with two uint16 setup parameters. The first is 0x0026; the second is the file handle 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.
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.
if (valid_user)
{
UINT16 3 - switch value indicating USER_INFO structure.
VOID* non-zero - pointer to USER_INFO structure
USER_INFO user logon information
UINT32 1 - Authoritative response; 0 - Non-Auth?
return 0 - indicates success
}
else
{
UINT16 0 - switch value. value to indicate no user presumed.
VOID* 0x0000 0000 - indicates no USER_INFO structure.
UINT32 1 - Authoritative response; 0 - Non-Auth?
return 0xC000 0064 - NT_STATUS_NO_SUCH_USER.
}
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) == 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
C->S ReqChal,Cc S->C Cs
C & S compute session key Ks = E(PW[9..15],E(PW[0..6],Add(Cc,Cs)))
C: Rc = Cred(Ks,Cc) C->S Authenticate,Rc S: Rs = Cred(Ks,Cs), assert(Rc == Cred(Ks,Cc)) S->C Rs C: assert(Rs == Cred(Ks,Cs))
On joining the domain the client will optionally attempt to change its password and the domain controller may refuse to update it depending on registry settings. This will also occur weekly afterwards.
C: Tc = Time(), Rc' = Cred(Ks,Rc+Tc) C->S ServerPasswordSet,Rc',Tc,arc4(Ks[0..7,16],lmowf(randompassword()) C: Rc = Cred(Ks,Rc+Tc+1) S: assert(Rc' == Cred(Ks,Rc+Tc)), Ts = Time() S: Rs' = Cred(Ks,Rs+Tc+1) S->C Rs',Ts C: assert(Rs' == Cred(Ks,Rs+Tc+1)) S: Rs = Rs'
User: U with password P wishes to login to the domain (incidental data such as workstation and domain omitted)
C: Tc = Time(), Rc' = Cred(Ks,Rc+Tc) C->S NetLogonSamLogon,Rc',Tc,U,arc4(Ks[0..7,16],16,ntowf(P),16), arc4(Ks[0..7,16],16,lmowf(P),16) S: assert(Rc' == Cred(Ks,Rc+Tc)) assert(passwords match those in SAM) 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 key to encrypt NT and LM one way functions of passwords which are password equivalents. Any user who logs in before the machine has been rebooted a second time will have their password equivalent exposed. Of course the new machine password is exposed at this time anyway.
None of the returned user info such as logon script, profile path and SIDs *appear* to be protected by anything other than the TCP checksum.
The server time stamps appear to be ignored.
The client sends a ReturnAuthenticator in the SamLogon request which I can't find a use for. However its time is used as the timestamp 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
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
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 and the constraints imposed by the very messy SMB and CIFS protocol.
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.
The short version is that smbd is not multithreaded, and alternative servers that take this approach under Unix (such as Syntax, at the time of writing) suffer tremendous performance penalties and are less robust. nmbd is not threaded either, but this is because it is not possible to do it while keeping code consistent and portable across 35 or more platforms. (This drawback also applies to threading smbd.)
The longer versions is that there are very good reasons for not making 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 must care about all variables if they have to be thread specific (currently they would be global).
if one thread dies (eg. a seg fault) then all threads die. We can immediately throw robustness out the window.
many of the system calls we make are blocking. Non-blocking equivalents of many calls are either not available or are awkward (and slow) to use. So while we block in one thread all clients are waiting. Imagine if one share is a slow NFS filesystem and the others are fast, we will end up slowing all clients to the speed of NFS.
you can't run as a different uid in different threads. This means we would have to switch uid/gid on _every_ SMB packet. It would be horrendously slow.
the per process file descriptor limit would mean that we could only support a limited number of clients.
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 ansi-C constructs (using setjmp and longjmp). Unfortunately some OSes defeat this by restricting longjmp to calling addresses that are shallower than the current address on the stack (apparently AIX does this). This makes a truly portable threads library impossible. So to support all our current platforms we would have to code nmbd both with and without threads, and as the real aim of threads is to make the code clearer we would not have gained anything. (it is a myth that threads make things faster. threading is like recursion, it can make things clear but the same thing can always be done faster by some other method)
Chris tried to spec out a general design that would abstract threading vs separate processes (vs other methods?) and make them accessible through some general API. This doesn't work because of the data sharing requirements of the protocol (packets in the future depending on packets now, etc.) At least, the code would work but would be very clumsy, and besides the fork() type model would never work on Unix. (Is there an OS that it would work on, for nmbd?)
A fork() is cheap, but not nearly cheap enough to do on every UDP 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 queuing system that keeps state information on each packet. The first version used a single structure which was used by all the pending states. As the initialisation of this structure was done by adding arguments, as the functionality developed, it got pretty messy. So, it was replaced with a higher-order function and a pointer to a user-defined memory block. This suddenly made things much simpler: large numbers of functions could be made static, and modularised. This is the same principle as used in NT's kernel, and achieves the same effect as threads, but in a single process.
Then Jeremy rewrote nmbd. The packet data in nmbd isn't what's on the wire. It's a nice format that is very amenable to processing but still 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
The syntax of a debugging log file is represented as:
>debugfile< :== { >debugmsg< }
>debugmsg< :== >debughdr< '\n' >debugtext<
>debughdr< :== '[' TIME ',' LEVEL ']' FILE ':' [FUNCTION] '(' LINE ')'
>debugtext< :== { >debugline< }
>debugline< :== TEXT '\n'
TEXT is a string of characters excluding the newline character.
LEVEL is the DEBUG level of the message (an integer in the range 0..10).
TIME is a timestamp.
FILE is the name of the file from which the debug message was generated.
FUNCTION is the function from which the debug message was generated.
LINE is the line number of the debug statement that generated the message.
Basically, what that all means is:
A debugging log file is made up of debug messages.
Each debug message is made up of a header and tiv>
Originally Andrew used recursion to simulate a multi-threaded
environment, which use the stack enormously>The s librBUGLVL() Macro
FUt vee clwhatf()
="id25imposescape(P),16server time /av>qua class="sf the c/div>
w { >>
FUabov wexa, thenot nearlng it methould; :== '[' TIME ',' LEVEL ']' FILE ': [/dt>/07/30 16:00:51, 0]fivindc:This is (128) 9104">ata in na "parthe name.p> TIME is ort. civ clasGLVL() M if onssect2"sxt()
<.== { >lass=" up ofivins/a>Rd249d t, the ca ="id25imposbent an tries toflushinfowire /p>file frothe n
Originally Andrew used recursion to simulate a multi-threaded environment, which use the stack enormously3>
It's Functions >% \n",
"id2499104">cket,sf the _mynumb,tsubrec langsubnm"_numb,t),16 lang),16_p> ));p>
TIME is ing=e
d24999plass=iar but tbreaksword/b>0title"GLVL() Mormaunctions,
asassforms: :== '[' TIME ',' LEVEL ']' FILE ':GLVL() 3, ( "stns_l> >% \n",t),16 lang),16_p> ) );p>
TIME is Aeadsila smbd.)is sp> >% \n",t),16 lang),16_p> );
9104}p>
TIME is('s F/span> f a oo chn
immediatoff one three
firaring rds.
nt rbehe
wir>dPkes it ide on-the-
nt rrequa cla
s="sf the cext()
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test t4iversal >
Intel byte ordered additt() Table ovidnts
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test tacros>< byteorder.h
Originally Andrew used recursion to simulate a multi-threaded
environment, which use the stack enormouslyd2500
It's F>CVAL(buf,pos)
ntlyr_aakinsrvlyr_as altciv classkont_/kosh_MThis is sa >ive
servers tonaliis sudde.t div>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test t7gfile<>PVAL(buf,pos)"titlepa>
Intel byte ordered additt()buf,p> Intel byte ordered additt()b7 Archites) Intel byte ordered additt()b with a S,pos,val) Intel byte ordered additt()802">
ItI,pos,val) Intel byte ordered additt()82500
It,val)ER_INFO_1
structure, in the LSA SAMear tos>d by/div>< Intel byte ordered additt()826">
ItI,po)ER_INFO_1
structure, in the LSA SAMear tos>d by/div>< Intel byte ordered additt()838> Intel byte ordered additt()>SIVAsal 0I34">LAN Manager SaER_INFO_1
structure, in the LSA SAMtigs>d byunally dh32 bi Intel byte ordered additt()>62> Intel byte ordered additt()>73VAsal 0I34"S>LAN Manager SaER_INFO_1
structure, in the LSA SAMtigs>d byolly dh32 bi Intel byte ordered additt()>8file<RS,pos,val) Intel byte ordered additt()89f,p> Intel byte ordered additt()#id25e<RS934">LAN Manager SaER_INFO_1
structure, in the LSA SAMtigs>d by/div>< Intel byte ordered additt()#LAN Manager SaER_INFO_1
structure, in the LSA SAMtigs>d by/div><
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test tut are quturn value Intel byte ordered additt( href=e<R#CodingSuggesER_INFO_1
structure, in the LSA SAM e"acear to b keser tabl)(e prinmatocs likeser), not multiogdle is an>e all mea ha sCodinork(en
chievwdiv> sch askeser tab/h4>st"S34">rlaser,2)"eene xtheah16 bi ear to b uct" >ent anine thastorrnt of>ear to b uct" retty mestmeme /av> v/rdikeser tab/( triesh4>st"S34">rlaser,4)" M retng it methto
tru>g="en"> TableStdt>nts TableSimonts Tableote itnts TableTimnts TableMassnnnts looset rre Basicsformppornt =ode wcgeo on"ing asny agsh
Thenuseli> fcoex']'o>nesto f cltn>uname f DATA_BLOB both"length specifiedppos)-dct"mh an tdvTre
w> fryppickurrha repGoxy>Chris Herte3
pley Lto.h)r an tncyref="#id2500502">dvwhg=h a thpafethPVAL(bwden>unRd/p FIsaMBso(seeMpos)dve /avUp>ork()earlice.6owe
f void s rndiposy any/p>
mbddffe gaotilllpg it methtringthef shgoaposto4are igtt>ple cltuniqup>reswdivi im
f/p>i ad>
fivxty anypat mm>mbdre-set:cit ubefor
ylinypat mmis>ive
svnmeef="#it>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test 1842">ntdtA>)
earlently rie=dnc="0/p>umme c="Sds, b ntly thtr">td>Transpaas="tloadiposof>rearottusedpef=edtmodules (noo
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test 188a he<Loadiposmodulesnshat used only
ansi-C constructs (usiSon'tsubrhis swiielh>ndict paseMed/p>ndic fryp
dthe otp.arotst adhs>r-itseof. Fs=">xa, ths
s="ssa sdbasubrhis sthas: h :== '[' TIME ',' LEVEL ']' FILE NTSTATUSismb_eag c>r_sa sdb(pri(le ans fortot
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test a965">sal Writiposmodulesnshat used only
ansi-C constructs (usiort. modulenhowf
o"in
and asa is boall mea. Fs="modules current =
nonameed , andp>pubrhis sivi>_ Intel byte ordered additt(2016lesal 0tarot/Sef=edtseoes is tuf,
onfigmes.nnntER_INFO_1
structure, in the LSA SAM Son'tmPVAL(buf,
onfigmes.nnd> BasYli>hthreare
s
Anmirgin-left: 0.5in; mirgin-r sta: 0.5in;" Intel byte oe /antER_Iis Traustthingnthela makestam
onfigmes.nndcgmmuseptiv ?: aMB_MODULE_PROVIVES(). Treadhe- was fs="modules curreeag c>r-less
, b thvardiv cd
in Ns usedpubres curre
. Thnec)ssshall sauggirhis stlass imtoringcd. All"modules curresh
Then
ryppuilt ="sd
iaultnhreads mb>
class="author">Chris Hertep><">>10. TineUpcgm FIsaAM Shis s><"> November 1997
Tableote itnts
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test 21SIVAchiteecurs
deiot muc'>CVAaAM') Basics=">xa, ths ws ofn a frypNULL<(at:cis- was s mtformlbmkome/exve gabe
utt eccnmbdsok eccnmbdd
alredkestas p anuggiaCL, fs="Rd24apospletpacpeeccnmbdseent.rver.
douniq/s us
. Thohandarde fo claildwe)>nt rhreadone douniq,
keepmethtrsitehs eccnmbd Howmposisedo d ="sle" aAM moduled anTinere t ingthef s
do d 'abov 'sle" infube"#e)es)ustehs ea t t eccnmbd Howmposisef shher.h
: ="sle" infube"#e)etseof)is
iv class="sdint as="tearle>???ing as ingare
rikadon/llFs=">xa, ths on
ADS, yli> f shsetaa>Rd24s i: e/taba lan-SSLninen"id249/llOhe o
ed/p>ndich4> wholgiaCL
issusclass="snem /avis>xa, tha-rbind
asathats usesirecthe)rver.
<',o triestformi
s="s'rm"'torma'se"'tr. Wines pleear to 'ACCESS_DENIED'Mfth"tl//pwycurr
bustf shabletde bepearrievl>
Andrew tried to write a test 22ter">
Andrew tried to write a test 2283">>CVAaAM) Basiing="en"> Basicsh"tl/a,kseeMwurreI'vepdo d hatrpc_is
Andrew tried to write a test 234er"e<Layt>s> Intel byte ordered additt(2346lentdtAprlice.6ownsER_INFO_1
structure, in the LSA SAM e"a in n>obustsmbd,hoamresttormawurrowirt>nd-s useeait cn>??? >et>/vl
or-pdbedi> Intel byte ordered additt(235 Ar> Intel byte ordered additt(2382Ar>ap
lice.6owsdirecthe,a"nl"sbe
utt Intel byte ordered additt(2406le><_sa sdbnsER_INFO_1
structure, in the LSA SAM INFSed. i sauggrads mb> Intel byte ordered additt(2426">><_adsnsER_INFO_1
structure, in the LSA SAM e"a in nonevionali f cltnAM modulel)ustnes<
mdivc>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test 2451Ar>n valueord ) '>CVAaAM'tddt>a 'choka>e pri'/llis >ahlo eof
dffe gat>ple cltdiv>asubrhis stlasehs
we.nowirt'acc on??i ' fs=g s
tocamHowafs="contced24s i:s,emi="cs
snestriid2499etc/lli infurmathatSAM
tocbThnlintens>isn'tca24999erver.
<_up/a><_acl"en")sle" infub250
detailic. Thaby sfuwas.>fort. o dlos) s="orspavoid viox#id250 aCLhmanipula is ctlellalidoplookups bacurr SIDhref="#iiv cliablelist">
s would be ideal, but gets sunk by portability requirements.
s would be ideal, but gets sunk by portability requirements.
s would be ideal, but gets sunk by portability requirements.
BasI th<_enum_acl"en"s(ortot SAM_CONTEXT *ore ext fortot
NT_USER_TOKENt*acle="_tok
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test 2525">>w>en=yppiec)the (oftwarb,tandoa>thetertan ln no
exlepnis ctIniextagnmethtrsit>CVAthbrhis s, wet>/vltrikan class="author">Chris Herterpc-klu/sp">>11. RPCtPtumb OcroModulesns"> November 1997 Tableotv>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a test 2662>s would be ideal, but gets sunk by portability requirements.
Andrew tried to write a ted252662><77">G
class="author">Chris H1160vsp">> November 1997
Tall/amyp e itnts
TSt="sne itnts
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a tid252825">>9leTcltn>
Intel byte ordered addiCod2825">>9leTcltg
Intel byte ordered addiCod2925">52f=P is thaVFSoopn"ing a>laytesnsER_INFO_1 structure, in the LSA SAM e"ultnwdiareiv>so was ="s fuwmetha()n->r-less
itime e o krov neanarely hise6ow lais v>so .h Tor-eal/p>pn"i. ta) :== '[' TIME ',' LEVEL ']' F32p*aam s><_ _116_op_6ow la{ ?: th_LAYER_NOOP = -1, /* -n N. xt fuwilt
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t="ch3025">>9leTcltI fubas is tbetwrnet cltn>
Intel byte ordered add>Cod3025">3f="In
and azing ar mbdreg cra iesnsER_INFO_1
structure, in the LSA As Tor-e cltn>nAM modut/v
ta)
:== '[' TIME ',' LEVEL ']' ILE NTSTA116_Fs=">xaldap_in
a(v;t);p>
TIM tha lall ifndtd hse">selSh/pnkallrk( andp>or
ta)
:== '[' TIME ',' LEVEL ']' ILE NTSTATUSiin
a_module(vot);p>
TIM tha lall ifndtd hawrnetpef cltuocolserver
ld achievsh
bet>pleortan lnhse">se tha lall iounietormathatmo.
G
medir4s i: iot tt>s<>
Intel byte ordered add>Cod3183">>3">HrmitlepModulesther.h
p aninen"id2499eaesnsER_INFO_1
structure, in the LSAs.>fo thaada lall cit asnonevioTr
yeser a oka>euioapospleg atuod 116_lesthe_s
onot.
ta)
:== '[' TIME ',' LEVEL ']' F32p*aam s
onott116_lesthe_s
onott{
s
onott116_lesthe_s
onott
pn"ing*/ maam#d i ?: th_OP? OP_OPEN(c()n, fniq-nurnets i:ode) \ ((c()n)-> TIM>3"> ?: th_LAYER_??? TRANSPAwg aboall myli ct ytiv cbixd.g atuosAg aboall r.h .>
pn"ing*/ maam#d i ?: th_NEXT_OPEN(lesthe, c()n, fniq-nurnets i:ode) \ ((lesthe)-> TIME v>ng cod
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t="ch3383">87">UpEVEdaposto4w, NCVAVFSoI fube"esnsEat used only ansi-C constructs (iablelist">
Intel byte ordered add>Cod3383">87">UpEVEdaposiable2.2.*>akin3.0aplhatmodulesnsER_INFO_1
structure, in the Lclass="term INFSgmazNTntlo thuy wo1disce glo
Add "116_lesthe_s
onott*lesthe, " asnonevioTr
yeser sas s m116hal/p>pn"iAg aboall r
e.g.oFs=">xalr anine(a()ninen"i_s
onott*c()n,ns fortot
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t="ch3883">23ssS m N /esnsEat used only ansi-C constructs (iablelist">
Intel byte ordered add>Cod3825">39leIarle>??? TRANSPARENTboall meesnsER_INFO_1 structure, in the LSA Aule(vatash"ttf aboall m/pwyos="o: fa ; :== '[' TIME ',' LEVEL ']' Fse">se ign>Fs=">xalraaqu(116_lesthe_s onott*lesthe, li>ui_s onott*fspnusdb(rdv { eas ear ?: th_NEXT_CLOSE(lesthe, fspnurdvoi} "s)p> TIME tl ede lortanormaada lallsADS, vlt*tan o.noa!wirhref="#iiv cliablelist">
Intel byte ordered add>C4d3825">39leIarle>??? OPAQUEboallss.esnsER_INFO_1 structure, in the LSA Iclaif wlteVconThenjthelearlejTtiettatspri(le filet onevd ia andp>ositopaQUEboall (F.g.o/pwyoa diskifreain fha lall vinm o/to .ag-onevopubrh) dtd htkVconThenjotl ede lif"sle a spec is boall s: clSA Iclaif wlteVconthelearlejTto499ups -onevopubrh>or somefth"tts="sdint aaposi9 .ksix onevopubrh. Mtru aseh inatADS, otl ede l
n>e116hal/p>pn"i!!!/ta)
:>
Fda lallsADS,r FSpurredidop/ a dffhievsh
betotl ede so wassomefth"tt/pwyos="o:
e.g.orms a l
alortanonevopubrh.
a ; :== '[' TIME ',' LEVEL ']' Fse">se ign>Fs=">xall
read(116_lesthe_s
onott*lesthe, a()ninen"i_s
onott*c()n,
sot class="author">Chris Hembdregy0vsp">> November 1997
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t3927">25">5lli>ddoiv cet se. W) nn
as="sdint aiv cet s: s: class="sect3"ibrhizgmazNTntlu thuy wooid disce gloNT4 (NT4 urreeaitronevo)lservf="#id25005TDB (Tcltn>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t=965">25">D499 mosdrettyse. W)
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t4034">25">Exs ex#il tl i fube" W)
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t4058">83">8ievutSeENTboall me W)
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t4106">83">Wtash"ttiv cet se. W) n>etime ninessbit..h
.> ???bla dffw trahypwd. .h
.>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t418d3825">Met>Mtug">ncl oo vi W) Mtutsstasict*tanmaiavorero was ="siv cet d. Whetwrnet>nd-t
isnonnishro xt fuwaa
ingicult n>fth"tt, t
t9t>Mt, iaydtooaqugdehignedpni sarrea di,twrea itiths wthdwurreeaitutssmaaqud.
2003 class="author">Chris H
ins ']' sp">> November 1997
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t4238">viCVLexict* Al mysise. W) Intel byte ordered add4314 c83">>esthhand63"Whasln cube"esnsER_INFO_1
structure, in the LSA Whasln cub ing, frero it a ytpot acsersirecognizgm was ="sisn cub()
fha lall (sea c32p*(3C)) exc'dtrvinmsplenew ab pot acser ('\n')
Tplenew ab is exclx so wradbey,itikro/aifiiswns'dempreIsso apoammforismn cubdtot acserri
t:.ref="#id250050Iol ix#ilwhasln cubde.(fiura pr
yeser ultnw "orkepb(pribl omde.(f>
ar
iFsc'dtle filecarrinmv eas earpot acsersi('\r'), a ytile<',o
.reireevned.s: clf="#id250050L
alh"ttdi,tormich"ttwhasln cub ingreevned aposireade di,tultnwd.Et:.ref="#i/oldiv> Intel byte ordered add4359 c83">>esthhand63"L#d
ior-less
lr. Wibyet c Tasd fliv csd> Intel byte ordered add4412a viCVL#d
ioxa, th: :== '[' TIME ',' LEVEL ']' F Tr
yrniq- = pr
yeser ultnw s
o ']A\
AAAA\
AAAAe.(f> ab ptlainul oo . "s)p>
TIM
ab ptlainul oo . "s)p>
TIMTpletan e matrumdulenc marlejlr. W ta)
:== '[' TIME ',' LEVEL ']' F Tr
yrniq- = pr
yeser ultnw s
o ']A\
;nc marlej\
AAAAe.(f>anc marle. "s)p>
TIMTptsstecomwd:ta)
:== '[' TIME ',' LEVEL ']' FTr
yrniq- = pr
yeser ultnw s
o ']AAAAA;nc marlejAAAAe.(f>anc marle. "s)p>
TIM
Oura me lall cnaldlj ab , eouniedpo a
n>
TIM.reireal asta)
:== '[' TIME ',' LEVEL ']' F [se lall read]F Tr
yrniq- = ultnw "s)p>
T>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t44od3383">2yavoxe. W) Intel byte ordered add455d3383">About Tr
ys.cviesnsER_INFO_1
structure, in the LSA TpleTr
shand63"t class="author">Chris Hsfos' sp">>WINVAVFSoIl msulesns"> November 1997
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t4594">83">WINVAFailotl vi W) n>etaggedngroup cit resp so negat velyeapospleniq- dt Mturedt st. Icla timeout occurs ths wdt Mt fuwaae a spec WINVAsl Oer,iif"slel Oer imamarkro it dt's.con
)p>tocd fur,i tytimeouts s stormabixd.sl Oer i>snesmWINVAgroup is r avoneo. Oec Mmarkro it
d
al, Tcltn> ipl rdopattampnanntr avoneiif"slel Oer vinmniq- mbdreg cra/ msolupn"iadt Miisw
vinm operiod Tas10 /inut W s: cl> class="author">Chris H
wenmrypt' sp">>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t4738">viCV>3">urredningtrk?vi W) n>eclirle r aninen"ir.h
.> 5>noabowaket,.it orrea 56 biti
DESwkeys,seachnile<',o ingv>so toltnmrypt t sachallenune8 wakei
ultnw,athrmhanda 24 wake ultnw knt's.it orma"resp fv"..h
.> sl Oer e sl Oer n n knt'tvo n tressmitoem ovg iv cbite.(fw-athuspin>i>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t4822>TviCV>9lesmb FIswd onevul W)
9lea h>dl>mksmb FIswd.shpan> h>>E ',' Liksnoout p, t t seTcltn>sS,rubtdibfDiory. Byoonevd i,sd flsmb FIswd oneva"or usedph , t:ta) : DEBUGtte">ncll/mUn@d/Ts .pri/smb FIswdig/sppadt>
9leown
l.ilethefDEBUGtte">ncll/mUn@d/Ts
.pri/.h/spn
dibfDiory hievsh
betg<"/to ud ', s stormap>dl>chmod 500 /usr/>ncll/mUn@d/Ts
.pripan> h>)o
.h
.> 9lethrmtt Tasd flsmb FIswd oneva"or(E shir. ncit bbetw
wrappedtcntc. Itlhievsh
appear
it hiserleitrper lr. e n
aifrlsmb FIswd onev.)"s)
:== '[' TIME ',' LEVEL ']' F>nd-ivin:uid:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
[Ac<_aclthuy ]:LCT-il"> FIt-change-time>
TIMAltievghlortanormand-ivinlang,l
idlang,l,
[]ndi,tti '[' TIMurseeaiG() ntltsp
FIt-change-timelangrse lallsAareisignspecant
astrareiedokro anai>snesmTcltn>adsto nd-tconayvclno npanw IN (nm
recomarldo.), editsd flg ab
xt fuwvi, s sturseeai tusatnevio11rpot acsersie.(f>
TIMIfnaif
areiaat sformbeyrsiconbey,t sesmb FIswd n>???bett
t sir Twtw
ianw INs,saif
maarwlteVconha-rlbeyrsiNO PASSWORD TUSi.agtane sov sy daanm
aWet>toltnt tyar.reviousdppanw IN wdl>smb FIswdign> h>>E ',' LimhenjbekG() Mrk(r anine eov sa
a h>dl>smbdign> h>>daeall as neanaussrve.(f>nodppanw IN. EnG() Mrpisd
wat>ddformi salr. e:ta)
: D h>dl>noabo
ianw INs = yesign> h>ta)
: eov sa[g Intel byte ordered add5105">25">Debuggh"ttdi,tormch"tThe DEBUG() Macro clas href="#id2wind sd-debug">18. F"odmormbeyful inthrmttall Tnve.nd sde. W) class="author">Chris Hsfod sd-debug">sp">>
This would be ideal, but gets sunk by portability requirements.
Andrew tried to write a t5384">viCVNetlogopWwabuggh"ttoutputvi W) class="author">Chris H
s
nL ']' sp">>Ps
nL ']AVFSoIl msulesns"> November 1997
Andrew tried to write a t5470' 83">FPs
nL ']AVFSoIfcub to VvriouspBack4us toa tG() Macrfha lall po
nLsrs>???b>tocmada lallso E s
fha lall p c58huy sAarei, frero il thefDEBUGtte">
Andrew tried to write a t554d3883">FPs
nL QuenweTDB's
ta W)
Andrew tried to write a t57263883">FChangeIDrs stClirle Cach ']rrlyPs
nLsrvInthrmttall
ta W)
Andrew tried to write a t57373383">
Wind sdoNT/2KyPs
nLsrvChange m ify
vi W) n beym wa Intel byte ordered add601d3883">Appet icdsThe DEBUG() Macro class="author">Chris HPv cag ']' sp">>20. m sndehnv cag>n(ul W)nd-thit annpanw IN g<",
end-'sdppanw IN..h
.>enevghlknt'ledgweTase thef
c58"o s) goreea
Andrew tried to write a t6045 cviCVV>n(le forls W)
Andrew tried to write a t6073">viCVModulesvi W)