Merge remote-tracking branch 'origin/master' into staging
[jackhill/guix/guix.git] / gnu / packages / samba.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016, 2017, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
6 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
7 ;;; Copyright © 2017, 2018, 2020 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
10 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
11 ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
12 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages samba)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix licenses)
35 #:use-module (guix utils)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages acl)
38 #:use-module (gnu packages admin)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages backup)
41 #:use-module (gnu packages base)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages crypto)
44 #:use-module (gnu packages cups)
45 #:use-module (gnu packages databases)
46 #:use-module (gnu packages docbook)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages gnome)
49 #:use-module (gnu packages gnupg)
50 #:use-module (gnu packages kerberos)
51 #:use-module (gnu packages linux)
52 #:use-module (gnu packages onc-rpc)
53 #:use-module (gnu packages openldap)
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages pkg-config)
56 #:use-module (gnu packages popt)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages readline)
59 #:use-module (gnu packages time)
60 #:use-module (gnu packages tls)
61 #:use-module (gnu packages web)
62 #:use-module (gnu packages xml))
63
64 (define-public cifs-utils
65 (package
66 (name "cifs-utils")
67 (version "6.13")
68 (source
69 (origin
70 (method url-fetch)
71 (uri (string-append "https://download.samba.org/pub/linux-cifs/"
72 "cifs-utils/cifs-utils-" version ".tar.bz2"))
73 (sha256 (base32
74 "0mnhcc4ayj2vn2azhk45fnal1hibsv0q2c4ihkxcrjhkhrn7in23"))))
75 (build-system gnu-build-system)
76 (native-inputs
77 `(("autoconf" ,autoconf)
78 ("automake" ,automake)
79 ("pkg-config" ,pkg-config)))
80 (inputs
81 `(("keytuils" ,keyutils)
82 ("linux-pam" ,linux-pam)
83 ("libcap-ng" ,libcap-ng)
84 ("mit-krb5" ,mit-krb5)
85 ("samba" ,samba)
86 ("talloc" ,talloc)))
87 (arguments
88 `(#:phases
89 (modify-phases %standard-phases
90 (add-before 'configure 'set-root-sbin
91 (lambda* (#:key outputs #:allow-other-keys)
92 ;; Don't try to install into "/sbin".
93 (setenv "ROOTSBINDIR"
94 (string-append (assoc-ref outputs "out") "/sbin"))
95 #t))
96 (add-before 'install 'create-man8dir
97 ;; Create a directory that isn't created since version 6.10.
98 (lambda* (#:key outputs #:allow-other-keys)
99 (let ((out (assoc-ref outputs "out")))
100 (mkdir-p (string-append out "/share/man/man8"))
101 #t))))))
102 (synopsis "User-space utilities for Linux CIFS (Samba) mounts")
103 (description "@code{cifs-utils} is a set of user-space utilities for
104 mounting and managing @dfn{Common Internet File System} (CIFS) shares using
105 the Linux kernel CIFS client.")
106 (home-page "https://wiki.samba.org/index.php/LinuxCIFS_utils")
107 ;; cifs-utils is licensed as GPL3 or later, but 3 files contain LGPL code.
108 (license gpl3+)))
109
110 (define-public iniparser
111 (package
112 (name "iniparser")
113 (version "4.1")
114 (source (origin
115 (method git-fetch)
116 (uri (git-reference
117 (url "https://github.com/ndevilla/iniparser")
118 (commit (string-append "v" version))))
119 (file-name (git-file-name name version))
120 (sha256
121 (base32
122 "0dhab6pad6wh816lr7r3jb6z273njlgw2vpw8kcfnmi7ijaqhnr5"))))
123 (build-system gnu-build-system)
124 (arguments
125 `(#:make-flags
126 (list ,(string-append "CC=" (cc-for-target)))
127 #:phases
128 (modify-phases %standard-phases
129 (replace 'configure
130 (lambda* (#:key outputs #:allow-other-keys)
131 (substitute* '("Makefile" "test/Makefile")
132 (("/usr/lib")
133 (string-append (assoc-ref outputs "out") "/lib")))
134 #t))
135 (replace 'build
136 (lambda* (#:key make-flags #:allow-other-keys)
137 (apply invoke "make" "libiniparser.so.1"
138 make-flags)))
139 (replace 'install
140 (lambda* (#:key outputs #:allow-other-keys)
141 (let* ((out (assoc-ref outputs "out"))
142 (lib (string-append out "/lib"))
143 (inc (string-append out "/include"))
144 (doc (string-append out "/share/doc/" ,name))
145 (html (string-append doc "/html")))
146 (define (install dir)
147 (lambda (file)
148 (install-file file dir)))
149 (for-each (install lib)
150 (find-files "." "^lib.*\\.so"))
151 (with-directory-excursion lib
152 (symlink "libiniparser.so.1" "libiniparser.so"))
153 (for-each (install inc)
154 (find-files "src" "\\.h$"))
155 (for-each (install html)
156 (find-files "html" ".*"))
157 (for-each (install doc)
158 '("AUTHORS" "INSTALL" "LICENSE" "README.md"))
159 #t))))))
160 (home-page "https://github.com/ndevilla/iniparser")
161 (synopsis "Simple @file{.ini} configuration file parsing library")
162 (description
163 "The iniParser C library reads and writes Windows-style @file{.ini}
164 configuration files. These are simple text files with a basic structure
165 composed of sections, properties, and values. While not expressive, they
166 are easy to read, write, and modify.
167
168 The library is small, thread safe, and written in portable ANSI C with no
169 external dependencies.")
170 (license x11)))
171
172 (define-public samba
173 (package
174 (name "samba")
175 (version "4.13.10")
176 (source
177 (origin
178 (method url-fetch)
179 (uri (string-append "https://download.samba.org/pub/samba/stable/"
180 "samba-" version ".tar.gz"))
181 (sha256
182 (base32 "00q5hf2r71dyma785dckcyksv3082mqfgyy9q6k6rc6kqjwkirzh"))
183 (modules '((guix build utils)))
184 (snippet
185 '(begin
186 ;; XXX: Some bundled libraries (e.g, popt, cmocka) are used from
187 ;; the system, but their bundled sources must be kept as they
188 ;; include the WAF scripts used for detecting them.
189 (delete-file-recursively "third_party/pyiso8601")
190 #t))))
191 (build-system gnu-build-system)
192 (arguments
193 `(#:make-flags '("TEST_OPTIONS=--quick") ;some tests are very long
194 #:phases
195 (modify-phases %standard-phases
196 (add-before 'configure 'setup-docbook-stylesheets
197 (lambda* (#:key inputs #:allow-other-keys)
198 ;; Append Samba's own DTDs to XML_CATALOG_FILES
199 ;; (c.f. docs-xml/build/README).
200 (copy-file "docs-xml/build/catalog.xml.in"
201 "docs-xml/build/catalog.xml")
202 (substitute* "docs-xml/build/catalog.xml"
203 (("/@abs_top_srcdir@")
204 (string-append (getcwd) "/docs-xml")))
205 ;; Honor XML_CATALOG_FILES.
206 (substitute* "buildtools/wafsamba/wafsamba.py"
207 (("XML_CATALOG_FILES=\"\\$\\{SAMBA_CATALOGS\\}" all)
208 (string-append all " $XML_CATALOG_FILES")))
209 #t))
210 (replace 'configure
211 ;; Samba uses a custom configuration script that runs WAF.
212 (lambda* (#:key outputs #:allow-other-keys)
213 (let* ((out (assoc-ref outputs "out"))
214 (libdir (string-append out "/lib")))
215 (invoke "./configure"
216 "--enable-selftest"
217 "--enable-fhs"
218 (string-append "--prefix=" out)
219 "--sysconfdir=/etc"
220 "--localstatedir=/var"
221 ;; Install public and private libraries into
222 ;; a single directory to avoid RPATH issues.
223 (string-append "--libdir=" libdir)
224 (string-append "--with-privatelibdir=" libdir)))))
225 (add-before 'install 'disable-etc,var-samba-directories-setup
226 (lambda _
227 (substitute* "dynconfig/wscript"
228 (("bld\\.INSTALL_DIR.*") ""))
229 #t)))
230 ;; FIXME: The test suite seemingly hangs after failing to provision the
231 ;; test environment.
232 #:tests? #f))
233 (inputs
234 `(("acl" ,acl)
235 ("cmocka" ,cmocka)
236 ("cups" ,cups)
237 ("gamin" ,gamin)
238 ("dbus" ,dbus)
239 ("gpgme" ,gpgme)
240 ("gnutls" ,gnutls)
241 ("heimdal" ,heimdal)
242 ("jansson" ,jansson)
243 ("libarchive" ,libarchive)
244 ("libtirpc" ,libtirpc)
245 ("linux-pam" ,linux-pam)
246 ("lmdb" ,lmdb)
247 ("openldap" ,openldap)
248 ("perl" ,perl)
249 ("python" ,python)
250 ("popt" ,popt)
251 ("readline" ,readline)
252 ("tdb" ,tdb)))
253 (propagated-inputs
254 ;; In Requires or Requires.private of pkg-config files.
255 `(("ldb" ,ldb)
256 ("talloc" ,talloc)
257 ("tevent" ,tevent)))
258 (native-inputs
259 `(("perl-parse-yapp" ,perl-parse-yapp)
260 ("pkg-config" ,pkg-config)
261 ("python-iso8601" ,python-iso8601)
262 ("rpcsvc-proto" ,rpcsvc-proto) ; for 'rpcgen'
263 ;; For generating man pages.
264 ("docbook-xml" ,docbook-xml-4.2)
265 ("docbook-xsl" ,docbook-xsl)
266 ("xsltproc" ,libxslt)
267 ("libxml2" ,libxml2))) ;for XML_CATALOG_FILES
268 (home-page "https://www.samba.org/")
269 (synopsis
270 "The standard Windows interoperability suite of programs for GNU and Unix")
271 (description
272 "Since 1992, Samba has provided secure, stable and fast file and print
273 services for all clients using the SMB/CIFS protocol, such as all versions of
274 DOS and Windows, OS/2, GNU/Linux and many others.
275
276 Samba is an important component to seamlessly integrate Linux/Unix Servers and
277 Desktops into Active Directory environments using the winbind daemon.")
278 (license gpl3+)))
279
280 (define-public talloc
281 (package
282 (name "talloc")
283 (version "2.3.3")
284 (source (origin
285 (method url-fetch)
286 (uri (string-append "https://www.samba.org/ftp/talloc/talloc-"
287 version ".tar.gz"))
288 (sha256
289 (base32
290 "1ala3l6v8qk2pwq97z1zdkj1isnfnrp1923srp2g22mxd0impsbb"))))
291 (build-system gnu-build-system)
292 (arguments
293 '(#:phases
294 (modify-phases %standard-phases
295 (replace 'configure
296 (lambda* (#:key outputs #:allow-other-keys)
297 ;; talloc uses a custom configuration script that runs a Python
298 ;; script called 'waf', and doesn't tolerate unknown options.
299 (setenv "CONFIG_SHELL" (which "sh"))
300 (let ((out (assoc-ref outputs "out")))
301 (invoke "./configure"
302 (string-append "--prefix=" out))))))))
303 (native-inputs
304 `(("which" ,which)))
305 (inputs
306 `(("python" ,python)))
307 (home-page "https://talloc.samba.org")
308 (synopsis "Hierarchical, reference counted memory pool system")
309 (description
310 "Talloc is a hierarchical, reference counted memory pool system with
311 destructors. It is the core memory allocator used in Samba.")
312 (license gpl3+))) ;; The bundled "replace" library uses LGPL3.
313
314 (define-public talloc/static
315 (package
316 (inherit talloc)
317 (name "talloc-static")
318 (synopsis
319 "Hierarchical, reference counted memory pool system (static library)")
320 (arguments
321 (substitute-keyword-arguments (package-arguments talloc)
322 ((#:phases phases)
323 ;; Since Waf, the build system talloc uses, apparently does not
324 ;; support building static libraries from a ./configure flag, roll our
325 ;; own build process. No need to be ashamed, we're not the only ones
326 ;; doing that:
327 ;; <https://github.com/proot-me/proot-static-build/blob/master/GNUmakefile>.
328 ;; :-)
329 `(modify-phases ,phases
330 (replace 'build
331 (lambda _
332 (invoke "gcc" "-c" "-Ibin/default" "-I" "lib/replace"
333 "-I." "-Wall" "-g" "-D__STDC_WANT_LIB_EXT1__=1"
334 "talloc.c")
335 (invoke "ar" "rc" "libtalloc.a" "talloc.o")))
336 (replace 'install
337 (lambda* (#:key outputs #:allow-other-keys)
338 (let* ((out (assoc-ref outputs "out"))
339 (lib (string-append out "/lib"))
340 (include (string-append out "/include")))
341 (mkdir-p lib)
342 (install-file "libtalloc.a" lib)
343 (install-file "talloc.h" include)
344 #t)))
345 (delete 'check))))))) ;XXX: tests rely on Python modules
346
347 (define-public tevent
348 (package
349 (name "tevent")
350 (version "0.11.0")
351 (source (origin
352 (method url-fetch)
353 (uri (string-append "https://www.samba.org/ftp/tevent/tevent-"
354 version ".tar.gz"))
355 (sha256
356 (base32
357 "1fl2pj4p8p5fa2laykwf1sfjdw7pkw9slklj3vzc5ah8x348d6pf"))))
358 (build-system gnu-build-system)
359 (arguments
360 '(#:phases
361 (modify-phases %standard-phases
362 (replace 'configure
363 ;; tevent uses a custom configuration script that runs waf.
364 (lambda* (#:key outputs #:allow-other-keys)
365 (let ((out (assoc-ref outputs "out")))
366 (invoke "./configure"
367 (string-append "--prefix=" out)
368 "--bundled-libraries=NONE")))))))
369 (native-inputs
370 `(("cmocka" ,cmocka)
371 ("pkg-config" ,pkg-config)
372 ("python" ,python)
373 ("which" ,which)))
374 (propagated-inputs
375 `(("talloc" ,talloc))) ; required by tevent.pc
376 (synopsis "Event system library")
377 (home-page "https://tevent.samba.org/")
378 (description
379 "Tevent is an event system based on the talloc memory management library.
380 It is the core event system used in Samba. The low level tevent has support for
381 many event types, including timers, signals, and the classic file descriptor events.")
382 (license lgpl3+)))
383
384 (define-public ldb
385 (package
386 (name "ldb")
387 (version "2.4.0")
388 (source (origin
389 (method url-fetch)
390 (uri (string-append "https://www.samba.org/ftp/ldb/ldb-"
391 version ".tar.gz"))
392 (sha256
393 (base32
394 "10rd1z2llqz8xdx6m7yyxb9a118gx2xxwri18bhkkab9n1w55rvn"))
395 (modules '((guix build utils)))
396 (snippet
397 '(begin
398 (for-each (lambda (file)
399 ;; Delete everything except the build tools.
400 (unless (or (string-prefix? "third_party/waf" file)
401 (string-suffix? "wscript" file))
402 (delete-file file)))
403 (find-files "third_party"))
404 #t))))
405 (build-system gnu-build-system)
406 (arguments
407 '(;; LMDB is only supported on 64-bit systems, yet the test suite
408 ;; requires it.
409 #:tests? (assoc-ref %build-inputs "lmdb")
410 #:phases
411 (modify-phases %standard-phases
412 (replace 'configure
413 ;; ldb use a custom configuration script that runs waf.
414 (lambda* (#:key outputs #:allow-other-keys)
415 (let ((out (assoc-ref outputs "out")))
416 (invoke "./configure"
417 (string-append "--prefix=" out)
418 (string-append "--with-modulesdir=" out
419 "/lib/ldb/modules")
420 "--bundled-libraries=NONE")))))))
421 (native-inputs
422 `(("cmocka" ,cmocka)
423 ("pkg-config" ,pkg-config)
424 ("python" ,python)
425 ("which" ,which)))
426 (propagated-inputs
427 ;; ldb.pc refers to all these.
428 `(("talloc" ,talloc)
429 ("tdb" ,tdb)))
430 (inputs
431 `(,@(if (target-64bit?)
432 `(("lmdb" ,lmdb))
433 '())
434 ("popt" ,popt)
435 ("tevent" ,tevent)))
436 (synopsis "LDAP-like embedded database")
437 (home-page "https://ldb.samba.org/")
438 (description
439 "Ldb is a LDAP-like embedded database built on top of TDB. What ldb does
440 is provide a fast database with an LDAP-like API designed to be used within an
441 application. In some ways it can be seen as a intermediate solution between
442 key-value pair databases and a real LDAP database.")
443 (license lgpl3+)))
444
445 (define-public ppp
446 (package
447 (name "ppp")
448 (version "2.4.9")
449 (source (origin
450 (method git-fetch)
451 (uri (git-reference
452 (url "https://github.com/paulusmack/ppp")
453 (commit version)))
454 (file-name (git-file-name name version))
455 (sha256
456 (base32
457 "1bhhksdclsnkw54a517ndrw55q5zljjbh9pcqz1z4a2z2flxpsgk"))))
458 (build-system gnu-build-system)
459 (arguments
460 '(#:tests? #f ; no check target
461 #:make-flags '("CC=gcc")
462 #:phases
463 (modify-phases %standard-phases
464 (add-before 'configure 'patch-Makefile
465 (lambda* (#:key inputs #:allow-other-keys)
466 (let ((libc (assoc-ref inputs "libc"))
467 (openssl (assoc-ref inputs "openssl"))
468 (libpcap (assoc-ref inputs "libpcap")))
469 (substitute* "pppd/Makefile.linux"
470 (("/usr/include/crypt\\.h")
471 (string-append libc "/include/crypt.h"))
472 (("/usr/include/openssl")
473 (string-append openssl "/include/openssl"))
474 (("/usr/include/pcap-bpf.h")
475 (string-append libpcap "/include/pcap-bpf.h")))
476 #t))))))
477 (inputs
478 `(("libpcap" ,libpcap)
479 ("openssl" ,(@ (gnu packages tls) openssl))))
480 (synopsis "Implementation of the Point-to-Point Protocol")
481 (home-page "https://ppp.samba.org/")
482 (description
483 "The Point-to-Point Protocol (PPP) provides a standard way to establish
484 a network connection over a serial link. At present, this package supports IP
485 and IPV6 and the protocols layered above them, such as TCP and UDP.")
486 ;; pppd, pppstats and pppdump are under BSD-style notices.
487 ;; some of the pppd plugins are GPL'd.
488 ;; chat is public domain.
489 (license (list bsd-3 bsd-4 gpl2+ public-domain))))
490