samba: update to samba-4.6.5

This commit is contained in:
MilhouseVH 2017-06-22 18:46:42 +01:00
parent 524dc53ee8
commit eeb5d381f4
30 changed files with 365 additions and 11186 deletions

View File

@ -0,0 +1,40 @@
Checking simple C program: OK
rpath library support: OK
-Wl,--version-script support: OK
Checking getconf LFS_CFLAGS: NO
Checking for large file support without additional flags: OK
Checking for -D_LARGE_FILES: OK
Checking correct behavior of strtoll: NO
Checking for working strptime: OK
Checking for C99 vsnprintf: OK
Checking for HAVE_SHARED_MMAP: OK
Checking for HAVE_MREMAP: OK
Checking for HAVE_INCOHERENT_MMAP: NO
Checking for HAVE_SECURE_MKSTEMP: OK
Checking for HAVE_IFACE_GETIFADDRS: OK
Checking for kernel change notify support: OK
Checking for Linux kernel oplocks: OK
Checking for kernel share modes: OK
Checking if can we convert from CP850 to UCS-2LE: OK
Checking if can we convert from UTF-8 to UCS-2LE: OK
Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
Checking whether we can use Linux thread-specific credentials: OK
Checking whether setreuid is available: OK
Checking whether setresuid is available: OK
Checking whether seteuid is available: OK
Checking whether fcntl locking is available: OK
Checking whether fcntl lock supports open file description locks: OK
Checking for the maximum value of the 'time_t' type: OK
Checking whether the realpath function allows a NULL argument: OK
Checking whether POSIX capabilities are available: OK
Checking for ftruncate extend: OK
vfs_fileid checking for statfs() and struct statfs.f_fsid: OK
getcwd takes a NULL argument: OK
Checking uname sysname type: "Linux"
Checking uname release type: "3.0.0"
Checking uname version type: "#1 Tue Nov 1 12:34:56 UTC 2013"
Checking value of NSIG: "65"
Checking value of _NSIG: "65"
Checking value of SIGRTMAX: "64"
Checking value of SIGRTMIN: "34"

View File

@ -1,6 +1,6 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -23,27 +23,31 @@
[global]
server string = LibreELEC
workgroup = WORKGROUP
netbios name = %h
security = share
guest account = root
socket options = TCP_NODELAY IPTOS_LOWDELAY
max protocol = SMB2
min receivefile size = 16384
deadtime = 30
mangled names = no
syslog only = yes
syslog = 2
name resolve order = host bcast wins
printcap name = /dev/null
load printers = no
browseable = yes
writeable = yes
printable = no
deadtime = 30
mangled names = no
name resolve order = host bcast
printcap name = /dev/null
load printers = no
encrypt passwords = true
enable core files = no
passdb backend = smbpasswd
smb encrypt = disabled
# samba share options
map to guest = Bad User
guest account = root
security = user
# samba tuning options
socket options = TCP_NODELAY IPTOS_LOWDELAY
min receivefile size = 16384
aio read size = 16384
aio write size = 16384
use sendfile = yes
# The following are default values for the master selection process
# local master = yes
# preferred master = auto

View File

