108.2. samba-4.24.7
SMB/CIFS file and print server and client tools
| Version | 4.24.7, release 3 |
| Shelf | servers — Daemons that serve other machines: remote shell, web, mail, XMPP, IRC, CalDAV/CardDAV, SMB and DLNA |
| Phase | 41_system (System), 584 of 1047 in build order |
| Licence | GPL-3.0-or-later AND LGPL-3.0-or-later |
| Homepage | https://www.samba.org/ |
| Build time | 11.9 SBU |
| Installed size | 92.2 MiB in 1610 files |
| Recipe | ports/core/servers/samba/kpkgbuild |
About
Samba implements SMB, the file- and printer-sharing protocol of Windows. In KDOS it is built as a file and print server, smbd, with the client tools and libraries: smbclient, libsmbclient, which gvfs, kodi and vlc use to open smb:// addresses, and ntlm_auth, which libsoup3 tries for NTLM sign-on. A Windows laptop, a phone or a network printer often speaks SMB and nothing else. The Active Directory domain controller, domain membership and winbind are not built.
The package carries a service script, 83_samba, that runs smbd under the supervisor only once some account can share, so a machine where nobody shares listens on nothing. At each start it works through these steps:
- It skips itself while
/etc/samba/smb.confis missing or empty. - It creates
/var/log/sambaand/var/cache/samba.smbdnever makes its log directory, and without it writes nothing but the supervisor’s log;testparmreports a missing cache directory as an error untilsmbdhas first written there. - It creates
/var/lib/samba/usershares, owned by root with groupsambashareand mode 1770. This is theusershare paththatsmb.confnames and thatnet usershare(Dolphin’s Share tab) writes into. A package cannot carry that mode, and without the directory every share fails, so it is made at every start whether or notsmbdthen runs. - It starts
smbdif any one of these holds, and otherwise prints[SKIP] samba: no account shares folders:- the
sambasharegroup has a member in/etc/group; - the usershare directory holds a share: a regular file, not a symbolic link (
smbdrefuses one), whose name does not begin with:(net usersharewrites each share through a:tmpfile it then renames); smb.confhas a section other than[global].
- the
A group member is enough on its own because no share can be made while smbd is down: net usershare add turns every name in a share’s access list, Dolphin’s Everyone among them, into a security identifier (SID) by asking the local smbd (source3/utils/net_usershare.c), and fails when there is none to ask. An account that Dolphin’s Share tab has just added to the group starts the server without a reboot: at that account’s next login kded-kdos asks kdos-powerd to run this script’s start.
The script passes supervise --stop-grace 15, so on a stop smbd has fifteen seconds to end its per-client children and close their open files before the supervisor sends SIGKILL; the default is five. Other machines reach the server once the firewall’s smb name is opened (see Opening a service).
Sources
samba-4.24.7.tar.gz(41.4 MiB)
sha25645b7747a47452eff2b2159a44cc63eb43690d339fd1069088e023a015fed06c7
upstream: https://download.samba.org/pub/samba/stable/samba-4.24.7.tar.gz
archive copy: sources-4/servers--samba-4.24.7.tar.gz
Dependencies
Depends on: python3, perl, pkgconf, gnutls, libtasn1, zlib, jansson, readline, popt, libarchive, icu, ncurses, e2fsprogs, util-linux, libtirpc, rpcsvc-proto, perl-parse-yapp, libxslt, docbook-xsl, docbook-xml, acl, avahi, liburing, libcap, libbsd, cups, libunwind-nongnu, talloc, tdb, tevent.
Required by (6): gvfs, kdenetwork-filesharing, kio-extras, kodi, libsoup3, vlc.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
Patches
build.sh applies these; kpkg applies nothing by itself.
musl-netlink.patch— Insource3/wscript, the two compile tests for Linux netlink and rtnetlink include<sys/socket.h>instead of<bits/sockaddr.h>, and each supplies its ownmain()withaddmain=False, so the headers are included at file scope rather than inside themain()waf otherwise wraps around the test.<bits/sockaddr.h>is a glibc header that musl does not have, so on musl both unpatched tests fail and Samba builds withoutHAVE_LINUX_RTNETLINK_H, whichsource3/lib/addrchange.cneeds to follow changes to the machine’s addresses over netlink.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install samba'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/servers/samba.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/servers/samba
echo '45b7747a47452eff2b2159a44cc63eb43690d339fd1069088e023a015fed06c7 samba-4.24.7.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/samba
SRC=$SRC_ROOT/samba-4.24.7
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf samba-4.24.7.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/musl-netlink.patch"
export XSLTPROC="xsltproc --maxdepth 10000"
./configure \
--prefix=/usr \
--enable-fhs \
--sysconfdir=/etc \
--libdir=/usr/lib \
--localstatedir=/var \
--with-piddir=/run/samba \
--with-lockdir=/var/lib/samba/lock \
--with-privatedir=/var/lib/samba/private \
--with-logfilebase=/var/log/samba \
--bundled-libraries='!talloc,!tdb,!tevent,ALL' \
--without-ad-dc \
--without-ads \
--without-ldap \
--without-pam \
--without-systemd \
--without-winbind \
--with-acl-support \
--without-quotas \
--without-ldb-lmdb \
--with-libunwind \
--without-lttng \
--without-fam \
--without-dmapi \
--without-winexe \
--without-kernel-keyring \
--with-regedit \
--with-shared-modules='vfs_io_uring,!vfs_snapper' \
--disable-spotlight \
--disable-glusterfs \
--disable-cephfs \
--enable-cups \
--disable-iprint \
--enable-avahi \
--disable-rpath \
--disable-rpath-install \
--nopyc --nopyo
grep -q 'define HAVE_CUPS 1' bin/default/include/config.h || {
echo 'samba: libcups not found, printer shares would be missing' >&2
exit 1
}
grep -q 'define HAVE_LINUX_RTNETLINK_H 1' bin/default/include/config.h
make
make DESTDIR=$PKG install
rm -rf "$PKG/run" "$PKG/var/run"
install -d -m 755 "$PKG/var/lib/samba/lock"
PKG_CONFIG_PATH="$PKG/usr/lib/pkgconfig" pkg-config --exists ndr_standard samba-util smbclient
install -d "$PKG/etc/init.d"
cat > "$PKG/etc/init.d/83_samba.sh" <<'KDOS_SH'
#!/bin/bash
. /etc/init.d/service_helper
NAME="samba"
DAEMON="/usr/sbin/smbd"
USERSHARES="/var/lib/samba/usershares"
has_member() {
grep -Eq '^sambashare:[^:]*:[^:]*:[^:[:space:]]' /etc/group
}
has_shares() {
for f in "$USERSHARES"/*; do
case "${f##*/}" in :*) continue ;; esac
[ -f "$f" ] && [ ! -L "$f" ] && return 0
done
grep -Eiv '^[[:space:]]*\[global\]' /etc/samba/smb.conf |
grep -Eq '^[[:space:]]*\['
}
case "$1" in
start)
[ ! -x "$DAEMON" ] && { echo "[SKIP] $NAME: $DAEMON not found"; exit 0; }
if [ ! -s /etc/samba/smb.conf ]; then
echo "[SKIP] $NAME: no /etc/samba/smb.conf"
exit 0
fi
install -d -m 755 /var/log/samba /var/cache/samba
install -d -m 1770 -o root -g sambashare "$USERSHARES"
if ! has_member && ! has_shares; then
echo "[SKIP] $NAME: no account shares folders"
exit 0
fi
echo "[KDOS] Starting $NAME..."
supervise --stop-grace 15 "$NAME" "$DAEMON" --foreground --no-process-group
;;
stop) stop_service "$NAME" ;;
status) check_status "$NAME" ;;
*) echo "Usage: $0 {start|stop|status}"; exit 1 ;;
esac
KDOS_SH
chmod 755 "$PKG/etc/init.d/83_samba.sh"
The switches, and why each is set:
export XSLTPROC="xsltproc --maxdepth 10000"— The manual pages are built withxsltproc, andsmb.conf.5nests the DocBook templates deeper than libxslt’s default limit of 3000, so the task would stop on “potential infinite template recursion” with every binary already built. waf takesXSLTPROCfrom the environment and splits it as a command line, so the limit is raised here rather than in the source.--enable-fhs— Lay files out by the Filesystem Hierarchy Standard. Samba refuses--prefix=/usrwithout it (“Don’t install directly under /usr or /usr/local without using the FHS option”), and its own layout would put everything under/usr/private,/usr/varand the like.--with-piddir=/run/samba,--with-privatedir=/var/lib/samba/private,--with-logfilebase=/var/log/samba— Where Samba keeps its PID files, its private databases (the password database and secrets) and its logs.--with-lockdir=/var/lib/samba/lock— Samba’s lock directory, which the package carries, root’s and mode 0755. The FHS default,/var/lock/samba, is in the world-writable/run/lock, so any Samba client run beforesmbd,net usersharefrom Dolphin’s Share tab among them, makes it and itsmsg.lockdirectory as its own user;smbdrefuses amsg.lockthat is not root’s (messaging_init_internalinsource3/lib/messages.c) and exits at every start. In a directory only root can write to, a client makes nothing and still works.smbdopens the lock databases withTDB_CLEAR_IF_FIRST, so their contents do not outlive the server, and a directory on the disk rather than a tmpfs is safe across a reboot.--bundled-libraries='!talloc,!tdb,!tevent,ALL'— Take talloc, tdb and tevent from their ports (talloc, tdb, tevent) and build every other library Samba carries (ldb among them, which is not a port) from its own copy. Named outright, a missing system library is a configure error and not a quiet switch to the bundled copy.--without-ad-dc— Build no Active Directory domain controller. What remains is the file server, the client tools and the libraries.--without-ldb-lmdb— Build ldb without its LMDB backend, which exists for the domain controller’s database. Samba does not drop it on its own: without the switch it stops with “ldb build (unless –without-ldb-lmdb) requires lmdb 0.9.16 or later”.--without-ads,--without-ldap— No Active Directory membership, and no LDAP, which in Samba serves the domain-member andldapsamaccount backends; openldap being in the build root must not switch them on.--without-winbind— Build nowinbindd.ntlm_authstill installs, but it signs on only from winbindd’s cached credentials, so libsoup’s attempt with it fails and libsoup answers NTLM itself (see Networking).--without-pam— Build without PAM: nopam_winbindmodule (winbind is not built either) and no PAM account and session checks insmbd, whoseobey pam restrictionssetting then has nothing to call. SMB clients are still checked against Samba’s own password database, whichsmbpasswdwrites.--without-systemd— No systemd notification or units; KDOS has no systemd (see No systemd).--with-acl-support— POSIX ACL support, through acl. Without it a Windows client cannot change a file’s permissions, and its security tab is read-only.--without-quotas— No disk quota support.--with-libunwind— Samba’s crash backtraces. musl has noexecinfo.h(backtrace()is a glibc extension), so without libunwind the fault handler cannot print one, and configure stops rather than choose. The probe wantslibunwind-generic.pcandlibunwind.h, which come from libunwind-nongnu.--without-lttng,--without-fam,--without-dmapi,--without-winexe,--disable-glusterfs,--disable-cephfs— LTTng tracing, FAM file notification, DMAPI,winexe(which needs a MinGW cross compiler), GlusterFS and CephFS. None of these is a port, and each switch keeps Samba from deciding by what happens to be installed.--without-kernel-keyring— The kernel keyring stores Kerberos credentials, and there is no realm to join.--with-regedit— Buildsamba-regedit, the curses registry editor, on ncurses.--with-shared-modules='vfs_io_uring,!vfs_snapper'— Namevfs_io_uring, which Samba builds only when pkg-config finds liburing, so a missing liburing fails the build instead of leaving the module out silently. Strikevfs_snapper: it talks to snapperd over D-Bus, snapper is not a port, and left in the default list it makes D-Bus a configure-time requirement.--disable-spotlight— No Spotlight search; its one real backend queries an Elasticsearch server.--enable-cups— A[printers]share can offer Windows clients every queue the local cups has. waf answers a missing libcups by building without printing, so theconfig.hcheck after configure fails the build instead.--disable-iprint— No Novell iPrint, which uses the same library.--enable-avahi— Advertise shares over mDNS with avahi, so a file manager on another machine finds them without a typed address.--disable-rpath,--disable-rpath-install— The first leaves theRPATHout of the binaries in the build tree, the second leaves theRPATHto the library directory,/usr/lib, out of the installed files.--disable-rpath-private-installis not given, so installed files keep theirRPATHto Samba’s private libraries in/usr/lib/samba.--nopyc,--nopyo— Install no compiled Python bytecode for Samba’s Python modules.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/samba, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf samba-4.24.7-3.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/samba, and runs the triggers its paths call for.
Contents
Installed programs: cifsdd, dbwrap_tool, eventlogadm, gentest, ldbadd, ldbdel, ldbedit, ldbmodify, ldbrename, ldbsearch, locktest, masktest, mdsearch, mvxattr, ndrdump, net, nmbd, nmblookup, ntlm_auth, oLschema2ldif, pdbedit, profiles, regdiff, regpatch, regshell, regtree, rpcclient, samba-gpupdate, samba-log-parser, samba-regedit, sharesec, smbcacls, smbclient, smbcontrol, smbcquotas, smbd, smbget, smbpasswd, smbspool, smbstatus, smbtar, smbtorture, smbtree, testparm, wbinfo, wspsearch.
Installed libraries: libdcerpc-binding.so, libdcerpc-server-core.so, libndr-krb5pac.so, libndr-nbt.so, libndr-standard.so, libndr.so, libnetapi.so, libnss_winbind.so, libnss_wins.so, libsamba-errors.so, libsamba-passdb.so, libsamba-util.so, libsmbclient.so, libsmbconf.so, libwbclient.so.
Installed directories: /etc/samba, /usr/include/samba-4.0, /usr/lib/python3.14/site-packages/samba, /usr/lib/samba, /usr/libexec/samba, /usr/share/licenses/samba, /var/cache/samba, /var/lib/samba, /var/log/samba.
Short descriptions
cifsdd |
convert and copy a file over SMB |
dbwrap_tool |
low level TDB/CTDB manipulation tool using the dbwrap interface |
eventlogadm |
push records into the Samba event log store |
gentest |
Run random generic SMB operations against two SMB servers and show the differences in behavior |
ldbadd |
Command-line utility for adding records to an LDB |
ldbdel |
Command-line program for deleting LDB records |
ldbedit |
Edit LDB databases using your preferred editor |
ldbmodify |
Modify records in a LDB database |
ldbrename |
Edit LDB databases using your favorite editor |
ldbsearch |
Search for records in a LDB database |
locktest |
Find differences in locking between two SMB servers |
masktest |
Find differences in wildcard matching between Sambas implementation and that of a remote server. |
mdsearch |
Run Spotlight searches against an SMB server |
mvxattr |
Recursively rename extended attributes |
ndrdump |
DCE/RPC Packet Parser and Dumper |
net |
Tool for administration of Samba and remote CIFS servers. |
nmbd |
NetBIOS name server to provide NetBIOS over IP naming services to clients |
nmblookup |
NetBIOS over TCP/IP client used to lookup NetBIOS names |
ntlm_auth |
tool to allow external access to Winbinds NTLM authentication function |
oLschema2ldif |
Converts LDAP schemas to LDB-compatible LDIF |
pdbedit |
manage the SAM database (Database of Samba Users) |
profiles |
A utility to report and change SIDs in registry files |
regdiff |
Diff program for Windows registry files |
regpatch |
Applies registry patches to registry files |
regshell |
Windows registry file browser using readline |
regtree |
Text-mode registry viewer |
rpcclient |
tool for executing client side MS-RPC functions |
samba-gpupdate |
apply group policy |
samba-log-parser |
Samba (winbind) trace parser. options: -h, --help show this help message and exit --traceid ID specify the traceid of the trace records --pid PID specify the pid of winbind client --breakdown breakdown the traces into per traceid files --merge-by-timestamp merge logs by timestamp --flow show the request/sub-request flow traces --flow-compact show the request/sub-request flow traces without dcerpc details |
samba-regedit |
ncurses based tool to manage the Samba registry |
sharesec |
Set or get share ACLs |
smbcacls |
Set or get ACLs on an NT file or directory names |
smbclient |
ftp-like client to access SMB/CIFS resources on servers |
smbcontrol |
send messages to smbd, nmbd or winbindd processes |
smbcquotas |
Set or get QUOTAs of NTFS 5 shares |
smbd |
server to provide SMB/CIFS services to clients |
smbget |
wget-like utility for download files over SMB |
smbpasswd |
change a users SMB password |
smbspool |
send a print file to an SMB printer |
smbstatus |
report on current Samba connections |
smbtar |
shell script for backing up SMB/CIFS shares directly to UNIX tape drives |
smbtorture |
Run a series of tests against a SMB server |
smbtree |
A text based smb network browser |
testparm |
check an smb.conf configuration file for internal correctness |
wbinfo |
Query information from winbind daemon |
wspsearch |
Run Windows Search Protocol searches against a SMB server |
ndr.pc |
Network Data Representation Core Library |
ndr_krb5pac.pc |
NDR marshallers for the KRB5 PAC formats |
ndr_nbt.pc |
NDR marshallers for nbt formats |
ndr_standard.pc |
NDR marshallers for the standard set of DCE/RPC interfaces |
netapi.pc |
A library to control CIFS servers |
samba-util.pc |
Samba utility functions |
smbclient.pc |
A SMB library interface |
wbclient.pc |
Winbind client |
Notes
After configure, build.sh greps bin/default/include/config.h for HAVE_CUPS and for HAVE_LINUX_RTNETLINK_H, and stops when either is missing. The second is the proof that the patch took effect.
rm -rf "$PKG/run" "$PKG/var/run" drops the runtime directories the install creates; /run is a fresh tmpfs at every boot. The lock directory is installed with an explicit install -d -m 755, so its mode does not depend on the installer’s umask. The pkg-config --exists line fails the build unless the ndr_standard, samba-util and smbclient pkg-config files were installed, the ones the client library’s consumers build against.
Samba’s build system, waf, is Python run at build time, which is why python3 is in the depends of a C program, and it builds inside the source tree.