SAMBA Developers Guide

Edited by

Jelmer R. Vernooij

Abstract

Last Update : Fri Oct 10 00: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

Attribution
I. The protocol
1. Definition of NetBIOS Protocol and Name Resolution Modes
NETBIOS
BROADCAST NetBIOS
NBNS NetBIOS
2. NetBIOS in a Unix World
Introduction
Usernames
File Ownership
Passwords
Locking
Deny Modes
Trapdoor UIDs
Port numbers
Protocol Complexity
3. NT Domain RPC's
Introduction
Sources
Credits
Notes and Structures
Notes
Enumerations
Structures
MSRPC over Transact Named Pipe
MSRPC Pipes
Header
Tail
RPC Bind / Bind Ack
NTLSA Transact Named Pipe
LSA Open Policy
LSA Query Info Policy
LSA Enumerate Trusted Domains
LSA Open Secret
LSA Close
LSA Lookup SIDS
LSA Lookup Names
NETLOGON rpc Transact Named Pipe
LSA Request Challenge
LSA Authenticate 2
LSA Server Password Set
LSA SAM Logon
LSA SAM Logoff
\\MAILSLOT\NET\NTLOGON
Query for PDC
SAM Logon
SRVSVC Transact Named Pipe
Net Share Enum
Net Server Get Info
Cryptographic side of NT Domain Authentication
Definitions
Protocol
Comments
SIDs and RIDs
Well-known SIDs
Well-known RIDS
II. Samba Basics
4. Samba Architecture
Introduction
Multithreading and Samba
Threading smbd
Threading nmbd
nbmd Design
5. The samba DEBUG system
New Output Syntax
The DEBUG() Macro
The DEBUGADD() Macro
The DEBUGLVL() Macro
New Functions
dbgtext()
dbghdr()
format_debug_text()
6. Samba Internals
Character Handling
The new functions
Macros in byteorder.h
CVAL(buf,pos)
PVAL(buf,pos)
SCVAL(buf,pos,val)
SVAL(buf,pos)
IVAL(buf,pos)
SVALS(buf,pos)
IVALS(buf,pos)
SSVAL(buf,pos,val)
SIVAL(buf,pos,val)
SSVALS(buf,pos,val)
SIVALS(buf,pos,val)
RSVAL(buf,pos)
RIVAL(buf,pos)
RSSVAL(buf,pos,val)
RSIVAL(buf,pos,val)
LAN Manager Samba API
Parameters
Return value
Code character table
7. Coding Suggestions
8. Contributing code
9. Modules
Advantages
Loading modules
Static modules
Shared modules
Writing modules
Static/Shared selection in configure.in
III. Samba Subsystems
10. RPC Pluggable Modules
About
General Overview
11. VFS Modules
The Samba (Posix) VFS layer
The general interface
Possible VFS operation layers
The Interaction between the Samba VFS subsystem and the modules
Initialization and registration
How the Modules handle per connection data
Upgrading to the New VFS Interface
Upgrading from 2.2.* and 3.0aplha modules
Some Notes
Implement TRANSPARENT functions
Implement OPAQUE functions
12. The registry subsystem
Planned backends
Data structures
External interface
Utility functions
Writing backends
Memory allocation
13. The smb.conf file
Lexical Analysis
Handling of Whitespace
Handling of Line Continuation
Line Continuation Quirks
Syntax
About params.c
14. Samba WINS Internals
WINS Failover
15. LanMan and NT Password Encryption
Introduction
How does it work?
The smbpasswd file
IV. Debugging and tracing
16. Tracing samba system calls
17. Finding useful information on windows
Netlogon debugging output
18. Samba Printing Internals
Abstract
Printing Interface to Various Back ends
Print Queue TDB's
ChangeID and Client Caching of Printer Information
Windows NT/2K Printer Change Notify
V. Appendices
19. Notes to packagers
Versioning
Modules