@ -17,12 +17,13 @@
################################################################################
PKG_NAME="samba"
PKG_VERSION="3.6.25"
PKG_VERSION="4.6.5"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_LICENSE="GPLv3+"
PKG_SITE="https://www.samba.org"
PKG_URL="https://samba.org/samba/ftp/stable/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain zlib connman"
PKG_DEPENDS_TARGET="toolchain heimdal:host e2fsprogs:host Python zlib readline popt libaio connman"
PKG_NEED_UNPACK="$(get_pkg_directory heimdal) $(get_pkg_directory e2fsprogs)"
PKG_SECTION="network"
PKG_SHORTDESC="samba: The free SMB / CIFS fileserver and client"
PKG_LONGDESC="Samba is a SMB server that runs on Unix and other operating systems. It allows these operating systems (currently Unix, Netware, OS/2 and AmigaDOS) to act as a file and print server for SMB and CIFS clients. There are many Lan-Manager compatible clients such as LanManager for DOS, Windows for Workgroups, Windows NT, Windows 95, Linux smbfs, OS/2, Pathworks and more."
@ -30,6 +31,8 @@ PKG_LONGDESC="Samba is a SMB server that runs on Unix and other operating system
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"
PKG_MAKE_OPTS_TARGET="V=1"
if [ "$AVAHI_DAEMON" = yes ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi"
SMB_AVAHI="--enable-avahi"
@ -37,127 +40,126 @@ else
SMB_AVAHI="--disable-avahi"
fi
PKG_CONFIGURE_SCRIPT="source3/configure"
PKG_CONFIGURE_OPTS_TARGET="ac_cv_file__proc_sys_kernel_core_pattern=yes \
libreplace_cv_HAVE_C99_VSNPRINTF=yes \
libreplace_cv_HAVE_GETADDRINFO=no \
libreplace_cv_HAVE_IFACE_IFCONF=no \
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 \
--with-configdir=/etc/samba \
--with-privatedir=/var/run \
--with-codepagedir=/etc/samba \
--with-lockdir=/var/lock \
--with-logfilebase=/var/log \
--with-nmbdsocketdir=/var/nmbd \
--with-piddir=/var/run \
--disable-shared-libs \
--disable-debug \
--with-libiconv="$SYSROOT_PREFIX/usr" \
--disable-krb5developer \
--disable-picky-developer \
--enable-largefile \
--disable-socket-wrapper \
--disable-nss-wrapper \
--disable-swat \
--disable-cups \
--disable-iprint \
--disable-pie \
--disable-relro \
--disable-fam \
--disable-dnssd \
$SMB_AVAHI \
--disable-pthreadpool \
--disable-dmalloc \
--with-fhs \
--without-libtalloc \
--disable-external-libtalloc \
--without-libtdb \
--disable-external-libtdb \
--without-libnetapi \
--with-libsmbclient \
--without-libsmbsharemodes \
--without-libaddns \
--without-afs \
--without-fake-kaserver \
--without-vfs-afsacl \
--without-ldap \
--without-ads \
--without-dnsupdate \
--without-automount \
--without-krb5 \
--without-pam \
--without-pam_smbpass \
--without-nisplus-home \
--with-syslog \
--without-quotas \
--without-sys-quotas \
--without-utmp \
--without-cluster-support \
--without-acl-support \
--without-aio-support \
--with-sendfile-support \
--without-libtevent \
--without-wbclient \
--without-winbind \
--with-included-popt \
--with-included-iniparser"
PKG_CONFIGURE_OPTS="--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--with-lockdir=/var/lock \
--with-logfilebase=/var/log \
--with-piddir=/run/samba \
--with-privatedir=/run/samba \
--with-modulesdir=/usr/lib \
--with-privatelibdir=/usr/lib \
--with-sockets-dir=/run/samba \
--with-configdir=/run/samba \
--with-libiconv=$SYSROOT_PREFIX/usr \
--cross-compile \
--cross-answers=$ROOT/$PKG_BUILD/cache.txt \
--hostcc=gcc \
--enable-fhs \
--without-dmapi \
--disable-glusterfs \
--disable-rpath \
--disable-rpath-install \
--disable-rpath-private-install \
$SMB_AVAHI \
--disable-cups \
--disable-iprint \
--disable-gnutls \
--with-relro \
--with-sendfile-support \
--without-acl-support \
--without-ads \
--without-ad-dc \
--without-automount \
--without-cluster-support \
--without-dnsupdate \
--without-fam \
--without-gettext \
--without-gpgme \
--without-iconv \
--without-ldap \
--without-pam \
--without-pie \
--without-regedit \
--without-systemd \
--without-utmp \
--without-winbind \
--enable-auto-reconfigure \
--bundled-libraries='ALL,!asn1_compile,!compile_et,!zlib' \
--without-quotas \
--with-syslog \
--nopyc --nopyo"
PKG_SAMBA_TARGET="smbclient"
[ "$SAMBA_SERVER" = "yes" ] && PKG_SAMBA_TARGET+=",smbd/smbd,nmbd,smbpasswd"
[ "$DEVTOOLS" = "yes" ] && PKG_SAMBA_TARGET+=",client/smbclient,smbtree,testparm"
pre_configure_target() {
( cd ../source3
sh autogen.sh
)
# samba uses its own build directory
cd $ROOT/$PKG_BUILD
rm -rf .$TARGET_NAME
# samba fails to build with gold support
strip_gold
CFLAGS="$CFLAGS -fPIC -DPIC"
LDFLAGS="$LDFLAGS -fwhole-program"
}
# work around link issues
export LDFLAGS="$LDFLAGS -lreadline"
make_target() {
make bin/libtalloc.a
make bin/libwbclient.a
make bin/libtdb.a
make bin/libtevent.a
make bin/libsmbclient.a
if [ "$SAMBA_SERVER" = "yes" ]; then
make bin/samba_multicall
# support 64-bit offsets and seeks on 32-bit platforms
if [ "$TARGET_ARCH" = "arm" ]; then
export CFLAGS+="-D_FILE_OFFSET_BITS=64 -D_OFF_T_DEFINED_ -Doff_t=off64_t -Dlseek=lseek64"
fi
}
post_make_target() {
mkdir -p $SYSROOT_PREFIX/usr/lib
cp -P bin/*.a $SYSROOT_PREFIX/usr/lib
configure_target() {
cp $PKG_DIR/config/samba4-cache.txt $ROOT/$PKG_BUILD/cache.txt
echo "Checking uname machine type: \"$TARGET_ARCH\"" >> $ROOT/$PKG_BUILD/cache.txt
mkdir -p $SYSROOT_PREFIX/usr/include
cp ../source3/include/libsmbclient.h $SYSROOT_PREFIX/usr/include
PYTHON_CONFIG="$SYSROOT_PREFIX/usr/bin/python-config" \
python_LDFLAGS="" python_LIBDIR="" \
./configure $PKG_CONFIGURE_OPTS
}
mkdir -p $SYSROOT_PREFIX/usr/lib/pkgconfig
# talloc/tdb/tevent/wbclient static
sed -e "s,^Libs: -lsmbclient$,Libs: -lsmbclient -ltalloc -ltdb -ltevent -lwbclient,g" -i pkgconfig/smbclient.pc
cp pkgconfig/smbclient.pc $SYSROOT_PREFIX/usr/lib/pkgconfig
make_target() {
./buildtools/bin/waf build --targets=$PKG_SAMBA_TARGET -j$CONCURRENCY_MAKE_LEVEL
}
makeinstall_target() {
./buildtools/bin/waf install --destdir=$SYSROOT_PREFIX --targets=smbclient -j$CONCURRENCY_MAKE_LEVEL
./buildtools/bin/waf install --destdir=$INSTALL --targets=$PKG_SAMBA_TARGET -j$CONCURRENCY_MAKE_LEVEL
}
post_makeinstall_target() {
rm -rf $INSTALL/usr/bin
rm -rf $INSTALL/usr/lib/python*
rm -rf $INSTALL/usr/share/perl*
mkdir -p $INSTALL/usr/lib/samba
cp $PKG_DIR/scripts/samba-config $INSTALL/usr/lib/samba
mkdir -p $INSTALL/etc/samba
if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/smb.conf ]; then
cp $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/smb.conf $INSTALL/etc/samba
elif [ -f $PROJECT_DIR/$PROJECT/config/smb.conf ]; then
cp $PROJECT_DIR/$PROJECT/config/smb.conf $INSTALL/etc/samba
elif [ -f $DISTRO_DIR/$DISTRO/config/smb.conf ]; then
cp $DISTRO_DIR/$DISTRO/config/smb.conf $INSTALL/etc/samba
else
cp $PKG_DIR/config/smb.conf $INSTALL/etc/samba
mkdir -p $INSTALL/usr/config
cp $PKG_DIR/config/smb.conf $INSTALL/usr/config/samba.conf.sample
fi
if [ "$DEVTOOLS" = "yes" ]; then
mkdir -p $INSTALL/usr/bin
cp -PR bin/default/source3/client/smbclient $INSTALL/usr/bin
cp -PR bin/default/source3/utils/smbtree $INSTALL/usr/bin
cp -PR bin/default/source3/utils/testparm $INSTALL/usr/bin
fi
if [ "$SAMBA_SERVER" = "yes" ]; then
mkdir -p $INSTALL/usr/bin
cp bin/samba_multicall $INSTALL/usr/bin
ln -sf samba_multicall $INSTALL/usr/bin/smbd
ln -sf samba_multicall $INSTALL/usr/bin/nmbd
ln -sf samba_multicall $INSTALL/usr/bin/smbpasswd
mkdir -p $INSTALL/etc/samba
cp ../codepages/lowcase.dat $INSTALL/etc/samba
cp ../codepages/upcase.dat $INSTALL/etc/samba
cp ../codepages/valid.dat $INSTALL/etc/samba
cp -PR bin/default/source3/utils/smbpasswd $INSTALL/usr/bin
mkdir -p $INSTALL/usr/lib/systemd/system
cp $PKG_DIR/system.d.opt/* $INSTALL/usr/lib/systemd/system
@ -166,26 +168,14 @@ makeinstall_target() {
cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services
mkdir -p $INSTALL/usr/lib/samba
cp $PKG_DIR/scripts/samba-config $INSTALL/usr/lib/samba
cp $PKG_DIR/scripts/samba-autoshare $INSTALL/usr/lib/samba
if [ -f $PROJECT_DIR/$PROJECT/config/smb.conf ]; then
mkdir -p $INSTALL/etc/samba
cp $PROJECT_DIR/$PROJECT/config/smb.conf $INSTALL/etc/samba
elif [ -f $DISTRO_DIR/$DISTRO/config/smb.conf ]; then
mkdir -p $INSTALL/etc/samba
cp $DISTRO_DIR/$DISTRO/config/smb.conf $INSTALL/etc/samba
else
mkdir -p $INSTALL/etc/samba
cp $PKG_DIR/config/smb.conf $INSTALL/etc/samba
mkdir -p $INSTALL/usr/config
cp $PKG_DIR/config/smb.conf $INSTALL/usr/config/samba.conf.sample
fi
cp $PKG_DIR/scripts/smbd-config $INSTALL/usr/lib/samba
fi
}
post_install() {
enable_service samba-config.service
if [ "$SAMBA_SERVER" = "yes" ]; then
enable_service nmbd.service
enable_service smbd.service

View File

@ -0,0 +1,41 @@
From fc0304ba92ec7ae9a2f75fbc31d97fee39d19665 Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Wed, 7 Sep 2016 23:03:43 -0300
Subject: [PATCH] libreplace: disable libbsd support
Disable libbsd support, samba4 uses a global config.h for its own
codebase and that of heimdal (when building with builtin).
This causes redefinition conflicts for link(2) when both standard
unistd.h and bsd/unistd.h get included.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
lib/replace/wscript | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 1dfd902..456be9b 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -248,18 +248,6 @@ def configure(conf):
conf.CHECK_FUNCS('prctl dirname basename')
- # libbsd on some platforms provides strlcpy and strlcat
- if not conf.CHECK_FUNCS('strlcpy strlcat'):
- conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
- checklibc=True)
- if not conf.CHECK_FUNCS('getpeereid'):
- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
-
- if not conf.CHECK_FUNCS('closefrom'):
- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h')
-
conf.CHECK_CODE('''
struct ucred cred;
socklen_t cred_len;
--
2.7.3

View File

@ -1,88 +0,0 @@
diff -Naur samba-3.6.0rc2/lib/replace/libreplace_network.m4 samba-3.6.0rc2.patch/lib/replace/libreplace_network.m4
--- samba-3.6.0rc2/lib/replace/libreplace_network.m4 2011-06-07 20:13:47.000000000 +0200
+++ samba-3.6.0rc2.patch/lib/replace/libreplace_network.m4 2011-07-03 00:23:27.924559484 +0200
@@ -228,43 +228,6 @@
libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)])
if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
- # getaddrinfo is broken on some AIX systems
- # see bug 5910, use our replacements if we detect
- # a broken system.
- AC_TRY_RUN([
- #include <stddef.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netdb.h>
- int main(int argc, const char *argv[])
- {
- struct addrinfo hints = {0,};
- struct addrinfo *ppres;
- const char hostname1[] = "0.0.0.0";
- const char hostname2[] = "127.0.0.1";
- const char hostname3[] = "::";
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_family = AF_UNSPEC;
- hints.ai_flags =
- AI_NUMERICHOST|AI_PASSIVE|AI_ADDRCONFIG;
- /* Test for broken flag combination on AIX. */
- if (getaddrinfo(hostname1, NULL, &hints, &ppres) == EAI_BADFLAGS) {
- /* This fails on an IPv6-only box, but not with
- the EAI_BADFLAGS error. */
- return 1;
- }
- if (getaddrinfo(hostname2, NULL, &hints, &ppres) == 0) {
- /* IPv4 lookup works - good enough. */
- return 0;
- }
- /* Uh-oh, no IPv4. Are we IPv6-only ? */
- return getaddrinfo(hostname3, NULL, &hints, &ppres) != 0 ? 1 : 0;
- }],
- libreplace_cv_HAVE_GETADDRINFO=yes,
- libreplace_cv_HAVE_GETADDRINFO=no)
-fi
-
-if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo])
AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo])
AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo])
diff -Naur samba-3.6.0rc2/source3/configure.in samba-3.6.0rc2.patch/source3/configure.in
--- samba-3.6.0rc2/source3/configure.in 2011-06-07 20:13:47.000000000 +0200
+++ samba-3.6.0rc2.patch/source3/configure.in 2011-07-03 00:02:08.391099610 +0200
@@ -1275,36 +1275,7 @@
#
#
#
-case "$host_os" in
- *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
- # glibc <= 2.3.2 has a broken getgrouplist
- AC_CACHE_CHECK([for good getgrouplist],samba_cv_linux_getgrouplist_ok,[AC_TRY_RUN([
-#include <unistd.h>
-#include <sys/utsname.h>
-main() {
- /* glibc up to 2.3 has a broken getgrouplist */
-#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
- int libc_major = __GLIBC__;
- int libc_minor = __GLIBC_MINOR__;
-
- if (libc_major < 2)
- exit(1);
- if ((libc_major == 2) && (libc_minor <= 3))
- exit(1);
-#endif
- exit(0);
-}
-], [samba_cv_linux_getgrouplist_ok=yes],
- [samba_cv_linux_getgrouplist_ok=no],
- [samba_cv_linux_getgrouplist_ok=cross])])
- if test x"$samba_cv_linux_getgrouplist_ok" = x"yes"; then
- AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])
- fi
- ;;
- *)
- AC_CHECK_FUNCS(getgrouplist)
- ;;
-esac
+AC_CHECK_FUNCS(getgrouplist)
#
# stat64 family may need <sys/stat.h> on some systems, notably ReliantUNIX

