summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-07-27 04:56:06 +0000
committerGerald Carter <jerry@samba.org>2002-07-27 04:56:06 +0000
commit637fe80a0b3f0f40d54238d8dfe5c08076c8ce59 (patch)
tree4473cf206106044379ea30627a60039690a0e69a
parenta637458ff33925dee6016647e39b8ec92ccdfb6f (diff)
downloadsamba-637fe80a0b3f0f40d54238d8dfe5c08076c8ce59.tar.gz
merging for 2.2.6pre1
-rw-r--r--docs/docbook/manpages/smb.conf.5.sgml6
-rw-r--r--examples/VFS/recycle/recycle.c2
-rw-r--r--source/Makefile.in13
-rw-r--r--source/aclocal.m4424
-rwxr-xr-xsource/configure140
-rw-r--r--source/configure.in6
-rw-r--r--source/include/byteorder.h26
-rw-r--r--source/include/proto.h558
-rw-r--r--source/include/smb.h6
-rw-r--r--source/include/version.h2
-rw-r--r--source/lib/select.c18
-rw-r--r--source/lib/substitute.c32
-rw-r--r--source/lib/username.c2
-rw-r--r--source/lib/util.c2
-rw-r--r--source/lib/util_sec.c36
-rw-r--r--source/lib/util_str.c14
-rw-r--r--source/libsmb/cliconnect.c9
-rw-r--r--source/libsmb/clientgen.c18
-rw-r--r--source/libsmb/clilist.c1
-rw-r--r--source/libsmb/unexpected.c2
-rw-r--r--source/msdfs/msdfs.c2
-rw-r--r--source/nsswitch/winbind_nss.c6
-rw-r--r--source/param/loadparm.c18
-rw-r--r--source/passdb/pdb_ldap.c12
-rw-r--r--source/passdb/pdb_smbpasswd.c6
-rw-r--r--source/passdb/pdb_tdb.c41
-rw-r--r--source/printing/lpq_parse.c2
-rw-r--r--source/printing/nt_printing.c11
-rw-r--r--source/printing/print_generic.c2
-rw-r--r--source/printing/printing.c111
-rw-r--r--source/rpc_client/cli_spoolss_notify.c2
-rw-r--r--source/rpc_parse/parse_prs.c11
-rw-r--r--source/rpc_parse/parse_reg.c14
-rw-r--r--source/rpc_parse/parse_sec.c81
-rw-r--r--source/rpc_parse/parse_spoolss.c4
-rw-r--r--source/rpc_server/srv_pipe.c2
-rw-r--r--source/rpc_server/srv_pipe_hnd.c2
-rwxr-xr-xsource/rpc_server/srv_spoolss.c3
-rw-r--r--source/rpc_server/srv_spoolss_nt.c24
-rw-r--r--source/rpc_server/srv_srvsvc_nt.c8
-rw-r--r--source/smbd/lanman.c18
-rw-r--r--source/smbd/mangle_hash2.c6
-rw-r--r--source/smbd/message.c2
-rw-r--r--source/smbd/nttrans.c8
-rw-r--r--source/smbd/password.c6
-rw-r--r--source/smbd/process.c4
-rw-r--r--source/smbd/sec_ctx.c39
-rw-r--r--source/smbd/service.c23
-rw-r--r--source/smbd/trans2.c3
-rw-r--r--source/tdb/tdb.c5
-rw-r--r--source/tdb/tdbtool.c32
-rw-r--r--source/utils/testparm.c2
52 files changed, 1056 insertions, 771 deletions
diff --git a/docs/docbook/manpages/smb.conf.5.sgml b/docs/docbook/manpages/smb.conf.5.sgml
index 1f54aea30c4..cff2afdcaca 100644
--- a/docs/docbook/manpages/smb.conf.5.sgml
+++ b/docs/docbook/manpages/smb.conf.5.sgml
@@ -7759,9 +7759,9 @@
<varlistentry>
<term><anchor id="UNIXEXTENSIONS">unix extensions(G)</term>
<listitem><para>This boolean parameter controls whether Samba
- implments the CIFS UNIX extensions, as defined by HP. These
- extensions enable CIFS to server UNIX clients to UNIX servers
- better, and allow such things as symbolic links, hard links etc.
+ implments the CIFS UNIX extensions, as defined by HP.
+ These extensions enable Samba to better serve UNIX CIFS clients
+ by supporting features such as symbolic links, hard links, etc...
These extensions require a similarly enabled client, and are of
no current use to Windows clients.</para>
diff --git a/examples/VFS/recycle/recycle.c b/examples/VFS/recycle/recycle.c
index 3d2d5d79697..4e7b6c7bcf3 100644
--- a/examples/VFS/recycle/recycle.c
+++ b/examples/VFS/recycle/recycle.c
@@ -154,7 +154,7 @@ static BOOL do_parameter(char *pszParmName, char *pszParmValue)
if (current->recycle_bin == NULL)
return False;
current->recycle_bin = safe_strcpy(current->recycle_bin,pszParmValue,sizeof(pstring));
- standard_sub_basic(current->recycle_bin);
+ standard_sub_basic(current->recycle_bin, strlen(current->recycle_bin));
trim_string(current->recycle_bin,"/","/");
DEBUG(10, ("name=%s\n", current->recycle_bin));
} else if (StrCaseCmp("mode",pszParmName)==0) {
diff --git a/source/Makefile.in b/source/Makefile.in
index f3589fb6c1d..f7eef9ff982 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -289,7 +289,8 @@ SMBW_OBJ = smbwrapper/smbw.o \
SMBWRAPPER_OBJ = $(SMBW_OBJ) smbwrapper/wrapped.o
-LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o $(LIB_OBJ) $(LIBSMB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ)
+LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o $(LIB_OBJ) $(LIBSMB_OBJ) \
+ $(PARAM_OBJ) $(UBIQX_OBJ)
CLIENT_OBJ = client/client.o client/clitar.o \
$(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
@@ -415,6 +416,8 @@ POPT_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
TDBBACKUP_OBJ = tdb/tdbbackup.o $(TDBBASE_OBJ)
+TDBDUMP_OBJ = tdb/tdbdump.o $(TDBBASE_OBJ)
+
######################################################################
# now the rules...
######################################################################
@@ -631,7 +634,7 @@ bin/smbsh: $(SMBSH_OBJ) bin/.dummy
bin/smbwrapper.@SHLIBEXT@: $(PICOBJS) bin/.dummy
@echo Linking shared library $@
- @$(SHLD) @LDSHFLAGS@ -o $@ $(PICOBJS) $(LIBS) \
+ @$(SHLD) @LDSHFLAGS@ -o $@ $(PICOBJS) $(LDFLAGS) $(LIBS) \
@SONAMEFLAG@`basename $@`
bin/smbwrapper.32.@SHLIBEXT@: $(PICOBJS32) bin/.dummy
@@ -650,7 +653,7 @@ bin/libsmbclient.a: $(LIBSMBCLIENT_PICOBJS) bin/.dummy
bin/pam_smbpass.@SHLIBEXT@: $(PAM_SMBPASS_OBJ) bin/.dummy
@echo Linking shared library $@
- $(SHLD) @LDSHFLAGS@ -o $@ $(PAM_SMBPASS_OBJ) $(LDFLAGS) -lpam $(DYNEXP) $(LIBS) -lc \
+ $(SHLD) @LDSHFLAGS@ -o $@ $(PAM_SMBPASS_OBJ) $(LDFLAGS) -lpam $(DYNEXP) $(LIBS) $(LDAPLIBS) -lc \
@SONAMEFLAG@`basename $@`
nsswitch/libnss_wins.so: $(NSS_OBJ)
@@ -687,6 +690,10 @@ bin/tdbbackup: $(TDBBACKUP_OBJ) bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(TDBBACKUP_OBJ)
+bin/tdbdump: $(TDBDUMP_OBJ) bin/.dummy
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(TDBDUMP_OBJ)
+
install: installbin installman installscripts installcp installswat
installdirs:
diff --git a/source/aclocal.m4 b/source/aclocal.m4
index 036b1481128..4ae5336a4bf 100644
--- a/source/aclocal.m4
+++ b/source/aclocal.m4
@@ -87,322 +87,13 @@ EOF
dnl Add an #include
dnl AC_ADD_INCLUDE(VARIABLE)
-AC_DEFUN(AC_ADD_INCLUDE,
+define(AC_ADD_INCLUDE,
[cat >> confdefs.h <<\EOF
[#include] $1
EOF
])
-## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
-## Copyright (C) 1996-1999 Free Software Foundation, Inc.
-## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-##
-## 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-##
-## As a special exception to the GNU General Public License, if you
-## distribute this file as part of a program that contains a
-## configuration script generated by Autoconf, you may include it under
-## the same distribution terms that you use for the rest of that program.
-
-# serial 40 AC_PROG_LIBTOOL
-AC_DEFUN(AC_PROG_LIBTOOL,
-[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
-
-# Save cache, so that ltconfig can load it
-AC_CACHE_SAVE
-
-# Actually configure libtool. ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
-DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
-|| AC_MSG_ERROR([libtool configure failed])
-
-# Reload cache, that may have been modified by ltconfig
-AC_CACHE_LOAD
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
-])
-
-AC_DEFUN(AC_LIBTOOL_SETUP,
-[AC_PREREQ(2.13)dnl
-AC_REQUIRE([AC_ENABLE_SHARED])dnl
-AC_REQUIRE([AC_ENABLE_STATIC])dnl
-AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([AC_PROG_RANLIB])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_LD])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-dnl
-
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
-esac
-
-# Check for any special flags to pass to ltconfig.
-libtool_flags="--cache-file=$cache_file"
-test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
-test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
-test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
-test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
-test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
-ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
-[libtool_flags="$libtool_flags --enable-dlopen"])
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-[libtool_flags="$libtool_flags --enable-win32-dll"])
-AC_ARG_ENABLE(libtool-lock,
- [ --disable-libtool-lock avoid locking (might break parallel builds)])
-test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
-test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case "$lt_target" in
-*-*-irix6*)
- # Find out which ABI we are using.
- echo '[#]line __oline__ "configure"' > conftest.$ac_ext
- if AC_TRY_EVAL(ac_compile); then
- case "`/usr/bin/file conftest.o`" in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-*-*-sco3.2v5*)
- # On SCO OpenServer 5, we need -belf to get full-featured binaries.
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -belf"
- AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
- [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
- if test x"$lt_cv_cc_needs_belf" != x"yes"; then
- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
- CFLAGS="$SAVE_CFLAGS"
- fi
- ;;
-
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-[*-*-cygwin* | *-*-mingw*)
- AC_CHECK_TOOL(DLLTOOL, dlltool, false)
- AC_CHECK_TOOL(AS, as, false)
- AC_CHECK_TOOL(OBJDUMP, objdump, false)
- ;;
-])
-esac
-])
-
-# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
-AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
-
-# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
-AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
-
-# AC_ENABLE_SHARED - implement the --enable-shared flag
-# Usage: AC_ENABLE_SHARED[(DEFAULT)]
-# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
-# `yes'.
-AC_DEFUN(AC_ENABLE_SHARED, [dnl
-define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(shared,
-changequote(<<, >>)dnl
-<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac],
-enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
-])
-
-# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_SHARED(no)])
-
-# AC_ENABLE_STATIC - implement the --enable-static flag
-# Usage: AC_ENABLE_STATIC[(DEFAULT)]
-# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
-# `yes'.
-AC_DEFUN(AC_ENABLE_STATIC, [dnl
-define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(static,
-changequote(<<, >>)dnl
-<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac],
-enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
-])
-
-# AC_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_STATIC(no)])
-
-
-# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
-# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
-# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
-# `yes'.
-AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
-define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(fast-install,
-changequote(<<, >>)dnl
-<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac],
-enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
-])
-
-# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
-AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_FAST_INSTALL(no)])
-
-# AC_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN(AC_PROG_LD,
-[AC_ARG_WITH(gnu-ld,
-[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-ac_prog=ld
-if test "$ac_cv_prog_gcc" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- AC_MSG_CHECKING([for ld used by GCC])
- ac_prog=`($CC -print-prog-name=ld) 2>&5`
- case "$ac_prog" in
- # Accept absolute paths.
-changequote(,)dnl
- [\\/]* | [A-Za-z]:[\\/]*)
- re_direlt='/[^/][^/]*/\.\./'
-changequote([,])dnl
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(ac_cv_path_LD,
-[if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- ac_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
-else
- ac_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$ac_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT($LD)
-else
- AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_PROG_LD_GNU
-])
-
+dnl Copied from libtool.m4
AC_DEFUN(AC_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
@@ -412,114 +103,3 @@ else
ac_cv_prog_gnu_ld=no
fi])
])
-
-# AC_PROG_NM - find the path to a BSD-compatible name lister
-AC_DEFUN(AC_PROG_NM,
-[AC_MSG_CHECKING([for BSD-compatible nm])
-AC_CACHE_VAL(ac_cv_path_NM,
-[if test -n "$NM"; then
- # Let the user override the test.
- ac_cv_path_NM="$NM"
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- ac_cv_path_NM="$ac_dir/nm -B"
- break
- elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- ac_cv_path_NM="$ac_dir/nm -p"
- break
- else
- ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
-fi])
-NM="$ac_cv_path_NM"
-AC_MSG_RESULT([$NM])
-])
-
-# AC_CHECK_LIBM - check for math library
-AC_DEFUN(AC_CHECK_LIBM,
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case "$lt_target" in
-*-*-beos* | *-*-cygwin*)
- # These system don't have libm
- ;;
-*-ncr-sysv4.3*)
- AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
- AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
- ;;
-*)
- AC_CHECK_LIB(m, main, LIBM="-lm")
- ;;
-esac
-])
-
-# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl convenience library, adds --enable-ltdl-convenience to
-# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'. Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
-AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
- case "$enable_ltdl_convenience" in
- no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
- "") enable_ltdl_convenience=yes
- ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
- esac
- LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
- INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
-])
-
-# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl installable library, and adds --enable-ltdl-install to
-# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'. Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
-# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
-AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
- AC_CHECK_LIB(ltdl, main,
- [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
- [if test x"$enable_ltdl_install" = xno; then
- AC_MSG_WARN([libltdl not installed, but installation disabled])
- else
- enable_ltdl_install=yes
- fi
- ])
- if test x"$enable_ltdl_install" = x"yes"; then
- ac_configure_args="$ac_configure_args --enable-ltdl-install"
- LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
- INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
- else
- ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
- LIBLTDL="-lltdl"
- INCLTDL=
- fi
-])
-
-dnl old names
-AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
-AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
-AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
-AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
-AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
-AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
-AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
-
-dnl This is just to silence aclocal about the macro not being used
-ifelse([AC_DISABLE_FAST_INSTALL])dnl
diff --git a/source/configure b/source/configure
index 69dca5f44e6..3102a368489 100755
--- a/source/configure
+++ b/source/configure
@@ -12228,15 +12228,17 @@ else
fi
LDAPLIBS="-lresolv $LDAPLIBS"
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $LDAPLIBS"
for ac_func in ldap_start_tls_s
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:12235: checking for $ac_func" >&5
+echo "configure:12237: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12240 "configure"
+#line 12242 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -12259,7 +12261,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:12263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -12283,6 +12285,7 @@ else
fi
done
+ LDFLAGS="$old_LDFLAGS"
with_smbpasswd_sam=no
;;
@@ -12299,7 +12302,7 @@ fi
#################################################
# check for a NISPLUS password database
echo $ac_n "checking whether to use NISPLUS SAM database""... $ac_c" 1>&6
-echo "configure:12303: checking whether to use NISPLUS SAM database" >&5
+echo "configure:12306: checking whether to use NISPLUS SAM database" >&5
# Check whether --with-nisplussam or --without-nisplussam was given.
if test "${with_nisplussam+set}" = set; then
withval="$with_nisplussam"
@@ -12327,7 +12330,7 @@ fi
# smbpasswd SAM is only used if another format
# has not been defined
echo $ac_n "checking whether to use traditional smbpasswd file""... $ac_c" 1>&6
-echo "configure:12331: checking whether to use traditional smbpasswd file" >&5
+echo "configure:12334: checking whether to use traditional smbpasswd file" >&5
if test $with_smbpasswd_sam = yes; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
@@ -12349,7 +12352,7 @@ fi
#################################################
# check for a NISPLUS_HOME support
echo $ac_n "checking whether to use NISPLUS_HOME""... $ac_c" 1>&6
-echo "configure:12353: checking whether to use NISPLUS_HOME" >&5
+echo "configure:12356: checking whether to use NISPLUS_HOME" >&5
# Check whether --with-nisplus-home or --without-nisplus-home was given.
if test "${with_nisplus_home+set}" = set; then
withval="$with_nisplus_home"
@@ -12374,7 +12377,7 @@ fi
#################################################
# check for the secure socket layer
echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6
-echo "configure:12378: checking whether to use SSL" >&5
+echo "configure:12381: checking whether to use SSL" >&5
# Check whether --with-ssl or --without-ssl was given.
if test "${with_ssl+set}" = set; then
withval="$with_ssl"
@@ -12448,7 +12451,7 @@ fi
#################################################
# check for syslog logging
echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6
-echo "configure:12452: checking whether to use syslog logging" >&5
+echo "configure:12455: checking whether to use syslog logging" >&5
# Check whether --with-syslog or --without-syslog was given.
if test "${with_syslog+set}" = set; then
withval="$with_syslog"
@@ -12473,7 +12476,7 @@ fi
#################################################
# check for a shared memory profiling support
echo $ac_n "checking whether to use profiling""... $ac_c" 1>&6
-echo "configure:12477: checking whether to use profiling" >&5
+echo "configure:12480: checking whether to use profiling" >&5
# Check whether --with-profiling-data or --without-profiling-data was given.
if test "${with_profiling_data+set}" = set; then
withval="$with_profiling_data"
@@ -12501,7 +12504,7 @@ fi
QUOTAOBJS=smbd/noquotas.o
echo $ac_n "checking whether to support disk-quotas""... $ac_c" 1>&6
-echo "configure:12505: checking whether to support disk-quotas" >&5
+echo "configure:12508: checking whether to support disk-quotas" >&5
# Check whether --with-quotas or --without-quotas was given.
if test "${with_quotas+set}" = set; then
withval="$with_quotas"
@@ -12525,7 +12528,7 @@ fi
# check for experimental utmp accounting
echo $ac_n "checking whether to support utmp accounting""... $ac_c" 1>&6
-echo "configure:12529: checking whether to support utmp accounting" >&5
+echo "configure:12532: checking whether to support utmp accounting" >&5
# Check whether --with-utmp or --without-utmp was given.
if test "${with_utmp+set}" = set; then
withval="$with_utmp"
@@ -12551,7 +12554,7 @@ fi
# check for MS Dfs support
echo $ac_n "checking whether to support Microsoft Dfs""... $ac_c" 1>&6
-echo "configure:12555: checking whether to support Microsoft Dfs" >&5
+echo "configure:12558: checking whether to support Microsoft Dfs" >&5
# Check whether --with-msdfs or --without-msdfs was given.
if test "${with_msdfs+set}" = set; then
withval="$with_msdfs"
@@ -12579,7 +12582,7 @@ fi
LIBSMBCLIENT_SHARED=
LIBSMBCLIENT=
echo $ac_n "checking whether to build the libsmbclient shared library""... $ac_c" 1>&6
-echo "configure:12583: checking whether to build the libsmbclient shared library" >&5
+echo "configure:12586: checking whether to build the libsmbclient shared library" >&5
# Check whether --with-libsmbclient or --without-libsmbclient was given.
if test "${with_libsmbclient+set}" = set; then
withval="$with_libsmbclient"
@@ -12606,14 +12609,14 @@ fi
#################################################
# these tests are taken from the GNU fileutils package
echo "checking how to get filesystem space usage" 1>&6
-echo "configure:12610: checking how to get filesystem space usage" >&5
+echo "configure:12613: checking how to get filesystem space usage" >&5
space=no
# Test for statvfs64.
if test $space = no; then
# SVR4
echo $ac_n "checking statvfs64 function (SVR4)""... $ac_c" 1>&6
-echo "configure:12617: checking statvfs64 function (SVR4)" >&5
+echo "configure:12620: checking statvfs64 function (SVR4)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -12621,7 +12624,7 @@ else
fu_cv_sys_stat_statvfs64=cross
else
cat > conftest.$ac_ext <<EOF
-#line 12625 "configure"
+#line 12628 "configure"
#include "confdefs.h"
#if defined(HAVE_UNISTD_H)
@@ -12635,7 +12638,7 @@ else
exit (statvfs64 (".", &fsd));
}
EOF
-if { (eval echo configure:12639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statvfs64=yes
else
@@ -12668,12 +12671,12 @@ fi
if test $space = no; then
# SVR4
echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6
-echo "configure:12672: checking statvfs function (SVR4)" >&5
+echo "configure:12675: checking statvfs function (SVR4)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12677 "configure"
+#line 12680 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statvfs.h>
@@ -12681,7 +12684,7 @@ int main() {
struct statvfs fsd; statvfs (0, &fsd);
; return 0; }
EOF
-if { (eval echo configure:12685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
fu_cv_sys_stat_statvfs=yes
else
@@ -12706,7 +12709,7 @@ fi
if test $space = no; then
# DEC Alpha running OSF/1
echo $ac_n "checking for 3-argument statfs function (DEC OSF/1)""... $ac_c" 1>&6
-echo "configure:12710: checking for 3-argument statfs function (DEC OSF/1)" >&5
+echo "configure:12713: checking for 3-argument statfs function (DEC OSF/1)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs3_osf1'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -12714,7 +12717,7 @@ else
fu_cv_sys_stat_statfs3_osf1=no
else
cat > conftest.$ac_ext <<EOF
-#line 12718 "configure"
+#line 12721 "configure"
#include "confdefs.h"
#include <sys/param.h>
@@ -12727,7 +12730,7 @@ else
exit (statfs (".", &fsd, sizeof (struct statfs)));
}
EOF
-if { (eval echo configure:12731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs3_osf1=yes
else
@@ -12754,7 +12757,7 @@ fi
if test $space = no; then
# AIX
echo $ac_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)""... $ac_c" 1>&6
-echo "configure:12758: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+echo "configure:12761: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_bsize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -12762,7 +12765,7 @@ else
fu_cv_sys_stat_statfs2_bsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 12766 "configure"
+#line 12769 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_PARAM_H
@@ -12781,7 +12784,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:12785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_bsize=yes
else
@@ -12808,7 +12811,7 @@ fi
if test $space = no; then
# SVR3
echo $ac_n "checking for four-argument statfs (AIX-3.2.5, SVR3)""... $ac_c" 1>&6
-echo "configure:12812: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+echo "configure:12815: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs4'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -12816,7 +12819,7 @@ else
fu_cv_sys_stat_statfs4=no
else
cat > conftest.$ac_ext <<EOF
-#line 12820 "configure"
+#line 12823 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statfs.h>
@@ -12826,7 +12829,7 @@ else
exit (statfs (".", &fsd, sizeof fsd, 0));
}
EOF
-if { (eval echo configure:12830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs4=yes
else
@@ -12853,7 +12856,7 @@ fi
if test $space = no; then
# 4.4BSD and NetBSD
echo $ac_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)""... $ac_c" 1>&6
-echo "configure:12857: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+echo "configure:12860: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_fsize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -12861,7 +12864,7 @@ else
fu_cv_sys_stat_statfs2_fsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 12865 "configure"
+#line 12868 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -12877,7 +12880,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:12881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_fsize=yes
else
@@ -12904,7 +12907,7 @@ fi
if test $space = no; then
# Ultrix
echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
-echo "configure:12908: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+echo "configure:12911: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -12912,7 +12915,7 @@ else
fu_cv_sys_stat_fs_data=no
else
cat > conftest.$ac_ext <<EOF
-#line 12916 "configure"
+#line 12919 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -12932,7 +12935,7 @@ else
exit (statfs (".", &fsd) != 1);
}
EOF
-if { (eval echo configure:12936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_fs_data=yes
else
@@ -12965,9 +12968,9 @@ fi
# file support.
#
echo $ac_n "checking if large file support can be enabled""... $ac_c" 1>&6
-echo "configure:12969: checking if large file support can be enabled" >&5
+echo "configure:12972: checking if large file support can be enabled" >&5
cat > conftest.$ac_ext <<EOF
-#line 12971 "configure"
+#line 12974 "configure"
#include "confdefs.h"
#if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
@@ -12980,7 +12983,7 @@ int main() {
int i
; return 0; }
EOF
-if { (eval echo configure:12984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes
else
@@ -13047,7 +13050,7 @@ fi
# check for ACL support
echo $ac_n "checking whether to support ACLs""... $ac_c" 1>&6
-echo "configure:13051: checking whether to support ACLs" >&5
+echo "configure:13054: checking whether to support ACLs" >&5
# Check whether --with-acl-support or --without-acl-support was given.
if test "${with_acl_support+set}" = set; then
withval="$with_acl_support"
@@ -13100,7 +13103,7 @@ EOF
;;
*)
echo $ac_n "checking for acl_get_file in -lacl""... $ac_c" 1>&6
-echo "configure:13104: checking for acl_get_file in -lacl" >&5
+echo "configure:13107: checking for acl_get_file in -lacl" >&5
ac_lib_var=`echo acl'_'acl_get_file | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -13108,7 +13111,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lacl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13112 "configure"
+#line 13115 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -13119,7 +13122,7 @@ int main() {
acl_get_file()
; return 0; }
EOF
-if { (eval echo configure:13123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -13147,13 +13150,13 @@ else
fi
echo $ac_n "checking for ACL support""... $ac_c" 1>&6
-echo "configure:13151: checking for ACL support" >&5
+echo "configure:13154: checking for ACL support" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_POSIX_ACLS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13157 "configure"
+#line 13160 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/acl.h>
@@ -13161,7 +13164,7 @@ int main() {
acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);
; return 0; }
EOF
-if { (eval echo configure:13165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
samba_cv_HAVE_POSIX_ACLS=yes
else
@@ -13181,13 +13184,13 @@ echo "$ac_t""$samba_cv_HAVE_POSIX_ACLS" 1>&6
EOF
echo $ac_n "checking for acl_get_perm_np""... $ac_c" 1>&6
-echo "configure:13185: checking for acl_get_perm_np" >&5
+echo "configure:13188: checking for acl_get_perm_np" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_ACL_GET_PERM_NP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13191 "configure"
+#line 13194 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/acl.h>
@@ -13195,7 +13198,7 @@ int main() {
acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);
; return 0; }
EOF
-if { (eval echo configure:13199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
samba_cv_HAVE_ACL_GET_PERM_NP=yes
else
@@ -13250,7 +13253,7 @@ fi
# (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS).
echo $ac_n "checking whether to build winbind""... $ac_c" 1>&6
-echo "configure:13254: checking whether to build winbind" >&5
+echo "configure:13257: checking whether to build winbind" >&5
# Initially, the value of $host_os decides whether winbind is supported
@@ -13310,7 +13313,7 @@ if test x"$HAVE_WINBIND" = x"yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking whether to enable winbind auth challenge/response code""... $ac_c" 1>&6
-echo "configure:13314: checking whether to enable winbind auth challenge/response code" >&5
+echo "configure:13317: checking whether to enable winbind auth challenge/response code" >&5
# Check whether --with-winbind-auth-challenge or --without-winbind-auth-challenge was given.
if test "${with_winbind_auth_challenge+set}" = set; then
withval="$with_winbind_auth_challenge"
@@ -13323,10 +13326,13 @@ EOF
echo "$ac_t""yes" 1>&6
;;
- no)
+ *)
echo "$ac_t""no" 1>&6
;;
esac
+else
+ echo "$ac_t""no" 1>&6
+
fi
@@ -13363,7 +13369,7 @@ fi
# It returns EGID too many times in the list of groups
# and causes a security problem
echo $ac_n "checking whether or not getgroups returns EGID too many times""... $ac_c" 1>&6
-echo "configure:13367: checking whether or not getgroups returns EGID too many times" >&5
+echo "configure:13373: checking whether or not getgroups returns EGID too many times" >&5
if eval "test \"`echo '$''{'samba_cv_have_getgroups_too_many_egids'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -13371,7 +13377,7 @@ else
samba_cv_have_getgroups_too_many_egids=cross
else
cat > conftest.$ac_ext <<EOF
-#line 13375 "configure"
+#line 13381 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -13387,7 +13393,7 @@ int main(int argc, char *argv[])
exit((n > 1 && groups[0] == getegid() && groups[1] == getegid()) ? 1 : 0);
}
EOF
-if { (eval echo configure:13391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_have_getgroups_too_many_egids=no
else
@@ -13428,20 +13434,20 @@ fi
# [#include <pwd.h>])
echo $ac_n "checking whether struct passwd has pw_comment""... $ac_c" 1>&6
-echo "configure:13432: checking whether struct passwd has pw_comment" >&5
+echo "configure:13438: checking whether struct passwd has pw_comment" >&5
if eval "test \"`echo '$''{'samba_cv_passwd_pw_comment'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13438 "configure"
+#line 13444 "configure"
#include "confdefs.h"
#include <pwd.h>
int main() {
struct passwd p; p.pw_comment;
; return 0; }
EOF
-if { (eval echo configure:13445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_passwd_pw_comment=yes
else
@@ -13466,20 +13472,20 @@ fi
# [#include <pwd.h>])
echo $ac_n "checking whether struct passwd has pw_age""... $ac_c" 1>&6
-echo "configure:13470: checking whether struct passwd has pw_age" >&5
+echo "configure:13476: checking whether struct passwd has pw_age" >&5
if eval "test \"`echo '$''{'samba_cv_passwd_pw_age'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 13476 "configure"
+#line 13482 "configure"
#include "confdefs.h"
#include <pwd.h>
int main() {
struct passwd p; p.pw_age;
; return 0; }
EOF
-if { (eval echo configure:13483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_passwd_pw_age=yes
else
@@ -13518,7 +13524,7 @@ fi
if test x"$INCLUDED_POPT" != x"yes"; then
echo $ac_n "checking for poptGetContext in -lpopt""... $ac_c" 1>&6
-echo "configure:13522: checking for poptGetContext in -lpopt" >&5
+echo "configure:13528: checking for poptGetContext in -lpopt" >&5
ac_lib_var=`echo popt'_'poptGetContext | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -13526,7 +13532,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpopt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 13530 "configure"
+#line 13536 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -13537,7 +13543,7 @@ int main() {
poptGetContext()
; return 0; }
EOF
-if { (eval echo configure:13541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -13561,7 +13567,7 @@ fi
fi
echo $ac_n "checking whether to use included popt""... $ac_c" 1>&6
-echo "configure:13565: checking whether to use included popt" >&5
+echo "configure:13571: checking whether to use included popt" >&5
if test x"$INCLUDED_POPT" = x"yes"; then
echo "$ac_t""$srcdir/popt" 1>&6
BUILD_POPT='$(POPT_OBJS)'
@@ -13576,16 +13582,16 @@ fi
#################################################
# final configure stuff
echo $ac_n "checking configure summary""... $ac_c" 1>&6
-echo "configure:13580: checking configure summary" >&5
+echo "configure:13586: checking configure summary" >&5
if test "$cross_compiling" = yes; then
echo "configure: warning: cannot run when cross-compiling" 1>&2
else
cat > conftest.$ac_ext <<EOF
-#line 13585 "configure"
+#line 13591 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/summary.c"
EOF
-if { (eval echo configure:13589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
else
diff --git a/source/configure.in b/source/configure.in
index 48a45d7b4a9..8c12dff9428 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -2074,7 +2074,10 @@ AC_ARG_WITH(ldapsam,
LDAPLIBS="-lldap"
AC_CHECK_LIB(lber, ber_bvfree, [LDAPLIBS="$LDAPLIBS -llber"])
LDAPLIBS="-lresolv $LDAPLIBS"
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $LDAPLIBS"
AC_CHECK_FUNCS(ldap_start_tls_s)
+ LDFLAGS="$old_LDFLAGS"
with_smbpasswd_sam=no
AC_SUBST(LDAPLIBS)
;;
@@ -2702,10 +2705,11 @@ if test x"$HAVE_WINBIND" = x"yes"; then
AC_DEFINE(WITH_WINBIND_AUTH_CRAP)
AC_MSG_RESULT(yes)
;;
- no)
+ *)
AC_MSG_RESULT(no)
;;
esac ],
+ AC_MSG_RESULT(no)
)
# Check for FreeBSD problem with getgroups
diff --git a/source/include/byteorder.h b/source/include/byteorder.h
index 2cbe711a7a7..c262dd2d337 100644
--- a/source/include/byteorder.h
+++ b/source/include/byteorder.h
@@ -1,6 +1,5 @@
/*
- Unix SMB/Netbios implementation.
- Version 1.9.
+ Unix SMB/CIFS implementation.
SMB Byte handling
Copyright (C) Andrew Tridgell 1992-1998
@@ -108,8 +107,7 @@ it also defines lots of intermediate macros, just ignore those :-)
#define CVAL(buf,pos) (((const unsigned char *)(buf))[pos])
#define CVAL_NC(buf,pos) (((unsigned char *)(buf))[pos]) /* Non-const version of CVAL */
-#define PVAL(buf,pos) ((const unsigned)CVAL(buf,pos))
-#define PVAL_NC(buf,pos) ((unsigned)CVAL(buf,pos)) /* Non const version of PVAL */
+#define PVAL(buf,pos) (CVAL(buf,pos))
#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
@@ -119,12 +117,12 @@ it also defines lots of intermediate macros, just ignore those :-)
#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
#define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(unsigned char)((val)&0xFF),CVAL_NC(buf,pos+1)=(unsigned char)((val)>>8))
#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
-#define SVALS(buf,pos) ((const int16)SVAL(buf,pos))
-#define IVALS(buf,pos) ((const int32)IVAL(buf,pos))
-#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((const uint16)(val)))
-#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((const uint32)(val)))
-#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((const int16)(val)))
-#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((const int32)(val)))
+#define SVALS(buf,pos) ((int16)SVAL(buf,pos))
+#define IVALS(buf,pos) ((int32)IVAL(buf,pos))
+#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16)(val)))
+#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val)))
+#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val)))
+#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val)))
#else /* CAREFUL_ALIGNMENT */
@@ -146,10 +144,10 @@ it also defines lots of intermediate macros, just ignore those :-)
#define IVALS_NC(buf,pos) (*(int32 *)((char *)(buf) + (pos))) /* Non const version of above. */
/* store single value in an SMB buffer */
-#define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((const uint16)(val))
-#define SIVAL(buf,pos,val) IVAL_NC(buf,pos)=((const uint32)(val))
-#define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((const int16)(val))
-#define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((const int32)(val))
+#define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((uint16)(val))
+#define SIVAL(buf,pos,val) IVAL_NC(buf,pos)=((uint32)(val))
+#define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((int16)(val))
+#define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((int32)(val))
#endif /* CAREFUL_ALIGNMENT */
diff --git a/source/include/proto.h b/source/include/proto.h
index 7d1aed9d475..d7dbf980843 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -181,7 +181,504 @@ void CatchSignal(int signum,void (*handler)(int ));
void CatchChild(void);
void CatchChildLeaveStatus(void);
+<<<<<<< proto.h
+<<<<<<< proto.h
/* The following definitions come from libsmb/cliconnect.c */
+=======
+/* The following definitions come from lib/smbrun.c */
+
+int smbrun(char *cmd, int *outfd);
+
+/* The following definitions come from lib/snprintf.c */
+
+
+/* The following definitions come from lib/substitute.c */
+
+void standard_sub_basic(char *str, int len);
+void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str, int len);
+void standard_sub_conn(connection_struct *conn, char *str, int len);
+void standard_sub_home(int snum, char *user, char *str, int len);
+void standard_sub_snum(int snum, char *str, int len);
+void standard_sub_vuser(char *str, int len, user_struct *vuser);
+void standard_sub_vsnum(char *str, int len, user_struct *vuser, int snum);
+
+/* The following definitions come from lib/sysacls.c */
+
+int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
+int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
+void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
+SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
+SMB_ACL_T sys_acl_get_fd(int fd);
+int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
+int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen);
+SMB_ACL_T sys_acl_init( int count);
+int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
+int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
+int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual);
+int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
+int sys_acl_valid( SMB_ACL_T theacl );
+int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
+int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
+int sys_acl_delete_def_file(const char *name);
+int sys_acl_free_text(char *text);
+int sys_acl_free_acl(SMB_ACL_T the_acl) ;
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
+int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
+int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
+void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
+SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
+SMB_ACL_T sys_acl_get_fd(int fd);
+int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
+int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen);
+SMB_ACL_T sys_acl_init( int count);
+int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
+int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
+int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual);
+int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
+int sys_acl_valid( SMB_ACL_T theacl );
+int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
+int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
+int sys_acl_delete_def_file(const char *name);
+int sys_acl_free_text(char *text);
+int sys_acl_free_acl(SMB_ACL_T the_acl) ;
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
+int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
+int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
+void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
+SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type);
+SMB_ACL_T sys_acl_get_fd(int fd);
+int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
+int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
+int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
+char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
+SMB_ACL_T sys_acl_init(int count);
+int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
+int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
+int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
+int sys_acl_valid(SMB_ACL_T acl_d);
+int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
+int sys_acl_set_fd(int fd, SMB_ACL_T acl_d);
+int sys_acl_delete_def_file(const char *path);
+int sys_acl_free_text(char *text);
+int sys_acl_free_acl(SMB_ACL_T acl_d) ;
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
+int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
+int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
+void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
+SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type);
+SMB_ACL_T sys_acl_get_fd(int fd);
+int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
+int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
+int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
+char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
+SMB_ACL_T sys_acl_init(int count);
+int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
+int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
+int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
+int sys_acl_valid(SMB_ACL_T acl_d);
+int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
+int sys_acl_set_fd(int fd, SMB_ACL_T acl_d);
+int sys_acl_delete_def_file(const char *path);
+int sys_acl_free_text(char *text);
+int sys_acl_free_acl(SMB_ACL_T acl_d) ;
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
+int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
+int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
+void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
+SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type);
+SMB_ACL_T sys_acl_get_fd(int fd);
+int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
+int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
+int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
+char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
+SMB_ACL_T sys_acl_init(int count);
+int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
+int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
+int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
+int sys_acl_valid(SMB_ACL_T acl_d);
+int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
+int sys_acl_set_fd(int fd, SMB_ACL_T acl_d);
+int sys_acl_delete_def_file(const char *name);
+int sys_acl_free_text(char *text);
+int sys_acl_free_acl(SMB_ACL_T acl_d) ;
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
+int sys_acl_get_entry( SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
+int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
+void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
+SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
+SMB_ACL_T sys_acl_get_fd(int fd);
+int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
+int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+char *sys_acl_to_text( SMB_ACL_T theacl, ssize_t *plen);
+SMB_ACL_T sys_acl_init( int count);
+int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
+int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
+int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual);
+int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
+int sys_acl_valid( SMB_ACL_T theacl );
+int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
+int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
+int sys_acl_delete_def_file(const char *name);
+int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+int sys_acl_free_text(char *text);
+int sys_acl_free_acl(SMB_ACL_T posix_acl);
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
+int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
+int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
+int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
+void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d);
+SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
+SMB_ACL_T sys_acl_get_fd(int fd);
+int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
+int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
+char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen);
+int sys_acl_free_text(char *text);
+SMB_ACL_T sys_acl_init( int count);
+int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
+int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
+int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual);
+int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
+int sys_acl_valid( SMB_ACL_T theacl );
+int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
+int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
+int sys_acl_delete_def_file(const char *name);
+int sys_acl_free_acl(SMB_ACL_T the_acl) ;
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
+
+/* The following definitions come from lib/system.c */
+
+int sys_usleep(long usecs);
+ssize_t sys_read(int fd, void *buf, size_t count);
+ssize_t sys_write(int fd, const void *buf, size_t count);
+ssize_t sys_send(int s, const void *msg, size_t len, int flags);
+ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
+ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
+int sys_fcntl_ptr(int fd, int cmd, void *arg);
+int sys_fcntl_long(int fd, int cmd, long arg);
+int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
+int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
+int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
+int sys_ftruncate(int fd, SMB_OFF_T offset);
+SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
+int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
+SMB_OFF_T sys_ftell(FILE *fp);
+int sys_creat(const char *path, mode_t mode);
+int sys_open(const char *path, int oflag, mode_t mode);
+FILE *sys_fopen(const char *path, const char *type);
+SMB_STRUCT_DIRENT *sys_readdir(DIR *dirp);
+int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
+char *sys_realpath(const char *path, char *resolved_path);
+int sys_waitpid(pid_t pid,int *status,int options);
+char *sys_getwd(char *s);
+int sys_symlink(const char *oldpath, const char *newpath);
+int sys_readlink(const char *path, char *buf, size_t bufsiz);
+int sys_link(const char *oldpath, const char *newpath);
+int sys_chown(const char *fname,uid_t uid,gid_t gid);
+int sys_chroot(const char *dname);
+struct hostent *sys_gethostbyname(const char *name);
+void oplock_set_capability(BOOL this_process, BOOL inherit);
+long sys_random(void);
+void sys_srandom(unsigned int seed);
+int groups_max(void);
+int sys_getgroups(int setlen, gid_t *gidset);
+int sys_setgroups(int setlen, gid_t *gidset);
+void sys_setpwent(void);
+struct passwd *sys_getpwent(void);
+void sys_endpwent(void);
+struct passwd *sys_getpwnam(const char *name);
+struct passwd *sys_getpwuid(uid_t uid);
+int wsys_stat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf);
+int wsys_lstat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf);
+int wsys_creat(const smb_ucs2_t *wfname, mode_t mode);
+int wsys_open(const smb_ucs2_t *wfname, int oflag, mode_t mode);
+FILE *wsys_fopen(const smb_ucs2_t *wfname, const char *type);
+DIR *wsys_opendir(const smb_ucs2_t *wfname);
+smb_ucs2_t *wsys_getwd(smb_ucs2_t *s);
+int wsys_chown(const smb_ucs2_t *wfname, uid_t uid, gid_t gid);
+int wsys_chroot(const smb_ucs2_t *wfname);
+pid_t sys_fork(void);
+pid_t sys_getpid(void);
+int sys_popen(const char *command);
+int sys_pclose(int fd);
+void *sys_dlopen(const char *name, int flags);
+void *sys_dlsym(void *handle, char *symbol);
+int sys_dlclose (void *handle);
+const char *sys_dlerror(void);
+void sys_adminlog(int priority, const char *format_str, ...);
+
+/* The following definitions come from lib/talloc.c */
+
+TALLOC_CTX *talloc_init(void);
+void *talloc(TALLOC_CTX *t, size_t size);
+void *talloc_realloc(TALLOC_CTX *t, void *ptr, size_t size);
+void talloc_destroy_pool(TALLOC_CTX *t);
+void talloc_destroy(TALLOC_CTX *t);
+size_t talloc_pool_size(TALLOC_CTX *t);
+const char * talloc_pool_name(TALLOC_CTX const *t);
+void *talloc_zero(TALLOC_CTX *t, size_t size);
+void *talloc_memdup(TALLOC_CTX *t, const void *p, size_t size);
+char *talloc_strdup(TALLOC_CTX *t, const char *p);
+char *talloc_describe_all(TALLOC_CTX *rt);
+void talloc_get_allocation(TALLOC_CTX *t,
+ size_t *total_bytes,
+ int *n_chunks);
+
+/* The following definitions come from lib/time.c */
+
+time_t get_time_t_min(void);
+time_t get_time_t_max(void);
+void GetTimeOfDay(struct timeval *tval);
+void TimeInit(void);
+void get_process_uptime(struct timeval *ret_time);
+int TimeDiff(time_t t);
+struct tm *LocalTime(time_t *t);
+time_t nt_time_to_unix(NTTIME *nt);
+time_t nt_time_to_unix_abs(NTTIME *nt);
+time_t interpret_long_date(char *p);
+void unix_to_nt_time(NTTIME *nt, time_t t);
+void unix_to_nt_time_abs(NTTIME *nt, time_t t);
+void put_long_date(char *p,time_t t);
+BOOL null_mtime(time_t mtime);
+void put_dos_date(char *buf,int offset,time_t unixdate);
+void put_dos_date2(char *buf,int offset,time_t unixdate);
+void put_dos_date3(char *buf,int offset,time_t unixdate);
+time_t make_unix_date(void *date_ptr);
+time_t make_unix_date2(void *date_ptr);
+time_t make_unix_date3(void *date_ptr);
+char *http_timestring(time_t t);
+char *timestring(BOOL hires);
+time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs);
+void init_nt_time(NTTIME *nt);
+
+/* The following definitions come from lib/ufc.c */
+
+char *ufc_crypt(const char *key,const char *salt);
+
+/* The following definitions come from lib/username.c */
+
+BOOL name_is_local(const char *name);
+char *get_user_home_dir(char *user);
+char *get_user_service_home_dir(char *user);
+BOOL map_username(char *user);
+struct passwd *Get_Pwnam(char *user,BOOL allow_change);
+BOOL user_in_group_list(char *user,char *gname);
+BOOL user_in_list(char *user,char *list);
+struct passwd *smb_getpwnam(char *user, BOOL allow_change);
+
+/* The following definitions come from lib/util.c */
+
+char *tmpdir(void);
+BOOL in_group(gid_t group, gid_t current_gid, int ngroups, gid_t *groups);
+char *Atoic(char *p, int *n, char *c);
+char *get_numlist(char *p, uint32 **num, int *count);
+BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
+time_t file_modtime(char *fname);
+BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st);
+SMB_OFF_T get_file_size(char *file_name);
+char *attrib_string(uint16 mode);
+void show_msg(char *buf);
+void smb_setlen(char *buf,int len);
+int set_message(char *buf,int num_words,int num_bytes,BOOL zero);
+int set_message_bcc(char *buf,int num_bytes);
+int set_message_end(void *outbuf,void *end_ptr);
+void dos_clean_name(char *s);
+void unix_clean_name(char *s);
+void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date);
+void close_low_fds(void);
+int set_blocking(int fd, BOOL set);
+ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn)(int, void *, size_t),
+ ssize_t (*write_fn)(int, const void *, size_t));
+SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n);
+void msleep(unsigned int t);
+void become_daemon(void);
+BOOL yesno(char *p);
+void *Realloc(void *p,size_t size);
+void safe_free(void *p);
+BOOL get_myname(char *my_name);
+int interpret_protocol(char *str,int def);
+BOOL is_ipaddress(const char *str);
+uint32 interpret_addr(const char *str);
+struct in_addr *interpret_addr2(const char *str);
+BOOL is_zero_ip(struct in_addr ip);
+void zero_ip(struct in_addr *ip);
+char *automount_lookup(char *user_name);
+char *automount_lookup(char *user_name);
+BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
+BOOL process_exists(pid_t pid);
+char *uidtoname(uid_t uid);
+char *gidtoname(gid_t gid);
+uid_t nametouid(char *name);
+gid_t nametogid(char *name);
+void smb_panic(char *why);
+char *readdirname(DIR *p);
+BOOL is_in_path(char *name, name_compare_entry *namelist);
+void set_namearray(name_compare_entry **ppname_array, char *namelist);
+void free_namearray(name_compare_entry *name_array);
+BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
+BOOL is_myname(char *s);
+const char* get_my_primary_ip (void);
+BOOL is_myname_or_ipaddr(char *s);
+void set_remote_arch(enum remote_arch_types type);
+enum remote_arch_types get_remote_arch(void);
+void out_ascii(FILE *f, unsigned char *buf,int len);
+void out_data(FILE *f,char *buf1,int len, int per_line);
+void print_asc(int level, unsigned char *buf,int len);
+void dump_data(int level,char *buf1,int len);
+char *tab_depth(int depth);
+int str_checksum(const char *s);
+void zero_free(void *p, size_t size);
+int set_maxfiles(int requested_max);
+BOOL reg_split_key(char *full_keyname, uint32 *reg_type, char *key_name);
+int smb_mkstemp(char *template);
+void *smb_xmalloc(size_t size);
+void *smb_xmemdup(const void *p, size_t size);
+char *smb_xstrdup(const char *s);
+int smb_xvasprintf(char **ptr, const char *format, va_list ap);
+void *memdup(void *p, size_t size);
+char *myhostname(void);
+char *lock_path(char *name);
+char *pid_path(char *name);
+char *parent_dirname(const char *path);
+BOOL ms_has_wild(char *s);
+BOOL mask_match(char *string, char *pattern, BOOL is_case_sensitive);
+BOOL unix_wild_match(char *pattern, char *string);
+DATA_BLOB data_blob(const void *p, size_t length);
+DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length);
+void data_blob_free(DATA_BLOB *d);
+void data_blob_clear(DATA_BLOB *d);
+int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6);
+
+/* The following definitions come from lib/util_file.c */
+
+BOOL do_file_lock(int fd, int waitsecs, int type);
+BOOL file_lock(int fd, int type, int secs, int *plock_depth);
+BOOL file_unlock(int fd, int *plock_depth);
+void *startfilepwent(char *pfile, char *s_readbuf, int bufsize,
+ int *file_lock_depth, BOOL update);
+void endfilepwent(void *vp, int *file_lock_depth);
+SMB_BIG_UINT getfilepwpos(void *vp);
+BOOL setfilepwpos(void *vp, SMB_BIG_UINT tok);
+int getfileline(void *vp, char *linebuf, int linebuf_size);
+char *fgets_slash(char *s2,int maxlen,FILE *f);
+char *file_pload(char *syscmd, size_t *size);
+char *fd_load(int fd, size_t *size);
+char *file_load(char *fname, size_t *size);
+char **file_lines_load(char *fname, int *numlines, BOOL convert);
+char **fd_lines_load(int fd, int *numlines, BOOL convert);
+char **file_lines_pload(char *syscmd, int *numlines, BOOL convert);
+void file_lines_free(char **lines);
+void file_lines_slashcont(char **lines);
+
+/* The following definitions come from lib/util_getent.c */
+
+struct sys_grent * getgrent_list(void);
+void grent_free (struct sys_grent *glist);
+struct sys_pwent * getpwent_list(void);
+void pwent_free (struct sys_pwent *plist);
+struct sys_userlist *get_users_in_group(const char *gname);
+void free_userlist(struct sys_userlist *list_head);
+
+/* The following definitions come from lib/util_seaccess.c */
+
+void se_map_generic(uint32 *access_mask, struct generic_mapping *mapping);
+void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
+BOOL se_access_check(SEC_DESC *sd, NT_USER_TOKEN *token,
+ uint32 acc_desired, uint32 *acc_granted,
+ NTSTATUS *status);
+SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
+ BOOL child_container);
+
+/* The following definitions come from lib/util_sec.c */
+
+void sec_init(void);
+uid_t sec_initial_uid(void);
+gid_t sec_initial_gid(void);
+BOOL non_root_mode(void);
+void gain_root_privilege(void);
+void gain_root_group_privilege(void);
+void set_effective_uid(uid_t uid);
+void set_effective_gid(gid_t gid);
+void save_re_uid(void);
+void restore_re_uid(void);
+int set_re_uid(void);
+void become_user_permanently(uid_t uid, gid_t gid);
+BOOL is_setuid_root(void) ;
+
+/* The following definitions come from lib/util_sid.c */
+=======
+/* The following definitions come from libsmb/cliconnect.c */
+>>>>>>> 1.900.2.381
+
+<<<<<<< proto.h
+void generate_wellknown_sids(void);
+BOOL map_domain_sid_to_name(DOM_SID *sid, char *nt_domain);
+BOOL lookup_known_rid(DOM_SID *sid, uint32 rid, char *name, enum SID_NAME_USE *psid_name_use);
+BOOL map_domain_name_to_sid(DOM_SID *sid, char *nt_domain);
+void split_domain_name(const char *fullname, char *domain, char *name);
+char *sid_to_string(fstring sidstr_out, DOM_SID *sid);
+const char *sid_string_static(DOM_SID *sid);
+BOOL string_to_sid(DOM_SID *sidout, const char *sidstr);
+BOOL sid_append_rid(DOM_SID *sid, uint32 rid);
+BOOL sid_split_rid(DOM_SID *sid, uint32 *rid);
+BOOL sid_peek_rid(DOM_SID *sid, uint32 *rid);
+void sid_copy(DOM_SID *dst, const DOM_SID *src);
+DOM_SID *sid_dup(DOM_SID *src);
+BOOL sid_linearize(char *outbuf, size_t len, DOM_SID *sid);
+BOOL sid_parse(char *inbuf, size_t len, DOM_SID *sid);
+int sid_compare_auth(const DOM_SID *sid1, const DOM_SID *sid2);
+int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
+int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2);
+BOOL sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
+BOOL sid_check_is_domain(const DOM_SID *sid);
+BOOL sid_check_is_builtin(const DOM_SID *sid);
+BOOL sid_check_is_in_our_domain(const DOM_SID *sid);
+BOOL sid_check_is_in_builtin(const DOM_SID *sid);
+size_t sid_size(DOM_SID *sid);
+BOOL non_mappable_sid(DOM_SID *sid);
+char *sid_binstring(DOM_SID *sid);
+
+/* The following definitions come from lib/util_sock.c */
+
+BOOL is_a_socket(int fd);
+void set_socket_options(int fd, char *options);
+ssize_t read_udp_socket(int fd,char *buf,size_t len);
+ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned int time_out);
+BOOL send_keepalive(int client);
+ssize_t read_data(int fd,char *buffer,size_t N);
+ssize_t write_data(int fd,char *buffer,size_t N);
+ssize_t write_socket_data(int fd,char *buffer,size_t N);
+ssize_t write_socket(int fd,char *buf,size_t len);
+ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout);
+BOOL receive_smb(int fd,char *buffer, unsigned int timeout);
+BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout);
+BOOL send_smb(int fd,char *buffer);
+BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type);
+int open_socket_in( int type, int port, int dlevel, uint32 socket_addr, BOOL rebind );
+int open_socket_out(int type, struct in_addr *addr, int port ,int timeout);
+void client_setfd(int fd);
+char *client_name(void);
+char *client_addr(void);
+char *get_socket_name(int fd);
+char *get_socket_addr(int fd);
+int create_pipe_sock(const char *socket_dir,
+ const char *socket_name,
+ mode_t dir_perms);
+int sock_exec(const char *prog);
+>>>>>>> 1.900.2.380
BOOL cli_session_setup(struct cli_state *cli,
char *user,
@@ -210,6 +707,35 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli,
char *password, int pass_len) ;
BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost,
struct in_addr *pdest_ip);
+=======
+BOOL cli_session_setup(struct cli_state *cli,
+ char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *workgroup);
+BOOL cli_ulogoff(struct cli_state *cli);
+BOOL cli_send_tconX(struct cli_state *cli,
+ const char *share, const char *dev, const char *pass, int passlen);
+BOOL cli_tdis(struct cli_state *cli);
+void cli_negprot_send(struct cli_state *cli);
+BOOL cli_negprot(struct cli_state *cli);
+BOOL cli_session_request(struct cli_state *cli,
+ struct nmb_name *calling, struct nmb_name *called);
+BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
+BOOL cli_establish_connection(struct cli_state *cli,
+ char *dest_host, struct in_addr *dest_ip,
+ struct nmb_name *calling, struct nmb_name *called,
+ char *service, char *service_type,
+ BOOL do_shutdown, BOOL do_tcon);
+NTSTATUS cli_full_connection(struct cli_state **output_cli,
+ const char *my_name, const char *dest_host,
+ struct in_addr *dest_ip, int port,
+ char *service, char *service_type,
+ char *user, char *domain,
+ char *password, int pass_len) ;
+BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost,
+ struct in_addr *pdest_ip);
+>>>>>>> 1.900.2.381
/* The following definitions come from libsmb/cli_dfs.c */
@@ -252,6 +778,7 @@ struct cli_state *cli_initialise(struct cli_state *cli);
void cli_shutdown(struct cli_state *cli);
void cli_sockopt(struct cli_state *cli, char *options);
uint16 cli_setpid(struct cli_state *cli, uint16 pid);
+BOOL cli_send_keepalive(struct cli_state *cli);
/* The following definitions come from libsmb/clierror.c */
@@ -816,6 +1343,7 @@ struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
/* The following definitions come from lib/substitute.c */
+<<<<<<< proto.h
void standard_sub_basic(char *str);
void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str);
void standard_sub_conn(connection_struct *conn, char *str);
@@ -823,6 +1351,15 @@ void standard_sub_home(int snum, char *user, char *str);
void standard_sub_snum(int snum, char *str);
void standard_sub_vuser(char *str, user_struct *vuser);
void standard_sub_vsnum(char *str, user_struct *vuser, int snum);
+=======
+void standard_sub_basic(char *str, int len);
+void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str, int len);
+void standard_sub_conn(connection_struct *conn, char *str, int len);
+void standard_sub_home(int snum, char *user, char *str, int len);
+void standard_sub_snum(int snum, char *str, int len);
+void standard_sub_vuser(char *str, int len, user_struct *vuser);
+void standard_sub_vsnum(char *str, int len, user_struct *vuser, int snum);
+>>>>>>> 1.900.2.381
/* The following definitions come from lib/sysacls.c */
@@ -1226,6 +1763,21 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
/* The following definitions come from lib/util_sec.c */
+<<<<<<< proto.h
+void sec_init(void);
+uid_t sec_initial_uid(void);
+gid_t sec_initial_gid(void);
+BOOL non_root_mode(void);
+void gain_root_privilege(void);
+void gain_root_group_privilege(void);
+void set_effective_uid(uid_t uid);
+void set_effective_gid(gid_t gid);
+void save_re_uid(void);
+void restore_re_uid(void);
+int set_re_uid(void);
+void become_user_permanently(uid_t uid, gid_t gid);
+BOOL is_setuid_root(void) ;
+=======
void sec_init(void);
uid_t sec_initial_uid(void);
gid_t sec_initial_gid(void);
@@ -1236,9 +1788,12 @@ void set_effective_uid(uid_t uid);
void set_effective_gid(gid_t gid);
void save_re_uid(void);
void restore_re_uid(void);
+void save_re_gid(void);
+void restore_re_gid(void);
int set_re_uid(void);
void become_user_permanently(uid_t uid, gid_t gid);
BOOL is_setuid_root(void) ;
+>>>>>>> 1.900.2.381
/* The following definitions come from lib/util_sid.c */
@@ -2886,6 +3441,7 @@ BOOL prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uin
BOOL prs_append_data(prs_struct *dst, char *src, uint32 len);
void prs_set_endian_data(prs_struct *ps, BOOL endian);
BOOL prs_align(prs_struct *ps);
+BOOL prs_align_uint16(prs_struct *ps);
BOOL prs_align_needed(prs_struct *ps, uint32 needed);
char *prs_mem_get(prs_struct *ps, uint32 extra_size);
void prs_switch_type(prs_struct *ps, BOOL io);
@@ -4675,7 +5231,7 @@ int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int size,
/* The following definitions come from smbd/sec_ctx.c */
-int get_current_groups(int *p_ngroups, gid_t **p_groups);
+int get_current_groups(gid_t gid, int *p_ngroups, gid_t **p_groups);
void delete_nt_token(NT_USER_TOKEN **pptoken);
NT_USER_TOKEN *dup_nt_token(NT_USER_TOKEN *ptoken);
BOOL initialise_groups(char *user, uid_t uid, gid_t gid);
diff --git a/source/include/smb.h b/source/include/smb.h
index ed5230a8d69..248f0bf5cbe 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -1291,6 +1291,12 @@ char *strdup(char *s);
#define BROWSER_ELECTION_VERSION 0x010f
#define BROWSER_CONSTANT 0xaa55
+/* Sercurity mode bits. */
+#define NEGOTIATE_SECURITY_USER_LEVEL 0x01
+#define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE 0x02
+#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04
+#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08
+
/* NT Flags2 bits - cifs6.txt section 3.1.2 */
#define FLAGS2_LONG_PATH_COMPONENTS 0x0001
diff --git a/source/include/version.h b/source/include/version.h
index d6f636effec..e416ffb2d4c 100644
--- a/source/include/version.h
+++ b/source/include/version.h
@@ -1 +1 @@
-#define VERSION "2.2.5"
+#define VERSION "2.2.6-pre1"
diff --git a/source/lib/select.c b/source/lib/select.c
index efcf63becca..f88ad52de65 100644
--- a/source/lib/select.c
+++ b/source/lib/select.c
@@ -102,6 +102,12 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s
}
if (FD_ISSET(select_pipe[0], readfds2)) {
+ char c;
+ saved_errno = errno;
+ if (read(select_pipe[0], &c, 1) == 1) {
+ pipe_read++;
+ }
+ errno = saved_errno;
FD_CLR(select_pipe[0], readfds2);
ret--;
if (ret == 0) {
@@ -110,18 +116,6 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s
}
}
- saved_errno = errno;
-
- while (pipe_written != pipe_read) {
- char c;
- /* Due to the linux kernel bug in 2.0.x, we
- * always increment here even if the read failed... */
- read(select_pipe[0], &c, 1);
- pipe_read++;
- }
-
- errno = saved_errno;
-
return ret;
}
diff --git a/source/lib/substitute.c b/source/lib/substitute.c
index c1ac1f504a3..e6c34d124f8 100644
--- a/source/lib/substitute.c
+++ b/source/lib/substitute.c
@@ -166,7 +166,7 @@ static char *automount_server(char *user_name)
Do some standard substitutions in a string.
****************************************************************************/
-void standard_sub_basic(char *str)
+void standard_sub_basic(char *str, int len)
{
extern pstring global_myname;
char *p, *s;
@@ -176,7 +176,7 @@ void standard_sub_basic(char *str)
for (s=str; (p=strchr(s, '%'));s=p) {
fstring tmp_str;
- int l = sizeof(pstring) - (int)(p-str);
+ int l = len - (int)(p-str);
switch (*(p+1)) {
case 'U' :
@@ -239,12 +239,12 @@ void standard_sub_basic(char *str)
Do some standard substitutions in a string.
****************************************************************************/
-void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str)
+void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str, int len)
{
char *p, *s, *home;
for (s=str; (p=strchr(s, '%'));s=p) {
- int l = sizeof(pstring) - (int)(p-str);
+ int l = len - (int)(p-str);
switch (*(p+1)) {
case 'N' : string_sub(p,"%N", automount_server(user),l); break;
@@ -289,16 +289,16 @@ void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, c
}
}
- standard_sub_basic(str);
+ standard_sub_basic(str,len);
}
/****************************************************************************
Do some standard substitutions in a string.
****************************************************************************/
-void standard_sub_conn(connection_struct *conn, char *str)
+void standard_sub_conn(connection_struct *conn, char *str, int len)
{
- standard_sub_advanced(SNUM(conn), conn->user, conn->connectpath, conn->gid, str);
+ standard_sub_advanced(SNUM(conn), conn->user, conn->connectpath, conn->gid, str, len);
}
/****************************************************************************
@@ -306,12 +306,12 @@ void standard_sub_conn(connection_struct *conn, char *str)
share. No user specific snum created yet so servicename should be the username.
****************************************************************************/
-void standard_sub_home(int snum, char *user, char *str)
+void standard_sub_home(int snum, char *user, char *str, int len)
{
char *p, *s;
for (s=str; (p=strchr(s, '%'));s=p) {
- int l = sizeof(pstring) - (int)(p-str);
+ int l = len - (int)(p-str);
switch (*(p+1)) {
case 'S':
@@ -329,14 +329,14 @@ void standard_sub_home(int snum, char *user, char *str)
}
}
- standard_sub_advanced(snum, user, "", -1, str);
+ standard_sub_advanced(snum, user, "", -1, str, len);
}
/****************************************************************************
Like standard_sub but by snum.
****************************************************************************/
-void standard_sub_snum(int snum, char *str)
+void standard_sub_snum(int snum, char *str, int len)
{
extern struct current_user current_user;
static uid_t cached_uid = -1;
@@ -349,23 +349,23 @@ void standard_sub_snum(int snum, char *str)
cached_uid = current_user.uid;
}
- standard_sub_advanced(snum, cached_user, "", -1, str);
+ standard_sub_advanced(snum, cached_user, "", -1, str, len);
}
/*******************************************************************
Substitute strings with useful parameters.
********************************************************************/
-void standard_sub_vuser(char *str, user_struct *vuser)
+void standard_sub_vuser(char *str, int len, user_struct *vuser)
{
- standard_sub_advanced(-1, vuser->user.unix_name, "", -1, str);
+ standard_sub_advanced(-1, vuser->user.unix_name, "", -1, str, len);
}
/*******************************************************************
Substitute strings with useful parameters.
********************************************************************/
-void standard_sub_vsnum(char *str, user_struct *vuser, int snum)
+void standard_sub_vsnum(char *str, int len, user_struct *vuser, int snum)
{
- standard_sub_advanced(snum, vuser->user.unix_name, "", -1, str);
+ standard_sub_advanced(snum, vuser->user.unix_name, "", -1, str, len);
}
diff --git a/source/lib/username.c b/source/lib/username.c
index 2bf289b6771..c28b28bf4e9 100644
--- a/source/lib/username.c
+++ b/source/lib/username.c
@@ -73,7 +73,7 @@ char *get_user_service_home_dir(char *user)
static pstring home_dir;
pstrcpy(home_dir, lp_pathname(snum));
- standard_sub_home(snum, user, home_dir);
+ standard_sub_home(snum, user, home_dir, sizeof(home_dir));
if (home_dir[0])
return home_dir;
diff --git a/source/lib/util.c b/source/lib/util.c
index b017e75dca2..b6266cb9257 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -454,6 +454,7 @@ close the low 3 fd's and open dev/null in their place
********************************************************************/
void close_low_fds(void)
{
+#ifndef VALGRIND
int fd;
int i;
close(0); close(1);
@@ -474,6 +475,7 @@ void close_low_fds(void)
return;
}
}
+#endif
}
/****************************************************************************
diff --git a/source/lib/util_sec.c b/source/lib/util_sec.c
index af7edd60808..08209190def 100644
--- a/source/lib/util_sec.c
+++ b/source/lib/util_sec.c
@@ -228,6 +228,7 @@ void set_effective_gid(gid_t gid)
}
static uid_t saved_euid, saved_ruid;
+static gid_t saved_egid, saved_rgid;
/****************************************************************************
save the real and effective uid for later restoration. Used by the quotas
@@ -266,6 +267,41 @@ void restore_re_uid(void)
}
/****************************************************************************
+ Save the real and effective gid for later restoration. Used by the
+ getgroups code
+****************************************************************************/
+
+void save_re_gid(void)
+{
+ saved_rgid = getgid();
+ saved_egid = getegid();
+}
+
+/****************************************************************************
+ And restore them!
+****************************************************************************/
+
+void restore_re_gid(void)
+{
+#if USE_SETRESUID
+ setresgid(saved_rgid, saved_egid, -1);
+#elif USE_SETREUID
+ setregid(saved_rgid, -1);
+ setregid(-1,saved_egid);
+#elif USE_SETUIDX
+ setgidx(ID_REAL, saved_rgid);
+ setgidx(ID_EFFECTIVE, saved_egid);
+#else
+ set_effective_gid(saved_egid);
+ if (getgid() != saved_rgid)
+ setgid(saved_rgid);
+ set_effective_gid(saved_egid);
+#endif
+
+ assert_gid(saved_rgid, saved_egid);
+}
+
+/****************************************************************************
set the real AND effective uid to the current effective uid in a way that
allows root to be regained.
This is only possible on some platforms.
diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index f44341b8dd1..74bee94413a 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -1163,7 +1163,7 @@ This routine looks for pattern in s and replaces it with
insert. It may do multiple replacements.
any of " ; ' $ or ` in the insert string are replaced with _
-if len==0 then no length check is performed
+if len==0 then no expansion is permitted.
****************************************************************************/
void string_sub(char *s,const char *pattern,const char *insert, size_t len)
{
@@ -1177,9 +1177,12 @@ void string_sub(char *s,const char *pattern,const char *insert, size_t len)
li = (ssize_t)strlen(insert);
if (!*pattern) return;
+
+ if (len == 0)
+ len = ls + 1; /* len is number of *bytes* */
while (lp <= ls && (p = strstr(s,pattern))) {
- if (len && (ls + (li-lp) >= len)) {
+ if (ls + (li-lp) >= len) {
DEBUG(0,("ERROR: string overflow by %d in string_sub(%.50s, %d)\n",
(int)(ls + (li-lp) - len),
pattern, (int)len));
@@ -1222,7 +1225,7 @@ void pstring_sub(char *s,const char *pattern,const char *insert)
/****************************************************************************
similar to string_sub() but allows for any character to be substituted.
Use with caution!
-if len==0 then no length check is performed
+if len==0 then no expansion is permitted.
****************************************************************************/
void all_string_sub(char *s,const char *pattern,const char *insert, size_t len)
{
@@ -1237,8 +1240,11 @@ void all_string_sub(char *s,const char *pattern,const char *insert, size_t len)
if (!*pattern) return;
+ if (len == 0)
+ len = ls + 1; /* len is number of *bytes* */
+
while (lp <= ls && (p = strstr(s,pattern))) {
- if (len && (ls + (li-lp) >= len)) {
+ if (ls + (li-lp) >= len) {
DEBUG(0,("ERROR: string overflow by %d in all_string_sub(%.50s, %d)\n",
(int)(ls + (li-lp) - len),
pattern, (int)len));
diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c
index 4e81ad99276..8ef9a103a2a 100644
--- a/source/libsmb/cliconnect.c
+++ b/source/libsmb/cliconnect.c
@@ -655,7 +655,14 @@ BOOL cli_session_request(struct cli_state *cli,
name_mangle(cli->calling.name, p, cli->calling.name_type);
len += name_len(p);
- /* setup the packet length */
+ /* setup the packet length
+ * Remove four bytes from the length count, since the length
+ * field in the NBT Session Service header counts the number
+ * of bytes which follow. The cli_send_smb() function knows
+ * about this and accounts for those four bytes.
+ * CRH.
+ */
+ len -= 4;
_smb_setlen(cli->outbuf,len);
SCVAL(cli->outbuf,0,0x81);
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index 25510da43ce..dae9f4de11a 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -272,3 +272,21 @@ uint16 cli_setpid(struct cli_state *cli, uint16 pid)
cli->pid = pid;
return ret;
}
+
+/****************************************************************************
+Send a keepalive packet to the server
+****************************************************************************/
+BOOL cli_send_keepalive(struct cli_state *cli)
+{
+ if (cli->fd == -1) {
+ DEBUG(3, ("cli_send_keepalive: fd == -1\n"));
+ return False;
+ }
+ if (!send_keepalive(cli->fd)) {
+ close(cli->fd);
+ cli->fd = -1;
+ DEBUG(0,("Error sending keepalive packet to client.\n"));
+ return False;
+ }
+ return True;
+}
diff --git a/source/libsmb/clilist.c b/source/libsmb/clilist.c
index 77ffe7b41b0..647bf54be61 100644
--- a/source/libsmb/clilist.c
+++ b/source/libsmb/clilist.c
@@ -59,6 +59,7 @@ static int interpret_long_filename(struct cli_state *cli,
sizeof(finfo->name),
len,
STR_TERMINATE);
+ p += 1; /* Skip the trailing \0 too */
return PTR_DIFF(p, base);
case 2: /* this is what OS/2 uses mostly */
diff --git a/source/libsmb/unexpected.c b/source/libsmb/unexpected.c
index 6a54250506d..2d17e3e9a41 100644
--- a/source/libsmb/unexpected.c
+++ b/source/libsmb/unexpected.c
@@ -47,7 +47,7 @@ void unexpected_packet(struct packet_struct *p)
int len=0;
if (!tdbd) {
- tdbd = tdb_open_log(lock_path("unexpected.tdb"), 1,
+ tdbd = tdb_open_log(lock_path("unexpected.tdb"), 0,
TDB_CLEAR_IF_FIRST|TDB_DEFAULT,
O_RDWR | O_CREAT, 0644);
if (!tdbd) {
diff --git a/source/msdfs/msdfs.c b/source/msdfs/msdfs.c
index 5220f38ab8d..3e4ceec78d0 100644
--- a/source/msdfs/msdfs.c
+++ b/source/msdfs/msdfs.c
@@ -102,7 +102,7 @@ static BOOL create_conn_struct( connection_struct *conn, int snum)
Parse the contents of a symlink to verify if it is an msdfs referral
A valid referral is of the form: msdfs:server1\share1,server2\share2
**********************************************************************/
-static inline BOOL parse_symlink(char* buf,struct referral** preflist,
+static BOOL parse_symlink(char* buf,struct referral** preflist,
int* refcount)
{
pstring temp;
diff --git a/source/nsswitch/winbind_nss.c b/source/nsswitch/winbind_nss.c
index c087c6c7ad9..250e2df59be 100644
--- a/source/nsswitch/winbind_nss.c
+++ b/source/nsswitch/winbind_nss.c
@@ -592,7 +592,7 @@ BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize)
static NSS_STATUS fill_pwent(struct passwd *result,
struct winbindd_pw *pw,
- char **buffer, int *buflen)
+ char **buffer, size_t *buflen)
{
/* User name */
@@ -678,7 +678,7 @@ static NSS_STATUS fill_pwent(struct passwd *result,
Return NSS_STATUS_TRYAGAIN if we run out of memory. */
static int fill_grent(struct group *result, struct winbindd_gr *gr,
- char *gr_mem, char **buffer, int *buflen)
+ char *gr_mem, char **buffer, size_t *buflen)
{
fstring name;
int i;
@@ -721,7 +721,7 @@ static int fill_grent(struct group *result, struct winbindd_gr *gr,
/* this next value is a pointer to a pointer so let's align it */
/* Calculate number of extra bytes needed to align on pointer size boundry */
- if ((i = (int)*buffer % sizeof(char*)) != 0)
+ if ((i = (unsigned long)(*buffer) % sizeof(char*)) != 0)
i = sizeof(char*) - i;
if ((tst = get_static(buffer, buflen, ((gr->num_gr_mem + 1) *
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 4d085887cf7..b6b6e03e23f 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -1493,7 +1493,7 @@ static char *lp_string(const char *s)
trim_string(ret, "\"", "\"");
- standard_sub_basic(ret);
+ standard_sub_basic(ret, len + 100);
return (ret);
}
@@ -2289,7 +2289,7 @@ BOOL lp_file_list_changed(void)
time_t mod_time;
pstrcpy(n2, f->name);
- standard_sub_basic(n2);
+ standard_sub_basic(n2,sizeof(n2));
DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
f->name, n2, ctime(&f->modtime)));
@@ -2320,7 +2320,7 @@ static BOOL handle_netbios_name(char *pszParmValue, char **ptr)
pstrcpy(netbios_name, pszParmValue);
- standard_sub_basic(netbios_name);
+ standard_sub_basic(netbios_name,sizeof(netbios_name));
strupper(netbios_name);
/*
@@ -2407,7 +2407,7 @@ static BOOL handle_source_env(char *pszParmValue, char **ptr)
pstrcpy(fname, pszParmValue);
- standard_sub_basic(fname);
+ standard_sub_basic(fname,sizeof(fname));
string_set(ptr, pszParmValue);
@@ -2526,9 +2526,9 @@ static BOOL handle_include(char *pszParmValue, char **ptr)
pstring fname;
pstrcpy(fname, pszParmValue);
- add_to_file_list(pszParmValue, fname);
+ standard_sub_basic(fname,sizeof(fname));
- standard_sub_basic(fname);
+ add_to_file_list(pszParmValue, fname);
string_set(ptr, fname);
@@ -3444,7 +3444,7 @@ BOOL lp_load(char *pszFname, BOOL global_only, BOOL save_defaults,
BOOL bRetval;
pstrcpy(n2, pszFname);
- standard_sub_basic(n2);
+ standard_sub_basic(n2,sizeof(n2));
add_to_file_list(pszFname, n2);
@@ -3462,7 +3462,7 @@ BOOL lp_load(char *pszFname, BOOL global_only, BOOL save_defaults,
}
pstrcpy(n2, pszFname);
- standard_sub_basic(n2);
+ standard_sub_basic(n2,sizeof(n2));
/* We get sections first, so have to start 'behind' to make up */
iServiceIndex = -1;
@@ -3571,7 +3571,7 @@ int lp_servicenumber(char *pszServiceName)
* service names
*/
fstrcpy(serviceName, ServicePtrs[iService]->szService);
- standard_sub_basic(serviceName);
+ standard_sub_basic(serviceName,sizeof(serviceName));
if (strequal(serviceName, pszServiceName))
break;
}
diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c
index c24d96653b6..2289a7070ee 100644
--- a/source/passdb/pdb_ldap.c
+++ b/source/passdb/pdb_ldap.c
@@ -114,7 +114,7 @@ static BOOL ldap_open_connection (LDAP ** ldap_struct)
{
int port;
int version;
- int tls;
+ int tls, rc;
uid_t uid = geteuid();
struct passwd* pass;
@@ -541,7 +541,7 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass,
if (!get_single_attribute(ldap_struct, entry, "homeDrive", dir_drive)) {
pstrcpy(dir_drive, lp_logon_drive());
- standard_sub_advanced(-1, username, "", gid, dir_drive);
+ standard_sub_advanced(-1, username, "", gid, dir_drive, sizeof(dir_drive));
DEBUG(5,("homeDrive fell back to %s\n",dir_drive));
pdb_set_dir_drive(sampass, dir_drive, False);
}
@@ -550,7 +550,7 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass,
if (!get_single_attribute(ldap_struct, entry, "smbHome", homedir)) {
pstrcpy(homedir, lp_logon_home());
- standard_sub_advanced(-1, username, "", gid, homedir);
+ standard_sub_advanced(-1, username, "", gid, homedir, sizeof(homedir));
DEBUG(5,("smbHome fell back to %s\n",homedir));
pdb_set_homedir(sampass, homedir, False);
}
@@ -559,7 +559,7 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass,
if (!get_single_attribute(ldap_struct, entry, "scriptPath", logon_script)) {
pstrcpy(logon_script, lp_logon_script());
- standard_sub_advanced(-1, username, "", gid, logon_script);
+ standard_sub_advanced(-1, username, "", gid, logon_script, sizeof(logon_script));
DEBUG(5,("scriptPath fell back to %s\n",logon_script));
pdb_set_logon_script(sampass, logon_script, False);
}
@@ -568,7 +568,7 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass,
if (!get_single_attribute(ldap_struct, entry, "profilePath", profile_path)) {
pstrcpy(profile_path, lp_logon_path());
- standard_sub_advanced(-1, username, "", gid, profile_path);
+ standard_sub_advanced(-1, username, "", gid, profile_path, sizeof(profile_path));
DEBUG(5,("profilePath fell back to %s\n",profile_path));
pdb_set_profile_path(sampass, profile_path, False);
}
@@ -854,7 +854,7 @@ BOOL pdb_getsampwnam(SAM_ACCOUNT * user, char *sname)
pstring filter;
pstrcpy(filter, lp_ldap_filter());
- standard_sub_advanced(-1, sname, "", -1, filter);
+ standard_sub_advanced(-1, sname, "", -1, filter, sizeof(filter));
DEBUG(0,("LDAP search \"%s\" returned %d entries.\n", filter,
ldap_count_entries(ldap_struct, result)));
ldap_unbind(ldap_struct);
diff --git a/source/passdb/pdb_smbpasswd.c b/source/passdb/pdb_smbpasswd.c
index 6f75f879667..f6bb98bd599 100644
--- a/source/passdb/pdb_smbpasswd.c
+++ b/source/passdb/pdb_smbpasswd.c
@@ -1236,15 +1236,15 @@ static BOOL build_sam_account(SAM_ACCOUNT *sam_pass, struct smb_passwd *pw_buf)
sam_logon_in_ssb = True;
pstrcpy(str, lp_logon_script());
- standard_sub_advanced(-1, pw_buf->smb_name, "", gid, str);
+ standard_sub_advanced(-1, pw_buf->smb_name, "", gid, str,0);
pdb_set_logon_script(sam_pass, str, False);
pstrcpy(str, lp_logon_path());
- standard_sub_advanced(-1, pw_buf->smb_name, "", gid, str);
+ standard_sub_advanced(-1, pw_buf->smb_name, "", gid, str,0);
pdb_set_profile_path(sam_pass, str, False);
pstrcpy(str, lp_logon_home());
- standard_sub_advanced(-1, pw_buf->smb_name, "", gid, str);
+ standard_sub_advanced(-1, pw_buf->smb_name, "", gid, str,0);
pdb_set_homedir(sam_pass, str, False);
sam_logon_in_ssb = False;
diff --git a/source/passdb/pdb_tdb.c b/source/passdb/pdb_tdb.c
index 58143977e08..aaada4d6687 100644
--- a/source/passdb/pdb_tdb.c
+++ b/source/passdb/pdb_tdb.c
@@ -87,6 +87,11 @@ static BOOL init_sam_from_buffer (SAM_ACCOUNT *sampass, uint8 *buf, uint32 bufle
uid_t uid;
gid_t gid;
+ pstring phomedir;
+ pstring pdir_drive;
+ pstring plogon_script;
+ pstring pprofile_path;
+
if(sampass == NULL || buf == NULL) {
DEBUG(0, ("init_sam_from_buffer: NULL parameters found!\n"));
return False;
@@ -160,42 +165,38 @@ static BOOL init_sam_from_buffer (SAM_ACCOUNT *sampass, uint8 *buf, uint32 bufle
if (homedir) setflag = True;
else {
setflag = False;
- homedir = strdup(lp_logon_home());
- if(!homedir) { ret = False; goto done; }
- standard_sub_advanced(-1, username, "", gid, homedir);
- DEBUG(5,("Home directory set back to %s\n", homedir));
+ pstrcpy(phomedir, lp_logon_home());
+ standard_sub_advanced(-1, username, "", gid, phomedir, sizeof(phomedir));
+ DEBUG(5,("Home directory set back to %s\n", phomedir));
}
- pdb_set_homedir(sampass, homedir, setflag);
+ pdb_set_homedir(sampass, phomedir, setflag);
if (dir_drive) setflag = True;
else {
setflag = False;
- dir_drive = strdup(lp_logon_drive());
- if(!dir_drive) { ret = False; goto done; }
- standard_sub_advanced(-1, username, "", gid, dir_drive);
- DEBUG(5,("Home directory set back to %s\n", dir_drive));
+ pstrcpy(pdir_drive, lp_logon_drive());
+ standard_sub_advanced(-1, username, "", gid, pdir_drive, sizeof(pdir_drive));
+ DEBUG(5,("Home directory set back to %s\n", pdir_drive));
}
- pdb_set_dir_drive(sampass, dir_drive, setflag);
+ pdb_set_dir_drive(sampass, pdir_drive, setflag);
if (logon_script) setflag = True;
else {
setflag = False;
- logon_script = strdup(lp_logon_script());
- if(!logon_script) { ret = False; goto done; }
- standard_sub_advanced(-1, username, "", gid, logon_script);
- DEBUG(5,("Home directory set back to %s\n", logon_script));
+ pstrcpy(plogon_script, lp_logon_script());
+ standard_sub_advanced(-1, username, "", gid, plogon_script, sizeof(plogon_script));
+ DEBUG(5,("Home directory set back to %s\n", plogon_script));
}
- pdb_set_logon_script(sampass, logon_script, setflag);
+ pdb_set_logon_script(sampass, plogon_script, setflag);
if (profile_path) setflag = True;
else {
setflag = False;
- profile_path = strdup(lp_logon_path());
- if(!profile_path) { ret = False; goto done; }
- standard_sub_advanced(-1, username, "", gid, profile_path);
- DEBUG(5,("Home directory set back to %s\n", profile_path));
+ pstrcpy(pprofile_path, lp_logon_path());
+ standard_sub_advanced(-1, username, "", gid, pprofile_path, sizeof(pprofile_path));
+ DEBUG(5,("Home directory set back to %s\n", pprofile_path));
}
- pdb_set_profile_path(sampass, profile_path, setflag);
+ pdb_set_profile_path(sampass, pprofile_path, setflag);
pdb_set_acct_desc (sampass, acct_desc);
pdb_set_workstations (sampass, workstations);
diff --git a/source/printing/lpq_parse.c b/source/printing/lpq_parse.c
index 26f84572c67..96484eaf583 100644
--- a/source/printing/lpq_parse.c
+++ b/source/printing/lpq_parse.c
@@ -257,6 +257,8 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
if (strequal(tokarr[LPRNG_RANKTOK],"active")) {
buf->status = LPQ_PRINTING;
+ } else if (strequal(tokarr[LPRNG_RANKTOK],"done")) {
+ buf->status = LPQ_PRINTED;
} else if (isdigit((int)*tokarr[LPRNG_RANKTOK])) {
buf->status = LPQ_QUEUED;
} else {
diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index 3311790cd2c..195028dc8a8 100644
--- a/source/printing/nt_printing.c
+++ b/source/printing/nt_printing.c
@@ -1,6 +1,5 @@
/*
- * Unix SMB/Netbios implementation.
- * Version 1.9.
+ * Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-2000,
* Copyright (C) Jean François Micouleau 1998-2000.
@@ -1006,22 +1005,22 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file,
if (new_major > old_major ||
(new_major == old_major && new_minor > old_minor)) {
- DEBUG(6,("file_version_is_newer: version Replacing [%s] with [%s]\n", old_file, new_file));
+ DEBUG(6,("file_version_is_newer: Replacing [%s] with [%s]\n", old_file, new_file));
return True;
}
else {
- DEBUG(6,("file_version_is_newer: version Leaving [%s] unchanged\n", old_file));
+ DEBUG(6,("file_version_is_newer: Leaving [%s] unchanged\n", old_file));
return False;
}
} else {
/* Compare modification time/dates and choose the newest time/date */
if (new_create_time > old_create_time) {
- DEBUG(6,("file_version_is_newer: file Replacing [%s] with [%s]\n", old_file, new_file));
+ DEBUG(6,("file_version_is_newer: Replacing [%s] with [%s]\n", old_file, new_file));
return True;
}
else {
- DEBUG(6,("file_version_is_newer: file Leaving [%s] unchanged\n", old_file));
+ DEBUG(6,("file_version_is_newer: Leaving [%s] unchanged\n", old_file));
return False;
}
}
diff --git a/source/printing/print_generic.c b/source/printing/print_generic.c
index a1f94d14a83..2a6b11ebc4e 100644
--- a/source/printing/print_generic.c
+++ b/source/printing/print_generic.c
@@ -79,7 +79,7 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
p = PRINTERNAME(snum);
pstring_sub(syscmd, "%p", p);
- standard_sub_snum(snum,syscmd);
+ standard_sub_snum(snum,syscmd,sizeof(syscmd));
/* Convert script args to unix-codepage */
dos_to_unix(syscmd);
diff --git a/source/printing/printing.c b/source/printing/printing.c
index 374aca16ea9..4ac2cfcb148 100644
--- a/source/printing/printing.c
+++ b/source/printing/printing.c
@@ -106,7 +106,8 @@ static struct printjob *print_job_find(int jobid)
TDB_DATA ret;
ret = tdb_fetch(tdb, print_key(jobid));
- if (!ret.dptr || ret.dsize != sizeof(pjob)) return NULL;
+ if (!ret.dptr || ret.dsize != sizeof(pjob))
+ return NULL;
memcpy(&pjob, ret.dptr, sizeof(pjob));
SAFE_FREE(ret.dptr);
@@ -139,11 +140,13 @@ static int print_parse_jobid(char *fname)
{
int jobid;
- if (strncmp(fname,PRINT_SPOOL_PREFIX,strlen(PRINT_SPOOL_PREFIX)) != 0) return -1;
+ if (strncmp(fname,PRINT_SPOOL_PREFIX,strlen(PRINT_SPOOL_PREFIX)) != 0)
+ return -1;
fname += strlen(PRINT_SPOOL_PREFIX);
jobid = atoi(fname);
- if (jobid <= 0) return -1;
+ if (jobid <= 0)
+ return -1;
return jobid;
}
@@ -185,14 +188,18 @@ struct traverse_struct {
int qcount, snum, maxcount, total_jobs;
};
-/* utility fn to delete any jobs that are no longer active */
+/****************************************************************************
+ Utility fn to delete any jobs that are no longer active.
+****************************************************************************/
+
static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *state)
{
struct traverse_struct *ts = (struct traverse_struct *)state;
struct printjob pjob;
int i, jobid;
- if (data.dsize != sizeof(pjob) || key.dsize != sizeof(int)) return 0;
+ if (data.dsize != sizeof(pjob) || key.dsize != sizeof(int))
+ return 0;
memcpy(&jobid, key.dptr, sizeof(jobid));
memcpy(&pjob, data.dptr, sizeof(pjob));
unix_to_dos(pjob.queuename);
@@ -207,7 +214,8 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void
/* remove a unix job if it isn't in the system queue any more */
for (i=0;i<ts->qcount;i++) {
- if (jobid == ts->queue[i].job + UNIX_JOB_START) break;
+ if (jobid == ts->queue[i].job + UNIX_JOB_START)
+ break;
}
if (i == ts->qcount)
tdb_delete(tdb, key);
@@ -230,7 +238,8 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void
for (i=0;i<ts->qcount;i++) {
int qid = print_parse_jobid(ts->queue[i].fs_file);
- if (jobid == qid) break;
+ if (jobid == qid)
+ break;
}
/* The job isn't in the system queue - we have to assume it has
@@ -307,7 +316,7 @@ static void set_updating_pid(fstring printer_name, BOOL delete)
fstring keystr;
TDB_DATA key;
TDB_DATA data;
- pid_t updating_pid = getpid();
+ pid_t updating_pid = sys_getpid();
slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", printer_name);
key.dptr = keystr;
@@ -516,7 +525,8 @@ BOOL print_job_exists(int jobid)
int print_job_snum(int jobid)
{
struct printjob *pjob = print_job_find(jobid);
- if (!pjob) return -1;
+ if (!pjob)
+ return -1;
return find_service(pjob->queuename);
}
@@ -528,9 +538,11 @@ int print_job_snum(int jobid)
int print_job_fd(int jobid)
{
struct printjob *pjob = print_job_find(jobid);
- if (!pjob) return -1;
+ if (!pjob)
+ return -1;
/* don't allow another process to get this info - it is meaningless */
- if (pjob->pid != local_pid) return -1;
+ if (pjob->pid != local_pid)
+ return -1;
return pjob->fd;
}
@@ -543,7 +555,8 @@ int print_job_fd(int jobid)
char *print_job_fname(int jobid)
{
struct printjob *pjob = print_job_find(jobid);
- if (!pjob || pjob->spooled || pjob->pid != local_pid) return NULL;
+ if (!pjob || pjob->spooled || pjob->pid != local_pid)
+ return NULL;
return pjob->filename;
}
@@ -564,7 +577,8 @@ BOOL print_job_set_place(int jobid, int place)
BOOL print_job_set_name(int jobid, char *name)
{
struct printjob *pjob = print_job_find(jobid);
- if (!pjob || pjob->pid != local_pid) return False;
+ if (!pjob || pjob->pid != local_pid)
+ return False;
fstrcpy(pjob->jobname, name);
return print_job_store(jobid, pjob);
@@ -579,7 +593,8 @@ static BOOL print_job_delete1(int jobid)
struct printjob *pjob = print_job_find(jobid);
int snum, result = 0;
- if (!pjob) return False;
+ if (!pjob)
+ return False;
/*
* If already deleting just return.
@@ -598,8 +613,7 @@ static BOOL print_job_delete1(int jobid)
has reached the spooler. */
if (pjob->sysjob == -1) {
- DEBUG(5, ("attempt to delete job %d not seen by lpr\n",
- jobid));
+ DEBUG(5, ("attempt to delete job %d not seen by lpr\n", jobid));
}
/* Set the tdb entry to be deleting. */
@@ -629,7 +643,8 @@ static BOOL is_owner(struct current_user *user, int jobid)
struct printjob *pjob = print_job_find(jobid);
user_struct *vuser;
- if (!pjob || !user) return False;
+ if (!pjob || !user)
+ return False;
if ((vuser = get_valid_user_struct(user->vuid)) != NULL) {
return strequal(pjob->user,
@@ -667,7 +682,8 @@ BOOL print_job_delete(struct current_user *user, int jobid, WERROR *errcode)
return False;
}
- if (!print_job_delete1(jobid)) return False;
+ if (!print_job_delete1(jobid))
+ return False;
/* force update the database and say the delete failed if the
job still exists */
@@ -693,9 +709,11 @@ BOOL print_job_pause(struct current_user *user, int jobid, WERROR *errcode)
int snum, ret = -1;
char *printer_name;
- if (!pjob || !user) return False;
+ if (!pjob || !user)
+ return False;
- if (!pjob->spooled || pjob->sysjob == -1) return False;
+ if (!pjob->spooled || pjob->sysjob == -1)
+ return False;
snum = print_job_snum(jobid);
if (snum == -1) {
@@ -742,9 +760,11 @@ BOOL print_job_resume(struct current_user *user, int jobid, WERROR *errcode)
char *printer_name;
int snum, ret;
- if (!pjob || !user) return False;
+ if (!pjob || !user)
+ return False;
- if (!pjob->spooled || pjob->sysjob == -1) return False;
+ if (!pjob->spooled || pjob->sysjob == -1)
+ return False;
snum = print_job_snum(jobid);
if (snum == -1) {
@@ -888,7 +908,8 @@ static int get_total_jobs(int snum)
int total_jobs;
/* make sure the database is up to date */
- if (print_cache_expired(snum)) print_queue_update(snum);
+ if (print_cache_expired(snum))
+ print_queue_update(snum);
total_jobs = tdb_fetch_int32(tdb, "INFO/total_jobs");
if (total_jobs >0)
@@ -1140,14 +1161,18 @@ fail:
return False;
}
-/* utility fn to enumerate the print queue */
+/****************************************************************************
+ Utility fn to enumerate the print queue.
+****************************************************************************/
+
static int traverse_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *state)
{
struct traverse_struct *ts = (struct traverse_struct *)state;
struct printjob pjob;
int i, jobid;
- if (data.dsize != sizeof(pjob) || key.dsize != sizeof(int)) return 0;
+ if (data.dsize != sizeof(pjob) || key.dsize != sizeof(int))
+ return 0;
memcpy(&jobid, key.dptr, sizeof(jobid));
memcpy(&pjob, data.dptr, sizeof(pjob));
unix_to_dos(pjob.queuename);
@@ -1156,7 +1181,8 @@ static int traverse_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *
if (ts->snum != lp_servicenumber(pjob.queuename))
return 0;
- if (ts->qcount >= ts->maxcount) return 0;
+ if (ts->qcount >= ts->maxcount)
+ return 0;
i = ts->qcount;
@@ -1178,14 +1204,18 @@ struct traverse_count_struct {
int snum, count;
};
-/* utility fn to count the number of entries in the print queue */
+/****************************************************************************
+ Utility fn to count the number of entries in the print queue.
+****************************************************************************/
+
static int traverse_count_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *state)
{
struct traverse_count_struct *ts = (struct traverse_count_struct *)state;
struct printjob pjob;
int jobid;
- if (data.dsize != sizeof(pjob) || key.dsize != sizeof(int)) return 0;
+ if (data.dsize != sizeof(pjob) || key.dsize != sizeof(int))
+ return 0;
memcpy(&jobid, key.dptr, sizeof(jobid));
memcpy(&pjob, data.dptr, sizeof(pjob));
unix_to_dos(pjob.queuename);
@@ -1199,19 +1229,25 @@ static int traverse_count_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data,
return 0;
}
-/* Sort print jobs by submittal time */
+/****************************************************************************
+ Sort print jobs by submittal time.
+****************************************************************************/
static int printjob_comp(print_queue_struct *j1, print_queue_struct *j2)
{
/* Silly cases */
- if (!j1 && !j2) return 0;
- if (!j1) return -1;
- if (!j2) return 1;
+ if (!j1 && !j2)
+ return 0;
+ if (!j1)
+ return -1;
+ if (!j2)
+ return 1;
/* Sort on job start time */
- if (j1->time == j2->time) return 0;
+ if (j1->time == j2->time)
+ return 0;
return (j1->time > j2->time) ? 1 : -1;
}
@@ -1229,7 +1265,8 @@ int print_queue_status(int snum,
TDB_DATA data, key;
/* make sure the database is up to date */
- if (print_cache_expired(snum)) print_queue_update(snum);
+ if (print_cache_expired(snum))
+ print_queue_update(snum);
*queue = NULL;
@@ -1264,8 +1301,7 @@ int print_queue_status(int snum,
/* Allocate the queue size. */
if ((tstruct.queue = (print_queue_struct *)
- malloc(sizeof(print_queue_struct)*tsc.count))
- == NULL)
+ malloc(sizeof(print_queue_struct)*tsc.count)) == NULL)
return 0;
/*
@@ -1296,7 +1332,8 @@ int print_queue_status(int snum,
int print_queue_snum(char *qname)
{
int snum = lp_servicenumber(qname);
- if (snum == -1 || !lp_print_ok(snum)) return -1;
+ if (snum == -1 || !lp_print_ok(snum))
+ return -1;
return snum;
}
diff --git a/source/rpc_client/cli_spoolss_notify.c b/source/rpc_client/cli_spoolss_notify.c
index c65e61095dd..118817256bb 100644
--- a/source/rpc_client/cli_spoolss_notify.c
+++ b/source/rpc_client/cli_spoolss_notify.c
@@ -123,7 +123,7 @@ BOOL spoolss_connect_to_client( struct cli_state *cli, char *remote_machine)
return False;
}
- if (!(cli->sec_mode & 1)) {
+ if (!(cli->sec_mode & NEGOTIATE_SECURITY_USER_LEVEL)) {
DEBUG(0,("connect_to_client: machine %s isn't in user level security mode\n", remote_machine));
cli_shutdown(cli);
return False;
diff --git a/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c
index 9699a7f6de3..6d6904dab7a 100644
--- a/source/rpc_parse/parse_prs.c
+++ b/source/rpc_parse/parse_prs.c
@@ -426,6 +426,17 @@ BOOL prs_align(prs_struct *ps)
return True;
}
+BOOL prs_align_uint16(prs_struct *ps)
+{
+ BOOL ret;
+ uint8 old_align = ps->align;
+
+ ps->align = 2;
+ ret = prs_align(ps);
+ ps->align = old_align;
+ return ret;
+}
+
/*******************************************************************
Align only if required (for the unistr2 string mainly)
********************************************************************/
diff --git a/source/rpc_parse/parse_reg.c b/source/rpc_parse/parse_reg.c
index 181a3855926..c26aaee3c30 100644
--- a/source/rpc_parse/parse_reg.c
+++ b/source/rpc_parse/parse_reg.c
@@ -1008,13 +1008,15 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth)
if(!prs_uint32("ptr_buflen", ps, depth, &(r_q->ptr_buflen)))
return False;
- if(!prs_uint32("buflen", ps, depth, &(r_q->buflen)))
- return False;
- if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2)))
- return False;
- if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2)))
- return False;
+ if (r_q->ptr_buflen) {
+ if(!prs_uint32("buflen", ps, depth, &(r_q->buflen)))
+ return False;
+ if(!prs_uint32("ptr_buflen2", ps, depth, &(r_q->ptr_buflen2)))
+ return False;
+ if(!prs_uint32("buflen2", ps, depth, &(r_q->buflen2)))
+ return False;
+ }
return True;
}
diff --git a/source/rpc_parse/parse_sec.c b/source/rpc_parse/parse_sec.c
index 9bd1b2e65a8..c9920a2b475 100644
--- a/source/rpc_parse/parse_sec.c
+++ b/source/rpc_parse/parse_sec.c
@@ -46,9 +46,6 @@ BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth)
prs_debug(ps, depth, desc, "sec_io_access");
depth++;
-
- if(!prs_align(ps))
- return False;
if(!prs_uint32("mask", ps, depth, &(t->mask)))
return False;
@@ -86,9 +83,6 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth)
prs_debug(ps, depth, desc, "sec_io_ace");
depth++;
-
- if(!prs_align(ps))
- return False;
old_offset = prs_offset(ps);
@@ -104,9 +98,6 @@ BOOL sec_io_ace(char *desc, SEC_ACE *psa, prs_struct *ps, int depth)
if(!sec_io_access("info ", &psa->info, ps, depth))
return False;
- if(!prs_align(ps))
- return False;
-
if(!smb_io_dom_sid("sid ", &psa->trustee , ps, depth))
return False;
@@ -178,6 +169,13 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
uint32 offset_acl_size;
SEC_ACL *psa;
+ /*
+ * Note that the size is always a multiple of 4 bytes due to the
+ * nature of the data structure. Therefore the prs_align() calls
+ * have been removed as they through us off when doing two-layer
+ * marshalling such as in the printing code (NEW_BUFFER). --jerry
+ */
+
if (ppsa == NULL)
return False;
@@ -194,9 +192,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
prs_debug(ps, depth, desc, "sec_io_acl");
depth++;
-
- if(!prs_align(ps))
- return False;
old_offset = prs_offset(ps);
@@ -226,9 +221,6 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
return False;
}
- if(!prs_align(ps))
- return False;
-
if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_acl_size, old_offset))
return False;
@@ -247,17 +239,19 @@ size_t sec_desc_size(SEC_DESC *psd)
offset = SD_HEADER_SIZE;
+ /* don't align */
+
if (psd->owner_sid != NULL)
- offset += ((sid_size(psd->owner_sid) + 3) & ~3);
+ offset += sid_size(psd->owner_sid);
if (psd->grp_sid != NULL)
- offset += ((sid_size(psd->grp_sid) + 3) & ~3);
+ offset += sid_size(psd->grp_sid);
if (psd->sacl != NULL)
- offset += ((psd->sacl->size + 3) & ~3);
+ offset += psd->sacl->size;
if (psd->dacl != NULL)
- offset += ((psd->dacl->size + 3) & ~3);
+ offset += psd->dacl->size;
return offset;
}
@@ -525,7 +519,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision,
offset = SD_HEADER_SIZE;
dst->off_owner_sid = offset;
- offset += ((sid_size(dst->owner_sid) + 3) & ~3);
+ offset += sid_size(dst->owner_sid);
}
if (dst->grp_sid != NULL) {
@@ -534,7 +528,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision,
offset = SD_HEADER_SIZE;
dst->off_grp_sid = offset;
- offset += ((sid_size(dst->grp_sid) + 3) & ~3);
+ offset += sid_size(dst->grp_sid);
}
if (dst->sacl != NULL) {
@@ -543,7 +537,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision,
offset = SD_HEADER_SIZE;
dst->off_sacl = offset;
- offset += ((dst->sacl->size + 3) & ~3);
+ offset += dst->sacl->size;
}
if (dst->dacl != NULL) {
@@ -552,7 +546,7 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision,
offset = SD_HEADER_SIZE;
dst->off_dacl = offset;
- offset += ((dst->dacl->size + 3) & ~3);
+ offset += dst->dacl->size;
}
*sd_size = (size_t)((offset == 0) ? SD_HEADER_SIZE : offset);
@@ -600,6 +594,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
{
uint32 old_offset;
uint32 max_offset = 0; /* after we're done, move offset to end */
+ uint32 tmp_offset = 0;
SEC_DESC *psd;
if (ppsd == NULL)
@@ -621,7 +616,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
prs_debug(ps, depth, desc, "sec_io_desc");
depth++;
-#if 0 /* JERRY */
+#if 0
/*
* if alignment is needed, should be done by the the
* caller. Not here. This caused me problems when marshalling
@@ -656,9 +651,11 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
if (psd->off_owner_sid != 0) {
+ tmp_offset = ps->data_offset;
+ if(!prs_set_offset(ps, old_offset + psd->off_owner_sid))
+ return False;
+
if (UNMARSHALLING(ps)) {
- if(!prs_set_offset(ps, old_offset + psd->off_owner_sid))
- return False;
/* reading */
if((psd->owner_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->owner_sid))) == NULL)
return False;
@@ -666,52 +663,56 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth))
return False;
- if(!prs_align(ps))
+
+ max_offset = MAX(max_offset, prs_offset(ps));
+
+ if (!prs_set_offset(ps,tmp_offset))
return False;
}
- max_offset = MAX(max_offset, prs_offset(ps));
-
if (psd->off_grp_sid != 0) {
+ tmp_offset = ps->data_offset;
+ if(!prs_set_offset(ps, old_offset + psd->off_grp_sid))
+ return False;
+
if (UNMARSHALLING(ps)) {
/* reading */
- if(!prs_set_offset(ps, old_offset + psd->off_grp_sid))
- return False;
if((psd->grp_sid = (DOM_SID *)prs_alloc_mem(ps,sizeof(*psd->grp_sid))) == NULL)
return False;
}
if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth))
return False;
- if(!prs_align(ps))
+
+ max_offset = MAX(max_offset, prs_offset(ps));
+
+ if (!prs_set_offset(ps,tmp_offset))
return False;
}
- max_offset = MAX(max_offset, prs_offset(ps));
-
if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) {
+ tmp_offset = ps->data_offset;
if(!prs_set_offset(ps, old_offset + psd->off_sacl))
return False;
if(!sec_io_acl("sacl", &psd->sacl, ps, depth))
return False;
- if(!prs_align(ps))
+ max_offset = MAX(max_offset, prs_offset(ps));
+ if (!prs_set_offset(ps,tmp_offset))
return False;
}
- max_offset = MAX(max_offset, prs_offset(ps));
-
if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) {
+ tmp_offset = ps->data_offset;
if(!prs_set_offset(ps, old_offset + psd->off_dacl))
return False;
if(!sec_io_acl("dacl", &psd->dacl, ps, depth))
return False;
- if(!prs_align(ps))
+ max_offset = MAX(max_offset, prs_offset(ps));
+ if (!prs_set_offset(ps,tmp_offset))
return False;
}
- max_offset = MAX(max_offset, prs_offset(ps));
-
if(!prs_set_offset(ps, max_offset))
return False;
return True;
diff --git a/source/rpc_parse/parse_spoolss.c b/source/rpc_parse/parse_spoolss.c
index dcf28c2d675..62275b38205 100644
--- a/source/rpc_parse/parse_spoolss.c
+++ b/source/rpc_parse/parse_spoolss.c
@@ -4,8 +4,8 @@
* Copyright (C) Andrew Tridgell 1992-2000,
* Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
* Copyright (C) Jean François Micouleau 1998-2000,
- * Copyright (C) Gerald Carter 2000-2002
- * Copyright (C) Tim Potter 2001.
+ * Copyright (C) Gerald Carter 2000-2002,
+ * Copyright (C) Tim Potter 2001-2002.
*
* 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
diff --git a/source/rpc_server/srv_pipe.c b/source/rpc_server/srv_pipe.c
index 73f8fe45d6c..1ad57a9b016 100644
--- a/source/rpc_server/srv_pipe.c
+++ b/source/rpc_server/srv_pipe.c
@@ -449,7 +449,7 @@ failed authentication on named pipe %s.\n", domain, pipe_user_name, wks, p->name
/* Set up pipe user group membership. */
initialise_groups(pipe_user_name, p->pipe_user.uid, p->pipe_user.gid);
- get_current_groups( &p->pipe_user.ngroups, &p->pipe_user.groups);
+ get_current_groups( p->pipe_user.gid, &p->pipe_user.ngroups, &p->pipe_user.groups);
/* Create an NT_USER_TOKEN struct for this user. */
p->pipe_user.nt_user_token = create_nt_token(p->pipe_user.uid,p->pipe_user.gid,
diff --git a/source/rpc_server/srv_pipe_hnd.c b/source/rpc_server/srv_pipe_hnd.c
index 0fe9b383a22..f1d26095fa3 100644
--- a/source/rpc_server/srv_pipe_hnd.c
+++ b/source/rpc_server/srv_pipe_hnd.c
@@ -46,7 +46,7 @@ static int pipes_open;
*/
#ifndef MAX_OPEN_SPOOLSS_PIPES
-#define MAX_OPEN_SPOOLSS_PIPES 64
+#define MAX_OPEN_SPOOLSS_PIPES 256
#endif
static int current_spoolss_pipes_open;
diff --git a/source/rpc_server/srv_spoolss.c b/source/rpc_server/srv_spoolss.c
index 226345b22d1..f9789a286cf 100755
--- a/source/rpc_server/srv_spoolss.c
+++ b/source/rpc_server/srv_spoolss.c
@@ -1,6 +1,5 @@
/*
- * Unix SMB/Netbios implementation.
- * Version 1.9.
+ * Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-2000,
* Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c
index 25a3f49ad45..b964767a05b 100644
--- a/source/rpc_server/srv_spoolss_nt.c
+++ b/source/rpc_server/srv_spoolss_nt.c
@@ -77,6 +77,7 @@ typedef struct _Printer{
SPOOL_NOTIFY_OPTION *option;
POLICY_HND client_hnd;
uint32 client_connected;
+ uint32 change;
} notify;
struct {
fstring machine;
@@ -659,6 +660,8 @@ static void send_spoolss_event_notification(PRINTER_MESSAGE_INFO *msg)
if (find_printer->notify.client_connected==True) {
+ msg->low = find_printer->notify.change;
+
/* does the client care about what changed? */
if (msg->flags && !is_client_monitoring_event(find_printer, msg->flags)) {
@@ -1723,9 +1726,8 @@ static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uin
* _spoolss_rffpcnex
* ReplyFindFirstPrinterChangeNotifyEx
*
- * jfmxxxx: before replying OK: status=0
- * should do a rpc call to the workstation asking ReplyOpenPrinter
- * have to code it, later.
+ * before replying OK: status=0 a rpc call is made to the workstation
+ * asking ReplyOpenPrinter
*
* in fact ReplyOpenPrinter is the changenotify equivalent on the spoolss pipe
* called from api_spoolss_rffpcnex
@@ -2479,6 +2481,10 @@ struct s_notify_info_data_table
NT_PRINTER_INFO_LEVEL *printer, TALLOC_CTX *mem_ctx);
};
+/* A table describing the various print notification constants and
+ whether the notification data is a pointer to a variable sized
+ buffer, a one value uint32 or a two value uint32. */
+
struct s_notify_info_data_table notify_info_data_table[] =
{
{ PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_SERVER_NAME, "PRINTER_NOTIFY_SERVER_NAME", POINTER, spoolss_notify_server_name },
@@ -2902,7 +2908,6 @@ static WERROR printer_notify_info(pipes_struct *p, POLICY_HND *hnd, SPOOL_NOTIFY
WERROR _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCNEX *r_u)
{
POLICY_HND *handle = &q_u->handle;
-/* uint32 change = q_u->change; - notused. */
/* SPOOL_NOTIFY_OPTION *option = q_u->option; - notused. */
SPOOL_NOTIFY_INFO *info = &r_u->info;
@@ -2920,17 +2925,16 @@ WERROR _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCN
DEBUG(4,("Printer type %x\n",Printer->printer_type));
- /* jfm: the change value isn't used right now.
- * we will honour it when
- * a) we'll be able to send notification to the client
- * b) we'll have a way to communicate between the spoolss process.
- *
+ /*
* same thing for option->flags
* I should check for PRINTER_NOTIFY_OPTIONS_REFRESH but as
* I don't have a global notification system, I'm sending back all the
* informations even when _NOTHING_ has changed.
*/
+ if (Printer->notify.client_connected)
+ Printer->notify.change = q_u->change;
+
/* just ignore the SPOOL_NOTIFY_OPTION */
switch (Printer->printer_type) {
@@ -4847,7 +4851,7 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer)
get_called_name());
/* change \ to \\ for the shell */
all_string_sub(driverlocation,"\\","\\\\",sizeof(pstring));
- standard_sub_basic(remote_machine);
+ standard_sub_basic(remote_machine,sizeof(remote_machine));
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
cmd, printer->info_2->printername, printer->info_2->sharename,
diff --git a/source/rpc_server/srv_srvsvc_nt.c b/source/rpc_server/srv_srvsvc_nt.c
index 1d884de2b5f..1ba85e7fdba 100644
--- a/source/rpc_server/srv_srvsvc_nt.c
+++ b/source/rpc_server/srv_srvsvc_nt.c
@@ -41,7 +41,7 @@ static void init_srv_share_info_1(pipes_struct *p, SRV_SHARE_INFO_1 *sh1, int sn
pstrcpy(net_name, lp_servicename(snum));
pstrcpy(remark, lp_comment(snum));
- standard_sub_conn(p->conn, remark);
+ standard_sub_conn(p->conn, remark, sizeof(remark));
len_net_name = strlen(net_name);
/* work out the share type */
@@ -73,7 +73,7 @@ static void init_srv_share_info_2(pipes_struct *p, SRV_SHARE_INFO_2 *sh2, int sn
pstrcpy(net_name, lp_servicename(snum));
pstrcpy(remark, lp_comment(snum));
- standard_sub_conn(p->conn, remark);
+ standard_sub_conn(p->conn, remark, sizeof(remark));
pstrcpy(path, "C:");
pstrcat(path, lp_pathname(snum));
@@ -358,7 +358,7 @@ static void init_srv_share_info_501(pipes_struct *p, SRV_SHARE_INFO_501 *sh501,
pstrcpy(net_name, lp_servicename(snum));
pstrcpy(remark, lp_comment(snum));
- standard_sub_conn(p->conn, remark);
+ standard_sub_conn(p->conn, remark,sizeof(remark));
len_net_name = strlen(net_name);
@@ -397,7 +397,7 @@ static void init_srv_share_info_502(pipes_struct *p, SRV_SHARE_INFO_502 *sh502,
pstrcpy(net_name, lp_servicename(snum));
pstrcpy(remark, lp_comment(snum));
- standard_sub_conn(p->conn, remark);
+ standard_sub_conn(p->conn, remark,sizeof(remark));
pstrcpy(path, "C:");
pstrcat(path, lp_pathname(snum));
diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c
index 718810726cc..c0de7c9f9c4 100644
--- a/source/smbd/lanman.c
+++ b/source/smbd/lanman.c
@@ -72,7 +72,7 @@ static int CopyExpanded(connection_struct *conn,
StrnCpy(buf,src,sizeof(buf)/2);
pstring_sub(buf,"%S",lp_servicename(snum));
- standard_sub_conn(conn,buf);
+ standard_sub_conn(conn,buf,sizeof(buf));
StrnCpy(*dst,buf,*n-1);
l = strlen(*dst) + 1;
(*dst) += l;
@@ -97,7 +97,7 @@ static int StrlenExpanded(connection_struct *conn, int snum, char* s)
if (!s) return(0);
StrnCpy(buf,s,sizeof(buf)/2);
pstring_sub(buf,"%S",lp_servicename(snum));
- standard_sub_conn(conn,buf);
+ standard_sub_conn(conn,buf,sizeof(buf));
return strlen(buf) + 1;
}
@@ -107,7 +107,7 @@ static char* Expand(connection_struct *conn, int snum, char* s)
if (!s) return(NULL);
StrnCpy(buf,s,sizeof(buf)/2);
pstring_sub(buf,"%S",lp_servicename(snum));
- standard_sub_conn(conn,buf);
+ standard_sub_conn(conn,buf,sizeof(buf));
return &buf[0];
}
@@ -2179,7 +2179,7 @@ static BOOL api_RNetServerGetInfo(connection_struct *conn,uint16 vuid, char *par
SIVAL(p,6,0);
} else {
SIVAL(p,6,PTR_DIFF(p2,*rdata));
- standard_sub_conn(conn,comment);
+ standard_sub_conn(conn,comment,sizeof(comment));
StrnCpy(p2,comment,MAX(mdrcnt - struct_len,0));
p2 = skip_string(p2,1);
}
@@ -2522,7 +2522,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
SIVALS(p,usri11_password_age,-1); /* password age */
SIVAL(p,usri11_homedir,PTR_DIFF(p2,p)); /* home dir */
pstrcpy(p2, lp_logon_home());
- standard_sub_conn(conn, p2);
+ standard_sub_conn(conn, p2,*rdata_len-(p2 - *rdata));
p2 = skip_string(p2,1);
SIVAL(p,usri11_parms,PTR_DIFF(p2,p)); /* parms */
pstrcpy(p2,"");
@@ -2559,14 +2559,14 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
SIVAL(p,44,PTR_DIFF(p2,*rdata)); /* home dir */
pstrcpy(p2,lp_logon_home());
- standard_sub_conn(conn, p2);
+ standard_sub_conn(conn, p2,*rdata_len-(p2 - *rdata));
p2 = skip_string(p2,1);
SIVAL(p,48,PTR_DIFF(p2,*rdata)); /* comment */
*p2++ = 0;
SSVAL(p,52,0); /* flags */
SIVAL(p,54,PTR_DIFF(p2,*rdata)); /* script_path */
pstrcpy(p2,lp_logon_script());
- standard_sub_conn( conn, p2 );
+ standard_sub_conn( conn, p2,*rdata_len-(p2 - *rdata));
p2 = skip_string(p2,1);
if (uLevel == 2)
{
@@ -2591,7 +2591,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
SSVALS(p,104,-1); /* num_logons */
SIVAL(p,106,PTR_DIFF(p2,*rdata)); /* logon_server */
pstrcpy(p2,"\\\\%L");
- standard_sub_conn(conn, p2);
+ standard_sub_conn(conn, p2,*rdata_len-(p2 - *rdata));
p2 = skip_string(p2,1);
SSVAL(p,110,49); /* country_code */
SSVAL(p,112,860); /* code page */
@@ -2714,7 +2714,7 @@ static BOOL api_WWkstaUserLogon(connection_struct *conn,uint16 vuid, char *param
{
pstring logon_script;
pstrcpy(logon_script,lp_logon_script());
- standard_sub_conn( conn, logon_script );
+ standard_sub_conn( conn, logon_script,sizeof(logon_script) );
PACKS(&desc,"z", logon_script); /* script path */
}
/* End of JHT mods */
diff --git a/source/smbd/mangle_hash2.c b/source/smbd/mangle_hash2.c
index 2074639f26c..a48981dddd4 100644
--- a/source/smbd/mangle_hash2.c
+++ b/source/smbd/mangle_hash2.c
@@ -196,13 +196,13 @@ static BOOL is_mangled_component(const char *name)
DEBUG(10,("is_mangled_component %s ?\n", name));
- /* the best distinguishing characteristic is the ~ */
- if (name[6] != '~') return False;
-
/* check the length */
len = strlen(name);
if (len > 12 || len < 8) return False;
+ /* the best distinguishing characteristic is the ~ */
+ if (len > 7 && name[6] != '~') return False;
+
/* check extension */
if (len > 8) {
if (name[8] != '.') return False;
diff --git a/source/smbd/message.c b/source/smbd/message.c
index 8acd4e83eec..d4e8871da94 100644
--- a/source/smbd/message.c
+++ b/source/smbd/message.c
@@ -86,7 +86,7 @@ static void msg_deliver(void)
pstrcpy(s,lp_msg_command());
pstring_sub(s,"%f",alpha_strcpy(alpha_msgfrom,msgfrom,NULL,sizeof(alpha_msgfrom)));
pstring_sub(s,"%t",alpha_strcpy(alpha_msgto,msgto,NULL,sizeof(alpha_msgto)));
- standard_sub_basic(s);
+ standard_sub_basic(s,sizeof(s));
pstring_sub(s,"%s",name);
smbrun(s,NULL);
}
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index f7a49794130..eaa86cec0e6 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -1760,13 +1760,15 @@ int reply_nttrans(connection_struct *conn,
uint32 num_params_sofar, num_data_sofar;
START_PROFILE(SMBnttrans);
- if(global_oplock_break && (function_code == NT_TRANSACT_CREATE)) {
+ if(global_oplock_break &&
+ ((function_code == NT_TRANSACT_CREATE) ||
+ (function_code == NT_TRANSACT_RENAME))) {
/*
* Queue this open message as we are the process of an oplock break.
*/
- DEBUG(2,("reply_nttrans: queueing message NT_TRANSACT_CREATE \
-due to being in oplock break state.\n" ));
+ DEBUG(2,("reply_nttrans: queueing message code 0x%x \
+due to being in oplock break state.\n", (unsigned int)function_code ));
push_oplock_pending_smb_message( inbuf, length);
END_PROFILE(SMBnttrans);
diff --git a/source/smbd/password.c b/source/smbd/password.c
index b861bfbea5d..9b9dfbcdf67 100644
--- a/source/smbd/password.c
+++ b/source/smbd/password.c
@@ -311,7 +311,7 @@ int register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
/* Find all the groups this uid is in and store them.
Used by change_to_user() */
initialise_groups(unix_name, uid, gid);
- get_current_groups( &vuser->n_groups, &vuser->groups);
+ get_current_groups( vuser->gid, &vuser->n_groups, &vuser->groups);
#ifdef HAVE_GETGROUPS_TOO_MANY_EGIDS
/*
@@ -1028,7 +1028,7 @@ struct cli_state *server_cryptkey(void)
p = pserver;
while(next_token( &p, desthost, LIST_SEP, sizeof(desthost))) {
- standard_sub_basic(desthost);
+ standard_sub_basic(desthost,sizeof(desthost));
strupper(desthost);
if(!resolve_name( desthost, &dest_ip, 0x20)) {
@@ -1248,7 +1248,7 @@ static BOOL connect_to_domain_password_server(struct cli_state **ppcli,
fstrcpy(remote_machine, server);
}
- standard_sub_basic(remote_machine);
+ standard_sub_basic(remote_machine,sizeof(remote_machine));
strupper(remote_machine);
if(!resolve_name( remote_machine, &dest_ip, 0x20)) {
diff --git a/source/smbd/process.c b/source/smbd/process.c
index 4eaa396f6b4..491e7f4b5e6 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -404,7 +404,7 @@ struct smb_message_struct
/* 0x2f */ { "SMBwriteX",reply_write_and_X,AS_USER | CAN_IPC },
/* 0x30 */ { NULL, NULL, 0 },
/* 0x31 */ { NULL, NULL, 0 },
-/* 0x32 */ { "SMBtrans2", reply_trans2, AS_USER | QUEUE_IN_OPLOCK | CAN_IPC },
+/* 0x32 */ { "SMBtrans2", reply_trans2, AS_USER | CAN_IPC },
/* 0x33 */ { "SMBtranss2", reply_transs2, AS_USER},
/* 0x34 */ { "SMBfindclose", reply_findclose,AS_USER},
/* 0x35 */ { "SMBfindnclose", reply_findnclose, AS_USER},
@@ -514,7 +514,7 @@ struct smb_message_struct
/* 0x9d */ { NULL, NULL, 0 },
/* 0x9e */ { NULL, NULL, 0 },
/* 0x9f */ { NULL, NULL, 0 },
-/* 0xa0 */ { "SMBnttrans", reply_nttrans, AS_USER | CAN_IPC | QUEUE_IN_OPLOCK},
+/* 0xa0 */ { "SMBnttrans", reply_nttrans, AS_USER | CAN_IPC },
/* 0xa1 */ { "SMBnttranss", reply_nttranss, AS_USER | CAN_IPC },
/* 0xa2 */ { "SMBntcreateX", reply_ntcreate_and_X, AS_USER | CAN_IPC | QUEUE_IN_OPLOCK },
/* 0xa3 */ { NULL, NULL, 0 },
diff --git a/source/smbd/sec_ctx.c b/source/smbd/sec_ctx.c
index 9a61a76f6fe..c93ca5c4389 100644
--- a/source/smbd/sec_ctx.c
+++ b/source/smbd/sec_ctx.c
@@ -133,29 +133,39 @@ static void gain_root(void)
Get the list of current groups.
****************************************************************************/
-int get_current_groups(int *p_ngroups, gid_t **p_groups)
+int get_current_groups(gid_t gid, int *p_ngroups, gid_t **p_groups)
{
int i;
gid_t grp;
- int ngroups = sys_getgroups(0,&grp);
- gid_t *groups;
+ int ngroups;
+ gid_t *groups = NULL;
(*p_ngroups) = 0;
(*p_groups) = NULL;
- if (ngroups <= 0)
- return -1;
+ /* this looks a little strange, but is needed to cope with
+ systems that put the current egid in the group list
+ returned from getgroups() (tridge) */
+ save_re_gid();
+ set_effective_gid(gid);
+ setgid(gid);
- if((groups = (gid_t *)malloc(sizeof(gid_t)*ngroups)) == NULL) {
+ ngroups = sys_getgroups(0,&grp);
+ if (ngroups <= 0) {
+ goto fail;
+ }
+
+ if((groups = (gid_t *)malloc(sizeof(gid_t)*(ngroups+1))) == NULL) {
DEBUG(0,("setup_groups malloc fail !\n"));
- return -1;
+ goto fail;
}
if ((ngroups = sys_getgroups(ngroups,groups)) == -1) {
- SAFE_FREE(groups);
- return -1;
+ goto fail;
}
+ restore_re_gid();
+
(*p_ngroups) = ngroups;
(*p_groups) = groups;
@@ -165,7 +175,12 @@ int get_current_groups(int *p_ngroups, gid_t **p_groups)
}
DEBUG( 3, ( "\n" ) );
- return ngroups;
+ return ngroups;
+
+fail:
+ SAFE_FREE(groups);
+ restore_re_gid();
+ return -1;
}
/****************************************************************************
@@ -245,7 +260,7 @@ BOOL initialise_groups(char *user, uid_t uid, gid_t gid)
SAFE_FREE(prev_ctx_p->groups);
prev_ctx_p->ngroups = 0;
- get_current_groups(&prev_ctx_p->ngroups, &prev_ctx_p->groups);
+ get_current_groups(gid, &prev_ctx_p->ngroups, &prev_ctx_p->groups);
done:
unbecome_root();
@@ -445,7 +460,7 @@ void init_sec_ctx(void)
ctx_p->uid = geteuid();
ctx_p->gid = getegid();
- get_current_groups(&ctx_p->ngroups, &ctx_p->groups);
+ get_current_groups(ctx_p->gid, &ctx_p->ngroups, &ctx_p->groups);
ctx_p->token = NULL; /* Maps to guest user. */
diff --git a/source/smbd/service.c b/source/smbd/service.c
index 4d40d8dec1b..4a02967866b 100644
--- a/source/smbd/service.c
+++ b/source/smbd/service.c
@@ -486,7 +486,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int
{
pstring s;
pstrcpy(s,lp_pathname(snum));
- standard_sub_conn(conn,s);
+ standard_sub_conn(conn,s,sizeof(s));
string_set(&conn->connectpath,s);
DEBUG(3,("Connect path is %s\n",s));
}
@@ -498,19 +498,8 @@ connection_struct *make_connection(char *service,char *user,char *password, int
/* Find all the groups this uid is in and
store them. Used by change_to_user() */
initialise_groups(conn->user, conn->uid, conn->gid);
- get_current_groups(&conn->ngroups,&conn->groups);
+ get_current_groups(conn->gid, &conn->ngroups,&conn->groups);
-#ifdef HAVE_GETGROUPS_TOO_MANY_EGIDS
- /*
- * Some OSes, like FreeBSD return EGID as group 0 from getgroups
- * and ignore group 0 on setgroups.
- * get_current_groups returns group 0 as 0, which is wrong.
- * We set it to gid here to prevent the token creation below
- * from creating an incorrect token (SID for local group 0).
- */
- if (conn->ngroups) conn->groups[0] = conn->gid;
-#endif /* HAVE_GETGROUPS_TOO_MANY_EGIDS */
-
/* check number of connections */
if (!claim_connection(conn,
lp_servicename(SNUM(conn)),
@@ -562,7 +551,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int
if (*lp_rootpreexec(SNUM(conn))) {
pstring cmd;
pstrcpy(cmd,lp_rootpreexec(SNUM(conn)));
- standard_sub_conn(conn,cmd);
+ standard_sub_conn(conn,cmd,sizeof(cmd));
DEBUG(5,("cmd=%s\n",cmd));
ret = smbrun(cmd,NULL);
if (ret != 0 && lp_rootpreexec_close(SNUM(conn))) {
@@ -586,7 +575,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int
if (*lp_preexec(SNUM(conn))) {
pstring cmd;
pstrcpy(cmd,lp_preexec(SNUM(conn)));
- standard_sub_conn(conn,cmd);
+ standard_sub_conn(conn,cmd,sizeof(cmd));
ret = smbrun(cmd,NULL);
if (ret != 0 && lp_preexec_close(SNUM(conn))) {
DEBUG(1,("preexec gave %d - failing connection\n", ret));
@@ -709,7 +698,7 @@ void close_cnum(connection_struct *conn, uint16 vuid)
change_to_user(conn, vuid)) {
pstring cmd;
pstrcpy(cmd,lp_postexec(SNUM(conn)));
- standard_sub_conn(conn,cmd);
+ standard_sub_conn(conn,cmd,sizeof(cmd));
smbrun(cmd,NULL);
}
@@ -718,7 +707,7 @@ void close_cnum(connection_struct *conn, uint16 vuid)
if (*lp_rootpostexec(SNUM(conn))) {
pstring cmd;
pstrcpy(cmd,lp_rootpostexec(SNUM(conn)));
- standard_sub_conn(conn,cmd);
+ standard_sub_conn(conn,cmd,sizeof(cmd));
smbrun(cmd,NULL);
}
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index cda99912813..3518ba023c6 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -2342,7 +2342,8 @@ static int call_trans2setfilepathinfo(connection_struct *conn, char *inbuf, char
SSVAL(params,0,0);
send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0);
return(-1);
- }
+ } else
+ return(UNIXERROR(ERRDOS,ERRbadpath));
} else {
/*
* Original code - this is an open file.
diff --git a/source/tdb/tdb.c b/source/tdb/tdb.c
index 14e1d4a24f7..ed75a55e3e9 100644
--- a/source/tdb/tdb.c
+++ b/source/tdb/tdb.c
@@ -189,7 +189,7 @@ static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset,
} while (ret == -1 && errno == EINTR);
if (ret == -1) {
- if (!probe) {
+ if (!probe && lck_type != F_SETLK) {
TDB_LOG((tdb, 5,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d lck_type=%d\n",
tdb->fd, offset, rw_type, lck_type));
}
@@ -419,7 +419,8 @@ static int rec_free_read(TDB_CONTEXT *tdb, tdb_off off, struct list_struct *rec)
TDB_LOG((tdb, 0,"rec_free_read non-free magic at offset=%d - fixing\n",
rec->magic, off));
rec->magic = TDB_FREE_MAGIC;
- tdb_write(tdb, off, rec, sizeof(*rec));
+ if (tdb_write(tdb, off, rec, sizeof(*rec)) == -1)
+ return -1;
}
if (rec->magic != TDB_FREE_MAGIC) {
diff --git a/source/tdb/tdbtool.c b/source/tdb/tdbtool.c
index caa29401418..3ae955901c2 100644
--- a/source/tdb/tdbtool.c
+++ b/source/tdb/tdbtool.c
@@ -110,22 +110,22 @@ static void print_data(unsigned char *buf,int len)
static void help(void)
{
- printf("
-tdbtool:
- create dbname : create a database
- open dbname : open an existing database
- erase : erase the database
- dump : dump the database as strings
- insert key data : insert a record
- store key data : store a record (replace)
- show key : show a record by key
- delete key : delete a record by key
- list : print the database hash table and freelist
- free : print the database freelist
- 1 | first : print the first record
- n | next : print the next record
- q | quit : terminate
- \\n : repeat 'next' command
+ printf(" \n \
+tdbtool: \n \
+ create dbname : create a database \n \
+ open dbname : open an existing database \n \
+ erase : erase the database \n \
+ dump : dump the database as strings \n \
+ insert key data : insert a record \n \
+ store key data : store a record (replace) \n \
+ show key : show a record by key \n \
+ delete key : delete a record by key \n \
+ list : print the database hash table and freelist \n \
+ free : print the database freelist \n \
+ 1 | first : print the first record \n \
+ n | next : print the next record \n \
+ q | quit : terminate \n \
+ \\n : repeat 'next' command \n \
");
}
diff --git a/source/utils/testparm.c b/source/utils/testparm.c
index 664f13ab269..9cef1d9ac85 100644
--- a/source/utils/testparm.c
+++ b/source/utils/testparm.c
@@ -153,7 +153,7 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
}
}
- if (lp_status(-1) && lp_max_smbd_processes()) {
+ if (!lp_status(-1) && lp_max_smbd_processes()) {
printf("ERROR: the 'max smbd processes' parameter is set and the 'status' parameter is set to 'no'.\n");
ret = 1;
}