~ruther/guix-local

ref: e68ec94fdb4c00a950480e845bc3746d6f01ce97 guix-local/gnu/packages/samba.scm -rw-r--r-- 30.8 KiB
e68ec94f — Christopher Baines gnu: guix-build-coordinator: Update to 0-136.a1c18b1. a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2015, 2017, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016, 2017, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
;;; Copyright © 2017, 2018, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2020, 2022, 2023 Maxim Cournoyer <maxim@guixotic.coop>
;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2022 Simon Streit <simon@netpanic.org>
;;; Copyright © 2024 Jordan Moore <lockbox@struct.foo>
;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2025 Murilo <murilo@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages samba)
  #:use-module (guix gexp)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system copy)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages acl)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages avahi)
  #:use-module (gnu packages backup)
  #:use-module (gnu packages base)
  #:use-module (gnu packages check)
  #:use-module (gnu packages crypto)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages docbook)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages kerberos)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages onc-rpc)
  #:use-module (gnu packages openldap)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages popt)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages ruby)
  #:use-module (gnu packages time)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xml)
  #:use-module (srfi srfi-1))

(define-public cifs-utils
  (package
    (name "cifs-utils")
    (version "7.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://download.samba.org/pub/linux-cifs/"
                           "cifs-utils/cifs-utils-" version ".tar.bz2"))
       (sha256 (base32
                "0ajvbc5lbwvzlhq2f2grsgy3rpzb314vm29icp4kcsjadbvj64d2"))))
    (build-system gnu-build-system)
    (native-inputs
     (list autoconf automake pkg-config
           ;; To generate the manpages.
           python-docutils)) ; rst2man
    (inputs
     (list keyutils libcap-ng linux-pam mit-krb5 samba talloc))
    (arguments
     (list #:configure-flags #~(list "--enable-man")
           #:phases
           #~(modify-phases %standard-phases
               (add-before 'bootstrap 'trigger-bootstrap
                 ;; The shipped configure script is buggy, e.g., it contains a
                 ;; unexpanded literal ‘LIBCAP_NG_PATH’ line).
                 (lambda _
                   (delete-file "configure")))
               (add-before 'configure 'set-root-sbin
                 ;; Don't try to install into "/sbin".
                 (lambda _
                   (setenv "ROOTSBINDIR" (string-append #$output "/sbin")))))))
    (synopsis "User-space utilities for Linux CIFS (Samba) mounts")
    (description "@code{cifs-utils} is a set of user-space utilities for
mounting and managing @acronym{CIFS, Common Internet File System} shares using
the Linux kernel CIFS client.")
    (home-page "https://wiki.samba.org/index.php/LinuxCIFS_utils")
    ;; cifs-utils is licensed as GPL3 or later, but 3 files contain LGPL code.
    (license license:gpl3+)))

(define-public iniparser
  (package
    (name "iniparser")
    (version "4.2.6")
    (source (origin
             (method git-fetch)
             (uri (git-reference
                    (url "https://gitlab.com/iniparser/iniparser")
                    (commit (string-append "v" version))))
             (file-name (git-file-name name version))
             (sha256
              (base32
               "1gi2kxp55095bq2qrdfy0hxiwzpc47413ydj15xvg9nbw3s14pfg"))
             (patches (search-patches "iniparser-remove-fetchcontent-usage.patch"))))
    (build-system cmake-build-system)
    (arguments
      (list #:phases
            #~(modify-phases %standard-phases
                (add-after 'unpack 'patch-runner
                  (lambda _
                    (substitute* "test/CMakeLists.txt"
                      (("@UNITY-GENERATE-TEST-RUNNER@")
                       (string-append #$(this-package-native-input "unity-test")
                                      "/share/unity-test/generate_test_runner.rb")))))
                (add-after 'install 'symlink-lib
                  (lambda _
                    (for-each (lambda (x)
                                (symlink x (string-append #$output "/include/" (basename x))))
                              (find-files (string-append #$output "/include/iniparser")
                                          ".*\\.h")))))))
    (native-inputs (list pkg-config doxygen ruby unity-test))
    (home-page "https://gitlab.com/iniparser/iniparser")
    (synopsis "Simple @file{.ini} configuration file parsing library")
    (description
     "The iniParser C library reads and writes Windows-style @file{.ini}
configuration files.  These are simple text files with a basic structure
composed of sections, properties, and values.  While not expressive, they
are easy to read, write, and modify.

The library is small, thread safe, and written in portable ANSI C with no
external dependencies.")
    (license license:expat)))

(define-public nss-wrapper
  (package
    (name "nss-wrapper")
    (version "1.1.16")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://git.samba.org/nss_wrapper.git/")
              (commit (string-append "nss_wrapper-" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1kwlylml18f65drwrph6w90ilp66c20dywjssxscmwhf2jwwfpya"))))
    (build-system cmake-build-system)
    (arguments
     (list
      ;; XXX: There are two failing tests, most likely because they need
      ;; some networking abilities (getaddinfo_[service|null]).
      ;; Disabled tests completely because there's not easy way to disable
      ;; specific tests using CMocka.
      #:tests? #f
      #:configure-flags #~(list "-DUNIT_TESTING=OFF")))
    (native-inputs (list cmocka libxcrypt uid-wrapper))
    (home-page "https://cwrap.org/nss_wrapper.html")
    (synopsis "Wrapper for the user, group and hosts NSS API")
    (description
     "There are projects that need to be able to create, modify, and delete
Unix users.  Others just switch user IDs to interact with the system on behalf
of another user (e.g. a user space file server).  To be able to test
applications like these, one needs to grant privileges to modify the passwd
and group files.  With this package it is possible to define your own passwd
and group files to be used the software while it is under test.  It also
allows you to create a hosts file to set up name resolution for the addresses
you use with @code{socket_wrapper}.  It provides the following features:
@itemize
@item Provides information for user and group accounts.
@item Network name resolution using a hosts file.
@item Loading and testing of NSS modules.
@end itemize")
    (license license:bsd-3)))

(define-public pam-wrapper
  (package
    (name "pam-wrapper")
    (version "1.1.8")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://git.samba.org/pam_wrapper.git/")
              (commit (string-append "pam_wrapper-" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1h1n6bgzcvc6zhpi79g76zrl3fypd7q25bc2kdx18x014p9wdr4r"))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:configure-flags
      #~(list "-DUNIT_TESTING=ON"
              (string-append "-DPYTHON_INSTALL_SITEARCH="
                             #$output "/lib/python"
                             #$(version-major+minor
                                (package-version
                                 (this-package-native-input "python")))
                             "/site-packages/pypamtest/"))))
    (native-inputs (list cmocka python))
    (inputs (list linux-pam))
    (home-page "https://cwrap.org/pam_wrapper.html")
    (synopsis "Tool to test PAM applications and PAM modules")
    (description
     "This package provides tools to test your PAM application or module.  For
testing PAM applications, a simple PAM module called @code{pam_matrix} is
provided.  For testing PAM modules, see the @code{pamtest} library.  One can
combine it with the CMocka unit testing framework or use the provided Python
bindings to write tests for modules in Python.")
    (license license:bsd-3)))

(define-public priv-wrapper
  (package
    (name "priv-wrapper")
    (version "1.0.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://git.samba.org/priv_wrapper.git/")
              (commit (string-append "priv_wrapper-" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "04ycb3fckcz3ck1wbg9gh6x63ydkpjyc1v4340l6sdw90w7rlr66"))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:configure-flags #~(list "-DUNIT_TESTING=ON")))
    (native-inputs (list cmocka))
    (home-page "https://cwrap.org/priv_wrapper.html")
    (synopsis "Library to drop privileges")
    (description
     "This package provides a library to disable resource limits and other
privilege dropping, i.e. disabling @code{chroot}, @code{prctl},
@code{pledge} and @code{setrlmit} system calls.  This package aims to help
running processes which are dropping privileges or are restricting resources
in test environments.  A disabled call always succeeds (i.e. returns 0) and
does nothing.")
    (license license:bsd-3)))

(define-public resolv-wrapper
  (package
    (name "resolv-wrapper")
    (version "1.1.8")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://git.samba.org/resolv_wrapper.git/")
              (commit (string-append "resolv_wrapper-" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "18xarq1hmz7n911hjrfvp5fcgsh9kzxa2v28zgv6afx1a2djqcd9"))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:configure-flags #~(list "-DUNIT_TESTING=ON")))
    (native-inputs (list cmocka socket-wrapper))
    (home-page "https://cwrap.org/resolv_wrapper.html")
    (synopsis "Wrapper for DNS name resolving or DNS faking")
    (description
     "This package makes it possible on most UNIX platforms to contact your
own DNS implementation in your test environment.  It requires socket_wrapper to
be able to contact the server.  Alternatively, the wrapper is able to fake DNS
queries and return valid responses to your application.  It provides the
following features:
@itemize
@item Redirects name queries to the nameservers specified in your resolv.conf.
@item Can fake DNS queries using a simple formatted DNS hosts file.
@end itemize")
    (license license:bsd-3)))

(define-public samba/pinned
  (hidden-package
   (package
     (name "samba")
     (version "4.18.1")
     (source
      ;; For updaters: the current PGP fingerprint is
      ;; 81F5E2832BD2545A1897B713AA99442FB680B620.
      (origin
        (method url-fetch)
        (uri (string-append "https://download.samba.org/pub/samba/stable/"
                            "samba-" version ".tar.gz"))
        (sha256
         (base32 "03ncp49pfpzjla205y3xpb9iy61dz4pryyrvyz26422a4hpsmpnf"))))
     (build-system gnu-build-system)
     (arguments
      (list
       #:make-flags #~(list "TEST_OPTIONS=--quick") ;some tests are very long
       #:phases
       #~(modify-phases %standard-phases
           (add-before 'configure 'setup-docbook-stylesheets
             (lambda* (#:key inputs #:allow-other-keys)
               ;; Append Samba's own DTDs to XML_CATALOG_FILES
               ;; (c.f. docs-xml/build/README).
               (copy-file "docs-xml/build/catalog.xml.in"
                          "docs-xml/build/catalog.xml")
               (substitute* "docs-xml/build/catalog.xml"
                 (("/@abs_top_srcdir@")
                  (string-append (getcwd) "/docs-xml")))
               ;; Honor XML_CATALOG_FILES.
               (substitute* "buildtools/wafsamba/wafsamba.py"
                 (("XML_CATALOG_FILES=\"\\$\\{SAMBA_CATALOGS\\}" all)
                  (string-append all " $XML_CATALOG_FILES")))))
           (replace 'configure
             ;; Samba uses a custom configuration script that runs WAF.
             (lambda* (#:key inputs #:allow-other-keys)
               (let* ((libdir (string-append #$output "/lib")))
                 (invoke "./configure"
                         #$@(if (member (%current-system)
                                        (package-transitive-supported-systems
                                         python-cryptography))
                                '("--enable-selftest")
                                '())
                         "--enable-fhs"
                         (string-append "--prefix=" #$output)
                         "--sysconfdir=/etc"
                         "--localstatedir=/var"
                         ;; Install public and private libraries into
                         ;; a single directory to avoid RPATH issues.
                         (string-append "--libdir=" libdir)
                         (string-append "--with-privatelibdir=" libdir)
                         "--with-system-mitkrb5"
                         (string-append "--with-system-mitkdc="
                                        (search-input-file inputs "sbin/krb5kdc"))
                         "--with-experimental-mit-ad-dc"))))
           (add-before 'install 'disable-etc,var-samba-directories-setup
             (lambda _
               (substitute* "dynconfig/wscript"
                 (("bld\\.INSTALL_DIR.*") "")))))
       ;; FIXME: The test suite seemingly hangs after failing to provision the
       ;; test environment.
       #:tests? #f))
     (inputs
      (list acl
            avahi
            cmocka
            cups
            gamin
            dbus
            gpgme
            gnutls
            jansson
            libarchive
            libtirpc
            libxcrypt
            linux-pam
            lmdb
            mit-krb5
            openldap
            perl
            python
            popt
            readline
            tdb))
     (propagated-inputs
      ;; In Requires or Requires.private of pkg-config files.
      (list ldb talloc tevent))
     (native-inputs
      (append
       (list perl-parse-yapp
             pkg-config)
       ;; The python-cryptography dependency is needed for the krb5 tests.
       ;; Since python-cryptography requires Rust, add it conditionally
       ;; depending on such support.
       (if (member (%current-system)
                   (package-transitive-supported-systems
                    python-cryptography))
           (list python-cryptography)
           '())
       (list python-dnspython
             python-iso8601/pinned
             python-markdown
             rpcsvc-proto               ;for 'rpcgen'
             python-pyasn1              ;for krb5 tests
             ;; For generating man pages.
             docbook-xml-4.2
             docbook-xsl
             libxslt)))
     (home-page "https://www.samba.org/")
     (synopsis
      "The standard Windows interoperability suite of programs for GNU and Unix")
     (description
      "Since 1992, Samba has provided secure, stable and fast file and print
services for all clients using the SMB/CIFS protocol, such as all versions of
DOS and Windows, OS/2, GNU/Linux and many others.

Samba is an important component to seamlessly integrate Linux/Unix Servers and
Desktops into Active Directory environments using the winbind daemon.")
     (license license:gpl3+))))

(define-public samba
  (package
    (inherit samba/pinned)
    (properties (alist-delete 'hidden? (package-properties samba/pinned)))))

(define-public talloc
  (package
    (name "talloc")
    (version "2.4.2")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://www.samba.org/ftp/talloc/talloc-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "19nqn6lygdwpfvc5g8jzany20hz126jfjlhajpwrh3z2cpjgkv45"))))
    (build-system gnu-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-crypt-reference
           ;; The following is needed because Python.h propagates
           ;; HAVE_CRYPT_H, which is then seen from lib/replace/ but talloc
           ;; doesn't need it at all.
           (lambda _
             (substitute* "lib/replace/replace.h"
               (("#include <crypt.h>")
                ""))))
         (replace 'configure
           (lambda* (#:key outputs #:allow-other-keys)
             ;; talloc uses a custom configuration script that runs a Python
             ;; script called 'waf', and doesn't tolerate unknown options.
             (setenv "CONFIG_SHELL" (which "sh"))
             (let ((out (assoc-ref outputs "out")))
               (invoke "./configure"
                       (string-append "--prefix=" out))))))))
    (native-inputs
     (list which))
    (inputs
     (list python))
    (home-page "https://talloc.samba.org")
    (synopsis "Hierarchical, reference counted memory pool system")
    (description
     "Talloc is a hierarchical, reference counted memory pool system with
destructors.  It is the core memory allocator used in Samba.")
    (license license:gpl3+))) ;; The bundled "replace" library uses LGPL3.

(define-public talloc/static
  (package
    (inherit talloc)
    (name "talloc-static")
    (synopsis
     "Hierarchical, reference counted memory pool system (static library)")
    (arguments
     (substitute-keyword-arguments (package-arguments talloc)
       ((#:phases phases)
        ;; Since Waf, the build system talloc uses, apparently does not
        ;; support building static libraries from a ./configure flag, roll our
        ;; own build process.  No need to be ashamed, we're not the only ones
        ;; doing that:
        ;; <https://github.com/proot-me/proot-static-build/blob/master/GNUmakefile>.
        ;; :-)
        `(modify-phases ,phases
           (replace 'build
             (lambda _
               (invoke "gcc" "-c" "-Ibin/default" "-I" "lib/replace"
                       "-I." "-Wall" "-g" "-D__STDC_WANT_LIB_EXT1__=1"
                       "talloc.c")
               (invoke "ar" "rc" "libtalloc.a" "talloc.o")))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out     (assoc-ref outputs "out"))
                      (lib     (string-append out "/lib"))
                      (include (string-append out "/include")))
                 (mkdir-p lib)
                 (install-file "libtalloc.a" lib)
                 (install-file "talloc.h" include)
                 #t)))
           (delete 'check)))))))            ;XXX: tests rely on Python modules

(define-public tevent
  (package
    (name "tevent")
    (version "0.16.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://www.samba.org/ftp/tevent/tevent-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "17h293jyya0ad4znral5vhi8qd5qqhcn6wz4dxgr1h9dygh72a9n"))))
    (build-system gnu-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-crypt-reference
           ;; The following is needed because Python.h propagates
           ;; HAVE_CRYPT_H, which is then seen from lib/replace/ but talloc
           ;; doesn't need it at all.
           (lambda _
             (substitute* "lib/replace/replace.h"
               (("#include <crypt.h>")
                ""))))
         (replace 'configure
           ;; tevent uses a custom configuration script that runs waf.
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (invoke "./configure"
                       (string-append "--prefix=" out)
                       "--bundled-libraries=NONE")))))))
    (native-inputs
     (list cmocka pkg-config python which))
    (propagated-inputs
     (list talloc)) ; required by tevent.pc
    (synopsis "Event system library")
    (home-page "https://tevent.samba.org/")
    (description
     "Tevent is an event system based on the talloc memory management library.
It is the core event system used in Samba.  The low level tevent has support for
many event types, including timers, signals, and the classic file descriptor events.")
    (license license:lgpl3+)))

(define-public ldb
  (package
    (name "ldb")
    (version "2.9.2")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://www.samba.org/ftp/ldb/ldb-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "1h6bsswcbpia86b6xzgf785m4biz06qzhhl67lfbp7f70908hmfi"))
              (modules '((guix build utils)))
              (snippet
               '(begin
                  (for-each (lambda (file)
                              ;; Delete everything except the build tools.
                              (unless (or (string-prefix? "third_party/waf" file)
                                          (string-suffix? "wscript" file))
                                (delete-file file)))
                            (find-files "third_party"))))))
    (build-system gnu-build-system)
    (arguments
     '(;; LMDB is only supported on 64-bit systems, yet the test suite
       ;; requires it.
       #:tests? (assoc-ref %build-inputs "lmdb")
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-crypt-reference
           ;; The following is needed because Python.h propagates
           ;; HAVE_CRYPT_H, which is then seen from lib/replace/ but talloc
           ;; doesn't need it at all.
           (lambda _
             (substitute* "lib/replace/replace.h"
               (("#include <crypt.h>")
                ""))))
         (replace 'configure
           ;; ldb use a custom configuration script that runs waf.
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (invoke "./configure"
                       (string-append "--prefix=" out)
                       (string-append "--with-modulesdir=" out
                                      "/lib/ldb/modules")
                       "--bundled-libraries=NONE")))))))
    (native-inputs
     (list cmocka pkg-config python which))
    (propagated-inputs
     ;; ldb.pc refers to all these.
     (list talloc tdb))
    (inputs
     `(,@(if (target-64bit?)
             `(("lmdb" ,lmdb))
             '())
       ("popt" ,popt)
       ("tevent" ,tevent)))
    (synopsis "LDAP-like embedded database")
    (home-page "https://ldb.samba.org/")
    (description
     "Ldb is a LDAP-like embedded database built on top of TDB.  What ldb does
is provide a fast database with an LDAP-like API designed to be used within an
application.  In some ways it can be seen as a intermediate solution between
key-value pair databases and a real LDAP database.")
    (license license:lgpl3+)))

(define-public ppp
  (package
    (name "ppp")
    (version "2.5.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ppp-project/ppp")
                    (commit (string-append "ppp-" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1pkvaxi5318lvsadspj603wdkxah01vgjhywri7rv249p249vfr7"))))
    (build-system gnu-build-system)
    (arguments
     (list #:tests? #f                  ; no tests
           #:configure-flags
           #~(list (string-append "CC=" #$(cc-for-target))
                   (string-append "--with-openssl="
                                  (assoc-ref %build-inputs "openssl")))
           #:make-flags #~(list "V=1")  ; better build logs
           #:phases
           #~(modify-phases %standard-phases
               (add-before 'bootstrap 'no-/bin/sh
                 (lambda _ (delete-file "autogen.sh"))))))
    (native-inputs
     (list autoconf automake libtool))
    (inputs
     (list libpcap libxcrypt openssl))
    (synopsis "Implementation of the Point-to-Point Protocol")
    (home-page "https://ppp.samba.org/")
    (description
     "The Point-to-Point Protocol (PPP) provides a standard way to establish
a network connection over a serial link.  At present, this package supports IP
and IPV6 and the protocols layered above them, such as TCP and UDP.")
    ;; pppd, pppstats and pppdump are under BSD-style notices.
    ;; some of the pppd plugins are GPL'd.
    ;; chat is public domain.
    (license (list license:bsd-3
                   license:bsd-4
                   license:gpl2+
                   license:public-domain))))

(define-public socket-wrapper
  (package
    (name "socket-wrapper")
    (version "1.5.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://git.samba.org/socket_wrapper.git/")
              (commit (string-append "socket_wrapper-" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
          "1bwvvfismcvkmld593nb89ryb0pxjav3a5hzvls5lg52xg6yv8v9"))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:configure-flags #~(list "-DUNIT_TESTING=ON")))
    (native-inputs (list cmocka))
    (home-page "https://cwrap.org/socket_wrapper.html")
    (synopsis "Library passing socket communications through Unix sockets")
    (description
     "This package aims to help client-server software development teams
achieve full functional test coverage.  It makes it possible to run several
instances of the full software stack on the same machine to functionally
test complex network configurations locally.  It provides the following
features:
@itemize
@item Redirects all network communication to happen over Unix sockets.
@item Support for IPv4 and IPv6 socket and addressing emulation.
@item Ability to capture network traffic in pcap format.
@end itemize")
    (license license:bsd-3)))

(define-public uid-wrapper
  (package
    (name "uid-wrapper")
    (version "1.3.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://git.samba.org/uid_wrapper.git/")
              (commit (string-append "uid_wrapper-" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1921vw95v7wv8c7zf6q5dqvbnkgbhsx37f8a0jswqd0qpp3zvvsy"))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:configure-flags #~(list "-DUNIT_TESTING=ON")))
    (native-inputs (list cmocka))
    (home-page "https://cwrap.org/uid_wrapper.html")
    (synopsis "Testing tool to fake privilege separation")
    (description
     "Some projects, such as a file server, need privilege separation to be
able to switch to the user who owns the files and do file operations on their
behalf.  This package convincingly lies to the application, letting it believe
it is operating as root and even switching between UIDs and GIDs as
needed.  You can start any application making it believe it is running as
root.  This package provides the following features :
@itemize
@item Allows uid switching as a normal user.
@item Start any application making it believe it is running as root.
@item Support for user/group changing in the local thread using the syscalls
(like glibc).
@item Intercepts @code{seteuid} and related calls and simulates them in a way
transparent to the application.
@end itemize")
    (license license:bsd-3)))

(define-public wsdd
  (package
    (name "wsdd")
    (version "0.7.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference (url "https://github.com/christgau/wsdd")
                           (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "16kk7x80jlargrvh643m23j277p0drs2yylqz54f9inf5ld5bxn5"))))
    (build-system gnu-build-system)
    (arguments
     (list
      #:tests? #f                       ; no test suite, only examples
      #:phases
      #~(modify-phases %standard-phases
          (delete 'configure)           ; no configure script
          (delete 'build)               ; nothing to build
          (replace 'install
            (lambda _
              (with-directory-excursion "src"
                (rename-file "wsdd.py" "wsdd")
                (install-file "wsdd" (string-append #$output "/bin")))
              (for-each
               (lambda (file)
                 (install-file file
                               (string-append #$output "/share/man/man"
                                              (string-take-right file 1))))
               (find-files "man" "\\.[0-9]$")))))))
    (inputs
     (list python))
    (home-page "https://github.com/christgau/wsdd")
    (synopsis "Web Service Discovery host daemon")
    (description "This daemon allows (Samba) hosts to be found by Web
Service Discovery Clients.  It also implements the client side of the
discovery protocol which searches for devices implementing
WSD.")
    (license license:expat)))