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