summaryrefslogtreecommitdiff
path: root/repo/samba
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-07-15 00:52:21 +0100
committerdavidovski <david@davidovski.xyz>2022-07-15 00:52:21 +0100
commit9a26d3fdc7fca2df6f824b56034ab9a823e898d8 (patch)
tree278bbf05c72536a30e701eebbd3546ba137543e7 /repo/samba
parentf6332a43c35387c4a2dea1746be5fd092890ae0e (diff)
added python deps for libvirt
Diffstat (limited to 'repo/samba')
-rw-r--r--repo/samba/add_missing___compar_fn_t.patch14
-rw-r--r--repo/samba/getpwent_r.patch80
-rw-r--r--repo/samba/missing-headers.patch38
-rw-r--r--repo/samba/musl_rm_unistd_incl.patch37
-rw-r--r--repo/samba/musl_uintptr.patch35
-rw-r--r--repo/samba/netapp.patch85
-rw-r--r--repo/samba/netdb-defines.patch19
-rw-r--r--repo/samba/pidl.patch114
-rw-r--r--repo/samba/samba-bgqd-include-signal-h.patch13
-rw-r--r--repo/samba/samba.confd9
-rw-r--r--repo/samba/samba.initd79
-rw-r--r--repo/samba/samba.logrotate9
-rw-r--r--repo/samba/samba.xibuild74
-rw-r--r--repo/samba/winbind.post-install6
-rw-r--r--repo/samba/winbind.post-upgrade6
-rw-r--r--repo/samba/winbind.pre-install5
-rw-r--r--repo/samba/winbind.pre-upgrade5
17 files changed, 628 insertions, 0 deletions
diff --git a/repo/samba/add_missing___compar_fn_t.patch b/repo/samba/add_missing___compar_fn_t.patch
new file mode 100644
index 0000000..96b65e6
--- /dev/null
+++ b/repo/samba/add_missing___compar_fn_t.patch
@@ -0,0 +1,14 @@
+--- a/source4/dsdb/samdb/ldb_modules/count_attrs.c
++++ b/source4/dsdb/samdb/ldb_modules/count_attrs.c
+@@ -38,6 +38,11 @@
+ #define NULL_REQ_PSEUDO_N -2LL;
+ #define STAR_REQ_PSEUDO_N -4LL;
+
++#ifndef __COMPAR_FN_T
++#define __COMPAR_FN_T
++typedef int (*__compar_fn_t)(const void *, const void *);
++#endif
++
+ struct count_attrs_private {
+ struct tdb_wrap *requested;
+ struct tdb_wrap *duplicates;
diff --git a/repo/samba/getpwent_r.patch b/repo/samba/getpwent_r.patch
new file mode 100644
index 0000000..0ba5fcc
--- /dev/null
+++ b/repo/samba/getpwent_r.patch
@@ -0,0 +1,80 @@
+diff --git a/source4/torture/local/nss_tests.c b/source4/torture/local/nss_tests.c
+index 2cd6122..04f13c6 100644
+--- a/source4/torture/local/nss_tests.c
++++ b/source4/torture/local/nss_tests.c
+@@ -247,7 +247,6 @@ static bool test_getgrnam_r(struct torture_context *tctx,
+ return true;
+ }
+
+-
+ static bool test_getgrgid(struct torture_context *tctx,
+ gid_t gid,
+ struct group *grp_p)
+@@ -333,6 +332,7 @@ static bool test_enum_passwd(struct torture_context *tctx,
+ return true;
+ }
+
++#if HAVE_GETPWENT_R
+ static bool test_enum_r_passwd(struct torture_context *tctx,
+ struct passwd **pwd_array_p,
+ size_t *num_pwd_p)
+@@ -383,6 +383,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx,
+
+ return true;
+ }
++#endif
+
+ static bool torture_assert_passwd_equal(struct torture_context *tctx,
+ const struct passwd *p1,
+@@ -434,7 +435,7 @@ static bool test_passwd_r(struct torture_context *tctx)
+ struct passwd *pwd, pwd1, pwd2;
+ size_t num_pwd;
+
+- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd),
++ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd),
+ "failed to enumerate passwd");
+
+ for (i=0; i < num_pwd; i++) {
+@@ -462,7 +463,7 @@ static bool test_passwd_r_cross(struct torture_context *tctx)
+ struct passwd *pwd, pwd1, pwd2, pwd3, pwd4;
+ size_t num_pwd;
+
+- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd),
++ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd),
+ "failed to enumerate passwd");
+
+ for (i=0; i < num_pwd; i++) {
+@@ -533,6 +534,7 @@ static bool test_enum_group(struct torture_context *tctx,
+ return true;
+ }
+
++#if HAVE_GETGRENT_R
+ static bool test_enum_r_group(struct torture_context *tctx,
+ struct group **grp_array_p,
+ size_t *num_grp_p)
+@@ -583,6 +585,7 @@ static bool test_enum_r_group(struct torture_context *tctx,
+
+ return true;
+ }
++#endif
+
+ static bool torture_assert_group_equal(struct torture_context *tctx,
+ const struct group *g1,
+@@ -639,7 +642,7 @@ static bool test_group_r(struct torture_context *tctx)
+ struct group *grp, grp1, grp2;
+ size_t num_grp;
+
+- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp),
++ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp),
+ "failed to enumerate group");
+
+ for (i=0; i < num_grp; i++) {
+@@ -667,7 +670,7 @@ static bool test_group_r_cross(struct torture_context *tctx)
+ struct group *grp, grp1, grp2, grp3, grp4;
+ size_t num_grp;
+
+- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp),
++ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp),
+ "failed to enumerate group");
+
+ for (i=0; i < num_grp; i++) {
diff --git a/repo/samba/missing-headers.patch b/repo/samba/missing-headers.patch
new file mode 100644
index 0000000..58c26ae
--- /dev/null
+++ b/repo/samba/missing-headers.patch
@@ -0,0 +1,38 @@
+diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h
+index b5d79b9..3f4eae0 100644
+--- a/lib/param/loadparm.h
++++ b/lib/param/loadparm.h
+@@ -31,6 +31,7 @@
+ #define _LOADPARM_H
+
+ #include <talloc.h>
++#include <time.h>
+
+ struct parmlist_entry {
+ struct parmlist_entry *prev, *next;
+diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c
+index 3b1ac9c..4044d75 100644
+--- a/source3/lib/system_smbd.c
++++ b/source3/lib/system_smbd.c
+@@ -27,6 +27,8 @@
+ #include "system/passwd.h"
+ #include "nsswitch/winbind_client.h"
+ #include "../lib/util/setid.h"
++#include <grp.h>
++#include <uuid/uuid.h>
+
+ #ifndef HAVE_GETGROUPLIST
+
+diff --git a/source4/torture/local/nss_tests.c b/source4/torture/local/nss_tests.c
+index 2cd6122..0c84ec2 100644
+--- a/source4/torture/local/nss_tests.c
++++ b/source4/torture/local/nss_tests.c
+@@ -20,6 +20,8 @@
+ */
+
+ #include "includes.h"
++#include <grp.h>
++#include <uuid/uuid.h>
+
+ #include "torture/torture.h"
+ #include "torture/local/proto.h"
diff --git a/repo/samba/musl_rm_unistd_incl.patch b/repo/samba/musl_rm_unistd_incl.patch
new file mode 100644
index 0000000..1f4aae2
--- /dev/null
+++ b/repo/samba/musl_rm_unistd_incl.patch
@@ -0,0 +1,37 @@
+--- a/lib/replace/replace.h
++++ b/lib/replace/replace.h
+@@ -168,10 +168,6 @@
+ #include <bsd/unistd.h>
+ #endif
+
+-#ifdef HAVE_UNISTD_H
+-#include <unistd.h>
+-#endif
+-
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #endif
+--- a/lib/replace/system/network.h
++++ b/lib/replace/system/network.h
+@@ -31,10 +31,6 @@
+ #error "AC_LIBREPLACE_NETWORK_CHECKS missing in configure"
+ #endif
+
+-#ifdef HAVE_UNISTD_H
+-#include <unistd.h>
+-#endif
+-
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+--- a/source3/rpc_server/mdssvc/mdssvc.c
++++ b/source3/rpc_server/mdssvc/mdssvc.c
+@@ -18,6 +18,8 @@
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
++#include <unistd.h>
++
+ #include "includes.h"
+ #include "librpc/gen_ndr/auth.h"
+ #include "dbwrap/dbwrap.h"
diff --git a/repo/samba/musl_uintptr.patch b/repo/samba/musl_uintptr.patch
new file mode 100644
index 0000000..de7f285
--- /dev/null
+++ b/repo/samba/musl_uintptr.patch
@@ -0,0 +1,35 @@
+commit f81e5b71ce78f33250347914dacc75c8463bf102
+Author: Breno Leitao <breno.leitao@gmail.com>
+Date: Wed Mar 29 15:22:38 2017 -0300
+
+ include: Check for previous declaration of uintptr_t
+
+ Adding a extra check before declaring uintptr_t. Currently musl uses
+ macro __DEFINED_uintptr_t once it defines uintptr_t type. Checking
+ this macro before defining it, and, defining it when uintptr_t is
+ defined.
+
+ Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
+
+diff --git a/third_party/cmocka/cmocka.h b/third_party/cmocka/cmocka.h
+index 303d0ae..a2bfc40 100644
+--- a/third_party/cmocka/cmocka.h
++++ b/third_party/cmocka/cmocka.h
+@@ -111,7 +111,7 @@
+ ((LargestIntegralType)(value))
+
+ /* Smallest integral type capable of holding a pointer. */
+-#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
++#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(__DEFINED_uintptr_t)
+ # if defined(_WIN32)
+ /* WIN32 is an ILP32 platform */
+ typedef unsigned int uintptr_t;
+@@ -137,6 +137,8 @@
+
+ # define _UINTPTR_T
+ # define _UINTPTR_T_DEFINED
++# define __DEFINED_uintptr_t
++
+ #endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
+
+ /* Perform an unsigned cast to uintptr_t. */
diff --git a/repo/samba/netapp.patch b/repo/samba/netapp.patch
new file mode 100644
index 0000000..fea413c
--- /dev/null
+++ b/repo/samba/netapp.patch
@@ -0,0 +1,85 @@
+https://bugzilla.samba.org/show_bug.cgi?id=12776
+
+diff --git a/source3/include/client.h b/source3/include/client.h
+index db8260d..becdf77 100644
+--- a/source3/include/client.h
++++ b/source3/include/client.h
+@@ -61,6 +61,9 @@ struct cli_state {
+ char *server_os;
+ char *server_domain;
+
++ /* is server_os spinstream2? true/false/not-yet-checked(-1) */
++ int is_spinstream2;
++
+ char *share;
+ char *dev;
+
+diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
+index bc5c1b1..6d6b725 100644
+--- a/source3/libsmb/clientgen.c
++++ b/source3/libsmb/clientgen.c
+@@ -111,6 +111,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
+ if (!cli->server_os) {
+ goto error;
+ }
++ cli->is_spinstream2 = -1;
+ cli->server_type = talloc_strdup(cli, "");
+ if (!cli->server_type) {
+ goto error;
+@@ -467,6 +468,24 @@ time_t cli_state_server_time(struct cli_state *cli)
+ return t;
+ }
+
++bool cli_state_server_is_spinstream2(struct cli_state *cli)
++{
++ int *ret = &cli->is_spinstream2;
++ if (*ret == -1) {
++ if (*cli->server_os == '\0') {
++ DEBUG(1, ("when checking if server is SpinStream2:"
++ " server_os field is empty (should have"
++ " been sent in Session Setup protocol"
++ " response), so ... presuming not"));
++ *ret = 0;
++ }
++ else {
++ *ret = strequal(cli->server_os, "SpinStream2") ? 1 : 0;
++ }
++ }
++ return *ret == 1;
++}
++
+ struct cli_echo_state {
+ bool is_smb2;
+ };
+diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
+index 3987477..6371bc2 100644
+--- a/source3/libsmb/clireadwrite.c
++++ b/source3/libsmb/clireadwrite.c
+@@ -89,6 +89,13 @@ static size_t cli_write_max_bufsize(struct cli_state *cli,
+ useable_space = 0xFFFFFF - data_offset;
+ } else if (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_WRITEX) {
+ useable_space = 0x1FFFF - data_offset;
++ if (cli_state_server_is_spinstream2(cli))
++ /*
++ * SpinStream2 (NetApp OnTAP, up to 8.3.2, at least;
++ * XXX may need to be more discerning than this)
++ * can't handle writes > 64k
++ */
++ useable_space = MIN(useable_space, 64 * 1024);
+ } else {
+ return min_space;
+ }
+diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
+index b453733..e334cc6 100644
+--- a/source3/libsmb/proto.h
++++ b/source3/libsmb/proto.h
+@@ -203,6 +203,7 @@ uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
+ bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
+ uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
+ time_t cli_state_server_time(struct cli_state *cli);
++bool cli_state_server_is_spinstream2(struct cli_state *cli);
+ struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+ struct cli_state *cli, uint16_t num_echos,
+ DATA_BLOB data);
+
+
diff --git a/repo/samba/netdb-defines.patch b/repo/samba/netdb-defines.patch
new file mode 100644
index 0000000..d7d6446
--- /dev/null
+++ b/repo/samba/netdb-defines.patch
@@ -0,0 +1,19 @@
+diff --git a/nsswitch/wins.c b/nsswitch/wins.c
+index dccb6dd..bb24acb 100644
+--- a/nsswitch/wins.c
++++ b/nsswitch/wins.c
+@@ -39,6 +39,14 @@ static pthread_mutex_t wins_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
+ #define INADDRSZ 4
+ #endif
+
++#ifndef NETDB_INTERNAL
++#define NETDB_INTERNAL -1
++#endif
++
++#ifndef NETDB_SUCCESS
++#define NETDB_SUCCESS 0
++#endif
++
+ NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname,
+ struct hostent *he,
+ char *buffer,
diff --git a/repo/samba/pidl.patch b/repo/samba/pidl.patch
new file mode 100644
index 0000000..60359e5
--- /dev/null
+++ b/repo/samba/pidl.patch
@@ -0,0 +1,114 @@
+From 838457ac4f9f3f6c1bb5936738566210a62cbdc5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
+Date: Tue, 27 Aug 2019 15:25:13 +0200
+Subject: [PATCH] Revert "waf: install: Remove installation of PIDL and
+ manpages."
+
+This reverts commit e24e344d0da58013fd5fa404529fe1d25ef403bf.
+
+BUG: https://bugzilla.samba.org/show_bug.cgi?id=14103
+
+Guenther
+
+Signed-off-by: Guenther Deschner <gd@samba.org>
+---
+ pidl/lib/wscript_build | 37 +++++++++++++++++++++++++++++++++++++
+ pidl/wscript | 38 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 75 insertions(+)
+ create mode 100644 pidl/lib/wscript_build
+
+diff --git a/pidl/lib/wscript_build b/pidl/lib/wscript_build
+new file mode 100644
+index 00000000000..54b3170c4e2
+--- /dev/null
++++ b/pidl/lib/wscript_build
+@@ -0,0 +1,33 @@
++#!/usr/bin/env python
++
++# install the pidl modules
++bld.INSTALL_FILES(bld.env.PERL_LIB_INSTALL_DIR,
++ '''
++ Parse/Pidl.pm
++ Parse/Pidl/Samba4.pm
++ Parse/Pidl/CUtil.pm
++ Parse/Pidl/Expr.pm
++ Parse/Pidl/Wireshark/Conformance.pm
++ Parse/Pidl/Wireshark/NDR.pm
++ Parse/Pidl/ODL.pm
++ Parse/Pidl/Dump.pm
++ Parse/Pidl/Util.pm
++ Parse/Pidl/Samba4/Header.pm
++ Parse/Pidl/Samba4/COM/Header.pm
++ Parse/Pidl/Samba4/COM/Proxy.pm
++ Parse/Pidl/Samba4/COM/Stub.pm
++ Parse/Pidl/Samba4/TDR.pm
++ Parse/Pidl/Samba4/NDR/Server.pm
++ Parse/Pidl/Samba4/NDR/Client.pm
++ Parse/Pidl/Samba4/NDR/Parser.pm
++ Parse/Pidl/Samba4/Python.pm
++ Parse/Pidl/Samba4/Template.pm
++ Parse/Pidl/IDL.pm
++ Parse/Pidl/Typelist.pm
++ Parse/Pidl/Samba3/ClientNDR.pm
++ Parse/Pidl/Samba3/ServerNDR.pm
++ Parse/Pidl/Compat.pm
++ Parse/Pidl/NDR.pm
++ ''',
++ flat=False)
++
+diff --git a/pidl/wscript b/pidl/wscript
+index 01b71bd8b27..a2a15d36851 100644
+--- a/pidl/wscript
++++ b/pidl/wscript
+@@ -28,12 +28,51 @@
+ 1.05):
+ raise Errors.WafError('perl module "Parse::Yapp::Driver" not found')
+
++ # we need a recent version of MakeMaker to get the right man page names
++ if conf.CHECK_PERL_MANPAGE():
++ conf.env.PERLMAN1EXT = conf.CHECK_PERL_MANPAGE(section='1')
++ conf.env.PERLMAN3EXT = conf.CHECK_PERL_MANPAGE(section='3')
++ conf.DEFINE('HAVE_PERL_MAKEMAKER', 1)
++
+ # yapp is used for building the parser
+ if not conf.find_program('yapp', var='YAPP'):
+ raise Errors.WafError('yapp not found')
++ conf.find_program('pod2man', var='POD2MAN')
+
+ def build(bld):
++ bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=MODE_755, perl_fixup=True)
++
++ bld.RECURSE('lib')
++
++ if not bld.CONFIG_SET('HAVE_PERL_MAKEMAKER'):
++ return
++
++ pidl_manpages = {
++ 'pidl': 'man1/pidl.${PERLMAN1EXT}',
++ 'lib/Parse/Pidl/NDR.pm': 'man3/Parse::Pidl::NDR.${PERLMAN3EXT}',
++ 'lib/Parse/Pidl/Wireshark/Conformance.pm': 'man3/Parse::Pidl::Wireshark::Conformance.${PERLMAN3EXT}',
++ 'lib/Parse/Pidl/Dump.pm': 'man3/Parse::Pidl::Dump.${PERLMAN3EXT}',
++ 'lib/Parse/Pidl/Util.pm': 'man3/Parse::Pidl::Util.${PERLMAN3EXT}',
++ 'lib/Parse/Pidl/Wireshark/NDR.pm': 'man3/Parse::Pidl::Wireshark::NDR.${PERLMAN3EXT}'
++ }
++
++ for k in pidl_manpages.keys():
++ pidl_manpages[k] = bld.EXPAND_VARIABLES(pidl_manpages[k])
++
++ # use perl to build the manpages
++ bld.env.pidl_srcdir = os.path.join(bld.srcnode.abspath(), 'pidl')
+
++ bld.SET_BUILD_GROUP('final')
++ if 'POD2MAN' in bld.env and bld.env['POD2MAN'] != '':
++ for src in pidl_manpages.keys():
++ manpage = pidl_manpages[src]
++ section = manpage.rsplit( ".", 1)[1]
++ bld(rule='${POD2MAN} -c "Samba Documentation" -s %s ${SRC} ${TGT}' % section,
++ shell=True,
++ source=src,
++ install_path=os.path.dirname(bld.EXPAND_VARIABLES('${MANDIR}/'+manpage)),
++ target=os.path.basename(manpage))
++
+ # we want to prefer the git version of the parsers if we can.
+ # Only if the source has changed do we want to re-run yapp
+ # But we force the developer to use the pidl standalone build
diff --git a/repo/samba/samba-bgqd-include-signal-h.patch b/repo/samba/samba-bgqd-include-signal-h.patch
new file mode 100644
index 0000000..c066223
--- /dev/null
+++ b/repo/samba/samba-bgqd-include-signal-h.patch
@@ -0,0 +1,13 @@
+SIGTERM and SIGPIPE are used but undefined.
+diff --git a/source3/printing/samba-bgqd.c b/source3/printing/samba-bgqd.c
+index 8ac6ec5..09a5d12 100644
+--- a/source3/printing/samba-bgqd.c
++++ b/source3/printing/samba-bgqd.c
+@@ -41,6 +41,7 @@
+ #include "source3/auth/proto.h"
+ #include "source3/printing/queue_process.h"
+ #include "source3/lib/substitute.h"
++#include <signal.h>
+
+ static void watch_handler(struct tevent_req *req)
+ {
diff --git a/repo/samba/samba.confd b/repo/samba/samba.confd
new file mode 100644
index 0000000..902cb1a
--- /dev/null
+++ b/repo/samba/samba.confd
@@ -0,0 +1,9 @@
+# Add "winbindd" to daemon_list if you want start winbind from here as well
+daemon_list="smbd nmbd"
+# Use "samba" alone for role based samba4 services (eg: ad-dc).
+#daemon_list="samba"
+
+smbd_options="-D"
+nmbd_options="-D"
+#winbindd_options=""
+#samba_options=""
diff --git a/repo/samba/samba.initd b/repo/samba/samba.initd
new file mode 100644
index 0000000..71c7fb2
--- /dev/null
+++ b/repo/samba/samba.initd
@@ -0,0 +1,79 @@
+#!/sbin/openrc-run
+
+extra_started_commands="reload"
+piddir=${piddir:-"/run/samba"}
+
+DAEMON=${RC_SVCNAME#samba.}
+if [ "$DAEMON" != "$RC_SVCNAME" ]; then
+ daemon_list=$DAEMON
+fi
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath --directory "$piddir"
+}
+
+start_samba() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/samba -- \
+ ${samba_options:-"-D"}
+}
+
+stop_samba() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/samba.pid
+}
+
+start_smbd() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- \
+ ${smbd_options:-"-D"}
+}
+
+stop_smbd() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/smbd.pid
+}
+
+start_nmbd() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- \
+ ${nmbd_options:-"-D"}
+}
+
+stop_nmbd() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/nmbd.pid
+}
+
+start_winbindd() {
+ start-stop-daemon --start --quiet --exec /usr/sbin/winbindd -- \
+ $winbindd_options
+}
+
+stop_winbindd() {
+ start-stop-daemon --stop --quiet --pidfile "$piddir"/winbindd.pid
+}
+
+start() {
+ for i in $daemon_list; do
+ ebegin "Starting $i"
+ start_$i
+ eend $?
+ done
+}
+
+stop() {
+ for i in $daemon_list; do
+ ebegin "Stopping $i"
+ stop_$i
+ eend $?
+ done
+}
+
+reload() {
+ for i in $daemon_list; do
+ ebegin "Reloading $i"
+ killall -HUP $i
+ eend $?
+ done
+}
+
diff --git a/repo/samba/samba.logrotate b/repo/samba/samba.logrotate
new file mode 100644
index 0000000..88abb90
--- /dev/null
+++ b/repo/samba/samba.logrotate
@@ -0,0 +1,9 @@
+/var/log/samba/log.* /var/log/samba/*.log {
+ notifempty
+ missingok
+ sharedscripts
+ copytruncate
+ postrotate
+ /etc/init.d/samba --quiet --ifstarted reload
+ endscript
+}
diff --git a/repo/samba/samba.xibuild b/repo/samba/samba.xibuild
new file mode 100644
index 0000000..b6fe918
--- /dev/null
+++ b/repo/samba/samba.xibuild
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+NAME="samba"
+DESC="Tools to access a server's filespace and printers via SMB"
+
+MAKEDEPS="acl bind cups dbus docbook-xsl e2fsprogs fuse gnutls iniparser jansson ldb libarchive libcap libtirpc liburing linux-pam musl-nscd ncurses openldap perl perl-parse-yapp popt python-tdb python-tevent python3 rpcgen subunit talloc tdb tevent zlib python-dnspython python-markdown tdb"
+
+PKG_VER=4.15.6
+SOURCE="
+ https://download.samba.org/pub/samba/stable/samba-$PKG_VER.tar.gz
+ "
+
+ADDITIONAL="
+add_missing___compar_fn_t.patch
+getpwent_r.patch
+missing-headers.patch
+musl_rm_unistd_incl.patch
+musl_uintptr.patch
+netapp.patch
+netdb-defines.patch
+pidl.patch
+samba-bgqd-include-signal-h.patch
+samba.confd
+samba.initd
+samba.logrotate
+winbind.post-install
+winbind.post-upgrade
+winbind.pre-install
+winbind.pre-upgrade
+"
+
+build() {
+ local _idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
+ local _pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
+ local _auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
+
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc/samba \
+ --with-configdir=/etc/samba \
+ --localstatedir=/var \
+ --libexecdir=/usr/lib \
+ --enable-fhs \
+ --with-lockdir=/var/cache/samba \
+ --with-piddir=/run/samba \
+ --with-logfilebase=/var/log/samba \
+ --with-pam \
+ --without-systemd \
+ --with-ads \
+ --with-shared-modules=$_idmap_modules,$_pdb_modules,$_auth_modules,vfs_io_uring \
+ --enable-cups \
+ --without-gettext \
+ --bundled-libraries=NONE,ntdb,roken,wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,cmocka \
+ --disable-rpath-install \
+ --without-gpgme
+ make -j"$(nproc)"
+}
+
+package() {
+ make DESTDIR="$PKG_DEST" install
+
+ install -d "$PKG_DEST"/var/log/samba \
+ "$PKG_DEST"/usr/share/doc/samba
+ install -dm755 "$PKG_DEST"/var/lib/samba/sysvol
+ install -Dm644 examples/smb.conf.default \
+ "$PKG_DEST"/etc/samba/smb.conf
+ install -m744 packaging/printing/smbprint \
+ "$PKG_DEST"/usr/bin/smbprint
+ install -Dm644 "$BUILD_ROOT"/samba.logrotate \
+ "$PKG_DEST"/etc/logrotate.d/samba
+
+ install -Dm755 "$BUILD_ROOT/samba.initd" "$PKG_DEST/etc/init.d/samba"
+ install -Dm644 "$BUILD_ROOT/samba.confd" "$PKG_DEST/etc/conf.d/samba"
+}
diff --git a/repo/samba/winbind.post-install b/repo/samba/winbind.post-install
new file mode 100644
index 0000000..59abe0f
--- /dev/null
+++ b/repo/samba/winbind.post-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+chgrp winbind /var/cache/samba/winbindd_privileged
+chmod 750 /var/cache/samba/winbindd_privileged
+exit 0
+
diff --git a/repo/samba/winbind.post-upgrade b/repo/samba/winbind.post-upgrade
new file mode 100644
index 0000000..59abe0f
--- /dev/null
+++ b/repo/samba/winbind.post-upgrade
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+chgrp winbind /var/cache/samba/winbindd_privileged
+chmod 750 /var/cache/samba/winbindd_privileged
+exit 0
+
diff --git a/repo/samba/winbind.pre-install b/repo/samba/winbind.pre-install
new file mode 100644
index 0000000..ac4df3f
--- /dev/null
+++ b/repo/samba/winbind.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S winbind 2>/dev/null
+
+exit 0
diff --git a/repo/samba/winbind.pre-upgrade b/repo/samba/winbind.pre-upgrade
new file mode 100644
index 0000000..ac4df3f
--- /dev/null
+++ b/repo/samba/winbind.pre-upgrade
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S winbind 2>/dev/null
+
+exit 0