samba36: add a stripped-down multicall samba 3.6, including smbd, nmbd and smbpasswd...
authorFelix Fietkau <nbd@openwrt.org>
Mon, 13 Feb 2012 03:51:59 +0000 (03:51 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 13 Feb 2012 03:51:59 +0000 (03:51 +0000)
SVN-Revision: 30489

12 files changed:
net/samba36/Makefile [new file with mode: 0644]
net/samba36/files/samba.config [new file with mode: 0644]
net/samba36/files/samba.init [new file with mode: 0755]
net/samba36/files/smb.conf.template [new file with mode: 0644]
net/samba36/patches/100-configure_fixes.patch [new file with mode: 0644]
net/samba36/patches/110-optional_printer_support.patch [new file with mode: 0644]
net/samba36/patches/120-no_ad_support.patch [new file with mode: 0644]
net/samba36/patches/130-remove_services.patch [new file with mode: 0644]
net/samba36/patches/140-no_winreg_support.patch [new file with mode: 0644]
net/samba36/patches/150-no_dfs_api.patch [new file with mode: 0644]
net/samba36/patches/160-add_missing_ifdef.patch [new file with mode: 0644]
net/samba36/patches/200-multicall.patch [new file with mode: 0644]

diff --git a/net/samba36/Makefile b/net/samba36/Makefile
new file mode 100644 (file)
index 0000000..28e4880
--- /dev/null
@@ -0,0 +1,109 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=samba
+PKG_VERSION:=3.6.3
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL_SUBDIR:=/
+PKG_SOURCE_URL:=http://ftp.samba.org/pub/samba$(PKG_SOURCE_URL_SUBDIR)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=98ac9db9f4b6ebfc3f013aa193ffb0d1
+
+include $(INCLUDE_DIR)/package.mk
+
+MAKE_PATH:=source3
+CONFIGURE_PATH:=source3
+
+PKG_BUILD_BIN:=$(PKG_BUILD_DIR)/$(MAKE_PATH)/bin
+
+define Package/samba36-server
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Samba 3.6 SMB/CIFS server
+  URL:=http://www.samba.org/
+endef
+
+define Package/samba36-server/description
+ The Samba software suite is a collection of programs that implements the
+ SMB protocol for UNIX systems, allowing you to serve files and printers to
+ Windows, NT, OS/2 and DOS clients. This protocol is sometimes also referred
+ to as the LanManager or Netbios protocol.
+endef
+
+TARGET_CFLAGS += -DMAX_DEBUG_LEVEL=2 -ffunction-sections -fdata-sections
+TARGET_LDFLAGS += -Wl,--gc-sections
+
+CONFIGURE_VARS += \
+       ac_cv_file__proc_sys_kernel_core_pattern=yes \
+       libreplace_cv_HAVE_C99_VSNPRINTF=yes \
+       libreplace_cv_HAVE_GETADDRINFO=yes \
+       libreplace_cv_HAVE_IFACE_IFCONF=yes \
+       LINUX_LFS_SUPPORT=yes \
+       samba_cv_CC_NEGATIVE_ENUM_VALUES=yes \
+       samba_cv_HAVE_GETTIMEOFDAY_TZ=yes \
+       samba_cv_HAVE_IFACE_IFCONF=yes \
+       samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes \
+       samba_cv_HAVE_SECURE_MKSTEMP=yes \
+       samba_cv_HAVE_WRFILE_KEYTAB=no \
+       samba_cv_USE_SETREUID=yes \
+       samba_cv_USE_SETRESUID=yes \
+       samba_cv_have_setreuid=yes \
+       samba_cv_have_setresuid=yes
+
+CONFIGURE_ARGS += \
+       --exec-prefix=/usr \
+       --prefix=/ \
+       --disable-avahi \
+       --disable-cups \
+       --disable-pie \
+       --disable-relro \
+       --disable-static \
+       --disable-swat \
+       --with-codepagedir=/etc/samba \
+       --with-configdir=/etc/samba \
+       --with-included-iniparser \
+       --with-included-popt \
+       --with-lockdir=/var/lock \
+       --with-logfilebase=/var/log \
+       --with-nmbdsocketdir=/var/nmbd \
+       --with-piddir=/var/run \
+       --with-privatedir=/etc/samba \
+       --with-sendfile-support \
+       --without-cluster-support \
+       --without-ads \
+       --without-krb5 \
+       --without-ldap \
+       --without-pam \
+       --without-winbind
+
+MAKE_FLAGS += DYNEXP=
+
+define Package/samba36-server/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/samba.config $(1)/etc/config/samba
+       $(INSTALL_DIR) $(1)/etc/samba
+       $(INSTALL_DATA) ./files/smb.conf.template $(1)/etc/samba
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/codepages/lowcase.dat $(1)/etc/samba
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/codepages/upcase.dat $(1)/etc/samba
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/codepages/valid.dat $(1)/etc/samba
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_BIN)/libtalloc.so.2 $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_BIN)/libtdb.so.1 $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/samba.init $(1)/etc/init.d/samba
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_BIN)/samba_multicall $(1)/usr/sbin
+       ln -sf samba_multicall $(1)/usr/sbin/smbd
+       ln -sf samba_multicall $(1)/usr/sbin/nmbd
+endef
+
+$(eval $(call BuildPackage,samba36-server))
+
diff --git a/net/samba36/files/samba.config b/net/samba36/files/samba.config
new file mode 100644 (file)
index 0000000..c79db0d
--- /dev/null
@@ -0,0 +1,6 @@
+config samba
+       option 'name'                   'OpenWrt'
+       option 'workgroup'              'WORKGROUP'
+       option 'description'            'OpenWrt'
+       option 'homes'                  '1'
+
diff --git a/net/samba36/files/samba.init b/net/samba36/files/samba.init
new file mode 100755 (executable)
index 0000000..8ec6277
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=60
+
+smb_header() {
+       local name
+       local workgroup
+       local description
+       local homes
+
+       config_get name $1 name
+       config_get workgroup $1 workgroup
+       config_get description $1 description
+       config_get homes $1 homes
+
+       [ -z "$name" ] && name=openwrt
+       [ -z "$workgroup" ] && workgroup=openwrt
+       [ -z "$description" ] && description=openwrt
+
+       cp /etc/samba/smb.conf.template /tmp/smb.conf
+       [ -L /etc/samba/smb.conf ] || ln -nsf /tmp/smb.conf /etc/samba/smb.conf
+       sed -i "s/|NAME|/$name/g" /tmp/smb.conf
+       sed -i "s/|WORKGROUP|/$workgroup/g" /tmp/smb.conf
+       sed -i "s/|DESCRIPTION|/$description/g" /tmp/smb.conf
+       [ "$homes" == "1" ] && {
+               echo -e "\n[homes]\n\tcomment = Home Directories\n\tbrowseable = no\n\tread only = no\n\tcreate mode = 0750" >> /tmp/smb.conf
+       }
+}
+
+smb_add_share() {
+       local name
+       local path
+       local users
+       local read_only
+       local guest_ok
+       local create_mask
+       local dir_mask
+
+       config_get name $1 name
+       config_get path $1 path
+       config_get users $1 users
+       config_get read_only $1 read_only
+       config_get guest_ok $1 guest_ok
+       config_get create_mask $1 create_mask
+       config_get dir_mask $1 dir_mask
+
+       [ -z "$name" -o -z "$path" ] && return
+
+       echo -e "\n[$name]\n\tpath = $path" >> /tmp/smb.conf
+       [ -n "$users" ] && echo -e "\tvalid users = $users" >> /tmp/smb.conf
+       [ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /tmp/smb.conf
+       [ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /tmp/smb.conf
+       [ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /tmp/smb.conf
+       [ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /tmp/smb.conf
+}
+
+start() {
+       config_load samba
+       config_foreach smb_header samba
+       config_foreach smb_add_share sambashare
+       service_start /usr/sbin/smbd -D
+       service_start /usr/sbin/nmbd -D
+}
+
+stop() {
+       service_stop /usr/sbin/smbd
+       service_stop /usr/sbin/nmbd
+}
diff --git a/net/samba36/files/smb.conf.template b/net/samba36/files/smb.conf.template
new file mode 100644 (file)
index 0000000..47f2f9c
--- /dev/null
@@ -0,0 +1,40 @@
+[global]
+       netbios name = |NAME| 
+       workgroup = |WORKGROUP|
+       server string = |DESCRIPTION|
+       browseable = yes
+       deadtime = 15
+       encrypt passwords = true
+       enable core files = no
+       guest account = nobody
+       invalid users = root
+       load printers = no
+       local master = yes
+       map to guest = Bad User
+       max protocol = SMB2
+       min receivefile size = 16384
+       null passwords = yes
+       obey pam restrictions = yes
+       os level = 20
+       passdb backend = smbpasswd
+       #passdb backend = tdbsam
+       preferred master = yes
+       printable = no
+       reset on zero vc = yes
+       remote announce = 192.168.1.255
+       security = user
+       smb encrypt = disableennounce = 192.168.1.255
+        security = user
+        smb encrypt = disabled
+       smb passwd file = /etc/samba/smbpasswd
+       socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65535 SO_SNDBUF=65535
+       syslog = 2
+       writeable = yes
+       unix charset = UTF-8
+       use sendfile = yes
+
+[template]
+       browseable = yes
+       guest ok = yes
+       writeable = yes
+
diff --git a/net/samba36/patches/100-configure_fixes.patch b/net/samba36/patches/100-configure_fixes.patch
new file mode 100644 (file)
index 0000000..0f20bbb
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/source3/configure
++++ b/source3/configure
+@@ -13285,10 +13285,7 @@ if test x"$libreplace_cv_HAVE_GETADDRINF
+       # see bug 5910, use our replacements if we detect
+       # a broken system.
+       if test "$cross_compiling" = yes; then :
+-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+-as_fn_error "cannot run test program while cross compiling
+-See \`config.log' for more details." "$LINENO" 5; }
++              $as_echo "assuming valid getaddrinfo without bug 5910" >&2
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/net/samba36/patches/110-optional_printer_support.patch b/net/samba36/patches/110-optional_printer_support.patch
new file mode 100644 (file)
index 0000000..46254ba
--- /dev/null
@@ -0,0 +1,356 @@
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -1110,6 +1110,10 @@ bool dcesrv_ep_setup(struct tevent_conte
+                                          "rpc_server",
+                                          "spoolss",
+                                          "embedded");
++#ifndef PRINTER_SUPPORT
++      if (1) {
++      } else
++#endif
+       if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
+               spoolss_cb.init         = spoolss_init_cb;
+               spoolss_cb.shutdown     = spoolss_shutdown_cb;
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -624,7 +624,9 @@ static struct cmd_set *rpcclient_command
+       lsarpc_commands,
+       ds_commands,
+       samr_commands,
++#ifdef PRINTER_SUPPORT
+       spoolss_commands,
++#endif
+       netlogon_commands,
+       srvsvc_commands,
+       dfs_commands,
+--- a/source3/printing/spoolssd.c
++++ b/source3/printing/spoolssd.c
+@@ -153,6 +153,10 @@ void start_spoolssd(struct tevent_contex
+       NTSTATUS status;
+       int ret;
++#ifndef PRINTER_SUPPORT
++      return;
++#endif
++
+       DEBUG(1, ("Forking SPOOLSS Daemon\n"));
+       pid = sys_fork();
+--- a/source3/utils/net_rpc.c
++++ b/source3/utils/net_rpc.c
+@@ -7791,6 +7791,10 @@ int net_rpc_printer(struct net_context *
+               {NULL, NULL, 0, NULL, NULL}
+       };
++#ifndef PRINTER_SUPPORT
++      return 0;
++#endif
++
+       if (argc == 0) {
+               if (c->display_usage) {
+                       d_printf(_("Usage:\n"));
+--- a/source3/smbd/reply.c
++++ b/source3/smbd/reply.c
+@@ -5194,7 +5194,11 @@ void reply_printopen(struct smb_request 
+               return;
+       }
+-      if (!CAN_PRINT(conn)) {
++
++#ifdef PRINTER_SUPPORT
++      if (!CAN_PRINT(conn))
++#endif
++      {
+               reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+               END_PROFILE(SMBsplopen);
+               return;
+@@ -5300,7 +5304,10 @@ void reply_printqueue(struct smb_request
+          is really quite gross and only worked when there was only
+          one printer - I think we should now only accept it if they
+          get it right (tridge) */
+-      if (!CAN_PRINT(conn)) {
++#ifdef PRINTER_SUPPORT
++      if (!CAN_PRINT(conn))
++#endif
++      {
+               reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+               END_PROFILE(SMBsplretq);
+               return;
+--- a/source3/smbd/lanman.c
++++ b/source3/smbd/lanman.c
+@@ -784,6 +784,10 @@ static bool api_DosPrintQGetInfo(struct 
+       union spoolss_JobInfo *job_info = NULL;
+       union spoolss_PrinterInfo printer_info;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -999,6 +1003,10 @@ static bool api_DosPrintQEnum(struct smb
+       union spoolss_DriverInfo *driver_info;
+       union spoolss_JobInfo **job_info;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!param_format || !output_format1 || !p) {
+               return False;
+       }
+@@ -3350,6 +3358,10 @@ static bool api_RDosPrintJobDel(struct s
+       struct spoolss_DevmodeContainer devmode_ctr;
+       enum spoolss_JobControl command;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -3483,6 +3495,10 @@ static bool api_WPrintQueueCtrl(struct s
+       struct sec_desc_buf secdesc_ctr;
+       enum spoolss_PrinterControl command;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !QueueName) {
+               return False;
+       }
+@@ -3649,6 +3665,10 @@ static bool api_PrintJobInfo(struct smbd
+       union spoolss_JobInfo info;
+       struct spoolss_SetJobInfo1 info1;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -4792,6 +4812,10 @@ static bool api_WPrintJobGetInfo(struct 
+       struct spoolss_DevmodeContainer devmode_ctr;
+       union spoolss_JobInfo info;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -4930,6 +4954,10 @@ static bool api_WPrintJobEnumerate(struc
+       uint32_t count = 0;
+       union spoolss_JobInfo *info;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -5135,6 +5163,10 @@ static bool api_WPrintDestGetInfo(struct
+       struct spoolss_DevmodeContainer devmode_ctr;
+       union spoolss_PrinterInfo info;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -5271,6 +5303,10 @@ static bool api_WPrintDestEnum(struct sm
+       union spoolss_PrinterInfo *info;
+       uint32_t count;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -5374,6 +5410,10 @@ static bool api_WPrintDriverEnum(struct 
+       int succnt;
+       struct pack_desc desc;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -5438,6 +5478,10 @@ static bool api_WPrintQProcEnum(struct s
+       int succnt;
+       struct pack_desc desc;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+@@ -5502,6 +5546,10 @@ static bool api_WPrintPortEnum(struct sm
+       int succnt;
+       struct pack_desc desc;
++#ifndef PRINTER_SUPPORT
++      return False;
++#endif
++
+       if (!str1 || !str2 || !p) {
+               return False;
+       }
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -142,7 +142,9 @@ static void exit_server_common(enum serv
+               rpc_eventlog_shutdown();
+               rpc_ntsvcs_shutdown();
+               rpc_svcctl_shutdown();
++#ifdef PRINTER_SUPPORT
+               rpc_spoolss_shutdown();
++#endif
+               rpc_srvsvc_shutdown();
+               rpc_winreg_shutdown();
+--- a/source3/smbd/open.c
++++ b/source3/smbd/open.c
+@@ -1556,6 +1556,9 @@ static NTSTATUS open_file_ntcreate(conne
+                * Most of the passed parameters are ignored.
+                */
++#ifndef PRINTER_SUPPORT
++              return NT_STATUS_ACCESS_DENIED;
++#endif
+               if (pinfo) {
+                       *pinfo = FILE_WAS_CREATED;
+               }
+--- a/source3/smbd/close.c
++++ b/source3/smbd/close.c
+@@ -638,6 +638,9 @@ static NTSTATUS close_normal_file(struct
+       status = ntstatus_keeperror(status, tmp);
+       if (fsp->print_file) {
++#ifndef PRINTER_SUPPORT
++              return NT_STATUS_OK;
++#endif
+               /* FIXME: return spool errors */
+               print_spool_end(fsp, close_type);
+               file_free(req, fsp);
+--- a/source3/smbd/fileio.c
++++ b/source3/smbd/fileio.c
+@@ -298,6 +298,10 @@ ssize_t write_file(struct smb_request *r
+               uint32_t t;
+               int ret;
++#ifndef PRINTER_SUPPORT
++              return -1;
++#endif
++
+               ret = print_spool_write(fsp, data, n, pos, &t);
+               if (ret) {
+                       errno = ret;
+--- a/source3/smbd/smb2_create.c
++++ b/source3/smbd/smb2_create.c
+@@ -485,7 +485,10 @@ static struct tevent_req *smbd_smb2_crea
+               info = FILE_WAS_OPENED;
+       } else if (CAN_PRINT(smb1req->conn)) {
+               status = file_new(smb1req, smb1req->conn, &result);
+-              if(!NT_STATUS_IS_OK(status)) {
++#ifdef PRINTER_SUPPORT
++              if(!NT_STATUS_IS_OK(status))
++#endif
++              {
+                       tevent_req_nterror(req, status);
+                       return tevent_req_post(req, ev);
+               }
+--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
++++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
+@@ -85,9 +85,11 @@ bool init_service_op_table( void )
+       /* add builtin services */
++#ifdef PRINTER_SUPPORT
+       svcctl_ops[i].name = talloc_strdup( svcctl_ops, "Spooler" );
+       svcctl_ops[i].ops  = &spoolss_svc_ops;
+       i++;
++#endif
+       svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" );
+       svcctl_ops[i].ops  = &netlogon_svc_ops;
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -113,9 +113,11 @@ static bool initialize_interfaces(void)
+       if (!smb_register_ndr_interface(&ndr_table_winreg)) {
+               return false;
+       }
++#ifdef PRINTER_SUPPORT
+       if (!smb_register_ndr_interface(&ndr_table_spoolss)) {
+               return false;
+       }
++#endif
+       if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
+               return false;
+       }
+--- a/source3/smbd/process.c
++++ b/source3/smbd/process.c
+@@ -2475,8 +2475,10 @@ static bool housekeeping_fn(const struct
+       change_to_root_user();
++#ifdef PRINTER_SUPPORT
+       /* update printer queue caches if necessary */
+       update_monitored_printq_cache(sconn->msg_ctx);
++#endif
+       /* check if we need to reload services */
+       check_reload(sconn, time_mono(NULL));
+--- a/source3/smbd/server.c
++++ b/source3/smbd/server.c
+@@ -126,7 +126,9 @@ static void smb_pcap_updated(struct mess
+ {
+       struct tevent_context *ev_ctx =
+               talloc_get_type_abort(private_data, struct tevent_context);
+-
++#ifndef PRINTER_SUPPORT
++      return;
++#endif
+       DEBUG(10,("Got message saying pcap was updated. Reloading.\n"));
+       change_to_root_user();
+       reload_printers(ev_ctx, msg);
+@@ -1211,8 +1213,10 @@ extern void build_options(bool screen);
+       if (!W_ERROR_IS_OK(registry_init_full()))
+               exit(1);
++#ifdef PRINTER_SUPPORT
+       if (!print_backend_init(smbd_messaging_context()))
+               exit(1);
++#endif
+       /* Open the share_info.tdb here, so we don't have to open
+          after the fork on every single connection.  This is a small
+@@ -1256,6 +1260,7 @@ extern void build_options(bool screen);
+               exit(1);
+       }
++#ifdef PRINTER_SUPPORT
+       /* Publish nt printers, this requires a working winreg pipe */
+       pcap_cache_reload(server_event_context(), smbd_messaging_context(),
+                         &reload_printers);
+@@ -1284,6 +1289,7 @@ extern void build_options(bool screen);
+                                      smbd_messaging_context());
+               }
+       }
++#endif
+       if (!is_daemon) {
+               /* inetd mode */
diff --git a/net/samba36/patches/120-no_ad_support.patch b/net/samba36/patches/120-no_ad_support.patch
new file mode 100644 (file)
index 0000000..babf6e0
--- /dev/null
@@ -0,0 +1,88 @@
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -95,9 +95,11 @@ static bool initialize_interfaces(void)
+       if (!smb_register_ndr_interface(&ndr_table_lsarpc)) {
+               return false;
+       }
++#ifdef ACTIVE_DIRECTORY
+       if (!smb_register_ndr_interface(&ndr_table_dssetup)) {
+               return false;
+       }
++#endif
+       if (!smb_register_ndr_interface(&ndr_table_samr)) {
+               return false;
+       }
+@@ -139,9 +141,11 @@ static bool initialize_interfaces(void)
+       if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
+               return false;
+       }
++#ifdef ACTIVE_DIRECTORY
+       if (!smb_register_ndr_interface(&ndr_table_drsuapi)) {
+               return false;
+       }
++#endif
+       return true;
+ }
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -918,6 +918,7 @@ static bool netdfs_init_cb(void *ptr)
+       return true;
+ }
++#ifdef ACTIVE_DIRECTORY
+ static bool dssetup_init_cb(void *ptr)
+ {
+       struct dcesrv_ep_context *ep_ctx =
+@@ -966,6 +967,7 @@ static bool dssetup_init_cb(void *ptr)
+       return true;
+ }
++#endif
+ static bool wkssvc_init_cb(void *ptr)
+ {
+@@ -1172,12 +1174,14 @@ bool dcesrv_ep_setup(struct tevent_conte
+       }
+ #endif
++#ifdef ACTIVE_DIRECTORY
+       dssetup_cb.init         = dssetup_init_cb;
+       dssetup_cb.shutdown     = NULL;
+       dssetup_cb.private_data = ep_ctx;
+       if (!NT_STATUS_IS_OK(rpc_dssetup_init(&dssetup_cb))) {
+               return false;
+       }
++#endif
+       wkssvc_cb.init         = wkssvc_init_cb;
+       wkssvc_cb.shutdown     = NULL;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -133,7 +133,9 @@ static void exit_server_common(enum serv
+       if (am_parent) {
+               rpc_wkssvc_shutdown();
++#ifdef ACTIVE_DIRECTORY
+               rpc_dssetup_shutdown();
++#endif
+ #ifdef DEVELOPER
+               rpc_rpcecho_shutdown();
+ #endif
+--- a/source3/rpc_client/cli_pipe.c
++++ b/source3/rpc_client/cli_pipe.c
+@@ -2874,12 +2874,14 @@ NTSTATUS cli_rpc_pipe_open_noauth_transp
+       status = rpc_pipe_bind(result, auth);
+       if (!NT_STATUS_IS_OK(status)) {
+               int lvl = 0;
++#ifdef ACTIVE_DIRECTORY
+               if (ndr_syntax_id_equal(interface,
+                                       &ndr_table_dssetup.syntax_id)) {
+                       /* non AD domains just don't have this pipe, avoid
+                        * level 0 statement in that case - gd */
+                       lvl = 3;
+               }
++#endif
+               DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe "
+                           "%s failed with error %s\n",
+                           get_pipe_name_from_syntax(talloc_tos(), interface),
diff --git a/net/samba36/patches/130-remove_services.patch b/net/samba36/patches/130-remove_services.patch
new file mode 100644 (file)
index 0000000..5b873a3
--- /dev/null
@@ -0,0 +1,84 @@
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -129,6 +129,7 @@ static bool initialize_interfaces(void)
+       if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
+               return false;
+       }
++#ifdef EXTRA_SERVICES
+       if (!smb_register_ndr_interface(&ndr_table_svcctl)) {
+               return false;
+       }
+@@ -138,6 +139,7 @@ static bool initialize_interfaces(void)
+       if (!smb_register_ndr_interface(&ndr_table_ntsvcs)) {
+               return false;
+       }
++#endif
+       if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
+               return false;
+       }
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -697,6 +697,7 @@ static bool spoolss_shutdown_cb(void *pt
+       return true;
+ }
++#ifdef EXTRA_SERVICES
+ static bool svcctl_init_cb(void *ptr)
+ {
+       struct dcesrv_ep_context *ep_ctx =
+@@ -733,6 +734,7 @@ static bool svcctl_init_cb(void *ptr)
+       return true;
+ }
++#endif
+ static bool svcctl_shutdown_cb(void *ptr)
+ {
+@@ -741,6 +743,8 @@ static bool svcctl_shutdown_cb(void *ptr
+       return true;
+ }
++#ifdef EXTRA_SERVICES
++
+ static bool ntsvcs_init_cb(void *ptr)
+ {
+       struct dcesrv_ep_context *ep_ctx =
+@@ -802,6 +806,7 @@ static bool eventlog_init_cb(void *ptr)
+       return true;
+ }
++#endif
+ static bool initshutdown_init_cb(void *ptr)
+ {
+@@ -1130,6 +1135,7 @@ bool dcesrv_ep_setup(struct tevent_conte
+               }
+       }
++#ifdef EXTRA_SERVICES
+       svcctl_cb.init         = svcctl_init_cb;
+       svcctl_cb.shutdown     = svcctl_shutdown_cb;
+       svcctl_cb.private_data = ep_ctx;
+@@ -1150,6 +1156,7 @@ bool dcesrv_ep_setup(struct tevent_conte
+       if (!NT_STATUS_IS_OK(rpc_eventlog_init(&eventlog_cb))) {
+               return false;
+       }
++#endif
+       initshutdown_cb.init         = initshutdown_init_cb;
+       initshutdown_cb.shutdown     = NULL;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -141,9 +141,11 @@ static void exit_server_common(enum serv
+ #endif
+               rpc_netdfs_shutdown();
+               rpc_initshutdown_shutdown();
++#ifdef EXTRA_SERVICES
+               rpc_eventlog_shutdown();
+-              rpc_ntsvcs_shutdown();
+               rpc_svcctl_shutdown();
++              rpc_ntsvcs_shutdown();
++#endif
+ #ifdef PRINTER_SUPPORT
+               rpc_spoolss_shutdown();
+ #endif
diff --git a/net/samba36/patches/140-no_winreg_support.patch b/net/samba36/patches/140-no_winreg_support.patch
new file mode 100644 (file)
index 0000000..0751c84
--- /dev/null
@@ -0,0 +1,134 @@
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -409,6 +409,7 @@ static bool epmapper_shutdown_cb(void *p
+       return true;
+ }
++#ifdef WINREG_SUPPORT
+ static bool winreg_init_cb(void *ptr)
+ {
+       struct dcesrv_ep_context *ep_ctx =
+@@ -456,6 +457,7 @@ static bool winreg_init_cb(void *ptr)
+       return true;
+ }
++#endif
+ static bool srvsvc_init_cb(void *ptr)
+ {
+@@ -710,10 +712,12 @@ static bool svcctl_init_cb(void *ptr)
+                                          "epmapper",
+                                          "none");
++#ifdef WINREG_SUPPORT
+       ok = svcctl_init_winreg(ep_ctx->msg_ctx);
+       if (!ok) {
+               return false;
+       }
++#endif
+       /* initialize the control hooks */
+       init_service_op_table();
+@@ -785,10 +789,12 @@ static bool eventlog_init_cb(void *ptr)
+                                          "epmapper",
+                                          "none");
++#ifdef WINREG_SUPPORT
+       ok = eventlog_init_winreg(ep_ctx->msg_ctx);
+       if (!ok) {
+               return false;
+       }
++#endif
+       if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
+           StrCaseCmp(rpcsrv_type, "daemon") == 0) {
+@@ -1077,12 +1083,14 @@ bool dcesrv_ep_setup(struct tevent_conte
+               }
+       }
++#ifdef WINREG_SUPPORT
+       winreg_cb.init         = winreg_init_cb;
+       winreg_cb.shutdown     = NULL;
+       winreg_cb.private_data = ep_ctx;
+       if (!NT_STATUS_IS_OK(rpc_winreg_init(&winreg_cb))) {
+               return false;
+       }
++#endif
+       srvsvc_cb.init         = srvsvc_init_cb;
+       srvsvc_cb.shutdown     = NULL;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -151,7 +151,9 @@ static void exit_server_common(enum serv
+ #endif
+               rpc_srvsvc_shutdown();
++#ifdef WINREG_SUPPORT
+               rpc_winreg_shutdown();
++#endif
+               rpc_netlogon_shutdown();
+               rpc_samr_shutdown();
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -112,9 +112,11 @@ static bool initialize_interfaces(void)
+       if (!smb_register_ndr_interface(&ndr_table_wkssvc)) {
+               return false;
+       }
++#ifdef WINREG_SUPPORT
+       if (!smb_register_ndr_interface(&ndr_table_winreg)) {
+               return false;
+       }
++#endif
+ #ifdef PRINTER_SUPPORT
+       if (!smb_register_ndr_interface(&ndr_table_spoolss)) {
+               return false;
+--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
++++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
+@@ -95,9 +95,11 @@ bool init_service_op_table( void )
+       svcctl_ops[i].ops  = &netlogon_svc_ops;
+       i++;
++#ifdef WINREG_SUPPORT
+       svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" );
+       svcctl_ops[i].ops  = &winreg_svc_ops;
+       i++;
++#endif
+       svcctl_ops[i].name = talloc_strdup( svcctl_ops, "WINS" );
+       svcctl_ops[i].ops  = &wins_svc_ops;
+--- a/source3/services/svc_winreg_glue.c
++++ b/source3/services/svc_winreg_glue.c
+@@ -88,6 +88,10 @@ struct security_descriptor *svcctl_get_s
+       NTSTATUS status;
+       WERROR result = WERR_OK;
++#ifndef WINREG_SUPPORT
++      return NULL;
++#endif
++
+       key = talloc_asprintf(mem_ctx,
+                             "%s\\%s\\Security",
+                             TOP_LEVEL_SERVICES_KEY, name);
+@@ -161,6 +165,10 @@ bool svcctl_set_secdesc(struct messaging
+       NTSTATUS status;
+       WERROR result = WERR_OK;
++#ifndef WINREG_SUPPORT
++      return false;
++#endif
++
+       tmp_ctx = talloc_stackframe();
+       if (tmp_ctx == NULL) {
+               return false;
+@@ -272,6 +280,10 @@ const char *svcctl_get_string_value(TALL
+       NTSTATUS status;
+       WERROR result = WERR_OK;
++#ifndef WINREG_SUPPORT
++      return NULL;
++#endif
++
+       tmp_ctx = talloc_stackframe();
+       if (tmp_ctx == NULL) {
+               return NULL;
diff --git a/net/samba36/patches/150-no_dfs_api.patch b/net/samba36/patches/150-no_dfs_api.patch
new file mode 100644 (file)
index 0000000..7b69087
--- /dev/null
@@ -0,0 +1,59 @@
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -881,6 +881,7 @@ static bool rpcecho_init_cb(void *ptr) {
+ #endif
++#ifdef DFS_SUPPORT
+ static bool netdfs_init_cb(void *ptr)
+ {
+       struct dcesrv_ep_context *ep_ctx =
+@@ -928,6 +929,7 @@ static bool netdfs_init_cb(void *ptr)
+       return true;
+ }
++#endif
+ #ifdef ACTIVE_DIRECTORY
+ static bool dssetup_init_cb(void *ptr)
+@@ -1173,12 +1175,14 @@ bool dcesrv_ep_setup(struct tevent_conte
+               return false;
+       }
++#ifdef DFS_SUPPORT
+       netdfs_cb.init         = netdfs_init_cb;
+       netdfs_cb.shutdown     = NULL;
+       netdfs_cb.private_data = ep_ctx;
+       if (!NT_STATUS_IS_OK(rpc_netdfs_init(&netdfs_cb))) {
+               return false;
+       }
++#endif
+ #ifdef DEVELOPER
+       rpcecho_cb.init         = rpcecho_init_cb;
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -122,9 +122,11 @@ static bool initialize_interfaces(void)
+               return false;
+       }
+ #endif
++#ifdef DFS_SUPPORT
+       if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
+               return false;
+       }
++#endif
+       if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
+               return false;
+       }
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -139,7 +139,9 @@ static void exit_server_common(enum serv
+ #ifdef DEVELOPER
+               rpc_rpcecho_shutdown();
+ #endif
++#ifdef DFS_SUPPORT
+               rpc_netdfs_shutdown();
++#endif
+               rpc_initshutdown_shutdown();
+ #ifdef EXTRA_SERVICES
+               rpc_eventlog_shutdown();
diff --git a/net/samba36/patches/160-add_missing_ifdef.patch b/net/samba36/patches/160-add_missing_ifdef.patch
new file mode 100644 (file)
index 0000000..4aab79a
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -127,9 +127,11 @@ static bool initialize_interfaces(void)
+               return false;
+       }
+ #endif
++#ifdef DEVELOPER
+       if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
+               return false;
+       }
++#endif
+       if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
+               return false;
+       }
diff --git a/net/samba36/patches/200-multicall.patch b/net/samba36/patches/200-multicall.patch
new file mode 100644 (file)
index 0000000..eec1391
--- /dev/null
@@ -0,0 +1,92 @@
+--- a/source3/Makefile.in
++++ b/source3/Makefile.in
+@@ -214,7 +214,7 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_P
+ # Note that all executable programs now provide for an optional executable suffix.
+-SBIN_PROGS = bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@
++SBIN_PROGS = bin/samba_multicall@EXEEXT@ bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@
+ BIN_PROGS1 = bin/smbclient@EXEEXT@ bin/net@EXEEXT@ bin/smbspool@EXEEXT@ \
+       bin/testparm@EXEEXT@ bin/smbstatus@EXEEXT@ bin/smbget@EXEEXT@ \
+@@ -1774,6 +1774,42 @@ bin/.dummy:
+         dir=bin $(MAKEDIR); fi
+       @: >> $@ || : > $@ # what a fancy emoticon!
++smbd/server_multicall.o: smbd/server.c smbd/server.o
++      @echo Compiling $<.c
++      @$(COMPILE_CC_PATH) -Dmain=smbd_main && exit 0;\
++              echo "The following command failed:" 1>&2;\
++              echo "$(COMPILE_CC_PATH)" 1>&2;\
++              $(COMPILE_CC_PATH) >/dev/null 2>&1
++
++nmbd/nmbd_multicall.o: nmbd/nmbd.c nmbd/nmbd.o
++      @echo Compiling $<.c
++      @$(COMPILE_CC_PATH) -Dmain=nmbd_main && exit 0;\
++              echo "The following command failed:" 1>&2;\
++              echo "$(COMPILE_CC_PATH)" 1>&2;\
++              $(COMPILE_CC_PATH) >/dev/null 2>&1
++
++utils/smbpasswd_multicall.o: utils/smbpasswd.c utils/smbpasswd.o
++      @echo Compiling $<.c
++      @$(COMPILE_CC_PATH) -Dmain=smbpasswd_main && exit 0;\
++              echo "The following command failed:" 1>&2;\
++              echo "$(COMPILE_CC_PATH)" 1>&2;\
++              $(COMPILE_CC_PATH) >/dev/null 2>&1
++
++SMBD_MULTI_O = $(patsubst smbd/server.o,smbd/server_multicall.o,$(SMBD_OBJ))
++NMBD_MULTI_O = $(patsubst nmbd/nmbd.o,nmbd/nmbd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(NMBD_OBJ)))
++SMBPASSWD_MULTI_O = $(patsubst utils/smbpasswd.o,utils/smbpasswd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(SMBPASSWD_OBJ)))
++MULTI_O = multi.o
++
++MULTICALL_O = $(sort $(SMBD_MULTI_O) $(NMBD_MULTI_O) $(SMBPASSWD_MULTI_O) $(MULTI_O))
++
++bin/samba_multicall@EXEEXT@: $(BINARY_PREREQS) $(MULTICALL_O) $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@
++      @echo Linking $@
++      @$(CC) -o $@ $(MULTICALL_O) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \
++              $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
++              $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) $(AVAHI_LIBS) \
++              $(POPT_LIBS) @SMBD_LIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
++              $(LIBWBCLIENT_LIBS) $(ZLIB_LIBS)
++
+ bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@
+       @echo Linking $@
+       @$(CC) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \
+--- /dev/null
++++ b/source3/multi.c
+@@ -0,0 +1,35 @@
++#include <stdio.h>
++#include <string.h>
++
++extern int smbd_main(int argc, char **argv);
++extern int nmbd_main(int argc, char **argv);
++extern int smbpasswd_main(int argc, char **argv);
++
++static struct {
++      const char *name;
++      int (*func)(int argc, char **argv);
++} multicall[] = {
++      { "smbd", smbd_main },
++      { "nmbd", nmbd_main },
++      { "smbpasswd", smbpasswd_main },
++};
++
++#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
++
++int main(int argc, char **argv)
++{
++      int i;
++
++      for (i = 0; i < ARRAY_SIZE(multicall); i++) {
++              if (strstr(argv[0], multicall[i].name))
++                      return multicall[i].func(argc, argv);
++      }
++
++      fprintf(stderr, "Invalid multicall command, available commands:");
++      for (i = 0; i < ARRAY_SIZE(multicall); i++)
++              fprintf(stderr, " %s", multicall[i].name);
++
++      fprintf(stderr, "\n");
++
++      return 1;
++}