View File

@ -1,122 +0,0 @@
diff -Naur samba-3.6.16/source3/Makefile.in samba-3.6.16.patch/source3/Makefile.in
--- samba-3.6.16/source3/Makefile.in 2013-06-19 09:35:24.000000000 +0200
+++ samba-3.6.16.patch/source3/Makefile.in 2013-08-01 01:53:43.264428180 +0200
@@ -73,22 +73,22 @@
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@
LIBTEVENT=@LIBTEVENT_STATIC@ @LIBTEVENT_SHARED@
-LIBTEVENT_LIBS=@LIBTEVENT_LIBS@
+LIBTEVENT_LIBS=@LIBTEVENT_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@
@@ -216,7 +216,7 @@
# 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@ \
@@ -1777,6 +1777,42 @@
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) $(LIBTEVENT) $(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) $(LIBTEVENT_LIBS) $(LIBTDB_LIBS) \
+ $(LIBWBCLIENT_LIBS) $(ZLIB_LIBS)
+
bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) $(LIBTALLOC) $(LIBTEVENT) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@
@echo Linking $@
@$(CC) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \
diff -Naur samba-3.6.16/source3/multi.c samba-3.6.16.patch/source3/multi.c
--- samba-3.6.16/source3/multi.c 1970-01-01 01:00:00.000000000 +0100
+++ samba-3.6.16.patch/source3/multi.c 2013-08-01 01:24:51.794393962 +0200
@@ -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;
+}

