# ceph/samba architecture

> Architecture diagram of the GitHub repository ceph/samba, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ceph/samba
- Repository: https://github.com/ceph/samba

## Overview

Samba provides SMB/CIFS file and print serving, domain-controller and domain-member roles, a Unix-side SMB client, and NetBIOS naming services. A common workflow is an SMB client requesting a share operation, the server handling it, and file or print services returning the result; domain authentication and directory services support the broader server roles. The graph also preserves the documented client, naming, and clustering branches. Relationships for unsampled subsystems are included only where the README documents the capability; source excerpts do not expose their full runtime wiring.

Main entry points: [`source3/smbd/server.c`](https://github.com/ceph/samba/blob/ceph/source3/smbd/server.c) (SMB server), [`source3/client/client.c`](https://github.com/ceph/samba/blob/ceph/source3/client/client.c) (SMB command client), [`source4/smbd/server.c`](https://github.com/ceph/samba/blob/ceph/source4/smbd/server.c) (AD domain controller), [`auth/gensec/gensec.c`](https://github.com/ceph/samba/blob/ceph/auth/gensec/gensec.c) (Security negotiation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_smb["SMB services"]
  node_smbd["SMB server<br/>[server.c]"]
  node_file_services["File and print<br/>[file_server.c]"]
  node_smb_client["SMB command client<br/>[client.c]"]
  node_smb_protocol["SMB protocol<br/>[smbXcli_base.c]"]
end

subgraph group_identity["Identity services"]
  node_gensec["Security negotiation<br/>[gensec.c]"]
  node_ntlmssp["NTLM authentication<br/>[ntlmssp.c]"]
  node_auth_service["AD authentication"]
  node_winbind["Domain integration<br/>[wb_queryuser.c]"]
end

subgraph group_directory["Directory and DNS"]
  node_ad_dc["AD domain controller<br/>[server.c]"]
  node_directory_db[("Directory database<br/>[samdb.h]")]
  node_dns_server["DNS service<br/>[dns_query.c]"]
  node_dns_client["DNS queries<br/>[dnsquery.c]"]
end

subgraph group_network["Network naming"]
  node_netbios_server["NetBIOS nameserver<br/>[query.c]"]
  node_netbios_lookup["Name lookup<br/>[namequery.c]"]
end

subgraph group_cluster["Cluster support"]
  node_ctdb_client["CTDB client<br/>[ctdb_client.c]"]
  node_ctdb_daemon["Cluster daemon<br/>[ctdbd.c]"]
end

node_smb_clients(("SMB clients"))
node_smb_resources(("Shared resources"))
node_domain_admin(("Domain administrator"))

node_smb_clients -->|"requests shares"| node_smbd
node_smbd -->|"serves files"| node_file_services
node_smbd -->|"provides file and print access"| node_smb_resources
node_smb_client -->|"accesses remote resources"| node_smb_resources
node_smb_client -->|"uses SMB"| node_smb_protocol
node_smbd -.->|"negotiates security"| node_gensec
node_gensec -.->|"supports authentication"| node_ntlmssp
node_ad_dc -.->|"provides authentication"| node_auth_service
node_ad_dc -.->|"uses directory data"| node_directory_db
node_domain_admin -->|"administers domain"| node_ad_dc
node_ad_dc -.->|"provides DNS"| node_dns_server
node_smbd -->|"joins domains"| node_winbind
node_smb_client -.->|"resolves names"| node_dns_client
node_netbios_lookup -.->|"queries names"| node_netbios_server
node_smbd -->|"handles cluster events"| node_ctdb_client
node_ctdb_client -.->|"communicates with"| node_ctdb_daemon
node_smb_clients -->|"initiates access"| node_smb_client

click node_smbd "https://github.com/ceph/samba/blob/ceph/source3/smbd/server.c"
click node_file_services "https://github.com/ceph/samba/blob/ceph/file_server/file_server.c"
click node_smb_client "https://github.com/ceph/samba/blob/ceph/source3/client/client.c"
click node_smb_protocol "https://github.com/ceph/samba/blob/ceph/libcli/smb/smbXcli_base.c"
click node_gensec "https://github.com/ceph/samba/blob/ceph/auth/gensec/gensec.c"
click node_ntlmssp "https://github.com/ceph/samba/blob/ceph/auth/ntlmssp/ntlmssp.c"
click node_auth_service "https://github.com/ceph/samba/blob/ceph/source4/auth/ntlm/auth_server_service.c"
click node_winbind "https://github.com/ceph/samba/blob/ceph/source3/winbindd/wb_queryuser.c"
click node_ad_dc "https://github.com/ceph/samba/blob/ceph/source4/smbd/server.c"
click node_directory_db "https://github.com/ceph/samba/blob/ceph/source4/dsdb/samdb/samdb.h"
click node_dns_server "https://github.com/ceph/samba/blob/ceph/source4/dns_server/dns_query.c"
click node_dns_client "https://github.com/ceph/samba/blob/ceph/lib/addns/dnsquery.c"
click node_netbios_server "https://github.com/ceph/samba/blob/ceph/source4/nbt_server/query.c"
click node_netbios_lookup "https://github.com/ceph/samba/blob/ceph/source3/libsmb/namequery.c"
click node_ctdb_client "https://github.com/ceph/samba/blob/ceph/ctdb/client/ctdb_client.c"
click node_ctdb_daemon "https://github.com/ceph/samba/blob/ceph/ctdb/server/ctdbd.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_smbd,node_file_services,node_smb_client,node_smb_protocol,node_smb_clients toneBlue
class node_gensec,node_ntlmssp,node_auth_service,node_winbind toneAmber
class node_ad_dc,node_directory_db,node_dns_server,node_dns_client toneMint
class node_netbios_server,node_netbios_lookup toneRose
class node_ctdb_client,node_ctdb_daemon,node_smb_resources,node_domain_admin toneIndigo
```

## Components

### SMB services

- [SMB server](https://github.com/ceph/samba/blob/ceph/source3/smbd/server.c): `source3/smbd/server.c`
- [File and print](https://github.com/ceph/samba/blob/ceph/file_server/file_server.c): `file_server/file_server.c`
- [SMB command client](https://github.com/ceph/samba/blob/ceph/source3/client/client.c): `source3/client/client.c`
- [SMB protocol](https://github.com/ceph/samba/blob/ceph/libcli/smb/smbXcli_base.c): `libcli/smb/smbXcli_base.c`

### Identity services

- [Security negotiation](https://github.com/ceph/samba/blob/ceph/auth/gensec/gensec.c): `auth/gensec/gensec.c`
- [NTLM authentication](https://github.com/ceph/samba/blob/ceph/auth/ntlmssp/ntlmssp.c): `auth/ntlmssp/ntlmssp.c`
- [AD authentication](https://github.com/ceph/samba/blob/ceph/source4/auth/ntlm/auth_server_service.c): `source4/auth/ntlm/auth_server_service.c`
- [Domain integration](https://github.com/ceph/samba/blob/ceph/source3/winbindd/wb_queryuser.c): `source3/winbindd/wb_queryuser.c`

### Directory and DNS

- [AD domain controller](https://github.com/ceph/samba/blob/ceph/source4/smbd/server.c): `source4/smbd/server.c`
- [Directory database](https://github.com/ceph/samba/blob/ceph/source4/dsdb/samdb/samdb.h): `source4/dsdb/samdb/samdb.h`
- [DNS service](https://github.com/ceph/samba/blob/ceph/source4/dns_server/dns_query.c): `source4/dns_server/dns_query.c`
- [DNS queries](https://github.com/ceph/samba/blob/ceph/lib/addns/dnsquery.c): `lib/addns/dnsquery.c`

### Network naming

- [NetBIOS nameserver](https://github.com/ceph/samba/blob/ceph/source4/nbt_server/query.c): `source4/nbt_server/query.c`
- [Name lookup](https://github.com/ceph/samba/blob/ceph/source3/libsmb/namequery.c): `source3/libsmb/namequery.c`

### Cluster support

- [CTDB client](https://github.com/ceph/samba/blob/ceph/ctdb/client/ctdb_client.c): `ctdb/client/ctdb_client.c`
- [Cluster daemon](https://github.com/ceph/samba/blob/ceph/ctdb/server/ctdbd.c): `ctdb/server/ctdbd.c`

### Other components

- **SMB clients**
- **Shared resources**
- **Domain administrator**

## Connections

- SMB clients → SMB server: requests shares (evidence: `README`)
- SMB server → File and print: serves files (evidence: `README`)
- SMB server → Shared resources: provides file and print access (evidence: `README`)
- SMB command client → Shared resources: accesses remote resources (evidence: `README`)
- SMB command client → SMB protocol: uses SMB (evidence: `source3/client/client.c`)
- SMB server → Security negotiation: negotiates security
- Security negotiation → NTLM authentication: supports authentication
- AD domain controller → AD authentication: provides authentication
- AD domain controller → Directory database: uses directory data (evidence: `source4/smbd/server.c`)
- Domain administrator → AD domain controller: administers domain (evidence: `README`)
- AD domain controller → DNS service: provides DNS
- SMB server → Domain integration: joins domains (evidence: `README`)
- SMB command client → DNS queries: resolves names
- Name lookup → NetBIOS nameserver: queries names
- SMB server → CTDB client: handles cluster events (evidence: `source3/smbd/server.c`)
- CTDB client → Cluster daemon: communicates with
- SMB clients → SMB command client: initiates access (evidence: `README`)
