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