gnu: masscan: Cross compile.
[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 ;;; 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.11")
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 "1n98hy3zi4klm1xxhb840br1x7hhz0xx8kp5sch84kr07yd26ndq"))))
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 (replace 'bootstrap
91 ;; Force a bootstrap to fix a ‘cannot find install-sh, install.sh,
92 ;; or shtool’ error since version 6.10.
93 (lambda _
94 (invoke "autoreconf" "-vfi")
95 #t))
96 (add-before 'configure 'set-root-sbin
97 (lambda* (#:key outputs #:allow-other-keys)
98 ;; Don't try to install into "/sbin".
99 (setenv "ROOTSBINDIR"
100 (string-append (assoc-ref outputs "out") "/sbin"))
101 #t))
102 (add-before 'install 'create-man8dir
103 ;; Create a directory that isn't created since version 6.10.
104 (lambda* (#:key outputs #:allow-other-keys)
105 (let ((out (assoc-ref outputs "out")))
106 (mkdir-p (string-append out "/share/man/man8"))
107 #t))))))
108 (synopsis "User-space utilities for Linux CIFS (Samba) mounts")
109 (description "@code{cifs-utils} is a set of user-space utilities for
110 mounting and managing @dfn{Common Internet File System} (CIFS) shares using
111 the Linux kernel CIFS client.")
112 (home-page "https://wiki.samba.org/index.php/LinuxCIFS_utils")
113 ;; cifs-utils is licensed as GPL3 or later, but 3 files contain LGPL code.
114 (license gpl3+)))
115
116 (define-public iniparser
117 (package
118 (name "iniparser")
119 (version "4.1")
120 (source (origin
121 (method git-fetch)
122 (uri (git-reference
123 (url "https://github.com/ndevilla/iniparser")
124 (commit (string-append "v" version))))
125 (file-name (git-file-name name version))
126 (sha256
127 (base32
128 "0dhab6pad6wh816lr7r3jb6z273njlgw2vpw8kcfnmi7ijaqhnr5"))))
129 (build-system gnu-build-system)
130 (arguments
131 `(#:make-flags
132 (list ,(string-append "CC=" (cc-for-target)))
133 #:phases
134 (modify-phases %standard-phases
135 (replace 'configure
136 (lambda* (#:key outputs #:allow-other-keys)
137 (substitute* '("Makefile" "test/Makefile")
138 (("/usr/lib")
139 (string-append (assoc-ref outputs "out") "/lib")))
140 #t))
141 (replace 'build
142 (lambda* (#:key make-flags #:allow-other-keys)
143 (apply invoke "make" "libiniparser.so.1"
144 make-flags)))
145 (replace 'install
146 (lambda* (#:key outputs #:allow-other-keys)
147 (let* ((out (assoc-ref outputs "out"))
148 (lib (string-append out "/lib"))
149 (inc (string-append out "/include"))
150 (doc (string-append out "/share/doc/" ,name))
151 (html (string-append doc "/html")))
152 (define (install dir)
153 (lambda (file)
154 (install-file file dir)))
155 (for-each (install lib)
156 (find-files "." "^lib.*\\.so"))
157 (with-directory-excursion lib
158 (symlink "libiniparser.so.1" "libiniparser.so"))
159 (for-each (install inc)
160 (find-files "src" "\\.h$"))
161 (for-each (install html)
162 (find-files "html" ".*"))
163 (for-each (install doc)
164 '("AUTHORS" "INSTALL" "LICENSE" "README.md"))
165 #t))))))
166 (home-page "https://github.com/ndevilla/iniparser")
167 (synopsis "Simple @file{.ini} configuration file parsing library")
168 (description
169 "The iniParser C library reads and writes Windows-style @file{.ini}
170 configuration files. These are simple text files with a basic structure
171 composed of sections, properties, and values. While not expressive, they
172 are easy to read, write, and modify.
173
174 The library is small, thread safe, and written in portable ANSI C with no
175 external dependencies.")
176 (license x11)))
177
178 (define-public samba
179 (package
180 (name "samba")
181 (version "4.13.2")
182 (source
183 (origin
184 (method url-fetch)
185 (uri (string-append "https://download.samba.org/pub/samba/stable/"
186 "samba-" version ".tar.gz"))
187 (sha256
188 (base32 "1d7j79c8aggwiv90y2q1yz63d9p5n4paq0fsbdvqpn05d8wn8r17"))
189 (patches (search-patches "samba-fix-fcntl-hint-detection.patch"))
190 (modules '((guix build utils)))
191 (snippet
192 '(begin
193 ;; XXX: Some bundled libraries (e.g, popt, cmocka) are used from
194 ;; the system, but their bundled sources must be kept as they
195 ;; include the WAF scripts used for detecting them.
196 (delete-file-recursively "third_party/pyiso8601")
197 #t))))
198 (build-system gnu-build-system)
199 (arguments
200 `(#:make-flags '("TEST_OPTIONS=--quick") ;some tests are very long
201 #:phases
202 (modify-phases %standard-phases
203 (add-before 'configure 'setup-docbook-stylesheets
204 (lambda* (#:key inputs #:allow-other-keys)
205 ;; Append Samba's own DTDs to XML_CATALOG_FILES
206 ;; (c.f. docs-xml/build/README).
207 (copy-file "docs-xml/build/catalog.xml.in"
208 "docs-xml/build/catalog.xml")
209 (substitute* "docs-xml/build/catalog.xml"
210 (("/@abs_top_srcdir@")
211 (string-append (getcwd) "/docs-xml")))
212 ;; Honor XML_CATALOG_FILES.
213 (substitute* "buildtools/wafsamba/wafsamba.py"
214 (("XML_CATALOG_FILES=\"\\$\\{SAMBA_CATALOGS\\}" all)
215 (string-append all " $XML_CATALOG_FILES")))
216 #t))
217 (replace 'configure
218 ;; Samba uses a custom configuration script that runs WAF.
219 (lambda* (#:key outputs #:allow-other-keys)
220 (let* ((out (assoc-ref outputs "out"))
221 (libdir (string-append out "/lib")))
222 (invoke "./configure"
223 "--enable-selftest"
224 "--enable-fhs"
225 (string-append "--prefix=" out)
226 "--sysconfdir=/etc"
227 "--localstatedir=/var"
228 ;; Install public and private libraries into
229 ;; a single directory to avoid RPATH issues.
230 (string-append "--libdir=" libdir)
231 (string-append "--with-privatelibdir=" libdir)))))
232 (add-before 'install 'disable-etc,var-samba-directories-setup
233 (lambda _
234 (substitute* "dynconfig/wscript"
235 (("bld\\.INSTALL_DIR.*") ""))
236 #t)))
237 ;; FIXME: The test suite seemingly hangs after failing to provision the
238 ;; test environment.
239 #:tests? #f))
240 (inputs
241 `(("acl" ,acl)
242 ("cmocka" ,cmocka)
243 ("cups" ,cups)
244 ("gamin" ,gamin)
245 ("dbus", dbus)
246 ("gpgme" ,gpgme)
247 ("gnutls" ,gnutls)
248 ("heimdal" ,heimdal)
249 ("jansson" ,jansson)
250 ("libarchive" ,libarchive)
251 ("libtirpc" ,libtirpc)
252 ("linux-pam" ,linux-pam)
253 ("lmdb" ,lmdb)
254 ("openldap" ,openldap)
255 ("perl" ,perl)
256 ("python" ,python)
257 ("popt" ,popt)
258 ("readline" ,readline)
259 ("tdb" ,tdb)))
260 (propagated-inputs
261 ;; In Requires or Requires.private of pkg-config files.
262 `(("ldb" ,ldb)
263 ("talloc" ,talloc)
264 ("tevent" ,tevent)))
265 (native-inputs
266 `(("perl-parse-yapp" ,perl-parse-yapp)
267 ("pkg-config" ,pkg-config)
268 ("python-iso8601" ,python-iso8601)
269 ("rpcsvc-proto" ,rpcsvc-proto) ; for 'rpcgen'
270 ;; For generating man pages.
271 ("docbook-xml" ,docbook-xml-4.2)
272 ("docbook-xsl" ,docbook-xsl)
273 ("xsltproc" ,libxslt)
274 ("libxml2", libxml2))) ;for XML_CATALOG_FILES
275 (home-page "https://www.samba.org/")
276 (synopsis
277 "The standard Windows interoperability suite of programs for GNU and Unix")
278 (description
279 "Since 1992, Samba has provided secure, stable and fast file and print
280 services for all clients using the SMB/CIFS protocol, such as all versions of
281 DOS and Windows, OS/2, GNU/Linux and many others.
282
283 Samba is an important component to seamlessly integrate Linux/Unix Servers and
284 Desktops into Active Directory environments using the winbind daemon.")
285 (license gpl3+)))
286
287 (define-public talloc
288 (package
289 (name "talloc")
290 (version "2.3.1")
291 (source (origin
292 (method url-fetch)
293 (uri (string-append "https://www.samba.org/ftp/talloc/talloc-"
294 version ".tar.gz"))
295 (sha256
296 (base32
297 "0xwzgzrqamfdlklwacp9d219pqkah0yfrhxb1j7bxlmgzp924j7g"))))
298 (build-system gnu-build-system)
299 (arguments
300 '(#:phases
301 (modify-phases %standard-phases
302 (replace 'configure
303 (lambda* (#:key outputs #:allow-other-keys)
304 ;; talloc uses a custom configuration script that runs a Python
305 ;; script called 'waf', and doesn't tolerate unknown options.
306 (setenv "CONFIG_SHELL" (which "sh"))
307 (let ((out (assoc-ref outputs "out")))
308 (invoke "./configure"
309 (string-append "--prefix=" out))))))))
310 (native-inputs
311 `(("which" ,which)))
312 (inputs
313 `(("python" ,python)))
314 (home-page "https://talloc.samba.org")
315 (synopsis "Hierarchical, reference counted memory pool system")
316 (description
317 "Talloc is a hierarchical, reference counted memory pool system with
318 destructors. It is the core memory allocator used in Samba.")
319 (license gpl3+))) ;; The bundled "replace" library uses LGPL3.
320
321 (define-public talloc/static
322 (package
323 (inherit talloc)
324 (name "talloc-static")
325 (synopsis
326 "Hierarchical, reference counted memory pool system (static library)")
327 (arguments
328 (substitute-keyword-arguments (package-arguments talloc)
329 ((#:phases phases)
330 ;; Since Waf, the build system talloc uses, apparently does not
331 ;; support building static libraries from a ./configure flag, roll our
332 ;; own build process. No need to be ashamed, we're not the only ones
333 ;; doing that:
334 ;; <https://github.com/proot-me/proot-static-build/blob/master/GNUmakefile>.
335 ;; :-)
336 `(modify-phases ,phases
337 (replace 'build
338 (lambda _
339 (invoke "gcc" "-c" "-Ibin/default" "-I" "lib/replace"
340 "-I." "-Wall" "-g" "-D__STDC_WANT_LIB_EXT1__=1"
341 "talloc.c")
342 (invoke "ar" "rc" "libtalloc.a" "talloc.o")))
343 (replace 'install
344 (lambda* (#:key outputs #:allow-other-keys)
345 (let* ((out (assoc-ref outputs "out"))
346 (lib (string-append out "/lib"))
347 (include (string-append out "/include")))
348 (mkdir-p lib)
349 (install-file "libtalloc.a" lib)
350 (install-file "talloc.h" include)
351 #t)))
352 (delete 'check))))))) ;XXX: tests rely on Python modules
353
354 (define-public tevent
355 (package
356 (name "tevent")
357 (version "0.10.2")
358 (source (origin
359 (method url-fetch)
360 (uri (string-append "https://www.samba.org/ftp/tevent/tevent-"
361 version ".tar.gz"))
362 (sha256
363 (base32
364 "15k6i8ad5lpxfjsjyq9h64zlyws8d3cm0vwdnaw8z1xjwli7hhpq"))))
365 (build-system gnu-build-system)
366 (arguments
367 '(#:phases
368 (modify-phases %standard-phases
369 (replace 'configure
370 ;; tevent uses a custom configuration script that runs waf.
371 (lambda* (#:key outputs #:allow-other-keys)
372 (let ((out (assoc-ref outputs "out")))
373 (invoke "./configure"
374 (string-append "--prefix=" out)
375 "--bundled-libraries=NONE")))))))
376 (native-inputs
377 `(("pkg-config" ,pkg-config)
378 ("python" ,python)
379 ("which" ,which)))
380 (propagated-inputs
381 `(("talloc" ,talloc))) ; required by tevent.pc
382 (synopsis "Event system library")
383 (home-page "https://tevent.samba.org/")
384 (description
385 "Tevent is an event system based on the talloc memory management library.
386 It is the core event system used in Samba. The low level tevent has support for
387 many event types, including timers, signals, and the classic file descriptor events.")
388 (license lgpl3+)))
389
390 (define-public ldb
391 (package
392 (name "ldb")
393 (version "1.5.6")
394 (source (origin
395 (method url-fetch)
396 (uri (string-append "https://www.samba.org/ftp/ldb/ldb-"
397 version ".tar.gz"))
398 (sha256
399 (base32
400 "0nwpkqidsna4yz3vhjzzadm4hpviwnyk80yml8ay82gi1d6lg0pz"))
401 (modules '((guix build utils)))
402 (snippet
403 '(begin
404 (for-each (lambda (file)
405 ;; Delete everything except the build tools.
406 (unless (or (string-prefix? "third_party/waf" file)
407 (string-suffix? "wscript" file))
408 (delete-file file)))
409 (find-files "third_party"))
410 #t))))
411 (build-system gnu-build-system)
412 (arguments
413 '(;; LMDB is only supported on 64-bit systems, yet the test suite
414 ;; requires it.
415 #:tests? (assoc-ref %build-inputs "lmdb")
416 #:phases
417 (modify-phases %standard-phases
418 (replace 'configure
419 ;; ldb use a custom configuration script that runs waf.
420 (lambda* (#:key outputs #:allow-other-keys)
421 (let ((out (assoc-ref outputs "out")))
422 (invoke "./configure"
423 (string-append "--prefix=" out)
424 (string-append "--with-modulesdir=" out
425 "/lib/ldb/modules")
426 "--bundled-libraries=NONE")))))))
427 (native-inputs
428 `(("cmocka" ,cmocka)
429 ("pkg-config" ,pkg-config)
430 ("python" ,python)
431 ("which" ,which)))
432 (propagated-inputs
433 ;; ldb.pc refers to all these.
434 `(("talloc" ,talloc)
435 ("tdb" ,tdb)))
436 (inputs
437 `(,@(if (target-64bit?)
438 `(("lmdb" ,lmdb))
439 '())
440 ("popt" ,popt)
441 ("tevent" ,tevent)))
442 (synopsis "LDAP-like embedded database")
443 (home-page "https://ldb.samba.org/")
444 (description
445 "Ldb is a LDAP-like embedded database built on top of TDB. What ldb does
446 is provide a fast database with an LDAP-like API designed to be used within an
447 application. In some ways it can be seen as a intermediate solution between
448 key-value pair databases and a real LDAP database.")
449 (license lgpl3+)))
450
451 (define-public ppp
452 ;; This git commit contains unreleased fixes for CVE-2020-8597.
453 (let ((revision "1")
454 (commit "8d45443bb5c9372b4c6a362ba2f443d41c5636af"))
455 (package
456 (name "ppp")
457 (version (git-version "2.4.8" revision commit))
458 (source (origin
459 (method git-fetch)
460 (uri (git-reference
461 (url "https://github.com/paulusmack/ppp")
462 (commit commit)))
463 (file-name (git-file-name name version))
464 (sha256
465 (base32
466 "06cf8fb84l3h2zy5da4j7k2j1qjv2gfqn986sf43xgj75605aks2"))))
467 (build-system gnu-build-system)
468 (arguments
469 '(#:tests? #f ; no check target
470 #:make-flags '("CC=gcc")
471 #:phases
472 (modify-phases %standard-phases
473 (add-before 'configure 'patch-Makefile
474 (lambda* (#:key inputs #:allow-other-keys)
475 (let ((libc (assoc-ref inputs "libc"))
476 (openssl (assoc-ref inputs "openssl"))
477 (libpcap (assoc-ref inputs "libpcap")))
478 (substitute* "pppd/Makefile.linux"
479 (("/usr/include/crypt\\.h")
480 (string-append libc "/include/crypt.h"))
481 (("/usr/include/openssl")
482 (string-append openssl "/include/openssl"))
483 (("/usr/include/pcap-bpf.h")
484 (string-append libpcap "/include/pcap-bpf.h")))
485 #t))))))
486 (inputs
487 `(("libpcap" ,libpcap)
488 ("openssl" ,(@ (gnu packages tls) openssl))))
489 (synopsis "Implementation of the Point-to-Point Protocol")
490 (home-page "https://ppp.samba.org/")
491 (description
492 "The Point-to-Point Protocol (PPP) provides a standard way to establish
493 a network connection over a serial link. At present, this package supports IP
494 and IPV6 and the protocols layered above them, such as TCP and UDP.")
495 ;; pppd, pppstats and pppdump are under BSD-style notices.
496 ;; some of the pppd plugins are GPL'd.
497 ;; chat is public domain.
498 (license (list bsd-3 bsd-4 gpl2+ public-domain)))))
499