mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-24 05:34:36 +02:00
samba36: move to trunk and add myself as a maintainer
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33689 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
9c8997d54d
commit
762ba61479
142
package/network/services/samba36/Makefile
Normal file
142
package/network/services/samba36/Makefile
Normal file
@ -0,0 +1,142 @@
|
||||
#
|
||||
# Copyright (C) 2007-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=samba
|
||||
PKG_VERSION:=3.6.5
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_URL:=http://ftp.samba.org/pub/samba \
|
||||
http://ftp.samba.org/pub/samba/old-versions
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_MD5SUM:=2f0c14547333c1b48fd4728b031e7040
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
|
||||
|
||||
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/
|
||||
DEPENDS:=+USE_EGLIBC:librt
|
||||
endef
|
||||
|
||||
define Package/samba36-client
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Samba 3.6 SMB/CIFS client
|
||||
URL:=http://www.samba.org/
|
||||
DEPENDS:=+libreadline +libncurses
|
||||
endef
|
||||
|
||||
define Package/samba36-server/config
|
||||
config PACKAGE_SAMBA_MAX_DEBUG_LEVEL
|
||||
int "Maximum level of compiled-in debug messages"
|
||||
depends PACKAGE_samba36-server || PACKAGE_samba36-client
|
||||
default -1
|
||||
|
||||
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=$(CONFIG_PACKAGE_SAMBA_MAX_DEBUG_LEVEL) -D__location__=\\\"\\\" -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 \
|
||||
ac_cv_header_zlib_h=no \
|
||||
samba_cv_zlib_1_2_3=no
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--exec-prefix=/usr \
|
||||
--prefix=/ \
|
||||
--disable-avahi \
|
||||
--disable-cups \
|
||||
--disable-pie \
|
||||
--disable-relro \
|
||||
--disable-static \
|
||||
--disable-swat \
|
||||
--disable-shared-libs \
|
||||
--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 \
|
||||
--without-libtdb \
|
||||
--without-libtalloc \
|
||||
--without-libnetapi \
|
||||
--without-libsmbclient \
|
||||
--without-libsmbsharemodes \
|
||||
--without-libaddns \
|
||||
--with-shared-modules=pdb_tdbsam,pdb_wbc_sam,idmap_nss,nss_info_template,auth_winbind,auth_wbc,auth_domain
|
||||
|
||||
MAKE_FLAGS += DYNEXP= PICFLAG= MODULES=
|
||||
|
||||
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)/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
|
||||
ln -sf samba_multicall $(1)/usr/sbin/smbpasswd
|
||||
endef
|
||||
|
||||
define Package/samba36-client/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_BIN)/smbclient $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_BIN)/nmblookup $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,samba36-client))
|
||||
$(eval $(call BuildPackage,samba36-server))
|
||||
|
6
package/network/services/samba36/files/samba.config
Normal file
6
package/network/services/samba36/files/samba.config
Normal file
@ -0,0 +1,6 @@
|
||||
config samba
|
||||
option 'name' 'OpenWrt'
|
||||
option 'workgroup' 'WORKGROUP'
|
||||
option 'description' 'OpenWrt'
|
||||
option 'homes' '1'
|
||||
|
97
package/network/services/samba36/files/samba.init
Executable file
97
package/network/services/samba36/files/samba.init
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2008-2012 OpenWrt.org
|
||||
|
||||
START=60
|
||||
|
||||
smb_header() {
|
||||
local interface
|
||||
config_get interface $1 interface "loopback lan"
|
||||
|
||||
# resolve interfaces
|
||||
local interfaces=$(
|
||||
. /lib/functions/network.sh
|
||||
|
||||
local net
|
||||
for net in $interface; do
|
||||
local device
|
||||
network_get_device device "$net" && {
|
||||
local subnet
|
||||
network_get_subnet subnet "$net" && echo -n "$subnet "
|
||||
network_get_subnet6 subnet "$net" && echo -n "$subnet "
|
||||
}
|
||||
|
||||
echo -n "${device:-$net} "
|
||||
done
|
||||
)
|
||||
|
||||
local name workgroup description charset
|
||||
local hostname="$(uci_get system.@system[0].hostname)"
|
||||
|
||||
config_get name $1 name "${hostname:-OpenWrt}"
|
||||
config_get workgroup $1 workgroup "${hostname:-OpenWrt}"
|
||||
config_get description $1 description "Samba on ${hostname:-OpenWrt}"
|
||||
config_get charset $1 charset "UTF-8"
|
||||
|
||||
mkdir -p /var/etc
|
||||
sed -e "s#|NAME|#$name#g" \
|
||||
-e "s#|WORKGROUP|#$workgroup#g" \
|
||||
-e "s#|DESCRIPTION|#$description#g" \
|
||||
-e "s#|INTERFACES|#$interfaces#g" \
|
||||
-e "s#|CHARSET|#$charset#g" \
|
||||
/etc/samba/smb.conf.template > /var/etc/smb.conf
|
||||
|
||||
local homes
|
||||
config_get_bool homes $1 homes 0
|
||||
[ $homes -gt 0 ] && {
|
||||
cat <<EOT >> /var/etc/smb.conf
|
||||
|
||||
[homes]
|
||||
comment = Home Directories
|
||||
browsable = no
|
||||
read only = no
|
||||
create mode = 0750
|
||||
EOT
|
||||
}
|
||||
|
||||
[ -L /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/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" >> /var/etc/smb.conf
|
||||
[ -n "$users" ] && echo -e "\tvalid users = $users" >> /var/etc/smb.conf
|
||||
[ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /var/etc/smb.conf
|
||||
[ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /var/etc/smb.conf
|
||||
[ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /var/etc/smb.conf
|
||||
[ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /var/etc/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
|
||||
}
|
34
package/network/services/samba36/files/smb.conf.template
Normal file
34
package/network/services/samba36/files/smb.conf.template
Normal file
@ -0,0 +1,34 @@
|
||||
[global]
|
||||
netbios name = |NAME|
|
||||
display charset = |CHARSET|
|
||||
interfaces = |INTERFACES|
|
||||
server string = |DESCRIPTION|
|
||||
unix charset = |CHARSET|
|
||||
workgroup = |WORKGROUP|
|
||||
browseable = yes
|
||||
deadtime = 30
|
||||
domain master = yes
|
||||
encrypt passwords = true
|
||||
enable core files = no
|
||||
guest account = nobody
|
||||
guest ok = yes
|
||||
invalid users = root
|
||||
local master = yes
|
||||
load printers = no
|
||||
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
|
||||
preferred master = yes
|
||||
printable = no
|
||||
security = user
|
||||
smb encrypt = disabled
|
||||
smb passwd file = /etc/samba/smbpasswd
|
||||
socket options = TCP_NODELAY IPTOS_LOWDELAY
|
||||
syslog = 2
|
||||
use sendfile = yes
|
||||
writeable = yes
|
||||
|
@ -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. */
|
117
package/network/services/samba36/patches/110-multicall.patch
Normal file
117
package/network/services/samba36/patches/110-multicall.patch
Normal file
@ -0,0 +1,117 @@
|
||||
--- a/source3/Makefile.in
|
||||
+++ b/source3/Makefile.in
|
||||
@@ -73,20 +73,20 @@ LDAP_LIBS=@LDAP_LIBS@
|
||||
NSCD_LIBS=@NSCD_LIBS@
|
||||
UUID_LIBS=@UUID_LIBS@
|
||||
LIBWBCLIENT=@LIBWBCLIENT_STATIC@ @LIBWBCLIENT_SHARED@
|
||||
-LIBWBCLIENT_LIBS=@LIBWBCLIENT_LIBS@
|
||||
+LIBWBCLIENT_LIBS=@LIBWBCLIENT_STATIC@
|
||||
PTHREAD_LDFLAGS=@PTHREAD_LDFLAGS@
|
||||
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
|
||||
DNSSD_LIBS=@DNSSD_LIBS@
|
||||
AVAHI_LIBS=@AVAHI_LIBS@
|
||||
POPT_LIBS=@POPTLIBS@
|
||||
LIBTALLOC=@LIBTALLOC_STATIC@ @LIBTALLOC_SHARED@
|
||||
-LIBTALLOC_LIBS=@LIBTALLOC_LIBS@
|
||||
+LIBTALLOC_LIBS=@LIBTALLOC_STATIC@
|
||||
LIBREPLACE_LIBS=@LIBREPLACE_LIBS@
|
||||
LIBTDB=@LIBTDB_STATIC@ @LIBTDB_SHARED@
|
||||
-LIBTDB_LIBS=@LIBTDB_LIBS@
|
||||
+LIBTDB_LIBS=@LIBTDB_STATIC@
|
||||
TDB_DEPS=@TDB_DEPS@
|
||||
LIBNETAPI=@LIBNETAPI_STATIC@ @LIBNETAPI_SHARED@
|
||||
-LIBNETAPI_LIBS=@LIBNETAPI_LIBS@
|
||||
+LIBNETAPI_LIBS=@LIBNETAPI_STATIC@
|
||||
LIBSMBCLIENT_LIBS=@LIBSMBCLIENT_LIBS@
|
||||
LIBSMBSHAREMODES_LIBS=@LIBSMBSHAREMODES_LIBS@
|
||||
|
||||
@@ -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;
|
||||
+}
|
@ -0,0 +1,277 @@
|
||||
--- a/source3/Makefile.in
|
||||
+++ b/source3/Makefile.in
|
||||
@@ -1016,7 +1016,7 @@ TEST_LP_LOAD_OBJ = param/test_lp_load.o
|
||||
|
||||
PASSWD_UTIL_OBJ = utils/passwd_util.o
|
||||
|
||||
-SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \
|
||||
+SMBPASSWD_OBJ = utils/owrt_smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \
|
||||
$(PARAM_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \
|
||||
$(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \
|
||||
$(POPT_LIB_OBJ) $(SMBLDAP_OBJ) \
|
||||
@@ -1788,7 +1788,7 @@ nmbd/nmbd_multicall.o: nmbd/nmbd.c nmbd/
|
||||
echo "$(COMPILE_CC_PATH)" 1>&2;\
|
||||
$(COMPILE_CC_PATH) >/dev/null 2>&1
|
||||
|
||||
-utils/smbpasswd_multicall.o: utils/smbpasswd.c utils/smbpasswd.o
|
||||
+utils/smbpasswd_multicall.o: utils/owrt_smbpasswd.c utils/owrt_smbpasswd.o
|
||||
@echo Compiling $<.c
|
||||
@$(COMPILE_CC_PATH) -Dmain=smbpasswd_main && exit 0;\
|
||||
echo "The following command failed:" 1>&2;\
|
||||
@@ -1797,7 +1797,7 @@ utils/smbpasswd_multicall.o: utils/smbpa
|
||||
|
||||
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)))
|
||||
+SMBPASSWD_MULTI_O = $(patsubst utils/owrt_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))
|
||||
--- /dev/null
|
||||
+++ b/source3/utils/owrt_smbpasswd.c
|
||||
@@ -0,0 +1,245 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
|
||||
+ * Copyright (C) 2008 John Crispin <blogic@openwrt.org>
|
||||
+ *
|
||||
+ * This program 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 2 of the License, or (at your
|
||||
+ * option) any later version.
|
||||
+ *
|
||||
+ * This program 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
|
||||
+ * this program; if not, write to the Free Software Foundation, Inc., 675
|
||||
+ * Mass Ave, Cambridge, MA 02139, USA. */
|
||||
+
|
||||
+#include "includes.h"
|
||||
+#include <endian.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+static char buf[256];
|
||||
+
|
||||
+static void md4hash(const char *passwd, uchar p16[16])
|
||||
+{
|
||||
+ int len;
|
||||
+ smb_ucs2_t wpwd[129];
|
||||
+ int i;
|
||||
+
|
||||
+ len = strlen(passwd);
|
||||
+ for (i = 0; i < len; i++) {
|
||||
+#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
+ wpwd[i] = (unsigned char)passwd[i];
|
||||
+#else
|
||||
+ wpwd[i] = (unsigned char)passwd[i] << 8;
|
||||
+#endif
|
||||
+ }
|
||||
+ wpwd[i] = 0;
|
||||
+
|
||||
+ len = len * sizeof(int16);
|
||||
+ mdfour(p16, (unsigned char *)wpwd, len);
|
||||
+ ZERO_STRUCT(wpwd);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static bool find_passwd_line(FILE *fp, const char *user, char **next)
|
||||
+{
|
||||
+ char *p1;
|
||||
+
|
||||
+ while (!feof(fp)) {
|
||||
+ if(!fgets(buf, sizeof(buf) - 1, fp))
|
||||
+ continue;
|
||||
+
|
||||
+ p1 = strchr(buf, ':');
|
||||
+
|
||||
+ if (p1 - buf != strlen(user))
|
||||
+ continue;
|
||||
+
|
||||
+ if (strncmp(buf, user, p1 - buf) != 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (next)
|
||||
+ *next = p1;
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+/* returns -1 if user is not present in /etc/passwd*/
|
||||
+static int find_uid_for_user(const char *user)
|
||||
+{
|
||||
+ FILE *fp;
|
||||
+ char *p1, *p2, *p3;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ fp = fopen("/etc/passwd", "r");
|
||||
+ if (!fp) {
|
||||
+ printf("failed to open /etc/passwd");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (!find_passwd_line(fp, user, &p1)) {
|
||||
+ printf("User %s not found or invalid in /etc/passwd\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ p2 = strchr(p1 + 1, ':');
|
||||
+ if (!p2)
|
||||
+ goto out;
|
||||
+
|
||||
+ p2++;
|
||||
+ p3 = strchr(p2, ':');
|
||||
+ if (!p1)
|
||||
+ goto out;
|
||||
+
|
||||
+ *p3 = '\0';
|
||||
+ ret = atoi(p2);
|
||||
+
|
||||
+out:
|
||||
+ if(fp)
|
||||
+ fclose(fp);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void smbpasswd_write_user(FILE *fp, const char *user, int uid, const char *password)
|
||||
+{
|
||||
+ static uchar nt_p16[NT_HASH_LEN];
|
||||
+ int len = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ md4hash(strdup(password), nt_p16);
|
||||
+
|
||||
+ len += snprintf(buf + len, sizeof(buf) - len, "%s:%u:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:", user, uid);
|
||||
+ for(i = 0; i < NT_HASH_LEN; i++)
|
||||
+ len += snprintf(buf + len, sizeof(buf) - len, "%02X", nt_p16[i]);
|
||||
+
|
||||
+ snprintf(buf + len, sizeof(buf) - len, ":[U ]:LCT-00000001:\n");
|
||||
+ fputs(buf, fp);
|
||||
+}
|
||||
+
|
||||
+static void smbpasswd_delete_user(FILE *fp)
|
||||
+{
|
||||
+ fpos_t r_pos, w_pos;
|
||||
+ int len = strlen(buf);
|
||||
+
|
||||
+ fgetpos(fp, &r_pos);
|
||||
+ w_pos = r_pos;
|
||||
+ w_pos.__pos -= len;
|
||||
+
|
||||
+ while (fgets(buf, sizeof(buf) - 1, fp)) {
|
||||
+ int cur_len = strlen(buf);
|
||||
+
|
||||
+ fsetpos(fp, &w_pos);
|
||||
+ fputs(buf, fp);
|
||||
+ r_pos.__pos += cur_len;
|
||||
+ w_pos.__pos += cur_len;
|
||||
+ fsetpos(fp, &r_pos);
|
||||
+ }
|
||||
+
|
||||
+ ftruncate(fileno(fp), w_pos.__pos);
|
||||
+}
|
||||
+
|
||||
+static int usage(const char *progname)
|
||||
+{
|
||||
+ fprintf(stderr,
|
||||
+ "Usage: %s [options] <username>\n"
|
||||
+ "\n"
|
||||
+ "Options:\n"
|
||||
+ " -s read password from stdin\n"
|
||||
+ " -a add user\n"
|
||||
+ " -x delete user\n",
|
||||
+ progname);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ const char *prog = argv[0];
|
||||
+ const char *user;
|
||||
+ char *pw1, *pw2;
|
||||
+ FILE *fp;
|
||||
+ bool add = false, delete = false, get_stdin = false, found;
|
||||
+ int ch;
|
||||
+ int uid;
|
||||
+
|
||||
+ TALLOC_CTX *frame = talloc_stackframe();
|
||||
+
|
||||
+ while ((ch = getopt(argc, argv, "asx")) != EOF) {
|
||||
+ switch (ch) {
|
||||
+ case 's':
|
||||
+ get_stdin = true;
|
||||
+ break;
|
||||
+ case 'a':
|
||||
+ add = true;
|
||||
+ break;
|
||||
+ case 'x':
|
||||
+ delete = true;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return usage(prog);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (add && delete)
|
||||
+ return usage(prog);
|
||||
+
|
||||
+ argc -= optind;
|
||||
+ argv += optind;
|
||||
+
|
||||
+ if (!argc)
|
||||
+ return usage(prog);
|
||||
+
|
||||
+ user = argv[0];
|
||||
+ if (!delete) {
|
||||
+ uid = find_uid_for_user(user);
|
||||
+ if (uid < 0) {
|
||||
+ fprintf(stderr, "Could not find user '%s' in /etc/passwd\n", user);
|
||||
+ return 2;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ fp = fopen("/etc/samba/smbpasswd", "r+");
|
||||
+ if(!fp) {
|
||||
+ fprintf(stderr, "Failed to open /etc/samba/smbpasswd");
|
||||
+ return 3;
|
||||
+ }
|
||||
+
|
||||
+ found = find_passwd_line(fp, user, NULL);
|
||||
+ if (!add && !found) {
|
||||
+ fprintf(stderr, "Could not find user '%s' in /etc/samba/smbpasswd\n", user);
|
||||
+ return 3;
|
||||
+ }
|
||||
+
|
||||
+ if (delete) {
|
||||
+ smbpasswd_delete_user(fp);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ pw1 = get_pass("New SMB password:", get_stdin);
|
||||
+ if (!pw1)
|
||||
+ pw1 = strdup("");
|
||||
+
|
||||
+ pw2 = get_pass("Retype SMB password:", get_stdin);
|
||||
+ if (!pw2)
|
||||
+ pw2 = strdup("");
|
||||
+
|
||||
+ if (strcmp(pw1, pw2) != 0) {
|
||||
+ fprintf(stderr, "Mismatch - password unchanged.\n");
|
||||
+ goto out_free;
|
||||
+ }
|
||||
+
|
||||
+ if (found)
|
||||
+ fseek(fp, -strlen(buf), SEEK_CUR);
|
||||
+ smbpasswd_write_user(fp, user, uid, pw2);
|
||||
+
|
||||
+out_free:
|
||||
+ free(pw1);
|
||||
+ free(pw2);
|
||||
+out:
|
||||
+ fclose(fp);
|
||||
+ TALLOC_FREE(frame);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
@ -0,0 +1,26 @@
|
||||
--- a/source3/librpc/rpc/rpc_common.c
|
||||
+++ b/source3/librpc/rpc/rpc_common.c
|
||||
@@ -119,9 +119,11 @@ static bool initialize_interfaces(void)
|
||||
if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
|
||||
return false;
|
||||
}
|
||||
+#ifdef DEVELOPER
|
||||
if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
|
||||
return false;
|
||||
}
|
||||
--- a/source3/rpcclient/rpcclient.c
|
||||
+++ b/source3/rpcclient/rpcclient.c
|
||||
@@ -628,7 +628,9 @@ static struct cmd_set *rpcclient_command
|
||||
netlogon_commands,
|
||||
srvsvc_commands,
|
||||
dfs_commands,
|
||||
+#ifdef DEVELOPER
|
||||
echo_commands,
|
||||
+#endif
|
||||
epmapper_commands,
|
||||
shutdown_commands,
|
||||
test_commands,
|
@ -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 */
|
@ -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;
|
||||
}
|
||||
@@ -141,9 +143,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),
|
@ -0,0 +1,98 @@
|
||||
--- a/source3/librpc/rpc/rpc_common.c
|
||||
+++ b/source3/librpc/rpc/rpc_common.c
|
||||
@@ -131,6 +131,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;
|
||||
}
|
||||
@@ -140,6 +141,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
|
||||
--- a/source3/rpcclient/rpcclient.c
|
||||
+++ b/source3/rpcclient/rpcclient.c
|
||||
@@ -637,9 +637,11 @@ static struct cmd_set *rpcclient_command
|
||||
shutdown_commands,
|
||||
test_commands,
|
||||
wkssvc_commands,
|
||||
+#ifdef EXTRA_SERVICES
|
||||
ntsvcs_commands,
|
||||
drsuapi_commands,
|
||||
eventlog_commands,
|
||||
+#endif
|
||||
winreg_commands,
|
||||
NULL
|
||||
};
|
@ -0,0 +1,146 @@
|
||||
--- 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;
|
||||
--- a/source3/rpcclient/rpcclient.c
|
||||
+++ b/source3/rpcclient/rpcclient.c
|
||||
@@ -642,7 +642,9 @@ static struct cmd_set *rpcclient_command
|
||||
drsuapi_commands,
|
||||
eventlog_commands,
|
||||
#endif
|
||||
+#ifdef WINREG_SUPPORT
|
||||
winreg_commands,
|
||||
+#endif
|
||||
NULL
|
||||
};
|
||||
|
@ -0,0 +1,71 @@
|
||||
--- 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
|
||||
#ifdef DEVELOPER
|
||||
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();
|
||||
--- a/source3/rpcclient/rpcclient.c
|
||||
+++ b/source3/rpcclient/rpcclient.c
|
||||
@@ -629,7 +629,9 @@ static struct cmd_set *rpcclient_command
|
||||
#endif
|
||||
netlogon_commands,
|
||||
srvsvc_commands,
|
||||
+#ifdef DFS_SUPPORT
|
||||
dfs_commands,
|
||||
+#endif
|
||||
#ifdef DEVELOPER
|
||||
echo_commands,
|
||||
#endif
|
@ -0,0 +1,185 @@
|
||||
--- a/source3/rpc_server/rpc_ep_setup.c
|
||||
+++ b/source3/rpc_server/rpc_ep_setup.c
|
||||
@@ -606,6 +606,7 @@ static bool samr_init_cb(void *ptr)
|
||||
return true;
|
||||
}
|
||||
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
static bool netlogon_init_cb(void *ptr)
|
||||
{
|
||||
struct dcesrv_ep_context *ep_ctx =
|
||||
@@ -654,6 +655,7 @@ static bool netlogon_init_cb(void *ptr)
|
||||
|
||||
return true;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static bool spoolss_init_cb(void *ptr)
|
||||
{
|
||||
@@ -1116,12 +1118,15 @@ bool dcesrv_ep_setup(struct tevent_conte
|
||||
return false;
|
||||
}
|
||||
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
netlogon_cb.init = netlogon_init_cb;
|
||||
netlogon_cb.shutdown = NULL;
|
||||
netlogon_cb.private_data = ep_ctx;
|
||||
if (!NT_STATUS_IS_OK(rpc_netlogon_init(&netlogon_cb))) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
|
||||
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
|
||||
"rpc_server",
|
||||
--- a/source3/librpc/rpc/rpc_common.c
|
||||
+++ b/source3/librpc/rpc/rpc_common.c
|
||||
@@ -103,9 +103,11 @@ static bool initialize_interfaces(void)
|
||||
if (!smb_register_ndr_interface(&ndr_table_samr)) {
|
||||
return false;
|
||||
}
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
if (!smb_register_ndr_interface(&ndr_table_netlogon)) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
if (!smb_register_ndr_interface(&ndr_table_srvsvc)) {
|
||||
return false;
|
||||
}
|
||||
--- a/source3/smbd/server_exit.c
|
||||
+++ b/source3/smbd/server_exit.c
|
||||
@@ -157,7 +157,9 @@ static void exit_server_common(enum serv
|
||||
rpc_winreg_shutdown();
|
||||
#endif
|
||||
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
rpc_netlogon_shutdown();
|
||||
+#endif
|
||||
rpc_samr_shutdown();
|
||||
rpc_lsarpc_shutdown();
|
||||
}
|
||||
--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
|
||||
+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
|
||||
@@ -91,9 +91,11 @@ bool init_service_op_table( void )
|
||||
i++;
|
||||
#endif
|
||||
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" );
|
||||
svcctl_ops[i].ops = &netlogon_svc_ops;
|
||||
i++;
|
||||
+#endif
|
||||
|
||||
#ifdef WINREG_SUPPORT
|
||||
svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" );
|
||||
--- a/source3/nmbd/nmbd_processlogon.c
|
||||
+++ b/source3/nmbd/nmbd_processlogon.c
|
||||
@@ -320,6 +320,10 @@ void process_logon_packet(struct packet_
|
||||
NTSTATUS status;
|
||||
const char *pdc_name;
|
||||
|
||||
+#ifndef NETLOGON_SUPPORT
|
||||
+ return;
|
||||
+#endif
|
||||
+
|
||||
in_addr_to_sockaddr_storage(&ss, p->ip);
|
||||
pss = iface_ip((struct sockaddr *)&ss);
|
||||
if (!pss) {
|
||||
--- a/source3/rpcclient/rpcclient.c
|
||||
+++ b/source3/rpcclient/rpcclient.c
|
||||
@@ -627,7 +627,9 @@ static struct cmd_set *rpcclient_command
|
||||
#ifdef PRINTER_SUPPORT
|
||||
spoolss_commands,
|
||||
#endif
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
netlogon_commands,
|
||||
+#endif
|
||||
srvsvc_commands,
|
||||
#ifdef DFS_SUPPORT
|
||||
dfs_commands,
|
||||
--- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
|
||||
+++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
|
||||
@@ -820,6 +820,10 @@ WERROR _wkssvc_NetrJoinDomain2(struct pi
|
||||
WERROR werr;
|
||||
struct security_token *token = p->session_info->security_token;
|
||||
|
||||
+#ifndef NETLOGON_SUPPORT
|
||||
+ return WERR_NOT_SUPPORTED;
|
||||
+#endif
|
||||
+
|
||||
if (!r->in.domain_name) {
|
||||
return WERR_INVALID_PARAM;
|
||||
}
|
||||
@@ -897,6 +901,10 @@ WERROR _wkssvc_NetrUnjoinDomain2(struct
|
||||
WERROR werr;
|
||||
struct security_token *token = p->session_info->security_token;
|
||||
|
||||
+#ifndef NETLOGON_SUPPORT
|
||||
+ return WERR_NOT_SUPPORTED;
|
||||
+#endif
|
||||
+
|
||||
if (!r->in.account || !r->in.encrypted_password) {
|
||||
return WERR_INVALID_PARAM;
|
||||
}
|
||||
--- a/source3/libsmb/trusts_util.c
|
||||
+++ b/source3/libsmb/trusts_util.c
|
||||
@@ -46,9 +46,11 @@ NTSTATUS trust_pw_change_and_store_it(st
|
||||
NTSTATUS nt_status;
|
||||
|
||||
switch (sec_channel_type) {
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
case SEC_CHAN_WKSTA:
|
||||
case SEC_CHAN_DOMAIN:
|
||||
break;
|
||||
+#endif
|
||||
default:
|
||||
return NT_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -159,6 +161,11 @@ bool enumerate_domain_trusts( TALLOC_CTX
|
||||
*num_domains = 0;
|
||||
*sids = NULL;
|
||||
|
||||
+#ifndef NETLOGON_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
/* lookup a DC first */
|
||||
|
||||
if ( !get_dc_name(domain, NULL, dc_name, &dc_ss) ) {
|
||||
@@ -243,6 +250,10 @@ NTSTATUS change_trust_account_password(
|
||||
struct cli_state *cli = NULL;
|
||||
struct rpc_pipe_client *netlogon_pipe = NULL;
|
||||
|
||||
+#ifndef NETLOGON_SUPPORT
|
||||
+ return NT_STATUS_UNSUCCESSFUL;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("change_trust_account_password: Attempting to change trust account password in domain %s....\n",
|
||||
domain));
|
||||
|
||||
--- a/source3/auth/auth_domain.c
|
||||
+++ b/source3/auth/auth_domain.c
|
||||
@@ -538,7 +538,9 @@ static NTSTATUS auth_init_trustdomain(st
|
||||
|
||||
NTSTATUS auth_domain_init(void)
|
||||
{
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
smb_register_auth(AUTH_INTERFACE_VERSION, "trustdomain", auth_init_trustdomain);
|
||||
smb_register_auth(AUTH_INTERFACE_VERSION, "ntdomain", auth_init_ntdomain);
|
||||
+#endif
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
--- a/source3/smbd/process.c
|
||||
+++ b/source3/smbd/process.c
|
||||
@@ -2483,8 +2483,10 @@ static bool housekeeping_fn(const struct
|
||||
/* check if we need to reload services */
|
||||
check_reload(sconn, time_mono(NULL));
|
||||
|
||||
+#ifdef NETLOGON_SUPPORT
|
||||
/* Change machine password if neccessary. */
|
||||
attempt_machine_password_change();
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Force a log file check.
|
155
package/network/services/samba36/patches/260-remove_samr.patch
Normal file
155
package/network/services/samba36/patches/260-remove_samr.patch
Normal file
@ -0,0 +1,155 @@
|
||||
--- a/source3/rpc_server/rpc_handles.c
|
||||
+++ b/source3/rpc_server/rpc_handles.c
|
||||
@@ -59,8 +59,11 @@ struct handle_list {
|
||||
|
||||
static bool is_samr_lsa_pipe(const struct ndr_syntax_id *syntax)
|
||||
{
|
||||
- return (ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id)
|
||||
- || ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id));
|
||||
+ return
|
||||
+#ifdef SAMR_SUPPORT
|
||||
+ ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) ||
|
||||
+#endif
|
||||
+ ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id);
|
||||
}
|
||||
|
||||
size_t num_pipe_handles(struct pipes_struct *p)
|
||||
--- a/source3/librpc/rpc/rpc_common.c
|
||||
+++ b/source3/librpc/rpc/rpc_common.c
|
||||
@@ -100,9 +100,11 @@ static bool initialize_interfaces(void)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
+#ifdef SAMR_SUPPORT
|
||||
if (!smb_register_ndr_interface(&ndr_table_samr)) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
#ifdef NETLOGON_SUPPORT
|
||||
if (!smb_register_ndr_interface(&ndr_table_netlogon)) {
|
||||
return false;
|
||||
--- a/source3/rpc_server/rpc_ep_setup.c
|
||||
+++ b/source3/rpc_server/rpc_ep_setup.c
|
||||
@@ -557,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr)
|
||||
return true;
|
||||
}
|
||||
|
||||
+#ifdef SAMR_SUPPORT
|
||||
static bool samr_init_cb(void *ptr)
|
||||
{
|
||||
struct dcesrv_ep_context *ep_ctx =
|
||||
@@ -605,6 +606,7 @@ static bool samr_init_cb(void *ptr)
|
||||
|
||||
return true;
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef NETLOGON_SUPPORT
|
||||
static bool netlogon_init_cb(void *ptr)
|
||||
@@ -1111,12 +1113,14 @@ bool dcesrv_ep_setup(struct tevent_conte
|
||||
return false;
|
||||
}
|
||||
|
||||
+#ifdef SAMR_SUPPORT
|
||||
samr_cb.init = samr_init_cb;
|
||||
samr_cb.shutdown = NULL;
|
||||
samr_cb.private_data = ep_ctx;
|
||||
if (!NT_STATUS_IS_OK(rpc_samr_init(&samr_cb))) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef NETLOGON_SUPPORT
|
||||
netlogon_cb.init = netlogon_init_cb;
|
||||
--- a/source3/smbd/server_exit.c
|
||||
+++ b/source3/smbd/server_exit.c
|
||||
@@ -160,7 +160,9 @@ static void exit_server_common(enum serv
|
||||
#ifdef NETLOGON_SUPPORT
|
||||
rpc_netlogon_shutdown();
|
||||
#endif
|
||||
+#ifdef SAMR_SUPPORT
|
||||
rpc_samr_shutdown();
|
||||
+#endif
|
||||
rpc_lsarpc_shutdown();
|
||||
}
|
||||
|
||||
--- a/source3/rpcclient/rpcclient.c
|
||||
+++ b/source3/rpcclient/rpcclient.c
|
||||
@@ -623,7 +623,9 @@ static struct cmd_set *rpcclient_command
|
||||
rpcclient_commands,
|
||||
lsarpc_commands,
|
||||
ds_commands,
|
||||
+#ifdef SAMR_SUPPORT
|
||||
samr_commands,
|
||||
+#endif
|
||||
#ifdef PRINTER_SUPPORT
|
||||
spoolss_commands,
|
||||
#endif
|
||||
--- a/source3/smbd/lanman.c
|
||||
+++ b/source3/smbd/lanman.c
|
||||
@@ -2353,6 +2353,10 @@ static bool api_RNetGroupEnum(struct smb
|
||||
NTSTATUS status, result;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -2541,6 +2545,10 @@ static bool api_NetUserGetGroups(struct
|
||||
NTSTATUS status, result;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !UserName || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -2733,6 +2741,10 @@ static bool api_RNetUserEnum(struct smbd
|
||||
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -2979,6 +2991,10 @@ static bool api_SetUserPassword(struct s
|
||||
int min_pwd_length;
|
||||
struct dcerpc_binding_handle *b = NULL;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
/* Skip 2 strings. */
|
||||
p = skip_string(param,tpscnt,np);
|
||||
p = skip_string(param,tpscnt,p);
|
||||
@@ -3224,6 +3240,10 @@ static bool api_SamOEMChangePassword(str
|
||||
int bufsize;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
*rparam_len = 4;
|
||||
*rparam = smb_realloc_limit(*rparam,*rparam_len);
|
||||
if (!*rparam) {
|
||||
@@ -4265,6 +4285,10 @@ static bool api_RNetUserGetInfo(struct s
|
||||
union samr_UserInfo *info;
|
||||
struct dcerpc_binding_handle *b = NULL;
|
||||
|
||||
+#ifndef SAMR_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !UserName || !p) {
|
||||
return False;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
--- a/source3/lib/smbconf/smbconf_init.c
|
||||
+++ b/source3/lib/smbconf/smbconf_init.c
|
||||
@@ -68,9 +68,12 @@ sbcErr smbconf_init(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef REGISTRY_BACKEND
|
||||
if (strequal(backend, "registry") || strequal(backend, "reg")) {
|
||||
err = smbconf_init_reg(mem_ctx, conf_ctx, path);
|
||||
- } else if (strequal(backend, "file") || strequal(backend, "txt")) {
|
||||
+ } else
|
||||
+#endif
|
||||
+ if (strequal(backend, "file") || strequal(backend, "txt")) {
|
||||
err = smbconf_init_txt(mem_ctx, conf_ctx, path);
|
||||
} else if (sep == NULL) {
|
||||
/*
|
||||
--- a/source3/lib/netapi/serverinfo.c
|
||||
+++ b/source3/lib/netapi/serverinfo.c
|
||||
@@ -557,7 +557,10 @@ static WERROR NetServerSetInfo_l_1005(st
|
||||
return WERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
- if (!lp_config_backend_is_registry()) {
|
||||
+#ifdef REGISTRY_BACKEND
|
||||
+ if (!lp_config_backend_is_registry())
|
||||
+#endif
|
||||
+ {
|
||||
libnetapi_set_error_string(ctx,
|
||||
"Configuration manipulation requested but not "
|
||||
"supported by backend");
|
||||
--- a/source3/smbd/server.c
|
||||
+++ b/source3/smbd/server.c
|
||||
@@ -1210,8 +1210,10 @@ extern void build_options(bool screen);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+#ifdef REGISTRY_BACKEND
|
||||
if (!W_ERROR_IS_OK(registry_init_full()))
|
||||
exit(1);
|
||||
+#endif
|
||||
|
||||
#ifdef PRINTER_SUPPORT
|
||||
if (!print_backend_init(smbd_messaging_context()))
|
143
package/network/services/samba36/patches/280-strip_srvsvc.patch
Normal file
143
package/network/services/samba36/patches/280-strip_srvsvc.patch
Normal file
@ -0,0 +1,143 @@
|
||||
--- a/source3/smbd/lanman.c
|
||||
+++ b/source3/smbd/lanman.c
|
||||
@@ -2197,6 +2197,10 @@ static bool api_RNetShareAdd(struct smbd
|
||||
struct srvsvc_NetShareInfo2 info2;
|
||||
struct dcerpc_binding_handle *b;
|
||||
|
||||
+#ifndef SRVSVC_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
@@ -3838,10 +3842,7 @@ static bool api_RNetServerGetInfo(struct
|
||||
NTSTATUS status;
|
||||
WERROR werr;
|
||||
TALLOC_CTX *mem_ctx = talloc_tos();
|
||||
- struct rpc_pipe_client *cli = NULL;
|
||||
- union srvsvc_NetSrvInfo info;
|
||||
int errcode;
|
||||
- struct dcerpc_binding_handle *b;
|
||||
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
@@ -3904,66 +3905,16 @@ static bool api_RNetServerGetInfo(struct
|
||||
p = *rdata;
|
||||
p2 = p + struct_len;
|
||||
|
||||
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
|
||||
- conn->session_info,
|
||||
- &conn->sconn->client_id,
|
||||
- conn->sconn->msg_ctx,
|
||||
- &cli);
|
||||
- if (!NT_STATUS_IS_OK(status)) {
|
||||
- DEBUG(0,("api_RNetServerGetInfo: could not connect to srvsvc: %s\n",
|
||||
- nt_errstr(status)));
|
||||
- errcode = W_ERROR_V(ntstatus_to_werror(status));
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- b = cli->binding_handle;
|
||||
-
|
||||
- status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
|
||||
- NULL,
|
||||
- 101,
|
||||
- &info,
|
||||
- &werr);
|
||||
- if (!NT_STATUS_IS_OK(status)) {
|
||||
- errcode = W_ERROR_V(ntstatus_to_werror(status));
|
||||
- goto out;
|
||||
- }
|
||||
- if (!W_ERROR_IS_OK(werr)) {
|
||||
- errcode = W_ERROR_V(werr);
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
- if (info.info101 == NULL) {
|
||||
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
if (uLevel != 20) {
|
||||
- srvstr_push(NULL, 0, p, info.info101->server_name, 16,
|
||||
+ srvstr_push(NULL, 0, p, global_myname(), 16,
|
||||
STR_ASCII|STR_UPPER|STR_TERMINATE);
|
||||
- }
|
||||
+ }
|
||||
p += 16;
|
||||
if (uLevel > 0) {
|
||||
- SCVAL(p,0,info.info101->version_major);
|
||||
- SCVAL(p,1,info.info101->version_minor);
|
||||
- SIVAL(p,2,info.info101->server_type);
|
||||
-
|
||||
- if (mdrcnt == struct_len) {
|
||||
- SIVAL(p,6,0);
|
||||
- } else {
|
||||
- SIVAL(p,6,PTR_DIFF(p2,*rdata));
|
||||
- if (mdrcnt - struct_len <= 0) {
|
||||
- return false;
|
||||
- }
|
||||
- push_ascii(p2,
|
||||
- info.info101->comment,
|
||||
- MIN(mdrcnt - struct_len,
|
||||
- MAX_SERVER_STRING_LENGTH),
|
||||
- STR_TERMINATE);
|
||||
- p2 = skip_string(*rdata,*rdata_len,p2);
|
||||
- if (!p2) {
|
||||
- return False;
|
||||
- }
|
||||
- }
|
||||
+ SCVAL(p,0,lp_major_announce_version());
|
||||
+ SCVAL(p,1,lp_minor_announce_version());
|
||||
+ SIVAL(p,2,lp_default_server_announce());
|
||||
+ SIVAL(p,6,0);
|
||||
}
|
||||
|
||||
if (uLevel > 1) {
|
||||
@@ -5654,6 +5605,10 @@ static bool api_RNetSessionEnum(struct s
|
||||
uint32_t totalentries, resume_handle = 0;
|
||||
uint32_t count = 0;
|
||||
|
||||
+#ifndef SRVSVC_SUPPORT
|
||||
+ return False;
|
||||
+#endif
|
||||
+
|
||||
if (!str1 || !str2 || !p) {
|
||||
return False;
|
||||
}
|
||||
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
|
||||
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
|
||||
@@ -1533,6 +1533,10 @@ WERROR _srvsvc_NetShareSetInfo(struct pi
|
||||
TALLOC_CTX *ctx = p->mem_ctx;
|
||||
union srvsvc_NetShareInfo *info = r->in.info;
|
||||
|
||||
+#ifndef FULL_SRVSVC
|
||||
+ return WERR_ACCESS_DENIED;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
|
||||
|
||||
if (!r->in.share_name) {
|
||||
@@ -1763,6 +1767,10 @@ WERROR _srvsvc_NetShareAdd(struct pipes_
|
||||
int max_connections = 0;
|
||||
TALLOC_CTX *ctx = p->mem_ctx;
|
||||
|
||||
+#ifndef FULL_SRVSVC
|
||||
+ return WERR_ACCESS_DENIED;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
|
||||
|
||||
if (r->out.parm_error) {
|
||||
@@ -1945,6 +1953,10 @@ WERROR _srvsvc_NetShareDel(struct pipes_
|
||||
struct share_params *params;
|
||||
TALLOC_CTX *ctx = p->mem_ctx;
|
||||
|
||||
+#ifndef FULL_SRVSVC
|
||||
+ return WERR_ACCESS_DENIED;
|
||||
+#endif
|
||||
+
|
||||
DEBUG(5,("_srvsvc_NetShareDel: %d\n", __LINE__));
|
||||
|
||||
if (!r->in.share_name) {
|
@ -0,0 +1,73 @@
|
||||
--- a/source3/librpc/rpc/rpc_common.c
|
||||
+++ b/source3/librpc/rpc/rpc_common.c
|
||||
@@ -92,9 +92,11 @@ bool smb_register_ndr_interface(const st
|
||||
|
||||
static bool initialize_interfaces(void)
|
||||
{
|
||||
+#ifdef LSA_SUPPORT
|
||||
if (!smb_register_ndr_interface(&ndr_table_lsarpc)) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
#ifdef ACTIVE_DIRECTORY
|
||||
if (!smb_register_ndr_interface(&ndr_table_dssetup)) {
|
||||
return false;
|
||||
--- a/source3/smbd/server_exit.c
|
||||
+++ b/source3/smbd/server_exit.c
|
||||
@@ -163,7 +163,9 @@ static void exit_server_common(enum serv
|
||||
#ifdef SAMR_SUPPORT
|
||||
rpc_samr_shutdown();
|
||||
#endif
|
||||
+#ifdef LSA_SUPPORT
|
||||
rpc_lsarpc_shutdown();
|
||||
+#endif
|
||||
}
|
||||
|
||||
/*
|
||||
--- a/source3/rpc_server/rpc_ep_setup.c
|
||||
+++ b/source3/rpc_server/rpc_ep_setup.c
|
||||
@@ -508,6 +508,7 @@ static bool srvsvc_init_cb(void *ptr)
|
||||
return true;
|
||||
}
|
||||
|
||||
+#ifdef LSA_SUPPORT
|
||||
static bool lsarpc_init_cb(void *ptr)
|
||||
{
|
||||
struct dcesrv_ep_context *ep_ctx =
|
||||
@@ -556,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr)
|
||||
|
||||
return true;
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef SAMR_SUPPORT
|
||||
static bool samr_init_cb(void *ptr)
|
||||
@@ -1106,12 +1108,14 @@ bool dcesrv_ep_setup(struct tevent_conte
|
||||
}
|
||||
|
||||
|
||||
+#ifdef LSA_SUPPORT
|
||||
lsarpc_cb.init = lsarpc_init_cb;
|
||||
lsarpc_cb.shutdown = NULL;
|
||||
lsarpc_cb.private_data = ep_ctx;
|
||||
if (!NT_STATUS_IS_OK(rpc_lsarpc_init(&lsarpc_cb))) {
|
||||
return false;
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef SAMR_SUPPORT
|
||||
samr_cb.init = samr_init_cb;
|
||||
--- a/source3/rpc_server/rpc_handles.c
|
||||
+++ b/source3/rpc_server/rpc_handles.c
|
||||
@@ -63,7 +63,10 @@ static bool is_samr_lsa_pipe(const struc
|
||||
#ifdef SAMR_SUPPORT
|
||||
ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) ||
|
||||
#endif
|
||||
- ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id);
|
||||
+#ifdef LSA_SUPPORT
|
||||
+ ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id) ||
|
||||
+#endif
|
||||
+ false;
|
||||
}
|
||||
|
||||
size_t num_pipe_handles(struct pipes_struct *p)
|
@ -0,0 +1,11 @@
|
||||
--- a/lib/util/util.h
|
||||
+++ b/lib/util/util.h
|
||||
@@ -53,7 +53,7 @@ extern const char *panic_action;
|
||||
#else
|
||||
/* redefine the assert macro for non-developer builds */
|
||||
#define SMB_ASSERT(b) do { if (!(b)) { \
|
||||
- DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \
|
||||
+ DEBUG(3,("PANIC: assert failed at %s(%d): %s\n", \
|
||||
__FILE__, __LINE__, #b)); }} while (0)
|
||||
#endif
|
||||
|
@ -0,0 +1,253 @@
|
||||
--- a/libcli/util/doserr.c
|
||||
+++ b/libcli/util/doserr.c
|
||||
@@ -28,6 +28,7 @@ struct werror_code_struct {
|
||||
|
||||
static const struct werror_code_struct dos_errs[] =
|
||||
{
|
||||
+#ifdef VERBOSE_ERROR
|
||||
{ "WERR_OK", WERR_OK },
|
||||
{ "WERR_BADFILE", WERR_BADFILE },
|
||||
{ "WERR_ACCESS_DENIED", WERR_ACCESS_DENIED },
|
||||
@@ -2668,6 +2669,7 @@ static const struct werror_code_struct d
|
||||
{ "WERR_AMBIGUOUS_SYSTEM_DEVICE", WERR_AMBIGUOUS_SYSTEM_DEVICE },
|
||||
{ "WERR_SYSTEM_DEVICE_NOT_FOUND", WERR_SYSTEM_DEVICE_NOT_FOUND },
|
||||
/* END GENERATED-WIN32-ERROR-CODES */
|
||||
+#endif
|
||||
{ NULL, W_ERROR(0) }
|
||||
};
|
||||
|
||||
@@ -2684,12 +2686,14 @@ const char *win_errstr(WERROR werror)
|
||||
static char msg[40];
|
||||
int idx = 0;
|
||||
|
||||
+#ifdef VERBOSE_ERROR
|
||||
while (dos_errs[idx].dos_errstr != NULL) {
|
||||
if (W_ERROR_V(dos_errs[idx].werror) ==
|
||||
W_ERROR_V(werror))
|
||||
return dos_errs[idx].dos_errstr;
|
||||
idx++;
|
||||
}
|
||||
+#endif
|
||||
|
||||
slprintf(msg, sizeof(msg), "DOS code 0x%08x", W_ERROR_V(werror));
|
||||
|
||||
@@ -2702,6 +2706,7 @@ struct werror_str_struct {
|
||||
};
|
||||
|
||||
const struct werror_str_struct dos_err_strs[] = {
|
||||
+#ifdef VERBOSE_ERROR
|
||||
{ WERR_OK, "Success" },
|
||||
{ WERR_ACCESS_DENIED, "Access is denied" },
|
||||
{ WERR_INVALID_PARAM, "Invalid parameter" },
|
||||
@@ -5324,6 +5329,7 @@ const struct werror_str_struct dos_err_s
|
||||
{ WERR_AMBIGUOUS_SYSTEM_DEVICE, "The requested system device cannot be identified due to multiple indistinguishable devices potentially matching the identification criteria." },
|
||||
{ WERR_SYSTEM_DEVICE_NOT_FOUND, "The requested system device cannot be found." },
|
||||
/* END GENERATED-WIN32-ERROR-CODES-DESC */
|
||||
+#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -5334,6 +5340,7 @@ const struct werror_str_struct dos_err_s
|
||||
|
||||
const char *get_friendly_werror_msg(WERROR werror)
|
||||
{
|
||||
+#ifdef VERBOSE_ERROR
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dos_err_strs); i++) {
|
||||
@@ -5342,6 +5349,7 @@ const char *get_friendly_werror_msg(WERR
|
||||
return dos_err_strs[i].friendly_errstr;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
return win_errstr(werror);
|
||||
}
|
||||
--- a/librpc/ndr/libndr.h
|
||||
+++ b/librpc/ndr/libndr.h
|
||||
@@ -598,4 +598,20 @@ _PUBLIC_ enum ndr_err_code ndr_push_enum
|
||||
|
||||
_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
|
||||
|
||||
+#ifndef VERBOSE_ERROR
|
||||
+#define ndr_print_bool(...) do {} while (0)
|
||||
+#define ndr_print_struct(...) do {} while (0)
|
||||
+#define ndr_print_null(...) do {} while (0)
|
||||
+#define ndr_print_enum(...) do {} while (0)
|
||||
+#define ndr_print_bitmap_flag(...) do {} while (0)
|
||||
+#define ndr_print_ptr(...) do {} while (0)
|
||||
+#define ndr_print_union(...) do {} while (0)
|
||||
+#define ndr_print_bad_level(...) do {} while (0)
|
||||
+#define ndr_print_array_uint8(...) do {} while (0)
|
||||
+#define ndr_print_string_array(...) do {} while (0)
|
||||
+#define ndr_print_string_array(...) do {} while (0)
|
||||
+#define ndr_print_NTSTATUS(...) do {} while (0)
|
||||
+#define ndr_print_WERROR(...) do {} while (0)
|
||||
+#endif
|
||||
+
|
||||
#endif /* __LIBNDR_H__ */
|
||||
--- a/librpc/ndr/ndr_basic.c
|
||||
+++ b/librpc/ndr/ndr_basic.c
|
||||
@@ -31,6 +31,19 @@
|
||||
#define NDR_SIVAL(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVAL(ndr->data,ofs,v); } else SIVAL(ndr->data,ofs,v); } while (0)
|
||||
#define NDR_SIVALS(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVALS(ndr->data,ofs,v); } else SIVALS(ndr->data,ofs,v); } while (0)
|
||||
|
||||
+#undef ndr_print_bool
|
||||
+#undef ndr_print_struct
|
||||
+#undef ndr_print_null
|
||||
+#undef ndr_print_enum
|
||||
+#undef ndr_print_bitmap_flag
|
||||
+#undef ndr_print_ptr
|
||||
+#undef ndr_print_union
|
||||
+#undef ndr_print_bad_level
|
||||
+#undef ndr_print_array_uint8
|
||||
+#undef ndr_print_string_array
|
||||
+#undef ndr_print_string_array
|
||||
+#undef ndr_print_NTSTATUS
|
||||
+#undef ndr_print_WERROR
|
||||
|
||||
/*
|
||||
check for data leaks from the server by looking for non-zero pad bytes
|
||||
--- a/librpc/ndr/ndr_string.c
|
||||
+++ b/librpc/ndr/ndr_string.c
|
||||
@@ -588,6 +588,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_stri
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
+#undef ndr_print_string_array
|
||||
_PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a)
|
||||
{
|
||||
uint32_t count;
|
||||
--- a/librpc/rpc/dcerpc_error.c
|
||||
+++ b/librpc/rpc/dcerpc_error.c
|
||||
@@ -31,6 +31,7 @@ struct dcerpc_fault_table {
|
||||
static const struct dcerpc_fault_table dcerpc_faults[] =
|
||||
{
|
||||
#define _FAULT_STR(x) { #x , x }
|
||||
+#ifdef VERBOSE_ERROR
|
||||
_FAULT_STR(DCERPC_NCA_S_COMM_FAILURE),
|
||||
_FAULT_STR(DCERPC_NCA_S_OP_RNG_ERROR),
|
||||
_FAULT_STR(DCERPC_NCA_S_UNKNOWN_IF),
|
||||
@@ -78,6 +79,7 @@ static const struct dcerpc_fault_table d
|
||||
_FAULT_STR(DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR),
|
||||
_FAULT_STR(DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND),
|
||||
_FAULT_STR(DCERPC_NCA_S_FAULT_NO_CLIENT_STUB),
|
||||
+#endif
|
||||
{ NULL, 0 }
|
||||
#undef _FAULT_STR
|
||||
};
|
||||
@@ -87,12 +89,14 @@ _PUBLIC_ const char *dcerpc_errstr(TALLO
|
||||
int idx = 0;
|
||||
WERROR werr = W_ERROR(fault_code);
|
||||
|
||||
+#ifdef VERBOSE_ERROR
|
||||
while (dcerpc_faults[idx].errstr != NULL) {
|
||||
if (dcerpc_faults[idx].faultcode == fault_code) {
|
||||
return dcerpc_faults[idx].errstr;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
+#endif
|
||||
|
||||
return win_errstr(werr);
|
||||
}
|
||||
--- a/source3/libsmb/nterr.c
|
||||
+++ b/source3/libsmb/nterr.c
|
||||
@@ -702,6 +702,7 @@ const char *nt_errstr(NTSTATUS nt_code)
|
||||
NT_STATUS_DOS_CODE(nt_code));
|
||||
}
|
||||
|
||||
+#ifdef VERBOSE_ERROR
|
||||
while (nt_errs[idx].nt_errstr != NULL) {
|
||||
if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
|
||||
NT_STATUS_V(nt_code)) {
|
||||
@@ -709,6 +710,7 @@ const char *nt_errstr(NTSTATUS nt_code)
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
+#endif
|
||||
|
||||
result = talloc_asprintf(talloc_tos(), "NT code 0x%08x",
|
||||
NT_STATUS_V(nt_code));
|
||||
@@ -724,12 +726,14 @@ const char *get_friendly_nt_error_msg(NT
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
+#ifdef VERBOSE_ERROR
|
||||
while (nt_err_desc[idx].nt_errstr != NULL) {
|
||||
if (NT_STATUS_V(nt_err_desc[idx].nt_errcode) == NT_STATUS_V(nt_code)) {
|
||||
return nt_err_desc[idx].nt_errstr;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* fall back to NT_STATUS_XXX string */
|
||||
|
||||
@@ -745,6 +749,7 @@ const char *get_nt_error_c_code(NTSTATUS
|
||||
char *result;
|
||||
int idx = 0;
|
||||
|
||||
+#ifdef VERBOSE_ERROR
|
||||
while (nt_errs[idx].nt_errstr != NULL) {
|
||||
if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
|
||||
NT_STATUS_V(nt_code)) {
|
||||
@@ -752,6 +757,7 @@ const char *get_nt_error_c_code(NTSTATUS
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
+#endif
|
||||
|
||||
result = talloc_asprintf(talloc_tos(), "NT_STATUS(0x%08x)",
|
||||
NT_STATUS_V(nt_code));
|
||||
@@ -767,12 +773,14 @@ NTSTATUS nt_status_string_to_code(const
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
+#ifdef VERBOSE_ERROR
|
||||
while (nt_errs[idx].nt_errstr != NULL) {
|
||||
if (strcasecmp(nt_errs[idx].nt_errstr, nt_status_str) == 0) {
|
||||
return nt_errs[idx].nt_errcode;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
+#endif
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
--- a/lib/tdb/common/tdb_private.h
|
||||
+++ b/lib/tdb/common/tdb_private.h
|
||||
@@ -69,7 +69,11 @@ typedef uint32_t tdb_off_t;
|
||||
/* NB assumes there is a local variable called "tdb" that is the
|
||||
* current context, also takes doubly-parenthesized print-style
|
||||
* argument. */
|
||||
+#ifdef VERBOSE_DEBUG
|
||||
#define TDB_LOG(x) tdb->log.log_fn x
|
||||
+#else
|
||||
+#define TDB_LOG(x) do {} while(0)
|
||||
+#endif
|
||||
|
||||
#ifdef TDB_TRACE
|
||||
void tdb_trace(struct tdb_context *tdb, const char *op);
|
||||
--- a/source3/script/mkbuildoptions.awk
|
||||
+++ b/source3/script/mkbuildoptions.awk
|
||||
@@ -55,7 +55,7 @@ BEGIN {
|
||||
print "****************************************************************************/";
|
||||
print "void build_options(bool screen)";
|
||||
print "{";
|
||||
- print " if ((DEBUGLEVEL < 4) && (!screen)) {";
|
||||
+ print " if ((DEBUGLEVEL < 4) || (!screen)) {";
|
||||
print " return;";
|
||||
print " }";
|
||||
print "";
|
||||
--- a/source3/script/mkbuildoptions-waf.awk
|
||||
+++ b/source3/script/mkbuildoptions-waf.awk
|
||||
@@ -55,7 +55,7 @@ BEGIN {
|
||||
print "****************************************************************************/";
|
||||
print "void build_options(bool screen)";
|
||||
print "{";
|
||||
- print " if ((DEBUGLEVEL < 4) && (!screen)) {";
|
||||
+ print " if ((DEBUGLEVEL < 4) || (!screen)) {";
|
||||
print " return;";
|
||||
print " }";
|
||||
print "";
|
@ -0,0 +1,22 @@
|
||||
--- a/lib/util/debug.h
|
||||
+++ b/lib/util/debug.h
|
||||
@@ -45,7 +45,7 @@ bool dbghdr( int level, const char *loca
|
||||
* Redefine DEBUGLEVEL because so we don't have to change every source file
|
||||
* that *unnecessarily* references it.
|
||||
*/
|
||||
-#define DEBUGLEVEL DEBUGLEVEL_CLASS[DBGC_ALL]
|
||||
+#define DEBUGLEVEL 0
|
||||
|
||||
/*
|
||||
* Define all new debug classes here. A class is represented by an entry in
|
||||
--- a/source3/nmbd/asyncdns.c
|
||||
+++ b/source3/nmbd/asyncdns.c
|
||||
@@ -85,7 +85,7 @@ static void asyncdns_process(void)
|
||||
struct query_record r;
|
||||
unstring qname;
|
||||
|
||||
- DEBUGLEVEL = -1;
|
||||
+ DEBUGLEVEL_CLASS[DBGC_ALL] = -1;
|
||||
|
||||
while (1) {
|
||||
NTSTATUS status;
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user