samba.scm 18 KB

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