summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/acconfig.h1
-rwxr-xr-xsource3/configure235
-rw-r--r--source3/configure.in12
-rw-r--r--source3/include/config.h.in7
-rw-r--r--source3/include/includes.h3
-rw-r--r--source3/include/proto.h683
-rw-r--r--source3/lib/debug.c12
-rw-r--r--source3/lib/replace.c16
-rw-r--r--source3/lib/system.c231
-rw-r--r--source3/printing/print_svid.c8
-rw-r--r--source3/smbd/dfree.c10
-rw-r--r--source3/smbd/nttrans.c6
-rw-r--r--source3/smbd/password.c6
-rw-r--r--source3/utils/make_printerdef.c44
14 files changed, 786 insertions, 488 deletions
diff --git a/source3/acconfig.h b/source3/acconfig.h
index 1dd2af1022..4bf614c04f 100644
--- a/source3/acconfig.h
+++ b/source3/acconfig.h
@@ -116,3 +116,4 @@
#undef USE_SETUIDX
#undef HAVE_LIBDL
#undef NEED_SGI_SEMUN_HACK
+#undef SYSCONF_SC_NGROUPS_MAX
diff --git a/source3/configure b/source3/configure
index a5c87073af..63c87c508d 100755
--- a/source3/configure
+++ b/source3/configure
@@ -4204,7 +4204,7 @@ else
fi
done
-for ac_func in initgroups select rdchk getgrnam getgrent pathconf popen
+for ac_func in initgroups select rdchk getgrnam getgrent pathconf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4211: checking for $ac_func" >&5
@@ -4259,7 +4259,7 @@ else
fi
done
-for ac_func in setpriv setgidx setuidx setgroups mktime rename ftruncate stat64 fstat64
+for ac_func in setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4266: checking for $ac_func" >&5
@@ -8509,8 +8509,45 @@ EOF
fi
+echo $ac_n "checking for sysconf(_SC_NGROUPS_MAX)""... $ac_c" 1>&6
+echo "configure:8514: checking for sysconf(_SC_NGROUPS_MAX)" >&5
+if eval "test \"`echo '$''{'samba_cv_SYSCONF_SC_NGROUPS_MAX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+if test "$cross_compiling" = yes; then
+ samba_cv_SYSCONF_SC_NGROUPS_MAX=cross
+else
+ cat > conftest.$ac_ext <<EOF
+#line 8523 "configure"
+#include "confdefs.h"
+#include <unistd.h>
+main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }
+EOF
+if { (eval echo configure:8528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ samba_cv_SYSCONF_SC_NGROUPS_MAX=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ samba_cv_SYSCONF_SC_NGROUPS_MAX=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$samba_cv_SYSCONF_SC_NGROUPS_MAX" 1>&6
+if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
+ cat >> confdefs.h <<\EOF
+#define SYSCONF_SC_NGROUPS_MAX 1
+EOF
+
+fi
+
echo $ac_n "checking for root""... $ac_c" 1>&6
-echo "configure:8514: checking for root" >&5
+echo "configure:8551: checking for root" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_ROOT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8519,11 +8556,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_ROOT=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8523 "configure"
+#line 8560 "configure"
#include "confdefs.h"
main() { exit(getuid() != 0); }
EOF
-if { (eval echo configure:8527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_ROOT=yes
else
@@ -8551,7 +8588,7 @@ fi
# look for a method of finding the list of network interfaces
iface=no;
echo $ac_n "checking for iface AIX""... $ac_c" 1>&6
-echo "configure:8555: checking for iface AIX" >&5
+echo "configure:8592: checking for iface AIX" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_IFACE_AIX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8560,7 +8597,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_IFACE_AIX=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8564 "configure"
+#line 8601 "configure"
#include "confdefs.h"
#define HAVE_IFACE_AIX 1
@@ -8568,7 +8605,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/interfaces.c"
EOF
-if { (eval echo configure:8572: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_IFACE_AIX=yes
else
@@ -8592,7 +8629,7 @@ fi
if test $iface = no; then
echo $ac_n "checking for iface ifconf""... $ac_c" 1>&6
-echo "configure:8596: checking for iface ifconf" >&5
+echo "configure:8633: checking for iface ifconf" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_IFACE_IFCONF'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8601,7 +8638,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_IFACE_IFCONF=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8605 "configure"
+#line 8642 "configure"
#include "confdefs.h"
#define HAVE_IFACE_IFCONF 1
@@ -8609,7 +8646,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/interfaces.c"
EOF
-if { (eval echo configure:8613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_IFACE_IFCONF=yes
else
@@ -8634,7 +8671,7 @@ fi
if test $iface = no; then
echo $ac_n "checking for iface ifreq""... $ac_c" 1>&6
-echo "configure:8638: checking for iface ifreq" >&5
+echo "configure:8675: checking for iface ifreq" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_IFACE_IFREQ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8643,7 +8680,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_IFACE_IFREQ=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8647 "configure"
+#line 8684 "configure"
#include "confdefs.h"
#define HAVE_IFACE_IFREQ 1
@@ -8651,7 +8688,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/interfaces.c"
EOF
-if { (eval echo configure:8655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_IFACE_IFREQ=yes
else
@@ -8680,7 +8717,7 @@ fi
seteuid=no;
if test $seteuid = no; then
echo $ac_n "checking for setresuid""... $ac_c" 1>&6
-echo "configure:8684: checking for setresuid" >&5
+echo "configure:8721: checking for setresuid" >&5
if eval "test \"`echo '$''{'samba_cv_USE_SETRESUID'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8689,7 +8726,7 @@ if test "$cross_compiling" = yes; then
samba_cv_USE_SETRESUID=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8693 "configure"
+#line 8730 "configure"
#include "confdefs.h"
#define AUTOCONF_TEST 1
@@ -8697,7 +8734,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/util_sec.c"
EOF
-if { (eval echo configure:8701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_USE_SETRESUID=yes
else
@@ -8723,7 +8760,7 @@ fi
if test $seteuid = no; then
echo $ac_n "checking for setreuid""... $ac_c" 1>&6
-echo "configure:8727: checking for setreuid" >&5
+echo "configure:8764: checking for setreuid" >&5
if eval "test \"`echo '$''{'samba_cv_USE_SETREUID'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8732,7 +8769,7 @@ if test "$cross_compiling" = yes; then
samba_cv_USE_SETREUID=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8736 "configure"
+#line 8773 "configure"
#include "confdefs.h"
#define AUTOCONF_TEST 1
@@ -8740,7 +8777,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/util_sec.c"
EOF
-if { (eval echo configure:8744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_USE_SETREUID=yes
else
@@ -8765,7 +8802,7 @@ fi
if test $seteuid = no; then
echo $ac_n "checking for seteuid""... $ac_c" 1>&6
-echo "configure:8769: checking for seteuid" >&5
+echo "configure:8806: checking for seteuid" >&5
if eval "test \"`echo '$''{'samba_cv_USE_SETEUID'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8774,7 +8811,7 @@ if test "$cross_compiling" = yes; then
samba_cv_USE_SETEUID=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8778 "configure"
+#line 8815 "configure"
#include "confdefs.h"
#define AUTOCONF_TEST 1
@@ -8782,7 +8819,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/util_sec.c"
EOF
-if { (eval echo configure:8786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_USE_SETEUID=yes
else
@@ -8807,7 +8844,7 @@ fi
if test $seteuid = no; then
echo $ac_n "checking for setuidx""... $ac_c" 1>&6
-echo "configure:8811: checking for setuidx" >&5
+echo "configure:8848: checking for setuidx" >&5
if eval "test \"`echo '$''{'samba_cv_USE_SETUIDX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8816,7 +8853,7 @@ if test "$cross_compiling" = yes; then
samba_cv_USE_SETUIDX=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8820 "configure"
+#line 8857 "configure"
#include "confdefs.h"
#define AUTOCONF_TEST 1
@@ -8824,7 +8861,7 @@ else
#include "confdefs.h"
#include "${srcdir-.}/lib/util_sec.c"
EOF
-if { (eval echo configure:8828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_USE_SETUIDX=yes
else
@@ -8849,7 +8886,7 @@ fi
echo $ac_n "checking for shared mmap""... $ac_c" 1>&6
-echo "configure:8853: checking for shared mmap" >&5
+echo "configure:8890: checking for shared mmap" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_SHARED_MMAP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8858,11 +8895,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_SHARED_MMAP=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8862 "configure"
+#line 8899 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/shared_mmap.c"
EOF
-if { (eval echo configure:8866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_SHARED_MMAP=yes
else
@@ -8889,7 +8926,7 @@ EOF
fi
echo $ac_n "checking for ftruncate needs root""... $ac_c" 1>&6
-echo "configure:8893: checking for ftruncate needs root" >&5
+echo "configure:8930: checking for ftruncate needs root" >&5
if eval "test \"`echo '$''{'samba_cv_FTRUNCATE_NEEDS_ROOT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8898,11 +8935,11 @@ if test "$cross_compiling" = yes; then
samba_cv_FTRUNCATE_NEEDS_ROOT=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8902 "configure"
+#line 8939 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/ftruncroot.c"
EOF
-if { (eval echo configure:8906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_FTRUNCATE_NEEDS_ROOT=yes
else
@@ -8925,7 +8962,7 @@ EOF
fi
echo $ac_n "checking for fcntl locking""... $ac_c" 1>&6
-echo "configure:8929: checking for fcntl locking" >&5
+echo "configure:8966: checking for fcntl locking" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_FCNTL_LOCK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8934,11 +8971,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_FCNTL_LOCK=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8938 "configure"
+#line 8975 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/fcntl_lock.c"
EOF
-if { (eval echo configure:8942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_FCNTL_LOCK=yes
else
@@ -8961,7 +8998,7 @@ EOF
fi
echo $ac_n "checking for broken (glibc2.1/x86) 64 bit fcntl locking""... $ac_c" 1>&6
-echo "configure:8965: checking for broken (glibc2.1/x86) 64 bit fcntl locking" >&5
+echo "configure:9002: checking for broken (glibc2.1/x86) 64 bit fcntl locking" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_BROKEN_FCNTL64_LOCKS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8970,11 +9007,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross
else
cat > conftest.$ac_ext <<EOF
-#line 8974 "configure"
+#line 9011 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/fcntl_lock64.c"
EOF
-if { (eval echo configure:8978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes
else
@@ -8999,7 +9036,7 @@ else
echo $ac_n "checking for 64 bit fcntl locking""... $ac_c" 1>&6
-echo "configure:9003: checking for 64 bit fcntl locking" >&5
+echo "configure:9040: checking for 64 bit fcntl locking" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_STRUCT_FLOCK64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9008,7 +9045,7 @@ else
samba_cv_HAVE_STRUCT_FLOCK64=cross
else
cat > conftest.$ac_ext <<EOF
-#line 9012 "configure"
+#line 9049 "configure"
#include "confdefs.h"
#if defined(HAVE_UNISTD_H)
@@ -9032,7 +9069,7 @@ exit(1);
#endif
}
EOF
-if { (eval echo configure:9036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_STRUCT_FLOCK64=yes
else
@@ -9057,7 +9094,7 @@ EOF
fi
echo $ac_n "checking for sysv ipc""... $ac_c" 1>&6
-echo "configure:9061: checking for sysv ipc" >&5
+echo "configure:9098: checking for sysv ipc" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_SYSV_IPC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9066,11 +9103,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_SYSV_IPC=cross
else
cat > conftest.$ac_ext <<EOF
-#line 9070 "configure"
+#line 9107 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/sysv_ipc.c"
EOF
-if { (eval echo configure:9074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_SYSV_IPC=yes
else
@@ -9093,7 +9130,7 @@ EOF
fi
echo $ac_n "checking for IRIX sysv ipc semun problem using gcc""... $ac_c" 1>&6
-echo "configure:9097: checking for IRIX sysv ipc semun problem using gcc" >&5
+echo "configure:9134: checking for IRIX sysv ipc semun problem using gcc" >&5
if eval "test \"`echo '$''{'samba_cv_NEED_SGI_SEMUN_HACK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9102,11 +9139,11 @@ if test "$cross_compiling" = yes; then
samba_cv_NEED_SGI_SEMUN_HACK=cross
else
cat > conftest.$ac_ext <<EOF
-#line 9106 "configure"
+#line 9143 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/sgi_sysv_hack.c"
EOF
-if { (eval echo configure:9110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_NEED_SGI_SEMUN_HACK=yes
else
@@ -9129,7 +9166,7 @@ EOF
fi
echo $ac_n "checking for a crypt that needs truncated salt""... $ac_c" 1>&6
-echo "configure:9133: checking for a crypt that needs truncated salt" >&5
+echo "configure:9170: checking for a crypt that needs truncated salt" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_TRUNCATED_SALT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9138,11 +9175,11 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_TRUNCATED_SALT=cross
else
cat > conftest.$ac_ext <<EOF
-#line 9142 "configure"
+#line 9179 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/crypttest.c"
EOF
-if { (eval echo configure:9146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_TRUNCATED_SALT=no
else
@@ -9165,13 +9202,13 @@ EOF
fi
echo $ac_n "checking for broken nisplus include files""... $ac_c" 1>&6
-echo "configure:9169: checking for broken nisplus include files" >&5
+echo "configure:9206: checking for broken nisplus include files" >&5
if eval "test \"`echo '$''{'samba_cv_BROKEN_NISPLUS_INCLUDE_FILES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9175 "configure"
+#line 9212 "configure"
#include "confdefs.h"
#include <sys/acl.h>
#if defined(HAVE_RPCSVC_NIS_H)
@@ -9181,7 +9218,7 @@ int main() {
return 0;
; return 0; }
EOF
-if { (eval echo configure:9185: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no
else
@@ -9205,7 +9242,7 @@ fi
#################################################
# check for smbwrapper support
echo $ac_n "checking whether to use smbwrapper""... $ac_c" 1>&6
-echo "configure:9209: checking whether to use smbwrapper" >&5
+echo "configure:9246: checking whether to use smbwrapper" >&5
# Check whether --with-smbwrapper or --without-smbwrapper was given.
if test "${with_smbwrapper+set}" = set; then
withval="$with_smbwrapper"
@@ -9249,7 +9286,7 @@ fi
#################################################
# check for the AFS filesystem
echo $ac_n "checking whether to use AFS""... $ac_c" 1>&6
-echo "configure:9253: checking whether to use AFS" >&5
+echo "configure:9290: checking whether to use AFS" >&5
# Check whether --with-afs or --without-afs was given.
if test "${with_afs+set}" = set; then
withval="$with_afs"
@@ -9275,7 +9312,7 @@ fi
#################################################
# check for the DFS auth system
echo $ac_n "checking whether to use DFS auth""... $ac_c" 1>&6
-echo "configure:9279: checking whether to use DFS auth" >&5
+echo "configure:9316: checking whether to use DFS auth" >&5
# Check whether --with-dfs or --without-dfs was given.
if test "${with_dfs+set}" = set; then
withval="$with_dfs"
@@ -9300,7 +9337,7 @@ fi
#################################################
# check for Kerberos IV auth system
echo $ac_n "checking whether to use Kerberos IV""... $ac_c" 1>&6
-echo "configure:9304: checking whether to use Kerberos IV" >&5
+echo "configure:9341: checking whether to use Kerberos IV" >&5
# Check whether --with-krb4 or --without-krb4 was given.
if test "${with_krb4+set}" = set; then
withval="$with_krb4"
@@ -9310,7 +9347,7 @@ if test "${with_krb4+set}" = set; then
EOF
echo $ac_n "checking for dn_expand in -lresolv""... $ac_c" 1>&6
-echo "configure:9314: checking for dn_expand in -lresolv" >&5
+echo "configure:9351: checking for dn_expand in -lresolv" >&5
ac_lib_var=`echo resolv'_'dn_expand | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -9318,7 +9355,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9322 "configure"
+#line 9359 "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
@@ -9329,7 +9366,7 @@ int main() {
dn_expand()
; return 0; }
EOF
-if { (eval echo configure:9333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -9368,7 +9405,7 @@ fi
#################################################
# check for Kerberos 5 auth system
echo $ac_n "checking whether to use Kerberos 5""... $ac_c" 1>&6
-echo "configure:9372: checking whether to use Kerberos 5" >&5
+echo "configure:9409: checking whether to use Kerberos 5" >&5
# Check whether --with-krb5 or --without-krb5 was given.
if test "${with_krb5+set}" = set; then
withval="$with_krb5"
@@ -9389,7 +9426,7 @@ fi
#################################################
# check for automount support
echo $ac_n "checking whether to use AUTOMOUNT""... $ac_c" 1>&6
-echo "configure:9393: checking whether to use AUTOMOUNT" >&5
+echo "configure:9430: checking whether to use AUTOMOUNT" >&5
# Check whether --with-automount or --without-automount was given.
if test "${with_automount+set}" = set; then
withval="$with_automount"
@@ -9414,7 +9451,7 @@ fi
#################################################
# check for smbmount support
echo $ac_n "checking whether to use SMBMOUNT""... $ac_c" 1>&6
-echo "configure:9418: checking whether to use SMBMOUNT" >&5
+echo "configure:9455: checking whether to use SMBMOUNT" >&5
# Check whether --with-smbmount or --without-smbmount was given.
if test "${with_smbmount+set}" = set; then
withval="$with_smbmount"
@@ -9443,7 +9480,7 @@ fi
#################################################
# check for a PAM password database
echo $ac_n "checking whether to use PAM password database""... $ac_c" 1>&6
-echo "configure:9447: checking whether to use PAM password database" >&5
+echo "configure:9484: checking whether to use PAM password database" >&5
# Check whether --with-pam or --without-pam was given.
if test "${with_pam+set}" = set; then
withval="$with_pam"
@@ -9470,7 +9507,7 @@ fi
#################################################
# check for a LDAP password database
echo $ac_n "checking whether to use LDAP password database""... $ac_c" 1>&6
-echo "configure:9474: checking whether to use LDAP password database" >&5
+echo "configure:9511: checking whether to use LDAP password database" >&5
# Check whether --with-ldap or --without-ldap was given.
if test "${with_ldap+set}" = set; then
withval="$with_ldap"
@@ -9496,7 +9533,7 @@ fi
#################################################
# check for a NISPLUS password database
echo $ac_n "checking whether to use NISPLUS password database""... $ac_c" 1>&6
-echo "configure:9500: checking whether to use NISPLUS password database" >&5
+echo "configure:9537: checking whether to use NISPLUS password database" >&5
# Check whether --with-nisplus or --without-nisplus was given.
if test "${with_nisplus+set}" = set; then
withval="$with_nisplus"
@@ -9521,7 +9558,7 @@ fi
#################################################
# check for a NISPLUS_HOME support
echo $ac_n "checking whether to use NISPLUS_HOME""... $ac_c" 1>&6
-echo "configure:9525: checking whether to use NISPLUS_HOME" >&5
+echo "configure:9562: 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"
@@ -9546,7 +9583,7 @@ fi
#################################################
# check for the secure socket layer
echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6
-echo "configure:9550: checking whether to use SSL" >&5
+echo "configure:9587: 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"
@@ -9605,7 +9642,7 @@ fi
#################################################
# check for syslog logging
echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6
-echo "configure:9609: checking whether to use syslog logging" >&5
+echo "configure:9646: 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"
@@ -9630,7 +9667,7 @@ fi
#################################################
# check for a shared memory profiling support
echo $ac_n "checking whether to use profiling""... $ac_c" 1>&6
-echo "configure:9634: checking whether to use profiling" >&5
+echo "configure:9671: checking whether to use profiling" >&5
# Check whether --with-profile or --without-profile was given.
if test "${with_profile+set}" = set; then
withval="$with_profile"
@@ -9656,7 +9693,7 @@ fi
#################################################
# check for experimental netatalk resource fork support
echo $ac_n "checking whether to support netatalk""... $ac_c" 1>&6
-echo "configure:9660: checking whether to support netatalk" >&5
+echo "configure:9697: checking whether to support netatalk" >&5
# Check whether --with-netatalk or --without-netatalk was given.
if test "${with_netatalk+set}" = set; then
withval="$with_netatalk"
@@ -9683,7 +9720,7 @@ fi
QUOTAOBJS=noquotas.o
echo $ac_n "checking whether to support disk-quotas""... $ac_c" 1>&6
-echo "configure:9687: checking whether to support disk-quotas" >&5
+echo "configure:9724: 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"
@@ -9707,7 +9744,7 @@ fi
# check for experimental utmp accounting
echo $ac_n "checking whether to support utmp accounting""... $ac_c" 1>&6
-echo "configure:9711: checking whether to support utmp accounting" >&5
+echo "configure:9748: 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"
@@ -9807,14 +9844,14 @@ fi
#################################################
# these tests are taken from the GNU fileutils package
echo "checking how to get filesystem space usage" 1>&6
-echo "configure:9811: checking how to get filesystem space usage" >&5
+echo "configure:9848: 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:9818: checking statvfs64 function (SVR4)" >&5
+echo "configure:9855: 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
@@ -9822,7 +9859,7 @@ else
fu_cv_sys_stat_statvfs64=cross
else
cat > conftest.$ac_ext <<EOF
-#line 9826 "configure"
+#line 9863 "configure"
#include "confdefs.h"
#if defined(HAVE_UNISTD_H)
@@ -9836,7 +9873,7 @@ else
exit (statvfs64 (".", &fsd));
}
EOF
-if { (eval echo configure:9840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statvfs64=yes
else
@@ -9869,12 +9906,12 @@ fi
if test $space = no; then
# SVR4
echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6
-echo "configure:9873: checking statvfs function (SVR4)" >&5
+echo "configure:9910: 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 9878 "configure"
+#line 9915 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statvfs.h>
@@ -9882,7 +9919,7 @@ int main() {
struct statvfs fsd; statvfs (0, &fsd);
; return 0; }
EOF
-if { (eval echo configure:9886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
fu_cv_sys_stat_statvfs=yes
else
@@ -9907,7 +9944,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:9911: checking for 3-argument statfs function (DEC OSF/1)" >&5
+echo "configure:9948: 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
@@ -9915,7 +9952,7 @@ else
fu_cv_sys_stat_statfs3_osf1=no
else
cat > conftest.$ac_ext <<EOF
-#line 9919 "configure"
+#line 9956 "configure"
#include "confdefs.h"
#include <sys/param.h>
@@ -9928,7 +9965,7 @@ else
exit (statfs (".", &fsd, sizeof (struct statfs)));
}
EOF
-if { (eval echo configure:9932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs3_osf1=yes
else
@@ -9955,7 +9992,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:9959: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+echo "configure:9996: 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
@@ -9963,7 +10000,7 @@ else
fu_cv_sys_stat_statfs2_bsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 9967 "configure"
+#line 10004 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_PARAM_H
@@ -9982,7 +10019,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:9986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_bsize=yes
else
@@ -10009,7 +10046,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:10013: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+echo "configure:10050: 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
@@ -10017,7 +10054,7 @@ else
fu_cv_sys_stat_statfs4=no
else
cat > conftest.$ac_ext <<EOF
-#line 10021 "configure"
+#line 10058 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statfs.h>
@@ -10027,7 +10064,7 @@ else
exit (statfs (".", &fsd, sizeof fsd, 0));
}
EOF
-if { (eval echo configure:10031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs4=yes
else
@@ -10054,7 +10091,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:10058: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+echo "configure:10095: 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
@@ -10062,7 +10099,7 @@ else
fu_cv_sys_stat_statfs2_fsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 10066 "configure"
+#line 10103 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -10078,7 +10115,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:10082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_fsize=yes
else
@@ -10105,7 +10142,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:10109: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+echo "configure:10146: 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
@@ -10113,7 +10150,7 @@ else
fu_cv_sys_stat_fs_data=no
else
cat > conftest.$ac_ext <<EOF
-#line 10117 "configure"
+#line 10154 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -10133,7 +10170,7 @@ else
exit (statfs (".", &fsd) != 1);
}
EOF
-if { (eval echo configure:10137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_fs_data=yes
else
@@ -10167,7 +10204,7 @@ fi
#
echo "checking if large file support can be enabled"
cat > conftest.$ac_ext <<EOF
-#line 10171 "configure"
+#line 10208 "configure"
#include "confdefs.h"
#if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
@@ -10180,7 +10217,7 @@ int main() {
int i
; return 0; }
EOF
-if { (eval echo configure:10184: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes
else
@@ -10205,11 +10242,11 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 10209 "configure"
+#line 10246 "configure"
#include "confdefs.h"
#include "${srcdir-.}/tests/summary.c"
EOF
-if { (eval echo configure:10213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo "configure OK";
else
diff --git a/source3/configure.in b/source3/configure.in
index 51505e8283..4d8ef647c8 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -353,8 +353,8 @@ AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod chroot)
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob strpbrk pipe crypt16 getauthuid)
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
-AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf popen)
-AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate stat64 fstat64)
+AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf)
+AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64)
AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid yp_get_default_domain getpwanam)
AC_CHECK_FUNCS(srandom random srand rand setenv usleep mmap64 strcasecmp fcvt fcvtl)
@@ -845,6 +845,14 @@ if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
AC_DEFINE(REPLACE_INET_NTOA)
fi
+AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
+AC_TRY_RUN([#include <unistd.h>
+main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
+samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
+if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
+ AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
+fi
+
AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
AC_TRY_RUN([main() { exit(getuid() != 0); }],
samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index c8d5d89233..0b3872e7ce 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -182,6 +182,7 @@
#undef USE_SETUIDX
#undef HAVE_LIBDL
#undef NEED_SGI_SEMUN_HACK
+#undef SYSCONF_SC_NGROUPS_MAX
/* The number of bytes in a int. */
#undef SIZEOF_INT
@@ -549,9 +550,6 @@
/* Define if you have the pipe function. */
#undef HAVE_PIPE
-/* Define if you have the popen function. */
-#undef HAVE_POPEN
-
/* Define if you have the pread function. */
#undef HAVE_PREAD
@@ -657,6 +655,9 @@
/* Define if you have the syscall function. */
#undef HAVE_SYSCALL
+/* Define if you have the sysconf function. */
+#undef HAVE_SYSCONF
+
/* Define if you have the usleep function. */
#undef HAVE_USLEEP
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 127e6d59af..1929df3b7d 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -628,6 +628,9 @@ extern int errno;
#define GID_T gid_t
#endif
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX 32 /* Guess... */
+#endif
/* Lists, trees, caching, datbase... */
#include "ubi_sLinkList.h"
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 7dc0d3e9e6..9209f3063e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -186,208 +186,10 @@ void CatchChildLeaveStatus(void);
int vslprintf(char *str, int n, char *format, va_list ap);
-/*The following definitions come from libsmb/clientgen.c */
-
-int cli_set_port(struct cli_state *cli, int port);
-char *cli_errstr(struct cli_state *cli);
-BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
- uint16 *setup, uint32 setup_count, uint32 max_setup_count,
- char *params, uint32 param_count, uint32 max_param_count,
- char *data, uint32 data_count, uint32 max_data_count,
- char **rparam, uint32 *rparam_count,
- char **rdata, uint32 *rdata_count);
-BOOL cli_api(struct cli_state *cli,
- char *param, int prcnt, int mprcnt,
- char *data, int drcnt, int mdrcnt,
- char **rparam, int *rprcnt,
- char **rdata, int *rdrcnt);
-BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
-BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
-BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
- void (*fn)(const char *, uint32, const char *));
-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,
- char *share, char *dev, char *pass, int passlen);
-BOOL cli_tdis(struct cli_state *cli);
-BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
-BOOL cli_unlink(struct cli_state *cli, char *fname);
-BOOL cli_mkdir(struct cli_state *cli, char *dname);
-BOOL cli_rmdir(struct cli_state *cli, char *dname);
-int cli_nt_create(struct cli_state *cli, char *fname);
-int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode);
-BOOL cli_close(struct cli_state *cli, int fnum);
-BOOL cli_lock(struct cli_state *cli, int fnum,
- uint32 offset, uint32 len, int timeout, enum brl_type lock_type);
-BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len);
-size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
-ssize_t cli_write(struct cli_state *cli,
- int fnum, uint16 write_mode,
- char *buf, off_t offset, size_t size);
-ssize_t cli_smbwrite(struct cli_state *cli,
- int fnum, char *buf, off_t offset, size_t size1);
-BOOL cli_getattrE(struct cli_state *cli, int fd,
- uint16 *attr, size_t *size,
- time_t *c_time, time_t *a_time, time_t *m_time);
-BOOL cli_getatr(struct cli_state *cli, char *fname,
- uint16 *attr, size_t *size, time_t *t);
-BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
-BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
- time_t *c_time, time_t *a_time, time_t *m_time,
- size_t *size, uint16 *mode);
-BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
- time_t *c_time, time_t *a_time, time_t *m_time,
- time_t *w_time, size_t *size, uint16 *mode,
- SMB_INO_T *ino);
-BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
- uint16 *mode, size_t *size,
- time_t *c_time, time_t *a_time, time_t *m_time,
- time_t *w_time, SMB_INO_T *ino);
-int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
- void (*fn)(file_info *, const char *));
-BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
- const char *old_password);
-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);
-struct cli_state *cli_initialise(struct cli_state *cli);
-void cli_shutdown(struct cli_state *cli);
-int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_error);
-void cli_sockopt(struct cli_state *cli, char *options);
-uint16 cli_setpid(struct cli_state *cli, uint16 pid);
-BOOL cli_reestablish_connection(struct cli_state *cli);
-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);
-int cli_printjob_del(struct cli_state *cli, int job);
-int cli_print_queue(struct cli_state *cli,
- void (*fn)(struct print_job_info *));
-BOOL cli_chkpath(struct cli_state *cli, char *path);
-BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
- int *grp);
-BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
-BOOL cli_message_end(struct cli_state *cli, int grp);
-BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
-BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost,
- struct in_addr *pdest_ip);
-
-/*The following definitions come from libsmb/credentials.c */
-
-char *credstr(uchar *cred);
-void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass,
- uchar session_key[8]);
-void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp,
- DOM_CHAL *cred);
-int cred_assert(DOM_CHAL *cred, uchar session_key[8], DOM_CHAL *stored_cred,
- UTIME timestamp);
-BOOL clnt_deal_with_creds(uchar sess_key[8],
- DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
-BOOL deal_with_creds(uchar sess_key[8],
- DOM_CRED *sto_clnt_cred,
- DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
-
-/*The following definitions come from libsmb/namequery.c */
-
-BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
- struct in_addr to_ip,char *master,char *rname);
-struct in_addr *name_query(int fd,const char *name,int name_type,
- BOOL bcast,BOOL recurse,
- struct in_addr to_ip, int *count);
-FILE *startlmhosts(char *fname);
-BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
-void endlmhosts(FILE *fp);
-BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
-BOOL find_master_ip(char *group, struct in_addr *master_ip);
-BOOL lookup_pdc_name(const char *srcname, const char *domain, struct in_addr *pdc_ip, char *ret_name);
-BOOL get_dc_list(char *group, struct in_addr **ip_list, int *count);
-
-/*The following definitions come from libsmb/nmblib.c */
-
-void debug_nmb_packet(struct packet_struct *p);
-char *nmb_namestr(struct nmb_name *n);
-struct packet_struct *copy_packet(struct packet_struct *packet);
-void free_packet(struct packet_struct *packet);
-struct packet_struct *parse_packet(char *buf,int length,
- enum packet_type packet_type);
-struct packet_struct *read_packet(int fd,enum packet_type packet_type);
-void make_nmb_name( struct nmb_name *n, const char *name, int type);
-BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
-int build_packet(char *buf, struct packet_struct *p);
-BOOL send_packet(struct packet_struct *p);
-struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
-struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
-struct packet_struct *receive_dgram_packet(int fd, int t, char *mailslot_name);
-BOOL match_mailslot_name(struct packet_struct *p, char *mailslot_name);
-void sort_query_replies(char *data, int n, struct in_addr ip);
-
-/*The following definitions come from libsmb/nterr.c */
-
-char *get_nt_error_msg(uint32 nt_code);
-
-/*The following definitions come from libsmb/passchange.c */
-
-BOOL remote_password_change(const char *remote_machine, const char *user_name,
- const char *old_passwd, const char *new_passwd,
- char *err_str, size_t err_str_len);
-
-/*The following definitions come from libsmb/pwd_cache.c */
-
-void pwd_init(struct pwd_info *pwd);
-void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
-BOOL pwd_compare(struct pwd_info *pwd1, struct pwd_info *pwd2);
-void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
-void pwd_set_nullpwd(struct pwd_info *pwd);
-void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
-void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
-void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
-void pwd_get_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
-void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
-void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8]);
-void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24]);
-
/*The following definitions come from lib/smbrun.c */
int smbrun(char *cmd,char *outfile,BOOL shared);
-/*The following definitions come from libsmb/smbdes.c */
-
-void E_P16(unsigned char *p14,unsigned char *p16);
-void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
-void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
-void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out);
-void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key);
-void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key);
-void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw);
-void SamOEMhash( unsigned char *data, unsigned char *key, int val);
-
-/*The following definitions come from libsmb/smbencrypt.c */
-
-void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24);
-void E_md4hash(uchar *passwd, uchar *p16);
-void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16]);
-void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]);
-void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]);
-void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24);
-BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode);
-
-/*The following definitions come from libsmb/smberr.c */
-
-char *smb_errstr(char *inbuf);
-
-/*The following definitions come from libsmb/unexpected.c */
-
-void unexpected_packet(struct packet_struct *p);
-void clear_unexpected(time_t t);
-struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
- char *mailslot_name);
-
/*The following definitions come from lib/snprintf.c */
@@ -417,6 +219,7 @@ BOOL set_process_capability( uint32 cap_flag, BOOL enable );
BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable );
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);
struct passwd *sys_getpwnam(const char *name);
@@ -430,6 +233,8 @@ 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);
+FILE *sys_popen(const char *command, const char *mode);
+int sys_pclose( FILE *fp);
/*The following definitions come from lib/talloc.c */
@@ -469,23 +274,6 @@ BOOL map_username(char *user);
struct passwd *Get_Pwnam(char *user,BOOL allow_change);
BOOL user_in_list(char *user,char *list);
-/*The following definitions come from lib/util_array.c */
-
-void free_void_array(uint32 num_entries, void **entries,
- void(free_item)(void*));
-void* add_copy_to_array(uint32 *len, void ***array, const void *item,
- void*(item_dup)(const void*), BOOL alloc_anyway);
-void* add_item_to_array(uint32 *len, void ***array, void *item);
-void free_use_info_array(uint32 num_entries, struct use_info **entries);
-struct use_info* add_use_info_to_array(uint32 *len, struct use_info ***array,
- const struct use_info *name);
-void free_char_array(uint32 num_entries, char **entries);
-char* add_chars_to_array(uint32 *len, char ***array, const char *name);
-void free_uint32_array(uint32 num_entries, uint32 **entries);
-uint32* add_uint32s_to_array(uint32 *len, uint32 ***array, const uint32 *name);
-void free_sid_array(uint32 num_entries, DOM_SID **entries);
-DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid);
-
/*The following definitions come from lib/util.c */
char *tmpdir(void);
@@ -563,6 +351,23 @@ char *myhostname(void);
char *lock_path(char *name);
char *parent_dirname(const char *path);
+/*The following definitions come from lib/util_array.c */
+
+void free_void_array(uint32 num_entries, void **entries,
+ void(free_item)(void*));
+void* add_copy_to_array(uint32 *len, void ***array, const void *item,
+ void*(item_dup)(const void*), BOOL alloc_anyway);
+void* add_item_to_array(uint32 *len, void ***array, void *item);
+void free_use_info_array(uint32 num_entries, struct use_info **entries);
+struct use_info* add_use_info_to_array(uint32 *len, struct use_info ***array,
+ const struct use_info *name);
+void free_char_array(uint32 num_entries, char **entries);
+char* add_chars_to_array(uint32 *len, char ***array, const char *name);
+void free_uint32_array(uint32 num_entries, uint32 **entries);
+uint32* add_uint32s_to_array(uint32 *len, uint32 ***array, const uint32 *name);
+void free_sid_array(uint32 num_entries, DOM_SID **entries);
+DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid);
+
/*The following definitions come from lib/util_file.c */
BOOL do_file_lock(int fd, int waitsecs, int type);
@@ -752,6 +557,204 @@ void split_at_last_component_w(smb_ucs2_t *path, smb_ucs2_t *front, smb_ucs2_t s
smb_ucs2_t *octal_string_w(int i);
smb_ucs2_t *string_truncate_w(smb_ucs2_t *s, size_t length);
+/*The following definitions come from libsmb/clientgen.c */
+
+int cli_set_port(struct cli_state *cli, int port);
+char *cli_errstr(struct cli_state *cli);
+BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
+ uint16 *setup, uint32 setup_count, uint32 max_setup_count,
+ char *params, uint32 param_count, uint32 max_param_count,
+ char *data, uint32 data_count, uint32 max_data_count,
+ char **rparam, uint32 *rparam_count,
+ char **rdata, uint32 *rdata_count);
+BOOL cli_api(struct cli_state *cli,
+ char *param, int prcnt, int mprcnt,
+ char *data, int drcnt, int mdrcnt,
+ char **rparam, int *rprcnt,
+ char **rdata, int *rdrcnt);
+BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
+BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
+BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
+ void (*fn)(const char *, uint32, const char *));
+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,
+ char *share, char *dev, char *pass, int passlen);
+BOOL cli_tdis(struct cli_state *cli);
+BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
+BOOL cli_unlink(struct cli_state *cli, char *fname);
+BOOL cli_mkdir(struct cli_state *cli, char *dname);
+BOOL cli_rmdir(struct cli_state *cli, char *dname);
+int cli_nt_create(struct cli_state *cli, char *fname);
+int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode);
+BOOL cli_close(struct cli_state *cli, int fnum);
+BOOL cli_lock(struct cli_state *cli, int fnum,
+ uint32 offset, uint32 len, int timeout, enum brl_type lock_type);
+BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len);
+size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
+ssize_t cli_write(struct cli_state *cli,
+ int fnum, uint16 write_mode,
+ char *buf, off_t offset, size_t size);
+ssize_t cli_smbwrite(struct cli_state *cli,
+ int fnum, char *buf, off_t offset, size_t size1);
+BOOL cli_getattrE(struct cli_state *cli, int fd,
+ uint16 *attr, size_t *size,
+ time_t *c_time, time_t *a_time, time_t *m_time);
+BOOL cli_getatr(struct cli_state *cli, char *fname,
+ uint16 *attr, size_t *size, time_t *t);
+BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
+BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ size_t *size, uint16 *mode);
+BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ time_t *w_time, size_t *size, uint16 *mode,
+ SMB_INO_T *ino);
+BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
+ uint16 *mode, size_t *size,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ time_t *w_time, SMB_INO_T *ino);
+int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
+ void (*fn)(file_info *, const char *));
+BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
+ const char *old_password);
+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);
+struct cli_state *cli_initialise(struct cli_state *cli);
+void cli_shutdown(struct cli_state *cli);
+int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_error);
+void cli_sockopt(struct cli_state *cli, char *options);
+uint16 cli_setpid(struct cli_state *cli, uint16 pid);
+BOOL cli_reestablish_connection(struct cli_state *cli);
+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);
+int cli_printjob_del(struct cli_state *cli, int job);
+int cli_print_queue(struct cli_state *cli,
+ void (*fn)(struct print_job_info *));
+BOOL cli_chkpath(struct cli_state *cli, char *path);
+BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
+ int *grp);
+BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
+BOOL cli_message_end(struct cli_state *cli, int grp);
+BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
+BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost, char *desthost,
+ struct in_addr *pdest_ip);
+
+/*The following definitions come from libsmb/credentials.c */
+
+char *credstr(uchar *cred);
+void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass,
+ uchar session_key[8]);
+void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp,
+ DOM_CHAL *cred);
+int cred_assert(DOM_CHAL *cred, uchar session_key[8], DOM_CHAL *stored_cred,
+ UTIME timestamp);
+BOOL clnt_deal_with_creds(uchar sess_key[8],
+ DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
+BOOL deal_with_creds(uchar sess_key[8],
+ DOM_CRED *sto_clnt_cred,
+ DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
+
+/*The following definitions come from libsmb/namequery.c */
+
+BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
+ struct in_addr to_ip,char *master,char *rname);
+struct in_addr *name_query(int fd,const char *name,int name_type,
+ BOOL bcast,BOOL recurse,
+ struct in_addr to_ip, int *count);
+FILE *startlmhosts(char *fname);
+BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
+void endlmhosts(FILE *fp);
+BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
+BOOL find_master_ip(char *group, struct in_addr *master_ip);
+BOOL lookup_pdc_name(const char *srcname, const char *domain, struct in_addr *pdc_ip, char *ret_name);
+BOOL get_dc_list(char *group, struct in_addr **ip_list, int *count);
+
+/*The following definitions come from libsmb/nmblib.c */
+
+void debug_nmb_packet(struct packet_struct *p);
+char *nmb_namestr(struct nmb_name *n);
+struct packet_struct *copy_packet(struct packet_struct *packet);
+void free_packet(struct packet_struct *packet);
+struct packet_struct *parse_packet(char *buf,int length,
+ enum packet_type packet_type);
+struct packet_struct *read_packet(int fd,enum packet_type packet_type);
+void make_nmb_name( struct nmb_name *n, const char *name, int type);
+BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
+int build_packet(char *buf, struct packet_struct *p);
+BOOL send_packet(struct packet_struct *p);
+struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
+struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
+struct packet_struct *receive_dgram_packet(int fd, int t, char *mailslot_name);
+BOOL match_mailslot_name(struct packet_struct *p, char *mailslot_name);
+void sort_query_replies(char *data, int n, struct in_addr ip);
+
+/*The following definitions come from libsmb/nterr.c */
+
+char *get_nt_error_msg(uint32 nt_code);
+
+/*The following definitions come from libsmb/passchange.c */
+
+BOOL remote_password_change(const char *remote_machine, const char *user_name,
+ const char *old_passwd, const char *new_passwd,
+ char *err_str, size_t err_str_len);
+
+/*The following definitions come from libsmb/pwd_cache.c */
+
+void pwd_init(struct pwd_info *pwd);
+void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
+BOOL pwd_compare(struct pwd_info *pwd1, struct pwd_info *pwd2);
+void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
+void pwd_set_nullpwd(struct pwd_info *pwd);
+void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
+void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
+void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
+void pwd_get_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
+void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
+void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8]);
+void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24]);
+
+/*The following definitions come from libsmb/smbdes.c */
+
+void E_P16(unsigned char *p14,unsigned char *p16);
+void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
+void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
+void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out);
+void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key);
+void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key);
+void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int forw);
+void SamOEMhash( unsigned char *data, unsigned char *key, int val);
+
+/*The following definitions come from libsmb/smbencrypt.c */
+
+void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24);
+void E_md4hash(uchar *passwd, uchar *p16);
+void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16]);
+void SMBOWFencrypt(uchar passwd[16], uchar *c8, uchar p24[24]);
+void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24]);
+void SMBNTencrypt(uchar *passwd, uchar *c8, uchar *p24);
+BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[16], BOOL unicode);
+
+/*The following definitions come from libsmb/smberr.c */
+
+char *smb_errstr(char *inbuf);
+
+/*The following definitions come from libsmb/unexpected.c */
+
+void unexpected_packet(struct packet_struct *p);
+void clear_unexpected(time_t t);
+struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
+ char *mailslot_name);
+
/*The following definitions come from locking/brlock.c */
void brl_init(int read_only);
@@ -809,6 +812,10 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
struct name_record **n);
void kill_async_dns_child(void);
+/*The following definitions come from nmbd/nmbd.c */
+
+BOOL reload_services(BOOL test);
+
/*The following definitions come from nmbd/nmbd_become_dmb.c */
void add_domain_names(time_t t);
@@ -839,10 +846,6 @@ void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
void collect_all_workgroup_names_from_wins_server(time_t t);
void sync_all_dmbs(time_t t);
-/*The following definitions come from nmbd/nmbd.c */
-
-BOOL reload_services(BOOL test);
-
/*The following definitions come from nmbd/nmbd_elections.c */
void check_master_browser_exists(time_t t);
@@ -1515,6 +1518,11 @@ void pcap_printer_fn(void (*fn)(char *, char *));
void cups_printer_fn(void (*fn)(char *, char *));
int cups_printername_ok(char *name);
+/*The following definitions come from printing/print_svid.c */
+
+void sysv_printer_fn(void (*fn)(char *, char *));
+int sysv_printername_ok(char *name);
+
/*The following definitions come from printing/printing.c */
void lpq_reset(int snum);
@@ -1529,11 +1537,6 @@ void printjob_decode(int jobid, int *snum, int *job);
void status_printqueue(connection_struct *conn,int snum,int status);
void load_printers(void);
-/*The following definitions come from printing/print_svid.c */
-
-void sysv_printer_fn(void (*fn)(char *, char *));
-int sysv_printername_ok(char *name);
-
/*The following definitions come from profile/profile.c */
BOOL profile_setup(BOOL rdonly);
@@ -1699,109 +1702,6 @@ BOOL do_wks_query_info(struct cli_state *cli,
char *server_name, uint32 switch_value,
WKS_INFO_100 *wks100);
-/*The following definitions come from rpcclient/cmd_lsarpc.c */
-
-void cmd_lsa_query_info(struct client_info *info);
-void cmd_lsa_lookup_sids(struct client_info *info);
-
-/*The following definitions come from rpcclient/cmd_netlogon.c */
-
-void cmd_netlogon_login_test(struct client_info *info);
-
-/*The following definitions come from rpcclient/cmd_reg.c */
-
-void cmd_reg_enum(struct client_info *info);
-void cmd_reg_query_key(struct client_info *info);
-void cmd_reg_create_val(struct client_info *info);
-void cmd_reg_delete_val(struct client_info *info);
-void cmd_reg_delete_key(struct client_info *info);
-void cmd_reg_create_key(struct client_info *info);
-void cmd_reg_test_key_sec(struct client_info *info);
-void cmd_reg_get_key_sec(struct client_info *info);
-
-/*The following definitions come from rpcclient/cmd_samr.c */
-
-void cmd_sam_ntchange_pwd(struct client_info *info);
-void cmd_sam_test(struct client_info *info);
-void cmd_sam_enum_users(struct client_info *info);
-void cmd_sam_query_user(struct client_info *info);
-void cmd_sam_query_groups(struct client_info *info);
-void cmd_sam_enum_aliases(struct client_info *info);
-
-/*The following definitions come from rpcclient/cmd_srvsvc.c */
-
-void cmd_srv_query_info(struct client_info *info);
-void cmd_srv_enum_conn(struct client_info *info);
-void cmd_srv_enum_shares(struct client_info *info);
-void cmd_srv_enum_sess(struct client_info *info);
-void cmd_srv_enum_files(struct client_info *info);
-
-/*The following definitions come from rpcclient/cmd_wkssvc.c */
-
-void cmd_wks_query_info(struct client_info *info);
-
-/*The following definitions come from rpcclient/display.c */
-
-char *get_file_mode_str(uint32 share_mode);
-char *get_file_oplock_str(uint32 op_type);
-char *get_share_type_str(uint32 type);
-char *get_server_type_str(uint32 type);
-void display_srv_info_101(FILE *out_hnd, enum action_type action,
- SRV_INFO_101 *sv101);
-void display_srv_info_102(FILE *out_hnd, enum action_type action,SRV_INFO_102 *sv102);
-void display_srv_info_ctr(FILE *out_hnd, enum action_type action,SRV_INFO_CTR *ctr);
-void display_conn_info_0(FILE *out_hnd, enum action_type action,
- CONN_INFO_0 *info0);
-void display_conn_info_1(FILE *out_hnd, enum action_type action,
- CONN_INFO_1 *info1, CONN_INFO_1_STR *str1);
-void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_0 *ctr);
-void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_1 *ctr);
-void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_CTR *ctr);
-void display_share_info_1(FILE *out_hnd, enum action_type action,
- SRV_SHARE_INFO_1 *info1);
-void display_share_info_2(FILE *out_hnd, enum action_type action,
- SRV_SHARE_INFO_2 *info2);
-void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_SHARE_INFO_CTR *ctr);
-void display_file_info_3(FILE *out_hnd, enum action_type action,
- FILE_INFO_3 *info3, FILE_INFO_3_STR *str3);
-void display_srv_file_info_3_ctr(FILE *out_hnd, enum action_type action,
- SRV_FILE_INFO_3 *ctr);
-void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_FILE_INFO_CTR *ctr);
-void display_server(FILE *out_hnd, enum action_type action,
- char *sname, uint32 type, char *comment);
-void display_share(FILE *out_hnd, enum action_type action,
- char *sname, uint32 type, char *comment);
-void display_share2(FILE *out_hnd, enum action_type action,
- char *sname, uint32 type, char *comment,
- uint32 perms, uint32 max_uses, uint32 num_uses,
- char *path, char *passwd);
-void display_name(FILE *out_hnd, enum action_type action,
- char *sname);
-void display_group_rid_info(FILE *out_hnd, enum action_type action,
- uint32 num_gids, DOM_GID *gid);
-void display_alias_name_info(FILE *out_hnd, enum action_type action,
- uint32 num_aliases, fstring *alias_name, uint32 *num_als_usrs);
-void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *usr);
-char *get_sec_mask_str(uint32 type);
-void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *info);
-void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *ace);
-void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *sec_acl);
-void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *sec);
-char *get_reg_val_type_str(uint32 type);
-void display_reg_value_info(FILE *out_hnd, enum action_type action,
- char *val_name, uint32 val_type, BUFFER2 *value);
-void display_reg_key_info(FILE *out_hnd, enum action_type action,
- char *key_name, time_t key_mod_time);
-
-/*The following definitions come from rpcclient/rpcclient.c */
-
-void rpcclient_init(void);
-
/*The following definitions come from rpc_parse/parse_creds.c */
BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
@@ -2859,6 +2759,109 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid);
BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data);
+/*The following definitions come from rpcclient/cmd_lsarpc.c */
+
+void cmd_lsa_query_info(struct client_info *info);
+void cmd_lsa_lookup_sids(struct client_info *info);
+
+/*The following definitions come from rpcclient/cmd_netlogon.c */
+
+void cmd_netlogon_login_test(struct client_info *info);
+
+/*The following definitions come from rpcclient/cmd_reg.c */
+
+void cmd_reg_enum(struct client_info *info);
+void cmd_reg_query_key(struct client_info *info);
+void cmd_reg_create_val(struct client_info *info);
+void cmd_reg_delete_val(struct client_info *info);
+void cmd_reg_delete_key(struct client_info *info);
+void cmd_reg_create_key(struct client_info *info);
+void cmd_reg_test_key_sec(struct client_info *info);
+void cmd_reg_get_key_sec(struct client_info *info);
+
+/*The following definitions come from rpcclient/cmd_samr.c */
+
+void cmd_sam_ntchange_pwd(struct client_info *info);
+void cmd_sam_test(struct client_info *info);
+void cmd_sam_enum_users(struct client_info *info);
+void cmd_sam_query_user(struct client_info *info);
+void cmd_sam_query_groups(struct client_info *info);
+void cmd_sam_enum_aliases(struct client_info *info);
+
+/*The following definitions come from rpcclient/cmd_srvsvc.c */
+
+void cmd_srv_query_info(struct client_info *info);
+void cmd_srv_enum_conn(struct client_info *info);
+void cmd_srv_enum_shares(struct client_info *info);
+void cmd_srv_enum_sess(struct client_info *info);
+void cmd_srv_enum_files(struct client_info *info);
+
+/*The following definitions come from rpcclient/cmd_wkssvc.c */
+
+void cmd_wks_query_info(struct client_info *info);
+
+/*The following definitions come from rpcclient/display.c */
+
+char *get_file_mode_str(uint32 share_mode);
+char *get_file_oplock_str(uint32 op_type);
+char *get_share_type_str(uint32 type);
+char *get_server_type_str(uint32 type);
+void display_srv_info_101(FILE *out_hnd, enum action_type action,
+ SRV_INFO_101 *sv101);
+void display_srv_info_102(FILE *out_hnd, enum action_type action,SRV_INFO_102 *sv102);
+void display_srv_info_ctr(FILE *out_hnd, enum action_type action,SRV_INFO_CTR *ctr);
+void display_conn_info_0(FILE *out_hnd, enum action_type action,
+ CONN_INFO_0 *info0);
+void display_conn_info_1(FILE *out_hnd, enum action_type action,
+ CONN_INFO_1 *info1, CONN_INFO_1_STR *str1);
+void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_0 *ctr);
+void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_1 *ctr);
+void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_CTR *ctr);
+void display_share_info_1(FILE *out_hnd, enum action_type action,
+ SRV_SHARE_INFO_1 *info1);
+void display_share_info_2(FILE *out_hnd, enum action_type action,
+ SRV_SHARE_INFO_2 *info2);
+void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SHARE_INFO_CTR *ctr);
+void display_file_info_3(FILE *out_hnd, enum action_type action,
+ FILE_INFO_3 *info3, FILE_INFO_3_STR *str3);
+void display_srv_file_info_3_ctr(FILE *out_hnd, enum action_type action,
+ SRV_FILE_INFO_3 *ctr);
+void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_FILE_INFO_CTR *ctr);
+void display_server(FILE *out_hnd, enum action_type action,
+ char *sname, uint32 type, char *comment);
+void display_share(FILE *out_hnd, enum action_type action,
+ char *sname, uint32 type, char *comment);
+void display_share2(FILE *out_hnd, enum action_type action,
+ char *sname, uint32 type, char *comment,
+ uint32 perms, uint32 max_uses, uint32 num_uses,
+ char *path, char *passwd);
+void display_name(FILE *out_hnd, enum action_type action,
+ char *sname);
+void display_group_rid_info(FILE *out_hnd, enum action_type action,
+ uint32 num_gids, DOM_GID *gid);
+void display_alias_name_info(FILE *out_hnd, enum action_type action,
+ uint32 num_aliases, fstring *alias_name, uint32 *num_als_usrs);
+void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *usr);
+char *get_sec_mask_str(uint32 type);
+void display_sec_access(FILE *out_hnd, enum action_type action, SEC_ACCESS *info);
+void display_sec_ace(FILE *out_hnd, enum action_type action, SEC_ACE *ace);
+void display_sec_acl(FILE *out_hnd, enum action_type action, SEC_ACL *sec_acl);
+void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *sec);
+char *get_reg_val_type_str(uint32 type);
+void display_reg_value_info(FILE *out_hnd, enum action_type action,
+ char *val_name, uint32 val_type, BUFFER2 *value);
+void display_reg_key_info(FILE *out_hnd, enum action_type action,
+ char *key_name, time_t key_mod_time);
+
+/*The following definitions come from rpcclient/rpcclient.c */
+
+void rpcclient_init(void);
+
/*The following definitions come from smbd/blocking.c */
BOOL push_blocking_lock_request( char *inbuf, int length, int lock_timeout, int lock_num);
@@ -3244,19 +3247,6 @@ BOOL unbecome_authenticated_pipe_user(pipes_struct *p);
void become_root(BOOL save_dir) ;
void unbecome_root(BOOL restore_dir);
-/*The following definitions come from smbd/vfs.c */
-
-int vfs_init_default(connection_struct *conn);
-BOOL vfs_init_custom(connection_struct *conn);
-BOOL vfs_directory_exist(connection_struct *conn, char *dname,
- SMB_STRUCT_STAT *st);
-BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf);
-ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N);
-SMB_OFF_T vfs_transfer_file(int in_fd, files_struct *in_fsp,
- int out_fd, files_struct *out_fsp,
- SMB_OFF_T n, char *header, int headlen, int align);
-char *vfs_readdirname(connection_struct *conn, void *p);
-
/*The following definitions come from smbd/vfs-wrap.c */
int vfswrap_dummy_connect(struct vfs_connection_struct *conn, char *service,
@@ -3284,6 +3274,19 @@ int vfswrap_unlink(char *path);
int vfswrap_chmod(char *path, mode_t mode);
int vfswrap_utime(char *path, struct utimbuf *times);
+/*The following definitions come from smbd/vfs.c */
+
+int vfs_init_default(connection_struct *conn);
+BOOL vfs_init_custom(connection_struct *conn);
+BOOL vfs_directory_exist(connection_struct *conn, char *dname,
+ SMB_STRUCT_STAT *st);
+BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf);
+ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N);
+SMB_OFF_T vfs_transfer_file(int in_fd, files_struct *in_fsp,
+ int out_fd, files_struct *out_fsp,
+ SMB_OFF_T n, char *header, int headlen, int align);
+char *vfs_readdirname(connection_struct *conn, void *p);
+
/*The following definitions come from smbwrapper/realcalls.c */
int real_utime(const char *name, struct utimbuf *buf);
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index a0dfe61f7d..c88f4e1a41 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -318,7 +318,8 @@ va_dcl
va_start( ap );
format_str = va_arg( ap, char * );
#endif
- (void)vfprintf( dbf, format_str, ap );
+ if(dbf)
+ (void)vfprintf( dbf, format_str, ap );
va_end( ap );
errno = old_errno;
return( 0 );
@@ -397,9 +398,11 @@ va_dcl
va_start( ap );
format_str = va_arg( ap, char * );
#endif
- (void)vfprintf( dbf, format_str, ap );
+ if(dbf)
+ (void)vfprintf( dbf, format_str, ap );
va_end( ap );
- (void)fflush( dbf );
+ if(dbf)
+ (void)fflush( dbf );
}
errno = old_errno;
@@ -488,7 +491,8 @@ static void format_debug_text( char *msg )
void dbgflush( void )
{
bufr_print();
- (void)fflush( dbf );
+ if(dbf)
+ (void)fflush( dbf );
} /* dbgflush */
/* ************************************************************************** **
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index 6a492f977c..8d91c2d785 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -163,15 +163,21 @@ Corrections by richard.kettlewell@kewill.com
/* yikes! no SETGROUPS or INITGROUPS? how can this work? */
return(0);
#else /* HAVE_SETGROUPS */
- gid_t grouplst[NGROUPS_MAX];
+ gid_t *grouplst = NULL;
+ int max_gr = groups_max();
+ int ret;
int i,j;
struct group *g;
char *gr;
+ if((grouplst = (gid_t *)malloc(sizeof(gid_t) * max_gr)) == NULL) {
+ DEBUG(0,("initgroups: malloc fail !\n");
+ return -1;
+ }
+
grouplst[0] = id;
i = 1;
- while (i < NGROUPS_MAX &&
- ((g = (struct group *)getgrent()) != (struct group *)NULL)) {
+ while (i < max_gr && ((g = (struct group *)getgrent()) != (struct group *)NULL)) {
if (g->gr_gid == id)
continue;
j = 0;
@@ -187,7 +193,9 @@ Corrections by richard.kettlewell@kewill.com
}
}
endgrent();
- return(sys_setgroups(i,grouplst));
+ ret = sys_setgroups(i,grouplst);
+ free((char *)grouplst);
+ return ret;
#endif /* HAVE_SETGROUPS */
}
#endif /* HAVE_INITGROUPS */
diff --git a/source3/lib/system.c b/source3/lib/system.c
index d146749974..25925b6d8e 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -562,6 +562,20 @@ void sys_srandom(unsigned int seed)
}
/**************************************************************************
+ Returns equivalent to NGROUPS_MAX - using sysconf if needed.
+****************************************************************************/
+
+int groups_max(void)
+{
+#if defined(SYSCONF_SC_NGROUPS_MAX)
+ int ret = sysconf(_SC_NGROUPS_MAX);
+ return (ret == -1) ? NGROUPS_MAX : ret;
+#else
+ return NGROUPS_MAX;
+#endif
+}
+
+/**************************************************************************
Wrapper for getgroups. Deals with broken (int) case.
****************************************************************************/
@@ -590,7 +604,7 @@ int sys_getgroups(int setlen, gid_t *gidset)
}
if (setlen == 0)
- setlen = 1;
+ setlen = groups_max();
if((group_list = (GID_T *)malloc(setlen * sizeof(GID_T))) == NULL) {
DEBUG(0,("sys_getgroups: Malloc fail.\n"));
@@ -631,21 +645,16 @@ int sys_setgroups(int setlen, gid_t *gidset)
if (setlen == 0)
return 0 ;
-#ifdef NGROUPS_MAX
- if (setlen > NGROUPS_MAX) {
+ if (setlen < 0 || setlen > groups_max()) {
errno = EINVAL;
return -1;
}
-#endif
/*
* Broken case. We need to allocate a
* GID_T array of size setlen.
*/
- if (setlen == 0)
- setlen = 1;
-
if((group_list = (GID_T *)malloc(setlen * sizeof(GID_T))) == NULL) {
DEBUG(0,("sys_setgroups: Malloc fail.\n"));
return -1;
@@ -892,3 +901,211 @@ SMB_STRUCT_WPASSWD *wsys_getpwuid(uid_t uid)
return &retval;
}
+
+/**************************************************************************
+ Extract a command into an arg list. Uses a static pstring for storage.
+ Caller frees returned arg list (which contains pointers into the static pstring).
+****************************************************************************/
+
+static char **extract_args(const char *command)
+{
+ static pstring trunc_cmd;
+ char *ptr;
+ int argcl;
+ char **argl = NULL;
+ int i;
+
+ pstrcpy(trunc_cmd, command);
+
+ if(!(ptr = strtok(trunc_cmd, " \t"))) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ /*
+ * Count the args.
+ */
+
+ for( argcl = 1; ptr; ptr = strtok(NULL, " \t"))
+ argcl++;
+
+ if((argl = (char **)malloc((argcl + 1) * sizeof(char *))) == NULL)
+ return NULL;
+
+ /*
+ * Now do the extraction.
+ */
+
+ pstrcpy(trunc_cmd, command);
+
+ ptr = strtok(trunc_cmd, " \t");
+ i = 0;
+ argl[i++] = ptr;
+
+ while((ptr = strtok(NULL, " \t")) != NULL)
+ argl[i++] = ptr;
+
+ argl[i++] = NULL;
+ return argl;
+}
+
+/**************************************************************************
+ Wrapper for popen. Safer as it doesn't search a path.
+ Modified from the glibc sources.
+****************************************************************************/
+
+typedef struct _popen_list
+{
+ FILE *fp;
+ pid_t child_pid;
+ struct _popen_list *next;
+} popen_list;
+
+static popen_list *popen_chain;
+
+FILE *sys_popen(const char *command, const char *mode)
+{
+ int parent_end, child_end;
+ int pipe_fds[2];
+ popen_list *entry = NULL;
+ pid_t child_pid;
+ char **argl = NULL;
+
+ if (pipe(pipe_fds) < 0)
+ return NULL;
+
+ if (mode[0] == 'r' && mode[1] == '\0') {
+ parent_end = pipe_fds[0];
+ child_end = pipe_fds[1];
+ } else if (mode[0] == 'w' && mode[1] == '\0') {
+ parent_end = pipe_fds[1];
+ child_end = pipe_fds[0];
+ } else {
+ errno = EINVAL;
+ goto err_exit;
+ }
+
+ if (!*command) {
+ errno = EINVAL;
+ goto err_exit;
+ }
+
+ if((entry = (popen_list *)malloc(sizeof(popen_list))) == NULL)
+ goto err_exit;
+
+ /*
+ * Extract the command and args into a NULL terminated array.
+ */
+
+ if(!(argl = extract_args(command)))
+ goto err_exit;
+
+ entry->child_pid = fork();
+
+ if (entry->child_pid == -1) {
+
+ /*
+ * Error !
+ */
+
+ goto err_exit;
+ }
+
+ if (entry->child_pid == 0) {
+
+ /*
+ * Child !
+ */
+
+ int child_std_end = (mode[0] == 'r') ? STDOUT_FILENO : STDIN_FILENO;
+ popen_list *p;
+
+ close(parent_end);
+ if (child_end != child_std_end) {
+ dup2 (child_end, child_std_end);
+ close (child_end);
+ }
+
+ /*
+ * POSIX.2: "popen() shall ensure that any streams from previous
+ * popen() calls that remain open in the parent process are closed
+ * in the new child process."
+ */
+
+ for (p = popen_chain; p; p = p->next)
+ close(fileno(p->fp));
+
+ execv(argl[0], argl);
+ _exit (127);
+ }
+
+ /*
+ * Parent.
+ */
+
+ close (child_end);
+ free((char *)argl);
+
+ /*
+ * Create the FILE * representing this fd.
+ */
+ entry->fp = fdopen(parent_end, mode);
+
+ /* Link into popen_chain. */
+ entry->next = popen_chain;
+ popen_chain = entry;
+
+ return entry->fp;
+
+err_exit:
+
+ if(entry)
+ free((char *)entry);
+ if(argl)
+ free((char *)argl);
+ close(pipe_fds[0]);
+ close(pipe_fds[1]);
+ return NULL;
+}
+
+/**************************************************************************
+ Wrapper for pclose. Modified from the glibc sources.
+****************************************************************************/
+
+int sys_pclose( FILE *fp)
+{
+ int wstatus;
+ popen_list **ptr = &popen_chain;
+ popen_list *entry = NULL;
+ pid_t wait_pid;
+ int status = -1;
+
+ /* Unlink from popen_chain. */
+ for ( ; *ptr != NULL; ptr = &(*ptr)->next) {
+ if ((*ptr)->fp == fp) {
+ entry = *ptr;
+ *ptr = (*ptr)->next;
+ status = 0;
+ break;
+ }
+ }
+
+ if (status < 0 || close(fileno(entry->fp)) < 0)
+ return -1;
+
+ /*
+ * As Samba is catching and eating child process
+ * exits we don't really care about the child exit
+ * code, a -1 with errno = ECHILD will do fine for us.
+ */
+
+ do {
+ wait_pid = sys_waitpid (entry->child_pid, &wstatus, 0);
+ } while (wait_pid == -1 && errno == EINTR);
+
+ free((char *)entry);
+
+ if (wait_pid == -1)
+ return -1;
+ return wstatus;
+}
diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c
index ffc059f9f9..9891e158a2 100644
--- a/source3/printing/print_svid.c
+++ b/source3/printing/print_svid.c
@@ -47,10 +47,9 @@ static printer_t *printers = NULL;
static void populate_printers(void)
{
-#ifdef HAVE_POPEN
FILE *fp;
- if ((fp = popen("/usr/bin/lpstat -v", "r")) != NULL) {
+ if ((fp = sys_popen("/usr/bin/lpstat -v", "r")) != NULL) {
char buf[BUFSIZ];
while (fgets(buf, sizeof (buf), fp) != NULL) {
@@ -88,13 +87,10 @@ static void populate_printers(void)
DEBUG(0,("populate_printers: malloc fail for ptmp\n"));
}
}
- pclose(fp);
+ sys_pclose(fp);
} else {
DEBUG(0,( "Unable to run lpstat!\n"));
}
-#else
- DEBUG(0,( "No popen() defined: Unable to run lpstat!\n"));
-#endif
}
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index 7838080461..7866d60277 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -208,7 +208,6 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query,
* If external disk calculation specified, use it.
*/
-#ifdef HAVE_POPEN
dfree_command = lp_dfree_command();
if (dfree_command && *dfree_command) {
pstring line;
@@ -216,7 +215,9 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query,
FILE *pp;
slprintf (line, sizeof(pstring) - 1, "%s %s", dfree_command, path);
- pp = popen(line, "r");
+ DEBUG (3, ("disk_free: Running command %s\n", line));
+
+ pp = sys_popen(line, "r");
if (pp) {
fgets(line, sizeof(pstring), pp);
line[sizeof(pstring)-1] = '\0';
@@ -236,7 +237,7 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query,
*bsize = (SMB_BIG_UINT)strtoul(p, NULL, 10);
else
*bsize = 1024;
- pclose (pp);
+ sys_pclose (pp);
DEBUG (3, ("Parsed output of dfree, dsize=%u, dfree=%u, bsize=%u\n",
(unsigned int)*dsize, (unsigned int)*dfree, (unsigned int)*bsize));
@@ -245,12 +246,11 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query,
if (!*dfree)
*dfree = 1024;
} else {
- DEBUG (0, ("disk_free: popen() failed for command %s. Error was : %s\n",
+ DEBUG (0, ("disk_free: sys_popen() failed for command %s. Error was : %s\n",
line, strerror(errno) ));
fsusage(path, dfree, dsize);
}
} else
-#endif /* HAVE_POPEN */
fsusage(path, dfree, dsize);
if (disk_quotas(path, &bsize_q, &dfree_q, &dsize_q)) {
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index d9ad16e7d3..e94e603661 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -843,15 +843,13 @@ int reply_ntcreate_and_X(connection_struct *conn,
}
if(fsp->is_directory) {
- if(fsp->conn->vfs_ops.stat(dos_to_unix(fsp->fsp_name, False),
- &sbuf) != 0) {
+ if(conn->vfs_ops.stat(dos_to_unix(fsp->fsp_name, False), &sbuf) != 0) {
close_file(fsp,True);
restore_case_semantics(file_attributes);
return(ERROR(ERRDOS,ERRnoaccess));
}
} else {
- if (fsp->conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf)
- != 0) {
+ if (conn->vfs_ops.fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fsp,False);
restore_case_semantics(file_attributes);
return(ERROR(ERRDOS,ERRnoaccess));
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 44fbdfa8ec..19e7d36443 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -175,14 +175,10 @@ int setup_groups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_gro
ngroups = sys_getgroups(0,&grp);
if (ngroups <= 0)
{
- ngroups = 32;
+ ngroups = groups_max();
}
-#ifdef NGROUPS_MAX
- if((groups = (gid_t *)malloc(sizeof(gid_t)*NGROUPS_MAX)) == NULL)
-#else /* NGROUPS_MAX */
if((groups = (gid_t *)malloc(sizeof(gid_t)*ngroups)) == NULL)
-#endif /* NGROUPS_MAX */
{
DEBUG(0,("setup_groups malloc fail !\n"));
return -1;
diff --git a/source3/utils/make_printerdef.c b/source3/utils/make_printerdef.c
index fc1f8ad781..33aec325c2 100644
--- a/source3/utils/make_printerdef.c
+++ b/source3/utils/make_printerdef.c
@@ -27,7 +27,7 @@
*/
char *files_to_copy;
-char *driverfile, *datafile, *helpfile, *languagemonitor, *datatype;
+char *driverfile, *datafile, *helpfile, *languagemonitor, *datatype, *vendorsetup;
char buffer[50][sizeof(pstring)];
char sbuffer[50][sizeof(pstring)];
char sub_dir[50][2][sizeof(pstring)];
@@ -96,13 +96,20 @@ static char *scan(char *chaine,char **entry)
i++;
}
(*entry)[i]='\0';
- pstrcpy(value,temp+i+1);
+ if (temp[i]!='\0') {
+ i++;
+ }
+ while( temp[i]==' ' && temp[i]!='\0') {
+ i++;
+ }
+ pstrcpy(value,temp+i);
return (value);
}
static void build_subdir(void)
{
int i=0;
+ int j=0;
char *entry;
char *data;
@@ -111,12 +118,18 @@ static void build_subdir(void)
#ifdef DEBUGIT
fprintf(stderr,"\tentry=data %s:%s\n",entry,data);
#endif
+ j = strlen(entry);
+ while (j) {
+ if (entry[j-1] != ' ') break;
+ j--;
+ }
+ entry[j] = '\0';
- if (strcmp(data,"11")==0) {
+ if (strncmp(data,"11",2)==0) {
pstrcpy(sub_dir[i][0],entry);
pstrcpy(sub_dir[i][1],"");
}
- if (strcmp(data,"23")==0) {
+ if (strncmp(data,"23",2)==0) {
pstrcpy(sub_dir[i][0],entry);
pstrcpy(sub_dir[i][1],"color\\");
}
@@ -362,15 +375,21 @@ static void scan_copyfiles(FILE *fichier, char *chaine)
else break;
}
}
- if (strlen(files_to_copy) != 0)
- pstrcat(files_to_copy,",");
- pstrcat(files_to_copy,direc);
- pstrcat(files_to_copy,buffer[i]);
- fprintf(stderr,"%s%s\n",direc,buffer[i]);
+ if (*buffer[i] != ';') {
+ if (strlen(files_to_copy) != 0)
+ pstrcat(files_to_copy,",");
+ pstrcat(files_to_copy,direc);
+ pstrcat(files_to_copy,buffer[i]);
+ fprintf(stderr,"%s%s\n",direc,buffer[i]);
+ }
i++;
}
}
part=strtok(NULL,",");
+ if (part)
+ while( *part ==' ' && *part != '\0') {
+ part++;
+ }
}
while (part!=NULL);
fprintf(stderr,"\n");
@@ -385,6 +404,7 @@ static void scan_short_desc(FILE *fichier, char *short_desc)
helpfile=0;
languagemonitor=0;
+ vendorsetup=0;
datatype="RAW";
if((temp=(char *)malloc(sizeof(pstring))) == NULL) {
fprintf(stderr, "scan_short_desc: malloc fail !\n");
@@ -414,6 +434,8 @@ static void scan_short_desc(FILE *fichier, char *short_desc)
languagemonitor=scan(buffer[i],&temp);
else if (strncasecmp(buffer[i],"DefaultDataType",15)==0)
datatype=scan(buffer[i],&temp);
+ else if (strncasecmp(buffer[i],"VendorSetup",11)==0)
+ vendorsetup=scan(buffer[i],&temp);
i++;
}
@@ -439,6 +461,8 @@ static void scan_short_desc(FILE *fichier, char *short_desc)
languagemonitor=scan(buffer[i],&temp);
else if (strncasecmp(buffer[i],"DefaultDataType",15)==0)
datatype=scan(buffer[i],&temp);
+ else if (strncasecmp(buffer[i],"VendorSetup",11)==0)
+ vendorsetup=scan(buffer[i],&temp);
i++;
}
}
@@ -464,6 +488,8 @@ static void scan_short_desc(FILE *fichier, char *short_desc)
helpfile?helpfile:"(null)");
fprintf(stderr,"LanguageMonitor: %s\n",
languagemonitor?languagemonitor:"(null)");
+ fprintf(stderr,"VendorSetup: %s\n",
+ vendorsetup?vendorsetup:"(null)");
if (copyfiles) scan_copyfiles(fichier,copyfiles);
}