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