View File

@ -1,26 +0,0 @@
--- 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,

View File

@ -1,360 +0,0 @@
diff -Naur samba-3.6.8/source3/librpc/rpc/rpc_common.c samba-3.6.8.patch/source3/librpc/rpc/rpc_common.c
--- samba-3.6.8/source3/librpc/rpc/rpc_common.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/librpc/rpc/rpc_common.c 2012-10-22 21:17:48.583839804 +0200
@@ -113,9 +113,11 @@
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;
}
diff -Naur samba-3.6.8/source3/printing/spoolssd.c samba-3.6.8.patch/source3/printing/spoolssd.c
--- samba-3.6.8/source3/printing/spoolssd.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/printing/spoolssd.c 2012-10-22 21:17:48.566839461 +0200
@@ -153,6 +153,10 @@
NTSTATUS status;
int ret;
+#ifndef PRINTER_SUPPORT
+ return;
+#endif
+
DEBUG(1, ("Forking SPOOLSS Daemon\n"));
pid = sys_fork();
diff -Naur samba-3.6.8/source3/rpcclient/rpcclient.c samba-3.6.8.patch/source3/rpcclient/rpcclient.c
--- samba-3.6.8/source3/rpcclient/rpcclient.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/rpcclient/rpcclient.c 2012-10-22 21:17:48.565839442 +0200
@@ -624,7 +624,9 @@
lsarpc_commands,
ds_commands,
samr_commands,
+#ifdef PRINTER_SUPPORT
spoolss_commands,
+#endif
netlogon_commands,
srvsvc_commands,
dfs_commands,
diff -Naur samba-3.6.8/source3/rpc_server/rpc_ep_setup.c samba-3.6.8.patch/source3/rpc_server/rpc_ep_setup.c
--- samba-3.6.8/source3/rpc_server/rpc_ep_setup.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/rpc_server/rpc_ep_setup.c 2012-10-22 21:17:48.564839423 +0200
@@ -1110,6 +1110,10 @@
"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;
diff -Naur samba-3.6.8/source3/rpc_server/svcctl/srv_svcctl_nt.c samba-3.6.8.patch/source3/rpc_server/svcctl/srv_svcctl_nt.c
--- samba-3.6.8/source3/rpc_server/svcctl/srv_svcctl_nt.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/rpc_server/svcctl/srv_svcctl_nt.c 2012-10-22 21:17:48.582839784 +0200
@@ -85,9 +85,11 @@
/* 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;
diff -Naur samba-3.6.8/source3/smbd/close.c samba-3.6.8.patch/source3/smbd/close.c
--- samba-3.6.8/source3/smbd/close.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/close.c 2012-10-22 21:17:48.579839724 +0200
@@ -643,6 +643,9 @@
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);
diff -Naur samba-3.6.8/source3/smbd/fileio.c samba-3.6.8.patch/source3/smbd/fileio.c
--- samba-3.6.8/source3/smbd/fileio.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/fileio.c 2012-10-22 21:17:48.580839744 +0200
@@ -298,6 +298,10 @@
uint32_t t;
int ret;
+#ifndef PRINTER_SUPPORT
+ return -1;
+#endif
+
ret = print_spool_write(fsp, data, n, pos, &t);
if (ret) {
errno = ret;
diff -Naur samba-3.6.8/source3/smbd/lanman.c samba-3.6.8.patch/source3/smbd/lanman.c
--- samba-3.6.8/source3/smbd/lanman.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/lanman.c 2012-10-22 21:17:48.576839664 +0200
@@ -784,6 +784,10 @@
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 @@
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 @@
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 @@
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 @@
union spoolss_JobInfo info;
struct spoolss_SetJobInfo1 info1;
+#ifndef PRINTER_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -4792,6 +4812,10 @@
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 @@
uint32_t count = 0;
union spoolss_JobInfo *info;
+#ifndef PRINTER_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -5135,6 +5163,10 @@
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 @@
union spoolss_PrinterInfo *info;
uint32_t count;
+#ifndef PRINTER_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -5374,6 +5410,10 @@
int succnt;
struct pack_desc desc;
+#ifndef PRINTER_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -5438,6 +5478,10 @@
int succnt;
struct pack_desc desc;
+#ifndef PRINTER_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -5502,6 +5546,10 @@
int succnt;
struct pack_desc desc;
+#ifndef PRINTER_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
diff -Naur samba-3.6.8/source3/smbd/open.c samba-3.6.8.patch/source3/smbd/open.c
--- samba-3.6.8/source3/smbd/open.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/open.c 2012-10-22 21:17:48.578839704 +0200
@@ -1546,6 +1546,9 @@
* Most of the passed parameters are ignored.
*/
+#ifndef PRINTER_SUPPORT
+ return NT_STATUS_ACCESS_DENIED;
+#endif
if (pinfo) {
*pinfo = FILE_WAS_CREATED;
}
diff -Naur samba-3.6.8/source3/smbd/process.c samba-3.6.8.patch/source3/smbd/process.c
--- samba-3.6.8/source3/smbd/process.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/process.c 2012-10-22 21:17:48.584839824 +0200
@@ -2475,8 +2475,10 @@
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));
diff -Naur samba-3.6.8/source3/smbd/reply.c samba-3.6.8.patch/source3/smbd/reply.c
--- samba-3.6.8/source3/smbd/reply.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/reply.c 2012-10-22 21:17:48.573839604 +0200
@@ -5196,7 +5196,11 @@
return;
}
- if (!CAN_PRINT(conn)) {
+
+#ifdef PRINTER_SUPPORT
+ if (!CAN_PRINT(conn))
+#endif
+ {
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
END_PROFILE(SMBsplopen);
return;
@@ -5302,7 +5306,10 @@
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;
diff -Naur samba-3.6.8/source3/smbd/server.c samba-3.6.8.patch/source3/smbd/server.c
--- samba-3.6.8/source3/smbd/server.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/server.c 2012-10-22 21:19:58.704461862 +0200
@@ -126,7 +126,9 @@
{
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);
@@ -1254,6 +1256,7 @@
exit(1);
}
+#ifdef PRINTER_SUPPORT
/*
* The print backend init also migrates the printing tdb's,
* this requires a winreg pipe.
@@ -1289,6 +1292,7 @@
smbd_messaging_context());
}
}
+#endif
if (!is_daemon) {
/* inetd mode */
diff -Naur samba-3.6.8/source3/smbd/server_exit.c samba-3.6.8.patch/source3/smbd/server_exit.c
--- samba-3.6.8/source3/smbd/server_exit.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/server_exit.c 2012-10-22 21:17:48.576839664 +0200
@@ -141,7 +141,9 @@
rpc_eventlog_shutdown();
rpc_ntsvcs_shutdown();
rpc_svcctl_shutdown();
+#ifdef PRINTER_SUPPORT
rpc_spoolss_shutdown();
+#endif
rpc_srvsvc_shutdown();
rpc_winreg_shutdown();
diff -Naur samba-3.6.8/source3/smbd/smb2_create.c samba-3.6.8.patch/source3/smbd/smb2_create.c
--- samba-3.6.8/source3/smbd/smb2_create.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/smbd/smb2_create.c 2012-10-22 21:17:48.581839764 +0200
@@ -485,7 +485,10 @@
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);
}
diff -Naur samba-3.6.8/source3/utils/net_rpc.c samba-3.6.8.patch/source3/utils/net_rpc.c
--- samba-3.6.8/source3/utils/net_rpc.c 2012-09-14 10:12:09.000000000 +0200
+++ samba-3.6.8.patch/source3/utils/net_rpc.c 2012-10-22 21:17:48.569839523 +0200
@@ -7791,6 +7791,10 @@
{NULL, NULL, 0, NULL, NULL}
};
+#ifndef PRINTER_SUPPORT
+ return 0;
+#endif
+
if (argc == 0) {
if (c->display_usage) {
d_printf(_("Usage:\n"));

View File

@ -1,88 +0,0 @@
--- 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),

View File

@ -1,98 +0,0 @@
--- 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
};

