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