From afa7bc906a0fc6360691e04bfaa303acd2ad43ef Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 4 May 2012 11:05:22 +0000 Subject: [PATCH] remove samba3, all of its features should now be supported by samba36+cifs-utils git-svn-id: svn://svn.openwrt.org/openwrt/packages@31585 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- net/samba3/Config.in | 24 - net/samba3/Makefile | 141 -- net/samba3/files/config-lfs.h | 0 net/samba3/files/samba-nmbd.init | 12 - net/samba3/files/samba.config | 29 - net/samba3/files/samba.init | 102 - net/samba3/files/smb.conf.template | 17 - net/samba3/patches/100-avm.patch | 1653 ----------------- net/samba3/patches/110-compile_fixes.patch | 44 - net/samba3/patches/120-owrt_paths.patch | 35 - net/samba3/patches/130-owrt_smbpasswd.patch | 212 --- net/samba3/patches/150-fix_ls.patch | 13 - net/samba3/patches/160-fix_log.patch | 11 - net/samba3/patches/170-no_rpc.patch | 21 - net/samba3/patches/200-fix-configure.patch | 12 - .../patches/500-remove_avm_smaller.patch | 76 - net/samba3/patches/510-remove-printing.patch | 47 - net/samba3/patches/600-CVE-2012-1182.patch | 41 - 18 files changed, 2490 deletions(-) delete mode 100644 net/samba3/Config.in delete mode 100644 net/samba3/Makefile delete mode 100644 net/samba3/files/config-lfs.h delete mode 100755 net/samba3/files/samba-nmbd.init delete mode 100644 net/samba3/files/samba.config delete mode 100755 net/samba3/files/samba.init delete mode 100644 net/samba3/files/smb.conf.template delete mode 100644 net/samba3/patches/100-avm.patch delete mode 100644 net/samba3/patches/110-compile_fixes.patch delete mode 100644 net/samba3/patches/120-owrt_paths.patch delete mode 100644 net/samba3/patches/130-owrt_smbpasswd.patch delete mode 100644 net/samba3/patches/150-fix_ls.patch delete mode 100644 net/samba3/patches/160-fix_log.patch delete mode 100644 net/samba3/patches/170-no_rpc.patch delete mode 100644 net/samba3/patches/200-fix-configure.patch delete mode 100644 net/samba3/patches/500-remove_avm_smaller.patch delete mode 100644 net/samba3/patches/510-remove-printing.patch delete mode 100644 net/samba3/patches/600-CVE-2012-1182.patch diff --git a/net/samba3/Config.in b/net/samba3/Config.in deleted file mode 100644 index a71de4d30..000000000 --- a/net/samba3/Config.in +++ /dev/null @@ -1,24 +0,0 @@ -config SAMBA3_CONFIG_DEBUG - bool "Enable Logging for samba3" - depends PACKAGE_samba3 - default n - help - Enables debugging support (will make binaries *much* bigger) - Also increases MAX_DEBUG_LEVEL to get more messages (also increases binary sizes!) - -config SAMBA3_CONFIG_PRINTING - bool "Enable shared printing support" - depends PACKAGE_samba3 - select PACKAGE_cups - default n - help - Enable shared printing support. - Adds about 18kB for smbd, about 15kB for nmbd and about 18kB for smbpasswd - -config SAMBA3_CONFIG_SMALLER - bool "Make samba3 even smaller" - depends PACKAGE_samba3 - default y - help - Removes support for ??? - Saves about 18kB for smbd, about 16kB for nmbd and about 17kB for smbpasswd diff --git a/net/samba3/Makefile b/net/samba3/Makefile deleted file mode 100644 index 191d6082a..000000000 --- a/net/samba3/Makefile +++ /dev/null @@ -1,141 +0,0 @@ -# -# Copyright (C) 2008-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:=samba3 -PKG_VERSION:=3.0.37 -PKG_RELEASE:=5 - -PKG_MD5SUM:=11ed2bfef4090bd5736b194b43f67289 - -PKG_SOURCE_URL:=ftp://ftp.samba.org/pub/samba/old-versions/ -PKG_SOURCE:=samba-$(PKG_VERSION).tar.gz -PKG_BUILD_DIR:=$(BUILD_DIR)/samba-$(PKG_VERSION) -PKG_BUILD_PARALLEL:=1 - -include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/nls.mk - -define Package/samba3/Default - SECTION:=net - CATEGORY:=Network - SUBMENU:=Filesystem - URL:=http://www.samba.org/ -endef - -define Package/samba3 -$(call Package/samba3/Default) - TITLE:=SMB server for file and printer sharing - DEPENDS:=+libpthread +libpopt $(ICONV_DEPENDS) -endef - -define Package/samba3-nmbd -$(call Package/samba3/Default) - TITLE:=NetBIOS name server - DEPENDS:=samba3 -endef - -define Package/samba3-mountcifs -$(call Package/samba3/Default) - SECTION:=utils - CATEGORY:=Utilities - TITLE:=Mount utility for samba shares -endef - -define Package/samba3/description -SMB server for file and printer sharing -Also contains a SMB password utility (smbpasswd) - -Made small with patches taken from AVM GPL releases and freetz -endef - -define Package/samba3-nmbd/description -NetBIOS name server - -Made small with patches taken from AVM GPL releases and freetz -endef - -define Package/samba3-mountcifs/description -An user space helper utility for mounting remote CIFS shares. -endef - -define Package/samba3/conffiles -/etc/config/samba -/etc/samba/smb.conf.template -endef - -define Package/samba3/config - source "$(SOURCE)/Config.in" -endef - -TARGET_CFLAGS+=$(if $(CONFIG_SAMBA3_CONFIG_DEBUG),-DSAMBA_DEBUG,-DMAX_DEBUG_LEVEL=2) -TARGET_CFLAGS+=$(if $(CONFIG_SAMBA3_CONFIG_SMALLER),-DAVM_SMALLER) -TARGET_CFLAGS+=$(if $(CONFIG_SAMBA3_CONFIG_PRINTING),,-DAVM_NO_PRINTING) -CONFIGURE_PATH:=source -CONFIGURE_ARGS+= \ - $(if $(CONFIG_SAMBA3_CONFIG_DEBUG),--enable-debug) \ - $(if $(CONFIG_SAMBA3_CONFIG_PRINTING),,--enable-cups=no --enable-iprint=no) \ - --without-krb5 \ - --without-ads \ - --without-ldap \ - --enable-largefile \ - --with-configdir=/etc/samba \ - --with-libiconv=$(ICONV_PREFIX) \ - --with-privatedir=/etc/samba - -# Make sure we tell the configure script that we support negative enum values and want to use setresuid -CONFIGURE_VARS+= \ - SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes \ - samba_cv_USE_SETEUID=no \ - samba_cv_have_setresuid=yes \ - samba_cv_USE_SETRESUID=yes \ - samba_cv_HAVE_C99_VSNPRINTF=yes \ - samba_cv_have_longlong=yes \ - ac_cv_type_long_long=yes \ - -MAKE_PATH=source -MAKE_FLAGS += \ - $(if $(CONFIG_SAMBA3_CONFIG_PRINTING),,OWRT_NO_PRINTING=1) \ - $(if $(CONFIG_SAMBA3_CONFIG_SMALLER),OWRT_SMALLER=1) - -define Build/Compile - # Ugly fix for parallel building (without this some generated files will be missing upon clean build) - $(call Build/Compile/Default, proto_exists) - $(call Build/Compile/Default, \ - $(if $(CONFIG_PACKAGE_samba3),bin/smbd bin/smbpasswd) \ - $(if $(CONFIG_PACKAGE_samba3-nmbd),bin/nmbd) \ - $(if $(CONFIG_PACKAGE_samba3-mountcifs),bin/mount.cifs bin/umount.cifs) \ - ) -endef - -define Package/samba3/install - $(INSTALL_DIR) $(1)/etc/{samba,init.d,config} - $(INSTALL_BIN) ./files/samba.init $(1)/etc/init.d/samba - $(INSTALL_DATA) ./files/samba.config $(1)/etc/config/samba - $(INSTALL_DATA) ./files/smb.conf.template $(1)/etc/samba/ - touch $(1)/etc/samba/smbpasswd - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/smbpasswd $(1)/usr/sbin/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/smbd $(1)/usr/sbin/ -endef - -define Package/samba3-nmbd/install - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/samba-nmbd.init $(1)/etc/init.d/samba-nmbd - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/nmbd $(1)/usr/sbin/ -endef - -define Package/samba3-mountcifs/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/mount.cifs $(1)/usr/sbin/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/bin/umount.cifs $(1)/usr/sbin/ -endef - -$(eval $(call BuildPackage,samba3)) -$(eval $(call BuildPackage,samba3-nmbd)) -$(eval $(call BuildPackage,samba3-mountcifs)) diff --git a/net/samba3/files/config-lfs.h b/net/samba3/files/config-lfs.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/net/samba3/files/samba-nmbd.init b/net/samba3/files/samba-nmbd.init deleted file mode 100755 index 5c4428d06..000000000 --- a/net/samba3/files/samba-nmbd.init +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2011 OpenWrt.org - -START=61 - -start() { - service_start /usr/sbin/nmbd -D -} - -stop() { - service_stop /usr/sbin/nmbd -} diff --git a/net/samba3/files/samba.config b/net/samba3/files/samba.config deleted file mode 100644 index 908f536e0..000000000 --- a/net/samba3/files/samba.config +++ /dev/null @@ -1,29 +0,0 @@ -# Base server settings -config samba - ## Override if desired, defaults to hostname - #option 'name' 'OpenWrt' - #option 'workgroup' 'OpenWrt' - #option 'description' 'Samba on OpenWrt' - - ## Expose user home directories, defaults to off - option 'homes' '1' - - ## Override character set, default is UTF-8 - option 'charset' 'ISO-8859-1' - - ## Override listen interfaces & addresses, - ## defaults to loopback and lan - #list 'interface' 'loopback' - #list 'interface' 'lan' - #list 'interface' '10.0.0.0/255.255.0.0' - #list 'interface' 'eth0' - -# Declare a share on /tmp -config sambashare - option 'name' 'tmp' - option 'path' '/tmp' - option 'read_only' 'no' - option 'guest_ok' 'no' - option 'create_mask' '0700' - option 'dir_mask' '0700' - #option 'users' 'abc' diff --git a/net/samba3/files/samba.init b/net/samba3/files/samba.init deleted file mode 100755 index 6d755ea7e..000000000 --- a/net/samba3/files/samba.init +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2011 OpenWrt.org - -START=60 - -smb_header() { - local interface - config_get interface $1 interface "loopback lan" - - # resolve interfaces - local interfaces=$( - include /lib/network - scan_interfaces - - local net - for net in $interface; do - local ifname - config_get ifname "$net" ifname - [ -n "$ifname" ] && { - local ipaddr netmask - config_get ipaddr "$net" ipaddr - config_get netmask "$net" netmask - [ -n "$ipaddr" ] && echo -n "$ipaddr/${netmask:-255.255.255.255} " - - local ip6addr - config_get ip6addr "$net" ip6addr - [ -n "$ip6addr" ] && echo -n "$ip6addr " - } - - echo -n "${ifname:-$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 <> /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 -} - -stop() { - service_stop /usr/sbin/smbd -} diff --git a/net/samba3/files/smb.conf.template b/net/samba3/files/smb.conf.template deleted file mode 100644 index 0780a7312..000000000 --- a/net/samba3/files/smb.conf.template +++ /dev/null @@ -1,17 +0,0 @@ -[global] - netbios name = |NAME| - workgroup = |WORKGROUP| - server string = |DESCRIPTION| - syslog = 10 - encrypt passwords = true - passdb backend = smbpasswd - obey pam restrictions = yes - socket options = TCP_NODELAY - unix charset = |CHARSET| - preferred master = yes - os level = 20 - security = share - guest account = nobody - invalid users = root - smb passwd file = /etc/samba/smbpasswd - interfaces = |INTERFACES| diff --git a/net/samba3/patches/100-avm.patch b/net/samba3/patches/100-avm.patch deleted file mode 100644 index 165991e19..000000000 --- a/net/samba3/patches/100-avm.patch +++ /dev/null @@ -1,1653 +0,0 @@ ---- a/source/auth/auth_util.c -+++ b/source/auth/auth_util.c -@@ -2284,18 +2284,20 @@ BOOL is_trusted_domain(const char* dom_n - /* The only other possible result is that winbind is not up - and running. We need to update the trustdom_cache - ourselves */ -- -+#ifndef AVM_SMALLER - update_trustdom_cache(); -+#endif - } - - /* now the trustdom cache should be available a DC could still - * have a transitive trust so fall back to the cache of trusted - * domains (like a domain member would use */ - -+#ifndef AVM_SMALLER - if ( trustdom_cache_fetch(dom_name, &trustdom_sid) ) { - return True; - } -- -+#endif - return False; - } - ---- a/source/include/local.h -+++ b/source/include/local.h -@@ -49,7 +49,8 @@ - #define MAX_DIRECTORY_HANDLES 2048 - - /* maximum number of file caches per smbd */ --#define MAX_WRITE_CACHES 10 -+/* #define MAX_WRITE_CACHES 10 */ -+#define MAX_WRITE_CACHES 2 /* AVM */ - - /* define what facility to use for syslog */ - #ifndef SYSLOG_FACILITY ---- a/source/lib/iconv.c -+++ b/source/lib/iconv.c -@@ -385,7 +385,10 @@ static size_t latin1_push(void *cd, cons - - while (*inbytesleft >= 2 && *outbytesleft >= 1) { - (*outbuf)[0] = (*inbuf)[0]; -- if ((*inbuf)[1]) ir_count++; -+ if ((*inbuf)[1]) { -+ ir_count++; -+ (*outbuf)[0] = '_'; // AVM -+ } - (*inbytesleft) -= 2; - (*outbytesleft) -= 1; - (*inbuf) += 2; ---- a/source/lib/pidfile.c -+++ b/source/lib/pidfile.c -@@ -87,6 +87,7 @@ void pidfile_create(const char *program_ - pstring pidFile; - pid_t pid; - -+#if 0 /* AVM */ - /* Add a suffix to the program name if this is a process with a - * none default configuration file name. */ - if (strcmp( CONFIGFILE, dyn_CONFIGFILE) == 0) { -@@ -103,6 +104,9 @@ void pidfile_create(const char *program_ - slprintf( name, sizeof( name)-1, "%s-%s", program_name, - short_configfile ); - } -+#else -+ strncpy( name, program_name, sizeof( name)-1); -+#endif - - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); - ---- a/source/lib/system.c -+++ b/source/lib/system.c -@@ -1499,7 +1499,11 @@ int sys_pclose(int fd) - void *sys_dlopen(const char *name, int flags) - { - #if defined(HAVE_DLOPEN) -+#if 1 /* FRITZBOX */ -+ return NULL; -+#else - return dlopen(name, flags); -+#endif - #else - return NULL; - #endif ---- a/source/lib/util.c -+++ b/source/lib/util.c -@@ -301,7 +301,11 @@ const char *tmpdir(void) - char *p; - if ((p = getenv("TMPDIR"))) - return p; -+#if 0 /* AVM */ -+ return "/var/tmp"; -+#else - return "/tmp"; -+#endif - } - - /**************************************************************************** ---- a/source/libsmb/clifile.c -+++ b/source/libsmb/clifile.c -@@ -21,6 +21,8 @@ - - #include "includes.h" - -+#ifndef AVM_SMALLER -+ - /**************************************************************************** - Hard/Symlink a file (UNIX extensions). - Creates new name (sym)linked to oldname. -@@ -71,6 +73,9 @@ static BOOL cli_link_internal(struct cli - return True; - } - -+#endif /* AVM_SMALLER */ -+ -+ - /**************************************************************************** - Map standard UNIX permissions onto wire representations. - ****************************************************************************/ -@@ -165,6 +170,9 @@ static mode_t unix_filetype_from_wire(ui - } - } - -+ -+#ifndef AVM_SMALLER -+ - /**************************************************************************** - Do a POSIX getfacl (UNIX extensions). - ****************************************************************************/ -@@ -647,6 +655,7 @@ int cli_nt_delete_on_close(struct cli_st - - return True; - } -+#endif /* AVM_SMALLER */ - - /**************************************************************************** - Open a file - exposing the full horror of the NT API :-). -@@ -718,6 +727,7 @@ int cli_nt_create(struct cli_state *cli, - FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0); - } - -+#ifndef AVM_SMALLER - /**************************************************************************** - Open a file - WARNING: if you open with O_WRONLY then getattrE won't work! -@@ -796,6 +806,7 @@ int cli_open(struct cli_state *cli, cons - - return SVAL(cli->inbuf,smb_vwv2); - } -+#endif /* AVM_SMALLER */ - - /**************************************************************************** - Close a file. -@@ -823,6 +834,7 @@ BOOL cli_close(struct cli_state *cli, in - return !cli_is_error(cli); - } - -+#ifndef AVM_SMALLER - - /**************************************************************************** - send a lock with a specified locktype -@@ -1972,3 +1984,6 @@ int cli_posix_rmdir(struct cli_state *cl - { - return cli_posix_unlink_internal(cli, fname, True); - } -+ -+#endif /* AVM_SMALLER */ -+ ---- a/source/libsmb/namequery.c -+++ b/source/libsmb/namequery.c -@@ -1114,6 +1114,7 @@ static BOOL resolve_ads(const char *name - const char *sitename, - struct ip_service **return_iplist, int *return_count) - { -+#ifdef HAVE_ADS - int i, j; - NTSTATUS status; - TALLOC_CTX *ctx; -@@ -1194,6 +1195,9 @@ static BOOL resolve_ads(const char *name - - talloc_destroy(ctx); - return True; -+#else /* HAVE_ADS */ -+ return False; -+#endif - } - - /******************************************************************* ---- a/source/libsmb/namequery_dc.c -+++ b/source/libsmb/namequery_dc.c -@@ -52,6 +52,9 @@ static BOOL ads_dc_name(const char *doma - struct in_addr *dc_ip, - fstring srv_name) - { -+#if 1 /* AVM */ -+ return False; -+#else - ADS_STRUCT *ads; - char *sitename; - int i; -@@ -139,6 +142,7 @@ static BOOL ads_dc_name(const char *doma - srv_name, inet_ntoa(*dc_ip))); - - return True; -+#endif /* AVM */ - } - - /**************************************************************************** ---- a/source/modules/vfs_default.c -+++ b/source/modules/vfs_default.c -@@ -24,6 +24,78 @@ - #undef DBGC_CLASS - #define DBGC_CLASS DBGC_VFS - -+// AVM_SEC - avoid following NTFS symbolic links to "not allowed places" -+// #define AVM_SEC -+ -+ -+#ifdef AVM_SEC -+static int IsAllowed(const char *pa) -+{ -+ // only allow access below /var/media/ftp/ -+ -+ if (!pa) return 0; -+ -+Log(("IsAllowed: checking %s", pa)); -+ -+ char *path = strdup(pa); -+ if (!path) goto no; -+ -+ char buf[4096]; -+ int ret; -+ char *p = &path[strlen(path)]; -+ char c = *p; -+ do { -+ if (path[0] == '\0') { -+ if (0 == getcwd(buf, sizeof(buf))) { -+ *p = c; -+ goto no; // failed - not allowed -+ } -+ ret = 0; -+ } else { -+ if (0 == realpath(path, buf)) ret = -1; -+ else ret = 0; -+ } -+ if (ret) { -+ // realpath failed - remove prev path component -+ *p = c; -+ while(p > path && *(p-1) != '/') p--; -+ if (p <= path) { -+ p = path; -+ } else { -+ p--; -+ } -+ c = *p; -+ *p = '\0'; -+ } -+ } while(ret); -+ -+ *p = c; -+ -+#if 0 // TODO -+ // weitere pfadkompontenen // /./ und /../ auswerten -+ // assert (*p ist '\0' oder '/') -+ while(*p != '\0') { -+ xxx -+ } -+#endif -+ -+ if (buf != strstr(buf, "/var/media/ftp")) goto no; -+ c = buf[strlen("/var/media/ftp")]; -+ if (c != '/' && c != '\0') goto no; -+ -+Log(("IsAllowed: %s ok", pa)); -+ if (path) free(path); -+ return 1; -+ -+no: -+ Log(("IsAllowed: %s not allowed", pa ? pa : "(null)")); -+ if (path) free(path); -+ return 0; -+} -+#endif -+ -+ -+ - /* Check for NULL pointer parameters in vfswrap_* functions */ - - /* We don't want to have NULL function pointers lying around. Someone -@@ -88,6 +160,10 @@ static int vfswrap_get_shadow_copy_data( - - static int vfswrap_statvfs(struct vfs_handle_struct *handle, const char *path, vfs_statvfs_struct *statbuf) - { -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - return sys_statvfs(path, statbuf); - } - -@@ -97,6 +173,10 @@ static SMB_STRUCT_DIR *vfswrap_opendir(v - { - SMB_STRUCT_DIR *result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(fname)) { errno = EACCES; return 0; } -+#endif -+ - START_PROFILE(syscall_opendir); - result = sys_opendir(fname); - END_PROFILE(syscall_opendir); -@@ -141,6 +221,10 @@ static int vfswrap_mkdir(vfs_handle_stru - int result; - BOOL has_dacl = False; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_mkdir); - - if (lp_inherit_acls(SNUM(handle->conn)) && (has_dacl = directory_has_default_acl(handle->conn, parent_dirname(path)))) -@@ -169,6 +253,10 @@ static int vfswrap_rmdir(vfs_handle_stru - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_rmdir); - result = rmdir(path); - END_PROFILE(syscall_rmdir); -@@ -192,6 +280,10 @@ static int vfswrap_open(vfs_handle_struc - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(fname)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_open); - result = sys_open(fname, flags, mode); - END_PROFILE(syscall_open); -@@ -361,6 +453,11 @@ static int copy_reg(const char *source, - int ifd = -1; - int ofd = -1; - -+#ifdef AVM_SEC -+ if (!IsAllowed(source)) { errno = EACCES; return -1; } -+ if (!IsAllowed(dest)) { errno = EACCES; return -1; } -+#endif -+ - if (sys_lstat (source, &source_stats) == -1) - return -1; - -@@ -442,6 +539,11 @@ static int vfswrap_rename(vfs_handle_str - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(oldname)) { errno = EACCES; return -1; } -+ if (!IsAllowed(newname)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_rename); - result = rename(oldname, newname); - if ((result == -1) && (errno == EXDEV)) { -@@ -471,6 +573,10 @@ static int vfswrap_stat(vfs_handle_struc - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(fname)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_stat); - result = sys_stat(fname, sbuf); - END_PROFILE(syscall_stat); -@@ -491,6 +597,10 @@ int vfswrap_lstat(vfs_handle_struct *han - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_lstat); - result = sys_lstat(path, sbuf); - END_PROFILE(syscall_lstat); -@@ -501,6 +611,10 @@ static int vfswrap_unlink(vfs_handle_str - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_unlink); - result = unlink(path); - END_PROFILE(syscall_unlink); -@@ -511,6 +625,10 @@ static int vfswrap_chmod(vfs_handle_stru - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_chmod); - - /* -@@ -572,6 +690,10 @@ static int vfswrap_chown(vfs_handle_stru - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_chown); - result = sys_chown(path, uid, gid); - END_PROFILE(syscall_chown); -@@ -597,6 +719,10 @@ static int vfswrap_chdir(vfs_handle_stru - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_chdir); - result = chdir(path); - END_PROFILE(syscall_chdir); -@@ -717,6 +843,44 @@ static int vfswrap_ftruncate(vfs_handle_ - return result; - } - -+#if 1 // AVM patch - don't growth the file (too much time and RAM for copy of large files to USB1.1 FAT filesystem) -+ { -+ SMB_BIG_UINT big_len = len; -+ -+ result = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st); -+ if (result == -1) { -+ goto done; -+ } -+ -+ if (big_len == (SMB_BIG_UINT)st.st_size) { -+ result = 0; -+ goto done; -+ } -+ -+ if (big_len > (SMB_BIG_UINT)st.st_size) { -+ SMB_BIG_UINT space_avail; -+ SMB_BIG_UINT bsize,dfree,dsize; -+ big_len -= st.st_size; -+ big_len /= 1024; /* Len is now number of 1k blocks needed. */ -+ space_avail = SMB_VFS_DISK_FREE(fsp->conn ,fsp->fsp_name,False,&bsize,&dfree,&dsize); -+ if (space_avail == (SMB_BIG_UINT)-1) { -+ result = -1; -+ goto done; -+ } -+ -+ if (big_len > space_avail) { -+ errno = ENOSPC; -+ result = -1; -+ goto done; -+ } -+ -+ // do nothing to be fast! -+ result = 0; -+ goto done; -+ } -+ } // block -+#endif // AVM Patch -+ - /* we used to just check HAVE_FTRUNCATE_EXTEND and only use - sys_ftruncate if the system supports it. Then I discovered that - you can have some filesystems that support ftruncate -@@ -830,6 +994,11 @@ static int vfswrap_symlink(vfs_handle_st - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(oldpath)) { errno = EACCES; return -1; } -+ if (!IsAllowed(newpath)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_symlink); - result = sys_symlink(oldpath, newpath); - END_PROFILE(syscall_symlink); -@@ -840,6 +1009,10 @@ static int vfswrap_readlink(vfs_handle_s - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_readlink); - result = sys_readlink(path, buf, bufsiz); - END_PROFILE(syscall_readlink); -@@ -850,6 +1023,11 @@ static int vfswrap_link(vfs_handle_struc - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(oldpath)) { errno = EACCES; return -1; } -+ if (!IsAllowed(newpath)) { errno = EACCES; return -1; } -+#endif -+ - START_PROFILE(syscall_link); - result = sys_link(oldpath, newpath); - END_PROFILE(syscall_link); -@@ -860,6 +1038,9 @@ static int vfswrap_mknod(vfs_handle_stru - { - int result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(pathname)) { errno = EACCES; return -1; } -+#endif - START_PROFILE(syscall_mknod); - result = sys_mknod(pathname, mode, dev); - END_PROFILE(syscall_mknod); -@@ -870,6 +1051,9 @@ static char *vfswrap_realpath(vfs_handle - { - char *result; - -+#ifdef AVM_SEC -+ if (!IsAllowed(path)) { errno = EACCES; return 0; } -+#endif - START_PROFILE(syscall_realpath); - result = sys_realpath(path, resolved_path); - END_PROFILE(syscall_realpath); ---- a/source/param/loadparm.c -+++ b/source/param/loadparm.c -@@ -2713,8 +2713,11 @@ static BOOL lp_add_ipc(const char *ipc_n - - slprintf(comment, sizeof(comment) - 1, - "IPC Service (%s)", Globals.szServerString); -- -+#if 0 /* AVM */ -+ string_set(&ServicePtrs[i]->szPath, "/var/media/ftp"); -+#else - string_set(&ServicePtrs[i]->szPath, tmpdir()); -+#endif - string_set(&ServicePtrs[i]->szUsername, ""); - string_set(&ServicePtrs[i]->comment, comment); - string_set(&ServicePtrs[i]->fstype, "IPC"); ---- a/source/registry/reg_frontend.c -+++ b/source/registry/reg_frontend.c -@@ -35,9 +35,11 @@ extern REGISTRY_OPS regdb_ops; /* these - - REGISTRY_HOOK reg_hooks[] = { - #ifndef REG_TDB_ONLY -+#ifndef AVM_NO_PRINTING - { KEY_PRINTING, &printing_ops }, - { KEY_PRINTING_2K, &printing_ops }, - { KEY_PRINTING_PORTS, &printing_ops }, -+#endif - { KEY_SHARES, &shares_reg_ops }, - #endif - { NULL, NULL } ---- a/source/rpc_client/cli_pipe.c -+++ b/source/rpc_client/cli_pipe.c -@@ -619,7 +619,11 @@ static NTSTATUS cli_pipe_validate_curren - - DEBUG(1, ("cli_pipe_validate_current_pdu: RPC fault code %s received from remote machine %s " - "pipe %s fnum 0x%x!\n", -+#if 1 /* AVM */ -+ "ERRSTR-REPLACEMENT", -+#else - dcerpc_errstr(NT_STATUS_V(fault_resp.status)), -+#endif - cli->cli->desthost, - cli->pipe_name, - (unsigned int)cli->fnum)); ---- a/source/rpc_parse/parse_prs.c -+++ b/source/rpc_parse/parse_prs.c -@@ -796,7 +796,12 @@ BOOL prs_dcerpc_status(const char *name, - } - - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, -- dcerpc_errstr(NT_STATUS_V(*status)))); -+#if 1 /* AVM */ -+ "ERRSTR-REPLACEMENT" -+#else -+ dcerpc_errstr(NT_STATUS_V(*status)) -+#endif -+ )); - - ps->data_offset += sizeof(uint32); - ---- a/source/rpc_parse/parse_sec.c -+++ b/source/rpc_parse/parse_sec.c -@@ -104,7 +104,7 @@ BOOL sec_io_ace(const char *desc, SEC_AC - for you as it reads them. - ********************************************************************/ - --BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) -+static BOOL sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth) - { - unsigned int i; - uint32 old_offset; ---- a/source/rpc_parse/parse_spoolss.c -+++ b/source/rpc_parse/parse_spoolss.c -@@ -227,8 +227,13 @@ static BOOL smb_io_notify_option_type_da - if(!prs_uint32("count2", ps, depth, &type->count2)) - return False; - -- if (type->count2 != type->count) -+ if (type->count2 != type->count) { - DEBUG(4,("What a mess, count was %x now is %x !\n", type->count, type->count2)); -+ return False; -+ } -+ if (type->count2 > MAX_NOTIFY_TYPE_FOR_NOW) { -+ return False; -+ } - - if (type->count2 > MAX_NOTIFY_TYPE_FOR_NOW) { - return False; ---- a/source/rpc_server/srv_pipe.c -+++ b/source/rpc_server/srv_pipe.c -@@ -2335,6 +2335,7 @@ void get_pipe_fns( int idx, struct api_s - int n_cmds = 0; - - switch ( idx ) { -+#ifndef AVM_SMALLER - case PI_LSARPC: - lsa_get_pipe_fns( &cmds, &n_cmds ); - break; -@@ -2347,12 +2348,14 @@ void get_pipe_fns( int idx, struct api_s - case PI_NETLOGON: - netlog_get_pipe_fns( &cmds, &n_cmds ); - break; -+#endif /* AVM_SMALLER */ - case PI_SRVSVC: - srvsvc_get_pipe_fns( &cmds, &n_cmds ); - break; - case PI_WKSSVC: - wkssvc_get_pipe_fns( &cmds, &n_cmds ); - break; -+#ifndef AVM_SMALLER - case PI_WINREG: - reg_get_pipe_fns( &cmds, &n_cmds ); - break; -@@ -2371,6 +2374,8 @@ void get_pipe_fns( int idx, struct api_s - case PI_NTSVCS: - ntsvcs_get_pipe_fns( &cmds, &n_cmds ); - break; -+#endif /* AVM_SMALLER */ -+ - #ifdef DEVELOPER - case PI_ECHO: - echo_get_pipe_fns( &cmds, &n_cmds ); ---- a/source/smbd/change_trust_pw.c -+++ b/source/smbd/change_trust_pw.c -@@ -30,6 +30,10 @@ - - NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine) - { -+#ifdef AVM_SMALLER -+ return NT_STATUS_UNSUCCESSFUL; -+#else -+ - NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; - struct in_addr pdc_ip; - fstring dc_name; -@@ -97,4 +101,5 @@ failed: - DEBUG(5,("change_trust_account_password: sucess!\n")); - - return nt_status; -+#endif /* AVM_SMALLER */ - } ---- a/source/smbd/close.c -+++ b/source/smbd/close.c -@@ -353,7 +353,9 @@ static NTSTATUS close_normal_file(files_ - saved_status2 = close_filestruct(fsp); - - if (fsp->print_file) { -+#ifndef AVM_NO_PRINTING - print_fsp_end(fsp, close_type); -+#endif - file_free(fsp); - return NT_STATUS_OK; - } ---- a/source/smbd/conn.c -+++ b/source/smbd/conn.c -@@ -216,9 +216,12 @@ BOOL conn_idle_all(time_t t, int deadtim - * idle with a handle open. - */ - -+ -+#ifndef AVM_SMALLER - for (plist = get_first_internal_pipe(); plist; plist = get_next_internal_pipe(plist)) - if (plist->pipe_handles && plist->pipe_handles->count) - allidle = False; -+#endif - - return allidle; - } ---- a/source/smbd/dfree.c -+++ b/source/smbd/dfree.c -@@ -130,11 +130,13 @@ SMB_BIG_UINT sys_disk_free(connection_st - } - } - -+#if 0 /* AVM */ - if (disk_quotas(path, &bsize_q, &dfree_q, &dsize_q)) { - (*bsize) = bsize_q; - (*dfree) = MIN(*dfree,dfree_q); - (*dsize) = MIN(*dsize,dsize_q); - } -+#endif - - /* FIXME : Any reason for this assumption ? */ - if (*bsize < 256) { ---- a/source/smbd/dosmode.c -+++ b/source/smbd/dosmode.c -@@ -40,12 +40,15 @@ static uint32 set_offline_flag(connectio - if (ISDOT(path) || ISDOTDOT(path)) { - return 0; - } -- -+#ifdef AVM_SMALLER -+ return 0; -+#else - if (!lp_dmapi_support(SNUM(conn)) || !dmapi_have_session()) { - return 0; - } - - return dmapi_file_flags(path); -+#endif - } - - /**************************************************************************** ---- a/source/smbd/fileio.c -+++ b/source/smbd/fileio.c -@@ -176,6 +176,8 @@ static ssize_t real_write_file(files_str - - static int wcp_file_size_change(files_struct *fsp) - { -+/* AVM: Fuer Pruefung des freien Speichers auf dem Datentraeger wird -+ SMB_VFS_FTRUNCATE aufgerufen, auch falls es langsam sein sollte */ - int ret; - write_cache *wcp = fsp->wcp; - -@@ -199,6 +201,10 @@ ssize_t write_file(files_struct *fsp, co - int write_path = -1; - - if (fsp->print_file) { -+#ifdef AVM_NO_PRINTING -+ errno = EBADF; -+ return -1; -+#else - fstring sharename; - uint32 jobid; - -@@ -210,6 +216,7 @@ ssize_t write_file(files_struct *fsp, co - } - - return print_job_write(SNUM(fsp->conn), jobid, data, pos, n); -+#endif /* AVM_NO_PRINTING */ - } - - if (!fsp->can_write) { ---- a/source/smbd/files.c -+++ b/source/smbd/files.c -@@ -203,10 +203,12 @@ open files, %d are available.\n", reques - exit_server("out of memory in file_init"); - } - -+#ifndef AVM_SMALLER - /* - * Ensure that pipe_handle_oppset is set correctly. - */ - set_pipe_handle_offset(real_max_open_files); -+#endif - } - - /**************************************************************************** ---- a/source/smbd/lanman.c -+++ b/source/smbd/lanman.c -@@ -400,6 +400,7 @@ static void PACKS(struct pack_desc* desc - PACK(desc,t,v); - } - -+#ifndef AVM_NO_PRINTING - /**************************************************************************** - Get a print queue. - ****************************************************************************/ -@@ -781,6 +782,7 @@ static int get_printerdrivernumber(int s - - return result; - } -+#endif /* AVM_NO_PRINTING */ - - static BOOL api_DosPrintQGetInfo(connection_struct *conn, uint16 vuid, - char *param, int tpscnt, -@@ -789,6 +791,9 @@ static BOOL api_DosPrintQGetInfo(connect - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -901,6 +906,7 @@ static BOOL api_DosPrintQGetInfo(connect - SAFE_FREE(tmpdata); - - return(True); -+#endif /* AVM_NO_PRINTING */ - } - - /**************************************************************************** -@@ -914,6 +920,9 @@ static BOOL api_DosPrintQEnum(connection - char **rdata, char** rparam, - int *rdata_len, int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *param_format = get_safe_str_ptr(param,tpscnt,param,2); - char *output_format1 = skip_string(param,tpscnt,param_format); - char *p = skip_string(param,tpscnt,output_format1); -@@ -1046,6 +1055,7 @@ static BOOL api_DosPrintQEnum(connection - SAFE_FREE(status); - - return False; -+#endif /* AVM_NO_PRINTING */ - } - - /**************************************************************************** -@@ -2539,6 +2549,9 @@ static BOOL api_RDosPrintJobDel(connecti - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - int function = get_safe_SVAL(param,tpscnt,param,0,0); - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); -@@ -2609,6 +2622,7 @@ static BOOL api_RDosPrintJobDel(connecti - SSVAL(*rparam,2,0); /* converter word */ - - return(True); -+#endif - } - - /**************************************************************************** -@@ -2622,6 +2636,9 @@ static BOOL api_WPrintQueueCtrl(connecti - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - int function = get_safe_SVAL(param,tpscnt,param,0,0); - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); -@@ -2674,6 +2691,7 @@ static BOOL api_WPrintQueueCtrl(connecti - SSVAL(*rparam,2,0); /* converter word */ - - return(True); -+#endif - } - - /**************************************************************************** -@@ -2714,6 +2732,9 @@ static BOOL api_PrintJobInfo(connection_ - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - struct pack_desc desc; - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); -@@ -2788,6 +2809,7 @@ static BOOL api_PrintJobInfo(connection_ - SSVAL(*rparam,2,0); /* converter word */ - - return(True); -+#endif - } - - -@@ -3579,6 +3601,9 @@ static BOOL api_WPrintJobGetInfo(connect - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -3669,6 +3694,7 @@ static BOOL api_WPrintJobGetInfo(connect - DEBUG(4,("WPrintJobGetInfo: errorcode %d\n",desc.errcode)); - - return True; -+#endif - } - - static BOOL api_WPrintJobEnumerate(connection_struct *conn, uint16 vuid, -@@ -3678,6 +3704,9 @@ static BOOL api_WPrintJobEnumerate(conne - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -3760,6 +3789,7 @@ static BOOL api_WPrintJobEnumerate(conne - DEBUG(4,("WPrintJobEnumerate: errorcode %d\n",desc.errcode)); - - return True; -+#endif - } - - static int check_printdest_info(struct pack_desc* desc, -@@ -3835,6 +3865,9 @@ static BOOL api_WPrintDestGetInfo(connec - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -3906,6 +3939,7 @@ static BOOL api_WPrintDestGetInfo(connec - SAFE_FREE(tmpdata); - - return True; -+#endif - } - - static BOOL api_WPrintDestEnum(connection_struct *conn, uint16 vuid, -@@ -3915,6 +3949,9 @@ static BOOL api_WPrintDestEnum(connectio - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -3987,6 +4024,7 @@ static BOOL api_WPrintDestEnum(connectio - DEBUG(4,("WPrintDestEnumerate: errorcode %d\n",desc.errcode)); - - return True; -+#endif - } - - static BOOL api_WPrintDriverEnum(connection_struct *conn, uint16 vuid, -@@ -3996,6 +4034,9 @@ static BOOL api_WPrintDriverEnum(connect - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -4050,6 +4091,7 @@ static BOOL api_WPrintDriverEnum(connect - DEBUG(4,("WPrintDriverEnum: errorcode %d\n",desc.errcode)); - - return True; -+#endif - } - - static BOOL api_WPrintQProcEnum(connection_struct *conn, uint16 vuid, -@@ -4059,6 +4101,9 @@ static BOOL api_WPrintQProcEnum(connecti - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -4113,6 +4158,7 @@ static BOOL api_WPrintQProcEnum(connecti - DEBUG(4,("WPrintQProcEnum: errorcode %d\n",desc.errcode)); - - return True; -+#endif - } - - static BOOL api_WPrintPortEnum(connection_struct *conn, uint16 vuid, -@@ -4122,6 +4168,9 @@ static BOOL api_WPrintPortEnum(connectio - char **rdata,char **rparam, - int *rdata_len,int *rparam_len) - { -+#ifdef AVM_NO_PRINTING -+return False; -+#else - char *str1 = get_safe_str_ptr(param,tpscnt,param,2); - char *str2 = skip_string(param,tpscnt,str1); - char *p = skip_string(param,tpscnt,str2); -@@ -4178,6 +4227,7 @@ static BOOL api_WPrintPortEnum(connectio - DEBUG(4,("WPrintPortEnum: errorcode %d\n",desc.errcode)); - - return True; -+#endif - } - - /**************************************************************************** ---- a/source/smbd/open.c -+++ b/source/smbd/open.c -@@ -1155,8 +1155,11 @@ NTSTATUS open_file_ntcreate(connection_s - } - - DEBUG(10, ("open_file_ntcreate: printer open fname=%s\n", fname)); -- -+#ifdef AVM_NO_PRINTING -+ return NT_STATUS_OK; -+#else - return print_fsp_open(conn, fname, result); -+#endif - } - - if (!parent_dirname_talloc(tmp_talloc_ctx(), fname, &parent_dir, ---- a/source/smbd/process.c -+++ b/source/smbd/process.c -@@ -1028,7 +1028,9 @@ static int construct_reply(char *inbuf,c - - chain_size = 0; - file_chain_reset(); -+#ifndef AVM_SMALLER - reset_chain_p(); -+#endif - - if (msg_type != 0) - return(reply_special(inbuf,outbuf)); -@@ -1268,9 +1270,11 @@ static int setup_select_timeout(void) - - select_timeout = blocking_locks_timeout_ms(SMBD_SELECT_TIMEOUT*1000); - -+#ifndef AVM_NO_PRINTING - if (print_notify_messages_pending()) { - select_timeout = MIN(select_timeout, 1000); - } -+#endif - - return select_timeout; - } -@@ -1461,9 +1465,10 @@ machine %s in domain %s.\n", global_myna - */ - process_blocking_lock_queue(); - -+#ifndef AVM_NO_PRINTING - /* update printer queue caches if necessary */ -- - update_monitored_printq_cache(); -+#endif - - /* - * Now we are root, check if the log files need pruning. -@@ -1472,9 +1477,10 @@ machine %s in domain %s.\n", global_myna - force_check_log_size(); - check_log_size(); - -+#ifndef AVM_NO_PRINTING - /* Send any queued printer notify message to interested smbd's. */ -- - print_notify_send_messages(0); -+#endif - - /* - * Modify the select timeout depending upon ---- a/source/smbd/reply.c -+++ b/source/smbd/reply.c -@@ -3606,7 +3606,10 @@ int reply_printopen(connection_struct *c - NTSTATUS status; - - START_PROFILE(SMBsplopen); -- -+#ifdef AVM_NO_PRINTING -+ END_PROFILE(SMBsplopen); -+ return ERROR_DOS(ERRDOS,ERRnoaccess); -+#else - if (!CAN_PRINT(conn)) { - END_PROFILE(SMBsplopen); - return ERROR_DOS(ERRDOS,ERRnoaccess); -@@ -3628,6 +3631,7 @@ int reply_printopen(connection_struct *c - - END_PROFILE(SMBsplopen); - return(outsize); -+#endif - } - - /**************************************************************************** -@@ -3644,6 +3648,10 @@ int reply_printclose(connection_struct * - - CHECK_FSP(fsp,conn); - -+#ifdef AVM_NO_PRINTING -+ END_PROFILE(SMBsplretq); -+ return ERROR_DOS(ERRDOS,ERRnoaccess); -+#else - if (!CAN_PRINT(conn)) { - END_PROFILE(SMBsplclose); - return ERROR_NT(NT_STATUS_DOS(ERRSRV, ERRerror)); -@@ -3661,6 +3669,7 @@ int reply_printclose(connection_struct * - - END_PROFILE(SMBsplclose); - return(outsize); -+#endif - } - - /**************************************************************************** -@@ -3670,6 +3679,10 @@ int reply_printclose(connection_struct * - int reply_printqueue(connection_struct *conn, - char *inbuf,char *outbuf, int dum_size, int dum_buffsize) - { -+#ifdef AVM_NO_PRINTING -+ END_PROFILE(SMBsplretq); -+ return ERROR_DOS(ERRDOS,ERRnoaccess); -+#else - int outsize = set_message(outbuf,2,3,True); - int max_count = SVAL(inbuf,smb_vwv0); - int start_index = SVAL(inbuf,smb_vwv1); -@@ -3732,6 +3745,7 @@ int reply_printqueue(connection_struct * - - END_PROFILE(SMBsplretq); - return(outsize); -+#endif - } - - /**************************************************************************** ---- a/source/smbd/server.c -+++ b/source/smbd/server.c -@@ -22,7 +22,7 @@ - - #include "includes.h" - --static_decl_rpc; -+/* AVM ???? static_decl_rpc; */ - - static int am_parent = 1; - -@@ -617,6 +617,7 @@ static BOOL open_sockets_smbd(BOOL is_da - **************************************************************************/ - void reload_printers(void) - { -+#ifndef AVM_NO_PRINTING - int snum; - int n_services = lp_numservices(); - int pnum = lp_servicenumber(PRINTERS_NAME); -@@ -643,6 +644,7 @@ void reload_printers(void) - } - - load_printers(); -+#endif /* AVM_NO_PRINTING */ - } - - /**************************************************************************** -@@ -725,7 +727,9 @@ static void exit_server_common(enum serv - - invalidate_all_vuids(); - -+#ifndef AVM_NO_PRINTING - print_notify_send_messages(3); /* 3 second timeout. */ -+#endif - - /* delete our entry in the connections database. */ - yield_connection(NULL,""); -@@ -739,7 +743,9 @@ static void exit_server_common(enum serv - #endif - - locking_end(); -+#ifndef AVM_NO_PRINTING - printing_end(); -+#endif - - if (how != SERVER_EXIT_NORMAL) { - int oldlevel = DEBUGLEVEL; -@@ -820,7 +826,9 @@ static BOOL init_structs(void ) - mkproto.h. Mixing $(builddir) and $(srcdir) source files in the current - prototype generation system is too complicated. */ - -+#if 0 /* AVM */ - extern void build_options(BOOL screen); -+#endif - - int main(int argc,const char *argv[]) - { -@@ -833,6 +841,13 @@ extern void build_options(BOOL screen); - static char *ports = NULL; - static char *profile_level = NULL; - int opt; -+ -+#if 0 // AVM DEBUG -+ extern void crashdump_init(char*); -+ crashdump_init("smbd"); -+#endif -+ -+#ifndef AVM_NO_POPT - poptContext pc; - - struct poptOption long_options[] = { -@@ -842,7 +857,9 @@ extern void build_options(BOOL screen); - {"foreground", 'F', POPT_ARG_VAL, &Fork, False, "Run daemon in foreground (for daemontools, etc.)" }, - {"no-process-group", '\0', POPT_ARG_VAL, &no_process_group, True, "Don't create a new process group" }, - {"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" }, -+#if 0 /* AVM */ - {"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" }, -+#endif - {"port", 'p', POPT_ARG_STRING, &ports, 0, "Listen on the specified ports"}, - {"profiling-level", 'P', POPT_ARG_STRING, &profile_level, 0, "Set profiling level","PROFILE_LEVEL"}, - POPT_COMMON_SAMBA -@@ -861,21 +878,31 @@ extern void build_options(BOOL screen); - pc = poptGetContext("smbd", argc, argv, long_options, 0); - - while((opt = poptGetNextOpt(pc)) != -1) { -+#if 0 /* AVM */ - switch (opt) { - case 'b': - build_options(True); /* Display output to screen as well as debug */ - exit(0); - break; - } -+#endif - } - - poptFreeContext(pc); -+#else -+ load_case_tables(); -+#endif /* AVM_NO_POPT */ -+ - - #ifdef HAVE_SETLUID - /* needed for SecureWare on SCO */ - setluid(0); - #endif - -+#if 1 /* AVM */ -+ setpriority(PRIO_PROCESS, 0, 19); /* be nice */ -+#endif -+ - sec_init(); - - set_remote_machine_name("smbd", False); -@@ -903,6 +930,16 @@ extern void build_options(BOOL screen); - /* make absolutely sure we run as root - to handle cases where people - are crazy enough to have it setuid */ - -+ generate_random_buffer(NULL, 0); -+ -+ /* make absolutely sure we run as root - to handle cases where people -+ are crazy enough to have it setuid */ -+ -+ gain_root_privilege(); -+ gain_root_group_privilege(); -+ -+ fault_setup((void (*)(void *))exit_server_fault); -+ dump_core_setup("smbd"); - gain_root_privilege(); - gain_root_group_privilege(); - -@@ -945,8 +982,10 @@ extern void build_options(BOOL screen); - DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n", - (int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid())); - -+#if 0 /* AVM */ - /* Output the build options to the debug log */ - build_options(False); -+#endif - - if (sizeof(uint16) < 2 || sizeof(uint32) < 4) { - DEBUG(0,("ERROR: Samba is not configured correctly for the word size on your machine\n")); -@@ -1042,16 +1081,20 @@ extern void build_options(BOOL screen); - - namecache_enable(); - -+#ifndef AVM_SMALLER - if (!init_registry()) - exit(1); -+#endif - - #if 0 - if (!init_svcctl_db()) - exit(1); - #endif - -+#ifndef AVM_NO_PRINTING - if (!print_backend_init()) - exit(1); -+#endif - - if (!init_guest_info()) { - DEBUG(0,("ERROR: failed to setup guest info.\n")); -@@ -1068,14 +1111,18 @@ extern void build_options(BOOL screen); - smbd is launched via inetd and we fork a copy of - ourselves here */ - -+#ifndef AVM_NO_PRINTING - if ( is_daemon && !interactive ) - start_background_queue(); -+#endif - -+#if 0 /* AVM */ - /* Always attempt to initialize DMAPI. We will only use it later if - * lp_dmapi_support is set on the share, but we need a single global - * session to work with. - */ - dmapi_init_session(); -+#endif - - if (!open_sockets_smbd(is_daemon, interactive, ports)) - exit(1); -@@ -1084,7 +1131,12 @@ extern void build_options(BOOL screen); - * everything after this point is run after the fork() - */ - -+#if 0 /* AVM */ - static_init_rpc; -+#else -+ rpc_wkssvc_init(); -+ rpc_srv_init(); -+#endif - - init_modules(); - ---- a/source/smbd/service.c -+++ b/source/smbd/service.c -@@ -288,6 +288,7 @@ int find_service(fstring service) - iService = add_home_service(service,service /* 'username' */, phome_dir); - } - -+#ifndef AVM_NO_PRINTING - /* If we still don't have a service, attempt to add it as a printer. */ - if (iService < 0) { - int iPrinterService; -@@ -307,6 +308,7 @@ int find_service(fstring service) - } - } - } -+#endif /* AVM_NO_PRINTING */ - - /* Check for default vfs service? Unsure whether to implement this */ - if (iService < 0) { -@@ -1225,7 +1227,9 @@ connection_struct *make_connection(const - void close_cnum(connection_struct *conn, uint16 vuid) - { - if (IS_IPC(conn)) { -+#ifndef AVM_SMALLER - pipe_close_conn(conn); -+#endif - } else { - file_close_conn(conn); - dptr_closecnum(conn); ---- a/source/smbd/trans2.c -+++ b/source/smbd/trans2.c -@@ -2878,11 +2878,14 @@ cap_low = 0x%x, cap_high = 0x%x\n", - /* unknown_2 6 NULL bytes follow*/ - - /* now set the quotas */ -+#if 1 /* AVM */ -+ return ERROR_DOS(ERRSRV,ERRerror); -+#else - if (vfs_set_ntquota(fsp, SMB_USER_FS_QUOTA_TYPE, NULL, "as)!=0) { - DEBUG(0,("vfs_set_ntquota() failed for service [%s]\n",lp_servicename(SNUM(conn)))); - return ERROR_DOS(ERRSRV,ERRerror); - } -- -+#endif - break; - } - default: ---- /dev/null -+++ b/source/utils/avm_smbpasswd.c -@@ -0,0 +1,212 @@ -+/* -+ * Unix SMB/CIFS implementation. -+ * Copyright (C) Jeremy Allison 1995-1998 -+ * Copyright (C) Tim Potter 2001 -+ * -+ * 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" -+ -+ -+void E_md4hash(const char *passwd, uchar p16[16]) -+{ -+ int len; -+ smb_ucs2_t wpwd[129]; -+ int i; -+ -+ -+ /* Password must be converted to NT unicode - null terminated. */ -+ len = strlen(passwd); -+#if 0 -+ push_ucs2(NULL, wpwd, (const char *)passwd, 256, STR_UNICODE|STR_NOALIGN|STR_TERMINATE); -+#else -+ for (i = 0; i < len; i++) { -+ wpwd[i] = (unsigned char)passwd[i]; -+ } -+ wpwd[i] = 0; // termination -+#endif -+ /* Calculate length in bytes */ -+ len = len /*strlen_w(wpwd)*/ * sizeof(int16); -+ -+ mdfour(p16, (unsigned char *)wpwd, len); -+ ZERO_STRUCT(wpwd); -+} -+ -+/** -+ * Creates the DES forward-only Hash of the users password in DOS ASCII charset -+ * @param passwd password in 'unix' charset. -+ * @param p16 return password hashed with DES, caller allocated 16 byte buffer -+ * @return False if password was > 14 characters, and therefore may be incorrect, otherwise True -+ * @note p16 is filled in regardless -+ */ -+ -+BOOL E_deshash(const char *passwd, uchar p16[16]) -+{ -+ BOOL ret = True; -+ char dospwd[256+2]; -+ int i; -+ int len; -+ -+ /* Password must be converted to DOS charset - null terminated, uppercase. */ -+// push_ascii(dospwd, passwd, sizeof(dospwd), STR_UPPER|STR_TERMINATE); -+ len = strlen(passwd); -+ for (i = 0; i < len; i++) { -+ char c = passwd[i]; -+ if (islower(c)) c = toupper(c); -+ dospwd[i] = c; -+ } -+ dospwd[i] = 0; -+ -+ /* Only the fisrt 14 chars are considered, password need not be null terminated. */ -+ E_P16((const unsigned char *)dospwd, p16); -+ -+ if (strlen(dospwd) > 14) { -+ ret = False; -+ } -+ -+ memset(dospwd, 0, sizeof(dospwd)); -+ // ZERO_STRUCT(dospwd); -+ -+ return ret; -+} -+ -+static void my_pdb_sethexpwd(char *p, const unsigned char *pwd) -+{ -+ if (pwd != NULL) { -+ int i; -+ for (i = 0; i < 16; i++) -+ slprintf(&p[i*2], 3, "%02X", pwd[i]); -+ } else { -+ strncpy(p, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 32); -+ } -+} -+ -+static void crypt_password (const char *user_name, -+ const char *new_passwd, char *new_lanman_p16, char *new_nt_p16) -+{ -+ /* Calculate the MD4 hash (NT compatible) of the password */ -+ E_md4hash(new_passwd, new_nt_p16); -+ -+ if (!E_deshash(new_passwd, new_lanman_p16)) { -+ /* E_deshash returns false for 'long' passwords (> 14 -+ DOS chars). This allows us to match Win2k, which -+ does not store a LM hash for these passwords (which -+ would reduce the effective password length to 14 */ -+ -+ memset(new_lanman_p16, 0, LM_HASH_LEN); -+ } -+} -+ -+/* -+ftpuser:1000:8C6F5D02DEB21501AAD3B435B51404EE:E0FBA38268D0EC66EF1CB452D5885E53:[UX ]:LCT-00000000: -+*/ -+ -+/********************************************************* -+ Start here. -+**********************************************************/ -+int main(int argc, char **argv) -+{ -+ char *passwd_filename = "/var/samba/private/smbpasswd"; -+ char *cleartext_filename = "/var/tmp/smbpasswd.cleartext"; -+ -+ if (argc != 1) { -+ fprintf(stderr, "use: smbpasswd\n"); -+ fprintf(stderr, " file %s will be encrypted to %s\n", cleartext_filename, passwd_filename); -+ return -9; -+ } -+ -+ FILE *fp = fopen(passwd_filename, "w"); -+ -+ if (fp == NULL) { -+ fprintf(stderr, "can't write %s\n", passwd_filename); -+ return -10; -+ } -+ /* Make sure it is only rw by the owner */ -+ chmod(passwd_filename, 0600); -+ -+ -+ FILE *fp_in = fopen(cleartext_filename, "r"); -+ if (!fp_in) { -+ fprintf(stderr, "can't read %s\n", cleartext_filename); -+ fclose(fp); -+ return -11; -+ } -+ -+ -+ char line[512]; -+ -+ unsigned nusers = 0; -+ while(line == fgets(line, sizeof(line)-1, fp_in)) { -+ char *username, *passwd, *extra; -+ unsigned uid; -+ uchar new_lanman_p16[LM_HASH_LEN]; -+ uchar new_nt_p16[NT_HASH_LEN]; -+ char ascii_p16[32+1]; -+ char *p; -+ -+ line[sizeof(line)-1] = '\0'; -+ if (strlen(line)) { -+ p = &line[strlen(line)-1]; -+ while(p >= line) { -+ if (*p != '\n' && *p != '\r') break; -+ *p = '\0'; -+ p--; -+ } -+ } -+ -+ p = line; -+ char *p2 = strchr(p, ':'); -+ if (!p2) goto err; -+ *p2 = 0; -+ username = p; -+ -+ p = p2 + 1; -+ p2 = strchr(p, ':'); -+ if (!p2) goto err; -+ *p2 = 0; -+ uid = atoi(p); -+ -+ p = p2 + 1; -+ p2 = strchr(p, ':'); -+ if (!p2) goto err; -+ *p2 = 0; -+ passwd = p; -+ -+ extra = p2 + 1; -+ -+ crypt_password(username, passwd, new_lanman_p16, new_nt_p16); -+ -+ fprintf(fp, "%s:%u:", username, uid); -+ -+ my_pdb_sethexpwd(ascii_p16, new_lanman_p16); -+ ascii_p16[32] = '\0'; -+ fprintf(fp, "%s:", ascii_p16); -+ -+ my_pdb_sethexpwd(ascii_p16, new_nt_p16); -+ ascii_p16[32] = '\0'; -+ fprintf(fp, "%s:", ascii_p16); -+ -+ fprintf(fp, "%s\n", extra); -+ -+ nusers++; -+ } // while -+ -+err: -+ fclose(fp_in); -+ fclose(fp); -+ -+fprintf(stderr, "%u samba users written to %s\n", nusers, passwd_filename); -+ return 0; -+} ---- a/source/Makefile.in -+++ b/source/Makefile.in -@@ -257,7 +257,7 @@ LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/ - lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \ - lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \ - lib/secdesc.o lib/util_seaccess.o lib/secace.o lib/secacl.o \ -- libads/krb5_errs.o lib/system_smbd.o lib/audit.o -+ lib/system_smbd.o lib/audit.o - - LIB_OBJ = $(LIB_WITHOUT_PROTO_OBJ) $(LIB_WITH_PROTO_OBJ) - -@@ -272,7 +272,7 @@ POPT_LIB_OBJ = lib/popt_common.o - - PARAM_OBJ = dynconfig.o param/loadparm.o param/params.o lib/sharesec.o lib/ldap_debug_handler.o - --KRBCLIENT_OBJ = libads/kerberos.o libads/ads_status.o -+KRBCLIENT_OBJ = libads/ads_status.o - - LIBADDNS_OBJ0 = libaddns/dnsrecord.o libaddns/dnsutils.o libaddns/dnssock.o \ - libaddns/dnsgss.o libaddns/dnsmarshall.o -@@ -282,14 +282,9 @@ LIBGPO_OBJ0 = libgpo/gpo_ldap.o libgpo/g - libgpo/gpo_fetch.o libgpo/gpo_filesync.o - LIBGPO_OBJ = $(LIBGPO_OBJ0) - --LIBADS_OBJ = libads/ldap.o libads/ldap_printer.o libads/sasl.o \ -- libads/krb5_setpw.o libads/ldap_user.o \ -- libads/ads_struct.o libads/kerberos_keytab.o \ -- libads/disp_sec.o libads/ads_utils.o libads/ldap_utils.o \ -- libads/authdata.o libads/cldap.o libads/util.o -+LIBADS_OBJ = - --LIBADS_SERVER_OBJ = libads/kerberos_verify.o \ -- libads/ldap_schema.o -+LIBADS_SERVER_OBJ = - - SECRETS_OBJ = passdb/secrets.o passdb/machine_sid.o - -@@ -471,7 +466,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpass - printing/printfsp.o lib/sysquotas.o lib/sysquotas_linux.o \ - lib/sysquotas_xfs.o lib/sysquotas_4A.o \ - smbd/change_trust_pw.o smbd/fake_file.o \ -- smbd/quotas.o smbd/ntquotas.o $(AFS_OBJ) smbd/msdfs.o \ -+ smbd/ntquotas.o $(AFS_OBJ) smbd/msdfs.o \ - $(AFS_SETTOKEN_OBJ) smbd/aio.o smbd/statvfs.o \ - smbd/dmapi.o $(MANGLE_OBJ) @VFS_STATIC@ - -@@ -821,9 +816,9 @@ TDBDUMP_OBJ = tdb/tools/tdbdump.o $(TDBB - NTLM_AUTH_OBJ1 = utils/ntlm_auth.o utils/ntlm_auth_diagnostics.o - - NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \ -- libsmb/asn1.o libsmb/spnego.o libsmb/clikrb5.o libads/kerberos.o \ -- libads/kerberos_verify.o $(SECRETS_OBJ) $(SERVER_MUTEX_OBJ) \ -- libads/authdata.o $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ -+ libsmb/asn1.o libsmb/spnego.o libsmb/clikrb5.o \ -+ $(SECRETS_OBJ) $(SERVER_MUTEX_OBJ) \ -+ $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ - $(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \ - $(LDB_OBJ) libsmb/errormap.o - diff --git a/net/samba3/patches/110-compile_fixes.patch b/net/samba3/patches/110-compile_fixes.patch deleted file mode 100644 index a5f93a60a..000000000 --- a/net/samba3/patches/110-compile_fixes.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/source/popt/popt.c -+++ b/source/popt/popt.c -@@ -10,13 +10,14 @@ - - #include "system.h" - --#if HAVE_FLOAT_H -+//#if HAVE_FLOAT_H - #include --#endif -+//#endif - #include - - #include "findme.h" - #include "poptint.h" -+#include "../include/config.h" - - #ifdef MYDEBUG - /*@unchecked@*/ -@@ -388,7 +389,7 @@ static int execCommand(poptContext con) - sprintf(s, "%s/%s", con->execPath, item->argv[0]); - argv[argc] = s; - } else { -- argv[argc] = findProgramPath(item->argv[0]); -+ argv[argc] = ""/*findProgramPath(item->argv[0])*/; - } - if (argv[argc++] == NULL) return POPT_ERROR_NOARG; - -@@ -1246,4 +1247,3 @@ int poptStrippedArgv(poptContext con, in - - return numargs; - } --/*@=boundswrite@*/ ---- a/source/modules/vfs_default.c -+++ b/source/modules/vfs_default.c -@@ -977,7 +977,7 @@ static int vfswrap_linux_setlease(vfs_ha - - START_PROFILE(syscall_linux_setlease); - --#ifdef LINUX -+#if defined(LINUX) && defined(HAVE_KERNEL_OPLOCKS_LINUX) - /* first set the signal handler */ - if(linux_set_lease_sighandler(fd) == -1) - return -1; diff --git a/net/samba3/patches/120-owrt_paths.patch b/net/samba3/patches/120-owrt_paths.patch deleted file mode 100644 index 0d19f1752..000000000 --- a/net/samba3/patches/120-owrt_paths.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/source/Makefile.in -+++ b/source/Makefile.in -@@ -92,7 +92,7 @@ INSTALLPERMS = 0755 - # or in smb.conf (see smb.conf(5)) - LOGFILEBASE = @logfilebase@ - CONFIGFILE = $(CONFIGDIR)/smb.conf --LMHOSTSFILE = $(CONFIGDIR)/lmhosts -+LMHOSTSFILE = /etc/lmhosts - - # This is where smbpasswd et al go - PRIVATEDIR = @privatedir@ ---- a/source/configure -+++ b/source/configure -@@ -1536,8 +1536,8 @@ Optional Packages: - --with-fhs Use FHS-compliant paths (default=no) - --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private) - --with-rootsbindir=DIR Which directory to use for root sbin ($ac_default_prefix/sbin) -- --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks) -- --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks) -+ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/lock) -+ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/run) - --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat) - --with-configdir=DIR Where to put configuration files ($libdir) - --with-logfilebase=DIR Where to put log files ($VARDIR) -@@ -2295,8 +2295,8 @@ fi - - - rootsbindir="\${SBINDIR}" --lockdir="\${VARDIR}/locks" --piddir="\${VARDIR}/locks" -+lockdir="\${VARDIR}/lock" -+piddir="\${VARDIR}/run" - test "${mandir}" || mandir="\${prefix}/man" - logfilebase="\${VARDIR}" - privatedir="\${prefix}/private" diff --git a/net/samba3/patches/130-owrt_smbpasswd.patch b/net/samba3/patches/130-owrt_smbpasswd.patch deleted file mode 100644 index 5c5333a98..000000000 --- a/net/samba3/patches/130-owrt_smbpasswd.patch +++ /dev/null @@ -1,212 +0,0 @@ ---- a/source/Makefile.in -+++ b/source/Makefile.in -@@ -538,10 +538,7 @@ TESTPARM_OBJ = utils/testparm.o \ - - PASSWD_UTIL_OBJ = utils/passwd_util.o - --SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \ -- $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \ -- $(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \ -- $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) -+SMBPASSWD_OBJ = utils/owrt_smbpasswd.o lib/md4.o - - PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) \ - $(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) \ ---- /dev/null -+++ b/source/utils/owrt_smbpasswd.c -@@ -0,0 +1,195 @@ -+/* -+ * Copyright (C) John Crispin -+ * -+ * 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 -+ -+void E_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); -+} -+ -+/* returns -1 if user is not present in /etc/passwd*/ -+int find_uid_for_user(char *user) -+{ -+ char t[256]; -+ FILE *fp = fopen("/etc/passwd", "r"); -+ int ret = -1; -+ -+ if(!fp) -+ { -+ printf("failed to open /etc/passwd"); -+ goto out; -+ } -+ -+ while(!feof(fp)) -+ { -+ if(fgets(t, 255, fp)) -+ { -+ char *p1, *p2; -+ p1 = strchr(t, ':'); -+ if(p1 && (p1 - t == strlen(user)) && (strncmp(t, user, strlen(user))) == 0) -+ { -+ p1 = strchr(t, ':'); -+ if(!p1) -+ goto out; -+ p2 = strchr(++p1, ':'); -+ if(!p2) -+ goto out; -+ p1 = strchr(++p2, ':'); -+ if(!p1) -+ goto out; -+ *p1 = '\0'; -+ ret = atoi(p2); -+ goto out; -+ } -+ } -+ } -+ printf("No valid user found in /etc/passwd\n"); -+ -+out: -+ if(fp) -+ fclose(fp); -+ return ret; -+} -+ -+void insert_user_in_smbpasswd(char *user, char *line) -+{ -+ char t[256]; -+ FILE *fp = fopen("/etc/samba/smbpasswd", "r+"); -+ -+ if(!fp) -+ { -+ printf("failed to open /etc/samba/smbpasswd"); -+ goto out; -+ } -+ -+ while(!feof(fp)) -+ { -+ if(fgets(t, 255, fp)) -+ { -+ char *p; -+ p = strchr(t, ':'); -+ if(p && (p - t == strlen(user)) && (strncmp(t, user, strlen(user))) == 0) -+ { -+ fseek(fp, -strlen(line), SEEK_CUR); -+ break; -+ } -+ } -+ } -+ -+ fprintf(fp, line); -+ -+out: -+ if(fp) -+ fclose(fp); -+} -+ -+void delete_user_from_smbpasswd(char *user) -+{ -+ char t[256]; -+ FILE *fp = fopen("/etc/samba/smbpasswd", "r+"); -+ -+ if(!fp) -+ { -+ printf("failed to open /etc/samba/smbpasswd"); -+ goto out; -+ } -+ -+ while(!feof(fp)) -+ { -+ if(fgets(t, 255, fp)) -+ { -+ char *p; -+ p = strchr(t, ':'); -+ if(p && (p - t == strlen(user)) && (strncmp(t, user, strlen(user))) == 0) -+ { -+ fpos_t r_pos, w_pos; -+ char t2[256]; -+ fgetpos(fp, &r_pos); -+ w_pos = r_pos; -+ w_pos.__pos -= strlen(t); -+ while(fgets(t2, 256, fp)) -+ { -+ fsetpos(fp, &w_pos); -+ fputs(t2, fp); -+ r_pos.__pos += strlen(t2); -+ w_pos.__pos += strlen(t2); -+ fsetpos(fp, &r_pos); -+ } -+ ftruncate(fileno(fp), w_pos.__pos); -+ break; -+ } -+ } -+ } -+ -+out: -+ if(fp) -+ fclose(fp); -+} -+ -+int main(int argc, char **argv) -+{ -+ unsigned uid; -+ uchar new_nt_p16[NT_HASH_LEN]; -+ int g; -+ int smbpasswd_present; -+ char smbpasswd_line[256]; -+ char *s; -+ -+ if(argc != 3) -+ { -+ printf("usage for openwrt_smbpasswd - \n\t%s USERNAME PASSWD\n\t%s -del USERNAME\n", argv[0], argv[0]); -+ exit(1); -+ } -+ if(strcmp(argv[1], "-del") == 0) -+ { -+ printf("deleting user %s\n", argv[2]); -+ delete_user_from_smbpasswd(argv[2]); -+ return 0; -+ } -+ uid = find_uid_for_user(argv[1]); -+ if(uid == -1) -+ exit(2); -+ -+ E_md4hash(argv[2], new_nt_p16); -+ s = smbpasswd_line; -+ s += snprintf(s, 256 - (s - smbpasswd_line), "%s:%u:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:", argv[1], uid); -+ for(g = 0; g < 16; g++) -+ s += snprintf(s, 256 - (s - smbpasswd_line), "%02X", new_nt_p16[g]); -+ snprintf(s, 256 - (s - smbpasswd_line), ":[U ]:LCT-00000001:\n"); -+ -+ insert_user_in_smbpasswd(argv[1], smbpasswd_line); -+ -+ return 0; -+} diff --git a/net/samba3/patches/150-fix_ls.patch b/net/samba3/patches/150-fix_ls.patch deleted file mode 100644 index 437d1b8be..000000000 --- a/net/samba3/patches/150-fix_ls.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/source/lib/ms_fnmatch.c -+++ b/source/lib/ms_fnmatch.c -@@ -153,6 +153,10 @@ int ms_fnmatch(const char *pattern, cons - int ret, count, i; - struct max_n *max_n = NULL; - -+ if (strcmp(pattern, "*") == 0) { -+ return 0; -+ } -+ - if (strcmp(string, "..") == 0) { - string = "."; - } diff --git a/net/samba3/patches/160-fix_log.patch b/net/samba3/patches/160-fix_log.patch deleted file mode 100644 index bc6b8c447..000000000 --- a/net/samba3/patches/160-fix_log.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/source/lib/popt_common.c -+++ b/source/lib/popt_common.c -@@ -54,7 +54,7 @@ static void set_logfile(poptContext con, - else - pname++; - -- pstr_sprintf(logfile, "%s/log.%s", arg, pname); -+ pstr_sprintf(logfile, "%s/log/%s.log", arg, pname); - lp_set_logfile(logfile); - } - diff --git a/net/samba3/patches/170-no_rpc.patch b/net/samba3/patches/170-no_rpc.patch deleted file mode 100644 index 0dd18e3ba..000000000 --- a/net/samba3/patches/170-no_rpc.patch +++ /dev/null @@ -1,21 +0,0 @@ - ---- a/source/configure -+++ b/source/configure -@@ -22548,6 +22548,17 @@ rm -f conftest.err conftest.$ac_ext - { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 - $as_echo "$ac_header_preproc" >&6; } - -+# Force disable RPC -+$as_echo "test=$ac_header" >&6 -+if test "$ac_header" = "rpc/rpc.h"; then -+ if test "$ac_header_compiler" = "yes" -o "$ac_header_preproc" = "yes"; then -+ $as_echo "RPC support force disabled by OpenWRT patch" >&5 -+ $as_echo "RPC support force disabled by OpenWRT patch" >&6 -+ fi -+fi -+ac_header_compiler=no -+ac_header_preproc=no -+ - # So? What about this header? - case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) diff --git a/net/samba3/patches/200-fix-configure.patch b/net/samba3/patches/200-fix-configure.patch deleted file mode 100644 index 2ab0d61ab..000000000 --- a/net/samba3/patches/200-fix-configure.patch +++ /dev/null @@ -1,12 +0,0 @@ -Get rid of error due to cross compilation, as glibc version in OpenWRT is high enough ---- a/source/configure -+++ b/source/configure -@@ -37222,7 +37222,7 @@ rm -f core conftest.err conftest.$ac_obj - case "$host_os" in - *linux*) - # glibc <= 2.3.2 has a broken getgrouplist -- if test "$cross_compiling" = yes; then -+ if test "false" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 - $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling diff --git a/net/samba3/patches/500-remove_avm_smaller.patch b/net/samba3/patches/500-remove_avm_smaller.patch deleted file mode 100644 index fdc07ddc1..000000000 --- a/net/samba3/patches/500-remove_avm_smaller.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/source/Makefile.in -+++ b/source/Makefile.in -@@ -291,7 +291,7 @@ SECRETS_OBJ = passdb/secrets.o passdb/ma - LIBNMB_OBJ = libsmb/unexpected.o libsmb/namecache.o libsmb/nmblib.o \ - libsmb/namequery.o libsmb/conncache.o libads/dns.o - --LIBSAMBA_OBJ = libsmb/nterr.o libsmb/dcerpc_err.o libsmb/smbdes.o \ -+LIBSAMBA_OBJ = libsmb/nterr.o $(if $(OWRT_SMALLER),,libsmb/dcerpc_err.o) libsmb/smbdes.o \ - libsmb/smbencrypt.o libsmb/ntlm_check.o \ - libsmb/ntlmssp.o libsmb/ntlmssp_parse.o libsmb/ntlmssp_sign.o - -@@ -323,35 +323,35 @@ REGISTRY_OBJ = registry/reg_frontend.o r - registry/reg_db.o registry/reg_eventlog.o registry/reg_shares.o \ - registry/reg_util.o registry/reg_dynamic.o registry/reg_perfcount.o - --RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o -+RPC_LSA_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o) - --RPC_NETLOG_OBJ = rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o -+RPC_NETLOG_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o) - --RPC_SAMR_OBJ = rpc_server/srv_samr.o rpc_server/srv_samr_nt.o \ -- rpc_server/srv_samr_util.o -+RPC_SAMR_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_samr.o rpc_server/srv_samr_nt.o \ -+ rpc_server/srv_samr_util.o) - - REGFIO_OBJ = registry/regfio.o - --RPC_REG_OBJ = rpc_server/srv_reg.o rpc_server/srv_reg_nt.o $(REGFIO_OBJ) -+RPC_REG_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_reg.o rpc_server/srv_reg_nt.o $(REGFIO_OBJ)) - --RPC_LSA_DS_OBJ = rpc_server/srv_lsa_ds.o rpc_server/srv_lsa_ds_nt.o -+RPC_LSA_DS_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_lsa_ds.o rpc_server/srv_lsa_ds_nt.o) - - RPC_SVC_OBJ = rpc_server/srv_srvsvc.o rpc_server/srv_srvsvc_nt.o - - RPC_WKS_OBJ = librpc/gen_ndr/srv_wkssvc.o rpc_server/srv_wkssvc_nt.o - --RPC_SVCCTL_OBJ = rpc_server/srv_svcctl.o rpc_server/srv_svcctl_nt.o \ -+RPC_SVCCTL_OBJ = $(if $(OWRT_SMALLER),, rpc_server/srv_svcctl.o) rpc_server/srv_svcctl_nt.o \ - services/svc_spoolss.o services/svc_rcinit.o services/services_db.o \ - services/svc_netlogon.o services/svc_winreg.o \ - services/svc_wins.o - --RPC_NTSVCS_OBJ = rpc_server/srv_ntsvcs.o rpc_server/srv_ntsvcs_nt.o -+RPC_NTSVCS_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_ntsvcs.o rpc_server/srv_ntsvcs_nt.o) - --RPC_DFS_OBJ = rpc_server/srv_dfs.o rpc_server/srv_dfs_nt.o -+RPC_DFS_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_dfs.o rpc_server/srv_dfs_nt.o) - --RPC_SPOOLSS_OBJ = rpc_server/srv_spoolss.o rpc_server/srv_spoolss_nt.o -+RPC_SPOOLSS_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_spoolss.o rpc_server/srv_spoolss_nt.o) - --RPC_EVENTLOG_OBJ = rpc_server/srv_eventlog.o rpc_server/srv_eventlog_nt.o rpc_server/srv_eventlog_lib.o -+RPC_EVENTLOG_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_eventlog.o rpc_server/srv_eventlog_nt.o rpc_server/srv_eventlog_lib.o) - - RPC_PIPE_OBJ = rpc_server/srv_pipe_hnd.o \ - rpc_server/srv_pipe.o rpc_server/srv_lsa_hnd.o -@@ -431,7 +431,7 @@ PLAINTEXT_AUTH_OBJ = auth/pampass.o auth - - SLCACHE_OBJ = libsmb/samlogon_cache.o - --DCUTIL_OBJ = libsmb/namequery_dc.o libsmb/trustdom_cache.o libsmb/trusts_util.o -+DCUTIL_OBJ = libsmb/namequery_dc.o $(if $(OWRT_SMALLER),,libsmb/trustdom_cache.o libsmb/trusts_util.o) - - AUTH_BUILTIN_OBJ = auth/auth_builtin.o - AUTH_DOMAIN_OBJ = auth/auth_domain.o -@@ -468,7 +468,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpass - smbd/change_trust_pw.o smbd/fake_file.o \ - smbd/ntquotas.o $(AFS_OBJ) smbd/msdfs.o \ - $(AFS_SETTOKEN_OBJ) smbd/aio.o smbd/statvfs.o \ -- smbd/dmapi.o $(MANGLE_OBJ) @VFS_STATIC@ -+ $(if $(OWRT_SMALLER),,smbd/dmapi.o) $(MANGLE_OBJ) @VFS_STATIC@ - - SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \ - $(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) $(SECRETS_OBJ) \ diff --git a/net/samba3/patches/510-remove-printing.patch b/net/samba3/patches/510-remove-printing.patch deleted file mode 100644 index c9260d183..000000000 --- a/net/samba3/patches/510-remove-printing.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/source/Makefile.in -+++ b/source/Makefile.in -@@ -319,7 +319,7 @@ LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_wk - - REGOBJS_OBJ = registry/reg_objects.o - --REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_printing.o \ -+REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o $(if $(OWRT_NO_PRINTING),,registry/reg_printing.o) \ - registry/reg_db.o registry/reg_eventlog.o registry/reg_shares.o \ - registry/reg_util.o registry/reg_dynamic.o registry/reg_perfcount.o - -@@ -349,7 +349,7 @@ RPC_NTSVCS_OBJ = $(if $(OWRT_SMALLER),,r - - RPC_DFS_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_dfs.o rpc_server/srv_dfs_nt.o) - --RPC_SPOOLSS_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_spoolss.o rpc_server/srv_spoolss_nt.o) -+RPC_SPOOLSS_OBJ = $(if $(OWRT_NO_PRINTING),,rpc_server/srv_spoolss.o rpc_server/srv_spoolss_nt.o) - - RPC_EVENTLOG_OBJ = $(if $(OWRT_SMALLER),,rpc_server/srv_eventlog.o rpc_server/srv_eventlog_nt.o rpc_server/srv_eventlog_lib.o) - -@@ -463,7 +463,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpass - smbd/vfs.o smbd/statcache.o \ - smbd/posix_acls.o lib/sysacls.o $(SERVER_MUTEX_OBJ) \ - smbd/process.o smbd/service.o smbd/error.o \ -- printing/printfsp.o lib/sysquotas.o lib/sysquotas_linux.o \ -+ $(if $(OWRT_NO_PRINTING),,printing/printfsp.o) lib/sysquotas.o lib/sysquotas_linux.o \ - lib/sysquotas_xfs.o lib/sysquotas_4A.o \ - smbd/change_trust_pw.o smbd/fake_file.o \ - smbd/ntquotas.o $(AFS_OBJ) smbd/msdfs.o \ -@@ -480,13 +480,13 @@ SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_ - $(REGISTRY_OBJ) $(POPT_LIB_OBJ) \ - $(BUILDOPT_OBJ) $(SMBLDAP_OBJ) - --PRINTING_OBJ = printing/pcap.o printing/print_svid.o printing/print_aix.o \ -+PRINTING_OBJ = $(if $(OWRT_NO_PRINTING),,printing/pcap.o printing/print_svid.o printing/print_aix.o \ - printing/print_cups.o printing/print_generic.o \ - printing/lpq_parse.o printing/load.o \ -- printing/print_iprint.o printing/print_test.o -+ printing/print_iprint.o printing/print_test.o) - --PRINTBASE_OBJ = printing/notify.o printing/printing_db.o --PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o $(PRINTBASE_OBJ) -+PRINTBASE_OBJ = $(if $(OWRT_NO_PRINTING),,printing/notify.o printing/printing_db.o) -+PRINTBACKEND_OBJ = $(if $(OWRT_NO_PRINTING),,printing/printing.o printing/nt_printing.o $(PRINTBASE_OBJ)) - - SMBD_OBJ = $(SMBD_OBJ_BASE) $(SMBD_OBJ_MAIN) - NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \ diff --git a/net/samba3/patches/600-CVE-2012-1182.patch b/net/samba3/patches/600-CVE-2012-1182.patch deleted file mode 100644 index b0f50a164..000000000 --- a/net/samba3/patches/600-CVE-2012-1182.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/source/librpc/gen_ndr/ndr_wkssvc.c -+++ b/source/librpc/gen_ndr/ndr_wkssvc.c -@@ -1385,10 +1385,10 @@ NTSTATUS ndr_pull_USER_INFO_0_CONTAINER( - NDR_PULL_ALLOC_N(ndr, r->user0, ndr_get_array_size(ndr, &r->user0)); - _mem_save_user0_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->user0, 0); -- for (cntr_user0_1 = 0; cntr_user0_1 < r->entries_read; cntr_user0_1++) { -+ for (cntr_user0_1 = 0; cntr_user0_1 < ndr_get_array_size(ndr, &r->user0); cntr_user0_1++) { - NDR_CHECK(ndr_pull_USER_INFO_0(ndr, NDR_SCALARS, &r->user0[cntr_user0_1])); - } -- for (cntr_user0_1 = 0; cntr_user0_1 < r->entries_read; cntr_user0_1++) { -+ for (cntr_user0_1 = 0; cntr_user0_1 < ndr_get_array_size(ndr, &r->user0); cntr_user0_1++) { - NDR_CHECK(ndr_pull_USER_INFO_0(ndr, NDR_BUFFERS, &r->user0[cntr_user0_1])); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user0_1, 0); -@@ -1631,10 +1631,10 @@ NTSTATUS ndr_pull_USER_INFO_1_CONTAINER( - NDR_PULL_ALLOC_N(ndr, r->user1, ndr_get_array_size(ndr, &r->user1)); - _mem_save_user1_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->user1, 0); -- for (cntr_user1_1 = 0; cntr_user1_1 < r->entries_read; cntr_user1_1++) { -+ for (cntr_user1_1 = 0; cntr_user1_1 < ndr_get_array_size(ndr, &r->user1); cntr_user1_1++) { - NDR_CHECK(ndr_pull_USER_INFO_1(ndr, NDR_SCALARS, &r->user1[cntr_user1_1])); - } -- for (cntr_user1_1 = 0; cntr_user1_1 < r->entries_read; cntr_user1_1++) { -+ for (cntr_user1_1 = 0; cntr_user1_1 < ndr_get_array_size(ndr, &r->user1); cntr_user1_1++) { - NDR_CHECK(ndr_pull_USER_INFO_1(ndr, NDR_BUFFERS, &r->user1[cntr_user1_1])); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user1_1, 0); -@@ -1953,10 +1953,10 @@ NTSTATUS ndr_pull_wkssvc_NetWkstaTranspo - NDR_PULL_ALLOC_N(ndr, r->array, ndr_get_array_size(ndr, &r->array)); - _mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->array, 0); -- for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) { -+ for (cntr_array_1 = 0; cntr_array_1 < ndr_get_array_size(ndr, &r->array); cntr_array_1++) { - NDR_CHECK(ndr_pull_wkssvc_NetWkstaTransportInfo0(ndr, NDR_SCALARS, &r->array[cntr_array_1])); - } -- for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) { -+ for (cntr_array_1 = 0; cntr_array_1 < ndr_get_array_size(ndr, &r->array); cntr_array_1++) { - NDR_CHECK(ndr_pull_wkssvc_NetWkstaTransportInfo0(ndr, NDR_BUFFERS, &r->array[cntr_array_1])); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0);