View File

@ -1,146 +0,0 @@
--- 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
};

View File

@ -1,71 +0,0 @@
--- 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

View File

@ -1,185 +0,0 @@
--- 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.

View File

@ -1,150 +0,0 @@
diff -Naur samba-3.6.23/source3/librpc/rpc/rpc_common.c samba-3.6.23.patch/source3/librpc/rpc/rpc_common.c
--- samba-3.6.23/source3/librpc/rpc/rpc_common.c 2014-03-12 16:10:57.120989895 +0100
+++ samba-3.6.23.patch/source3/librpc/rpc/rpc_common.c 2014-03-12 16:11:48.361046356 +0100
@@ -100,9 +100,11 @@
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;
diff -Naur samba-3.6.23/source3/rpcclient/rpcclient.c samba-3.6.23.patch/source3/rpcclient/rpcclient.c
--- samba-3.6.23/source3/rpcclient/rpcclient.c 2014-03-12 16:10:57.121989948 +0100
+++ samba-3.6.23.patch/source3/rpcclient/rpcclient.c 2014-03-12 16:11:48.362046792 +0100
@@ -623,7 +623,9 @@
rpcclient_commands,
lsarpc_commands,
ds_commands,
+#ifdef SAMR_SUPPORT
samr_commands,
+#endif
#ifdef PRINTER_SUPPORT
spoolss_commands,
#endif
diff -Naur samba-3.6.23/source3/rpc_server/rpc_ep_setup.c samba-3.6.23.patch/source3/rpc_server/rpc_ep_setup.c
--- samba-3.6.23/source3/rpc_server/rpc_ep_setup.c 2014-03-12 16:10:57.120989895 +0100
+++ samba-3.6.23.patch/source3/rpc_server/rpc_ep_setup.c 2014-03-12 16:11:48.361046356 +0100
@@ -557,6 +557,7 @@
return true;
}
+#ifdef SAMR_SUPPORT
static bool samr_init_cb(void *ptr)
{
struct dcesrv_ep_context *ep_ctx =
@@ -605,6 +606,7 @@
return true;
}
+#endif
#ifdef NETLOGON_SUPPORT
static bool netlogon_init_cb(void *ptr)
@@ -1111,12 +1113,14 @@
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;
diff -Naur samba-3.6.23/source3/rpc_server/rpc_handles.c samba-3.6.23.patch/source3/rpc_server/rpc_handles.c
--- samba-3.6.23/source3/rpc_server/rpc_handles.c 2014-03-11 11:17:34.000000000 +0100
+++ samba-3.6.23.patch/source3/rpc_server/rpc_handles.c 2014-03-12 16:11:48.361046356 +0100
@@ -59,8 +59,11 @@
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)
diff -Naur samba-3.6.23/source3/smbd/lanman.c samba-3.6.23.patch/source3/smbd/lanman.c
--- samba-3.6.23/source3/smbd/lanman.c 2014-03-12 16:10:30.535984713 +0100
+++ samba-3.6.23.patch/source3/smbd/lanman.c 2014-03-12 16:11:48.362046792 +0100
@@ -2353,6 +2353,10 @@
NTSTATUS status, result;
struct dcerpc_binding_handle *b;
+#ifndef SAMR_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -2541,6 +2545,10 @@
NTSTATUS status, result;
struct dcerpc_binding_handle *b;
+#ifndef SAMR_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !UserName || !p) {
return False;
}
@@ -2741,6 +2749,10 @@
struct dcerpc_binding_handle *b;
+#ifndef SAMR_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -2979,6 +2991,10 @@
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) {
@@ -4020,6 +4036,10 @@
union samr_UserInfo *info;
struct dcerpc_binding_handle *b = NULL;
+#ifndef SAMR_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !UserName || !p) {
return False;
}
diff -Naur samba-3.6.23/source3/smbd/server_exit.c samba-3.6.23.patch/source3/smbd/server_exit.c
--- samba-3.6.23/source3/smbd/server_exit.c 2014-03-12 16:10:57.120989895 +0100
+++ samba-3.6.23.patch/source3/smbd/server_exit.c 2014-03-12 16:11:48.361046356 +0100
@@ -159,7 +159,9 @@
#ifdef NETLOGON_SUPPORT
rpc_netlogon_shutdown();
#endif
+#ifdef SAMR_SUPPORT
rpc_samr_shutdown();
+#endif
rpc_lsarpc_shutdown();
}

View File

@ -1,43 +0,0 @@
--- 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()))

View File

@ -1,143 +0,0 @@
--- 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) {

View File

@ -1,73 +0,0 @@
--- 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)

View File

@ -1,11 +0,0 @@
--- 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

View File

@ -1,253 +0,0 @@
--- 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 "";

View File

@ -1,22 +0,0 @@
--- 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;

View File

@ -1,138 +0,0 @@
From d7758e2be5d810f2dcd068ccd3b577706f13120d Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet@samba.org>
Date: Tue, 1 Apr 2014 17:03:34 +1300
Subject: [PATCH] libsmbclient: Wrap more function calls in talloc_stackframe()
to protect against talloc_tos() calls
BUG: https://bugzilla.samba.org/show_bug.cgi?id=8449
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
---
source3/libsmb/libsmb_context.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c
index c2b88f5..ffa4d2d 100644
--- a/source3/libsmb/libsmb_context.c
+++ b/source3/libsmb/libsmb_context.c
@@ -560,6 +560,7 @@ SMBCCTX *
smbc_init_context(SMBCCTX *context)
{
int pid;
+ TALLOC_CTX *frame;
if (!context) {
errno = EBADF;
@@ -571,11 +572,14 @@ smbc_init_context(SMBCCTX *context)
return NULL;
}
+ frame = talloc_stackframe();
+
if ((!smbc_getFunctionAuthData(context) &&
!smbc_getFunctionAuthDataWithContext(context)) ||
smbc_getDebug(context) < 0 ||
smbc_getDebug(context) > 100) {
+ TALLOC_FREE(frame);
errno = EINVAL;
return NULL;
@@ -594,6 +598,7 @@ smbc_init_context(SMBCCTX *context)
}
if (!user) {
+ TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
@@ -602,6 +607,7 @@ smbc_init_context(SMBCCTX *context)
SAFE_FREE(user);
if (!smbc_getUser(context)) {
+ TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
@@ -624,6 +630,7 @@ smbc_init_context(SMBCCTX *context)
pid = getpid();
netbios_name = (char *)SMB_MALLOC(17);
if (!netbios_name) {
+ TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
@@ -632,6 +639,7 @@ smbc_init_context(SMBCCTX *context)
}
if (!netbios_name) {
+ TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
@@ -640,6 +648,7 @@ smbc_init_context(SMBCCTX *context)
SAFE_FREE(netbios_name);
if (!smbc_getNetbiosName(context)) {
+ TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
@@ -659,6 +668,7 @@ smbc_init_context(SMBCCTX *context)
}
if (!workgroup) {
+ TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
@@ -667,6 +677,7 @@ smbc_init_context(SMBCCTX *context)
SAFE_FREE(workgroup);
if (!smbc_getWorkgroup(context)) {
+ TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;
}
@@ -692,6 +703,7 @@ smbc_init_context(SMBCCTX *context)
smb_panic("error unlocking 'initialized_ctx_count'");
}
+ TALLOC_FREE(frame);
return context;
}
@@ -727,12 +739,15 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context,
smbc_bool use_kerberos = false;
const char *signing_state = "off";
struct user_auth_info *auth_info = NULL;
+ TALLOC_CTX *frame;
if (! context) {
return;
}
+ frame = talloc_stackframe();
+
if (! workgroup || ! *workgroup) {
workgroup = smbc_getWorkgroup(context);
}
@@ -749,6 +764,7 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context,
if (! auth_info) {
DEBUG(0, ("smbc_set_credentials_with_fallback: allocation fail\n"));
+ TALLOC_FREE(frame);
return;
}
@@ -777,4 +793,5 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context,
TALLOC_FREE(context->internal->auth_info);
context->internal->auth_info = auth_info;
+ TALLOC_FREE(frame);
}
--
1.9.1.423.g4596e3a

View File

@ -1,123 +0,0 @@
diff -urN a/source3/include/proto.h b/source3/include/proto.h
--- a/source3/include/proto.h 2014-06-23 08:03:27.000000000 +0200
+++ b/source3/include/proto.h 2014-11-01 13:02:42.918300338 +0100
@@ -947,7 +947,7 @@
size_t maxlength);
char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
bool in_list(const char *s, const char *list, bool casesensitive);
-void string_free(char **s);
+void smb_string_free(char **s);
bool string_set(char **dest,const char *src);
void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
bool remove_unsafe_characters, bool replace_once,
diff -urN a/source3/lib/util_str.c b/source3/lib/util_str.c
--- a/source3/lib/util_str.c 2014-06-23 08:03:27.000000000 +0200
+++ b/source3/lib/util_str.c 2014-11-01 13:03:11.113658974 +0100
@@ -764,7 +764,7 @@
Free a string value.
**/
-void string_free(char **s)
+void smb_string_free(char **s)
{
if (!s || !(*s))
return;
@@ -780,7 +780,7 @@
bool string_set(char **dest,const char *src)
{
- string_free(dest);
+ smb_string_free(dest);
return(string_init(dest,src));
}
diff -urN a/source3/param/loadparm.c b/source3/param/loadparm.c
--- a/source3/param/loadparm.c 2014-06-23 08:03:27.000000000 +0200
+++ b/source3/param/loadparm.c 2014-11-01 13:03:03.872057887 +0100
@@ -4998,7 +4998,7 @@
if ((parm.type == P_STRING) ||
(parm.type == P_USTRING))
{
- string_free((char**)parm_ptr);
+ smb_string_free((char**)parm_ptr);
} else if (parm.type == P_LIST) {
TALLOC_FREE(*((char***)parm_ptr));
}
@@ -5160,7 +5160,7 @@
if (!done_init) {
/* The logfile can be set before this is invoked. Free it if so. */
if (Globals.szLogFile != NULL) {
- string_free(&Globals.szLogFile);
+ smb_string_free(&Globals.szLogFile);
Globals.szLogFile = NULL;
}
done_init = True;
@@ -6108,7 +6108,7 @@
while (data) {
if (strwicmp(data->key, param_key) == 0) {
- string_free(&param_key);
+ smb_string_free(&param_key);
return data;
}
data = data->next;
@@ -6120,14 +6120,14 @@
data = Globals.param_opt;
while (data) {
if (strwicmp(data->key, param_key) == 0) {
- string_free(&param_key);
+ smb_string_free(&param_key);
return data;
}
data = data->next;
}
}
- string_free(&param_key);
+ smb_string_free(&param_key);
return NULL;
}
@@ -6350,8 +6350,8 @@
}
opt = *popts;
while (opt != NULL) {
- string_free(&opt->key);
- string_free(&opt->value);
+ smb_string_free(&opt->key);
+ smb_string_free(&opt->value);
TALLOC_FREE(opt->list);
next_opt = opt->next;
SAFE_FREE(opt);
@@ -6375,7 +6375,7 @@
free_parameters(pservice);
- string_free(&pservice->szService);
+ smb_string_free(&pservice->szService);
TALLOC_FREE(pservice->copymap);
free_param_opts(&pservice->param_opt);
@@ -7085,7 +7085,7 @@
overridden */
return;
}
- string_free(&opt->value);
+ smb_string_free(&opt->value);
TALLOC_FREE(opt->list);
opt->value = SMB_STRDUP(opt_value);
opt->flags = flags;
diff -urN a/source3/smbd/conn.c b/source3/smbd/conn.c
--- a/source3/smbd/conn.c 2014-06-23 08:03:27.000000000 +0200
+++ b/source3/smbd/conn.c 2014-11-01 13:02:49.008926676 +0100
@@ -412,8 +412,8 @@
free_namearray(conn->veto_oplock_list);
free_namearray(conn->aio_write_behind_list);
- string_free(&conn->connectpath);
- string_free(&conn->origpath);
+ smb_string_free(&conn->connectpath);
+ smb_string_free(&conn->origpath);
ZERO_STRUCTP(conn);
talloc_destroy(conn);

View File

@ -0,0 +1,62 @@
diff -Naur samba-4.5.5/buildtools/wafsamba/wafsamba.py samba-4.5.5.patch/buildtools/wafsamba/wafsamba.py
--- samba-4.5.5/buildtools/wafsamba/wafsamba.py 2016-08-11 09:51:04.000000000 +0200
+++ samba-4.5.5.patch/buildtools/wafsamba/wafsamba.py 2017-02-17 15:33:36.453169574 +0100
@@ -330,9 +330,9 @@
if pc_files is not None and not private_library:
bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
- if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and
- bld.env['XSLTPROC_MANPAGES']):
- bld.MANPAGES(manpages, install)
+# if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and
+# bld.env['XSLTPROC_MANPAGES']):
+# bld.MANPAGES(manpages, install)
Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
@@ -437,8 +437,8 @@
samba_ldflags = pie_ldflags
)
- if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']:
- bld.MANPAGES(manpages, install)
+# if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']:
+# bld.MANPAGES(manpages, install)
Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
diff -Naur samba-4.5.5/docs-xml/wscript_build samba-4.5.5.patch/docs-xml/wscript_build
--- samba-4.5.5/docs-xml/wscript_build 2016-08-11 09:51:04.000000000 +0200
+++ samba-4.5.5.patch/docs-xml/wscript_build 2017-02-17 15:44:45.142392019 +0100
@@ -127,17 +127,17 @@
rule=smbdotconf_generate_parameter_list,
dep_vars=bld.dynconfig_varnames())
-def SMBDOTCONF_MANPAGE(bld, target):
- ''' assemble and build smb.conf.5 manual page'''
- bld.SAMBAMANPAGES(target, parameter_all)
-
-if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):
-
- SMBDOTCONF_MANPAGE(bld, 'manpages/smb.conf.5')
- bld.SAMBAMANPAGES(manpages)
-
- if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'):
- bld.SAMBAMANPAGES(pam_winbind_manpages)
-
- if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
- bld.SAMBAMANPAGES(krb5_locator_manpages)
+#def SMBDOTCONF_MANPAGE(bld, target):
+# ''' assemble and build smb.conf.5 manual page'''
+# bld.SAMBAMANPAGES(target, parameter_all)
+#
+#if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):
+#
+# SMBDOTCONF_MANPAGE(bld, 'manpages/smb.conf.5')
+# bld.SAMBAMANPAGES(manpages)
+#
+# if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'):
+# bld.SAMBAMANPAGES(pam_winbind_manpages)
+#
+# if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
+# bld.SAMBAMANPAGES(krb5_locator_manpages)

View File

@ -1,7 +1,7 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -21,46 +21,9 @@ SMB_USERCONF="/storage/.config/samba.conf"
SMB_DEFCONF="/etc/samba/smb.conf"
SMB_CONF="/run/samba/smb.conf"
if [ ! -f /storage/.cache/services/samba.conf ]; then
/bin/cp /usr/share/services/samba.conf /storage/.cache/services
fi
. /storage/.cache/services/samba.conf
mkdir -p /run/samba
if [ -f $SMB_USERCONF ]; then
cp $SMB_USERCONF $SMB_CONF
else
cp $SMB_DEFCONF $SMB_CONF
fi
# handle external drives
if [ "$SAMBA_AUTOSHARE" == "true" ] ; then
for dir in /media/* ; do
if [ -d "$dir" ] ; then
name=$(basename "$dir")
echo -e "[$name]\n path = $dir\n available = yes\n browsable = yes\n public = yes\n writable = yes\n" >> $SMB_CONF
fi
done
fi
# only letters & numbers permitted for username & password
SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"`
SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"`
if [ "$SAMBA_SECURE" == "true" -a ! "$SAMBA_USERNAME" == "" -a ! "$SAMBA_PASSWORD" == "" ] ; then
# username map: first line makes sure plain root does not work all the time
# processing continues, so if user chooses root as username, second line overrides the first
# this is done always in case user uses passwords in userconf.
# many thanks to viljoviitanen for this
echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1
echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /var/run/samba.map
sed -e 's|^.[ \t]*.public.=.*| public = no |' -i $SMB_CONF
sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF
sed -e 's|^.[ \t]*.security.=.*| security = user\n username map = /var/run/samba.map|' -i $SMB_CONF
else
sed -e 's|^.[ \t]*.public.=.*| public = yes |' -i $SMB_CONF
sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF
sed -e 's|^.[ \t]*.security.=.*| security = share|' -i $SMB_CONF
fi
if [ -f $SMB_USERCONF ]; then
cp $SMB_USERCONF $SMB_CONF
else
cp $SMB_DEFCONF $SMB_CONF
fi

View File

@ -0,0 +1,59 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC 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.
#
# OpenELEC 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 OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
SMB_CONF="/run/samba/smb.conf"
if [ ! -f /storage/.cache/services/samba.conf ]; then
cp /usr/share/services/samba.conf /storage/.cache/services
fi
. /storage/.cache/services/samba.conf
# handle external drives
if [ "$SAMBA_AUTOSHARE" == "true" ] ; then
for dir in /media/* ; do
if [ -d "$dir" ] ; then
name=$(basename "$dir")
echo -e "[$name]\n path = $dir\n available = yes\n browsable = yes\n public = yes\n writable = yes\n" >> $SMB_CONF
fi
done
fi
# only letters & numbers permitted for username & password
SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"`
SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"`
if [ "$SAMBA_SECURE" == "true" -a ! "$SAMBA_USERNAME" == "" -a ! "$SAMBA_PASSWORD" == "" ] ; then
# username map: first line makes sure plain root does not work all the time
# processing continues, so if user chooses root as username, second line overrides the first
# this is done always in case user uses passwords in userconf.
# many thanks to viljoviitanen for this
echo -e "$SAMBA_PASSWORD\n$SAMBA_PASSWORD" | smbpasswd -s -a root >/dev/null 2>&1
echo -e "nobody = root\nroot = $SAMBA_USERNAME" > /run/samba/samba.map
sed -e 's|^.[ \t]*.public.=.*| public = no |' \
-e 's|^.[ \t]*.username map.=.*||' \
-e 's|^.[ \t]*.security.=.*| security = user\n username map = /run/samba/samba.map|' \
-i $SMB_CONF
else
sed -e 's|^.[ \t]*.public.=.*| public = yes |' \
-e 's|^.[ \t]*.username map.=.*||' \
-e 's|^.[ \t]*.security.=.*| security = user|' \
-i $SMB_CONF
fi

View File

@ -1,12 +1,14 @@
[Unit]
Description=Samba NMB Daemon
After=network.target smbd.service
ConditionPathExists=/storage/.cache/services/samba.conf
After=network.target samba-config.service
ConditionPathExists=!/storage/.cache/services/samba.disabled
ConditionPathExists=/run/samba/smb.conf
Requires=samba-config.service
[Service]
Type=forking
PIDFile=/var/run/nmbd-smb.conf.pid
ExecStart=/usr/bin/nmbd --configfile=/run/samba/smb.conf
PIDFile=/run/samba/nmbd.pid
ExecStart=/usr/sbin/nmbd
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=1s
Restart=always

View File

@ -1,14 +1,16 @@
[Unit]
Description=Samba SMB Daemon
After=network.target
ConditionPathExists=/storage/.cache/services/samba.conf
After=network.target samba-config.service
ConditionPathExists=!/storage/.cache/services/samba.disabled
ConditionPathExists=/run/samba/smb.conf
Requires=samba-config.service
[Service]
Type=forking
PIDFile=/var/run/smbd-smb.conf.pid
PIDFile=/run/samba/smbd.pid
LimitNOFILE=16384
ExecStart=/usr/bin/smbd --configfile=/run/samba/smb.conf
ExecStartPre=/usr/lib/samba/samba-config
ExecStartPre=/usr/lib/samba/smbd-config
ExecStart=/usr/sbin/smbd
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=1s
Restart=always

View File

@ -0,0 +1,10 @@
[Unit]
Description=Samba Configuration
DefaultDependencies=false
[Service]
Type=oneshot
ExecStart=/usr/lib/samba/samba-config
[Install]
WantedBy=sysinit.target