summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-06-27 12:03:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2008-06-27 12:03:23 +1000
commit7a295c66c056bc6eeb26d2176584fff4152b90b8 (patch)
tree6d18c2cb68f89f36e8085689e282fbf1cbc3e95f /source4
parent1e36856ae50762ebad2d16e81b7ad604509b0d52 (diff)
parentd4172dac2c122bc2cf5f419d5687168468a9a141 (diff)
downloadsamba-7a295c66c056bc6eeb26d2176584fff4152b90b8.tar.gz
samba-7a295c66c056bc6eeb26d2176584fff4152b90b8.tar.bz2
samba-7a295c66c056bc6eeb26d2176584fff4152b90b8.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
(This used to be commit 9607e79c3db9743617397c347bb69f87f6525801)
Diffstat (limited to 'source4')
-rw-r--r--source4/Makefile35
-rw-r--r--source4/build/make/rules.mk2
-rw-r--r--source4/build/make/templates.mk33
-rw-r--r--source4/build/smb_build/makefile.pm9
-rwxr-xr-xsource4/client/tests/test_cifsdd.sh73
-rwxr-xr-xsource4/client/tests/test_smbclient.sh166
-rwxr-xr-xsource4/heimdal_build/asn1_deps.pl3
-rw-r--r--source4/heimdal_build/config.h2
-rwxr-xr-xsource4/heimdal_build/et_deps.pl3
-rw-r--r--source4/lib/events/libevents.m422
-rw-r--r--source4/lib/ldb/config.mk62
-rw-r--r--source4/lib/ldb/ldb_ildap/config.mk4
-rw-r--r--source4/lib/ldb/tools/config.mk28
-rw-r--r--source4/lib/popt/config.mk2
-rwxr-xr-xsource4/nsswitch/tests/test_wbinfo.sh187
-rw-r--r--source4/nsswitch/wbinfo.c40
-rwxr-xr-xsource4/script/installbin.sh40
-rwxr-xr-xsource4/script/uninstallbin.sh42
-rw-r--r--source4/selftest/config.mk2
-rwxr-xr-xsource4/selftest/samba4_tests.sh8
-rw-r--r--source4/smbd/server.c20
21 files changed, 582 insertions, 201 deletions
diff --git a/source4/Makefile b/source4/Makefile
index 37d601f4f3..3c2efe35af 100644
--- a/source4/Makefile
+++ b/source4/Makefile
@@ -71,6 +71,7 @@ smbreadlinesrcdir := lib/smbreadline
libmessagingsrcdir := lib/messaging
libeventssrcdir := lib/events
libcmdlinesrcdir := lib/cmdline
+poptsrcdir := lib/popt
socketwrappersrcdir := lib/socket_wrapper
nsswrappersrcdir := lib/nss_wrapper
appwebsrcdir := lib/appweb
@@ -105,8 +106,6 @@ ntp_signdsrcdir := ntp_signd
include data.mk
-BINARIES += $(BIN_PROGS) $(SBIN_PROGS)
-
pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
@@ -135,7 +134,6 @@ endif
DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
$(srcdir)/version.h
-binaries:: $(BINARIES)
libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
modules:: $(PLUGINS)
headers:: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
@@ -212,20 +210,6 @@ installdirs::
$(DESTDIR)$(sysconfdir) \
installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
- @$(SHELL) $(srcdir)/script/installbin.sh \
- $(INSTALLPERMS) \
- $(DESTDIR)$(BASEDIR) \
- $(DESTDIR)$(sbindir) \
- $(DESTDIR)$(libdir) \
- $(DESTDIR)$(localstatedir) \
- $(SBIN_PROGS)
- @$(SHELL) $(srcdir)/script/installbin.sh \
- $(INSTALLPERMS) \
- $(DESTDIR)$(BASEDIR) \
- $(DESTDIR)$(bindir) \
- $(DESTDIR)$(libdir) \
- $(DESTDIR)$(localstatedir) \
- $(BIN_PROGS)
@$(SHELL) $(srcdir)/script/installtorture.sh \
$(INSTALLPERMS) \
$(DESTDIR)$(TORTUREDIR) \
@@ -262,6 +246,20 @@ uninstall:: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader
uninstallmisc::
#FIXME
+$(DESTDIR)$(bindir)/%: bin/% installdirs
+ @mkdir -p $(@D)
+ @echo Installing $(@F) as $@
+ @if test -f $@; then; rm -f $@.old; mv $@ $@.old; fi
+ @cp $< $@
+ @chmod $(INSTALLPERMS) $@
+
+$(DESTDIR)$(sbindir)/%: bin/% installdirs
+ @mkdir -p $(@D)
+ @echo Installing $(@F) as $@
+ @if test -f $@; then; rm -f $@.old; mv $@ $@.old; fi
+ @cp $< $@
+ @chmod $(INSTALLPERMS) $@
+
uninstallbin::
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(BIN_PROGS)
@@ -289,7 +287,8 @@ data.mk: config.status $(MK_FILES)
testcov-html::
include $(pidldir)/config.mk
-include $(srcdir)/selftest/config.mk
+selftestdir := $(srcdir)/selftest
+include $(selftestdir)/config.mk
showflags::
@echo ' pwd = '`/bin/pwd`
diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk
index 27a214459a..f8df8f0b53 100644
--- a/source4/build/make/rules.mk
+++ b/source4/build/make/rules.mk
@@ -43,8 +43,6 @@ clean:: clean_pch
@-find . -name '*.o' -exec rm -f '{}' \;
@echo Removing hostcc objects
@-find . -name '*.ho' -exec rm -f '{}' \;
- @echo Removing binaries
- @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
@echo Removing libraries
@-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
@-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
diff --git a/source4/build/make/templates.mk b/source4/build/make/templates.mk
index 41a7ccd0a5..d4973e7dd6 100644
--- a/source4/build/make/templates.mk
+++ b/source4/build/make/templates.mk
@@ -22,6 +22,12 @@ define binary_link_template
$(1): $(2) ;
@echo Linking $$@
@$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+
+clean::
+ @rm -f $(1)
+
+binaries:: $(1)
+
endef
# Link a host-machine binary
@@ -30,6 +36,12 @@ define host_binary_link_template
$(1): $(2) ;
@echo Linking $$@
@$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+
+clean::
+ rm -f $(1)
+
+binaries:: $(1)
+
endef
# Create a prototype header
@@ -106,3 +118,24 @@ uninstallplugins::
@-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
endef
+
+# abspath for older makes
+abspath := $(shell cd $(1); pwd)
+
+# Install a binary
+# Arguments: path to binary to install
+define binary_install_template
+installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1))
+
+uninstallbin::
+ @echo "Removing $(notdir $(1))"
+ @rm -f $$(DESTDIR)$$(bindir)/$(1)
+endef
+
+define sbinary_install_template
+installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1)) installdirs
+
+uninstallsbin::
+ @echo "Removing $(notdir $(1))"
+ @rm -f $$(DESTDIR)$$(sbindir)/$(1)
+endef
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 0ea31062f7..d9cbca0614 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -196,11 +196,10 @@ sub Binary($$)
my ($self,$ctx) = @_;
unless (defined($ctx->{INSTALLDIR})) {
- $self->output("BINARIES += $ctx->{TARGET_BINARY}\n");
} elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
- $self->output("SBIN_PROGS += $ctx->{RESULT_BINARY}\n");
+ $self->output("\$(eval \$(call sbinary_install_template,$ctx->{RESULT_BINARY}))\n");
} elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
- $self->output("BIN_PROGS += $ctx->{RESULT_BINARY}\n");
+ $self->output("\$(eval \$(call binary_install_template,$ctx->{RESULT_BINARY}))\n");
}
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
@@ -208,9 +207,9 @@ sub Binary($$)
$self->_prepare_list($ctx, "LINK_FLAGS");
if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") {
-$self->output("\$(call host_binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n");
+$self->output("\$(eval \$(call host_binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS)))\n");
} else {
-$self->output("\$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n");
+$self->output("\$(eval \$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS)))\n");
}
}
diff --git a/source4/client/tests/test_cifsdd.sh b/source4/client/tests/test_cifsdd.sh
new file mode 100755
index 0000000000..08bfb25e80
--- /dev/null
+++ b/source4/client/tests/test_cifsdd.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# Basic script to make sure that cifsdd can do both local and remote I/O.
+
+if [ $# -lt 4 ]; then
+cat <<EOF
+Usage: test_cifsdd.sh SERVER USERNAME PASSWORD DOMAIN
+EOF
+exit 1;
+fi
+
+SERVER=$1
+USERNAME=$2
+PASSWORD=$3
+DOMAIN=$4
+
+. `dirname $0`/../../../testprogs/blackbox/subunit.sh
+
+samba4bindir=`dirname $0`/../../bin
+DD=$samba4bindir/cifsdd
+
+SHARE=tmp
+DEBUGLEVEL=1
+
+runcopy() {
+ message="$1"
+ shift
+
+ testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \
+ "$@" || failed=`expr $failed + 1`
+}
+
+compare() {
+ testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1`
+}
+
+sourcepath=tempfile.src.$$
+destpath=tempfile.dst.$$
+
+# Create a source file with arbitrary contents
+dd if=$DD of=$sourcepath bs=1024 count=50 > /dev/null
+
+ls -l $sourcepath
+
+for bs in 512 4k 48k ; do
+
+echo "Testing $bs block size ..."
+
+# Check whether we can do local IO
+runcopy "Testing local -> local copy" if=$sourcepath of=$destpath bs=$bs
+compare "Checking local differences" $sourcepath $destpath
+
+# Check whether we can do a round trip
+runcopy "Testing local -> remote copy" \
+ if=$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
+runcopy "Testing remote -> local copy" \
+ if=//$SERVER/$SHARE/$sourcepath of=$destpath bs=$bs
+compare "Checking differences" $sourcepath $destpath
+
+# Check that copying within the remote server works
+runcopy "Testing local -> remote copy" \
+ if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
+runcopy "Testing remote -> remote copy" \
+ if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$destpath bs=$bs
+runcopy "Testing remote -> local copy" \
+ if=//$SERVER/$SHARE/$destpath of=$destpath bs=$bs
+compare "Checking differences" $sourcepath $destpath
+
+done
+
+rm -f $sourcepath $destpath
+
+exit $failed
diff --git a/source4/client/tests/test_smbclient.sh b/source4/client/tests/test_smbclient.sh
new file mode 100755
index 0000000000..27a3488c88
--- /dev/null
+++ b/source4/client/tests/test_smbclient.sh
@@ -0,0 +1,166 @@
+#!/bin/sh
+# Blackbox tests for smbclient
+# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer@samba.org>
+# Copyright (C) 2006-2007 Andrew Bartlett <abartlet@samba.org>
+
+if [ $# -lt 5 ]; then
+cat <<EOF
+Usage: test_smbclient.sh SERVER USERNAME PASSWORD DOMAIN PREFIX
+EOF
+exit 1;
+fi
+
+SERVER=$1
+USERNAME=$2
+PASSWORD=$3
+DOMAIN=$4
+PREFIX=$5
+shift 5
+failed=0
+
+samba4bindir=`dirname $0`/../../bin
+smbclient=$samba4bindir/smbclient
+
+. `dirname $0`/../../../testprogs/blackbox/subunit.sh
+
+runcmd() {
+ name="$1"
+ cmd="$2"
+ shift
+ shift
+ echo "test: $name"
+ $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@
+ status=$?
+ if [ x$status = x0 ]; then
+ echo "success: $name"
+ else
+ echo "failure: $name"
+ fi
+ return $status
+}
+
+testit "share and server list" $VALGRIND $smbclient -L $SERVER $CONFIGURATION -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1`
+
+testit "share and server list anonymously" $VALGRIND $smbclient -N -L $SERVER $CONFIGURATION $@ || failed=`expr $failed + 1`
+
+testit "domain join" $VALGRIND bin/net join $DOMAIN $CONFIGURATION -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1`
+
+# Generate random file
+cat >tmpfile<<EOF
+foo
+bar
+bloe
+blah
+EOF
+
+# put that file
+runcmd "MPutting file" 'mput tmpfile' || failed=`expr $failed + 1`
+# check file info
+runcmd "Getting alternative name" 'altname tmpfile'|| failed=`expr $failed + 1`
+# run allinfo on that file
+runcmd "Checking info on file" 'allinfo tmpfile'|| failed=`expr $failed + 1`
+# get that file
+mv tmpfile tmpfile-old
+runcmd "MGetting file" 'mget tmpfile' || failed=`expr $failed + 1`
+# remove that file
+runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1`
+# compare locally
+testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
+# create directory
+# cd to directory
+# cd to top level directory
+# remove directory
+runcmd "Creating directory, Changing directory, Going back" 'mkdir bla; cd bla; cd ..; rmdir bla' || failed=`expr $failed + 1`
+# enable recurse, create nested directory
+runcmd "Creating nested directory" 'mkdir bla/bloe' || failed=`expr $failed + 1`
+# remove child directory
+runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1`
+# remove parent directory
+runcmd "Removing directory" 'rmdir bla'|| failed=`expr $failed + 1`
+# enable recurse, create nested directory
+runcmd "Creating nested directory" 'mkdir bla' || failed=`expr $failed + 1`
+# rename bla to bla2
+runcmd "rename of nested directory" 'rename bla bla2' || failed=`expr $failed + 1`
+# deltree
+runcmd "deltree of nested directory" 'deltree bla2' || failed=`expr $failed + 1`
+# run fsinfo
+runcmd "Getting file system info" 'fsinfo allocation'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo volume'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo volumeinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo sizeinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo deviceinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo attributeinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo volume-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo size-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo device-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo attribute-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo quota-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo fullsize-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo objectid'|| failed=`expr $failed + 1`
+
+# put that file
+runcmd "Putting file" 'put tmpfile'|| failed=`expr $failed + 1`
+# get that file
+mv tmpfile tmpfile-old
+runcmd "Getting file" 'get tmpfile'|| failed=`expr $failed + 1`
+runcmd "Getting file EA info" 'eainfo tmpfile'|| failed=`expr $failed + 1`
+# remove that file
+runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1`
+# compare locally
+testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
+# put that file
+runcmd "Putting file with different name" 'put tmpfile tmpfilex' || failed=`expr $failed + 1`
+# get that file
+runcmd "Getting file again" 'get tmpfilex' || failed=`expr $failed + 1`
+# compare locally
+testit "Comparing files" diff tmpfilex tmpfile || failed=`expr $failed + 1`
+# remove that file
+runcmd "Removing file" 'rm tmpfilex'|| failed=`expr $failed + 1`
+
+runcmd "Lookup name" "lookup $DOMAIN\\$USERNAME" || failed=`expr $failed + 1`
+
+#Fails unless there are privilages
+#runcmd "Lookup privs of name" "privileges $DOMAIN\\$USERNAME" || failed=`expr $failed + 1`
+
+# do some simple operations using old protocol versions
+runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 || failed=`expr $failed + 1`
+runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 || failed=`expr $failed + 1`
+
+runcmd "Print current working directory" 'pwd'|| failed=`expr $failed + 1`
+
+testit "Test login with --machine-pass without kerberos" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --machine-pass -k no || failed=`expr $failed + 1`
+
+testit "Test login with --machine-pass and kerberos" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --machine-pass -k yes || failed=`expr $failed + 1`
+
+(
+ echo "password=$PASSWORD"
+ echo "username=$USERNAME"
+ echo "domain=$DOMAIN"
+) > tmpauthfile
+
+testit "Test login with --authentication-file" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --authentication-file=tmpauthfile || failed=`expr $failed + 1`
+
+PASSWD_FILE="tmppassfile"
+echo "$PASSWORD" > $PASSWD_FILE
+export PASSWD_FILE
+testit "Test login with PASSWD_FILE" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
+PASSWD_FILE=""
+export PASSWD_FILE
+unset PASSWD_FILE
+
+PASSWD="$PASSWORD"
+export PASSWD
+testit "Test login with PASSWD" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
+
+oldUSER=$USER
+USER="$USERNAME"
+export USER
+testit "Test login with USER and PASSWD" $VALGRIND $smbclient -k no -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" || failed=`expr $failed + 1`
+PASSWD=
+export PASSWD
+unset PASSWD
+USER=$oldUSER
+export USER
+
+rm -f tmpfile tmpfile-old tmpfilex tmpauthfile tmppassfile
+exit $failed
diff --git a/source4/heimdal_build/asn1_deps.pl b/source4/heimdal_build/asn1_deps.pl
index 80334328fc..6b7181c4dd 100755
--- a/source4/heimdal_build/asn1_deps.pl
+++ b/source4/heimdal_build/asn1_deps.pl
@@ -6,7 +6,6 @@
# GPL
use File::Basename;
-use Cwd 'getcwd';
my $file = shift;
my $prefix = shift;
@@ -32,7 +31,7 @@ my $header = "$dirname/$prefix.h";
print "$header: \$(heimdalsrcdir)/$file \$(ASN1C)\n";
print "\t\@echo \"Compiling ASN1 file \$(heimdalsrcdir)/$file\"\n";
-print "\t\@\$(heimdalbuildsrcdir)/asn1_compile_wrapper.sh \$(builddir) $dirname \$(ASN1C) " . getcwd() . "/\$(heimdalsrcdir)/$file $prefix $options\n\n";
+print "\t\@\$(heimdalbuildsrcdir)/asn1_compile_wrapper.sh \$(builddir) $dirname \$(ASN1C) \$(call abspath,\$(heimdalsrcdir)/$file) $prefix $options\n\n";
open(IN,"heimdal/$file") or die("Can't open heimdal/$file: $!");
my @lines = <IN>;
diff --git a/source4/heimdal_build/config.h b/source4/heimdal_build/config.h
index e2c735a65f..38cdfbb6a6 100644
--- a/source4/heimdal_build/config.h
+++ b/source4/heimdal_build/config.h
@@ -21,4 +21,6 @@
#define HDB_DB_DIR ""
+#undef HAVE_KRB5_ENCRYPT_BLOCK
+
#endif
diff --git a/source4/heimdal_build/et_deps.pl b/source4/heimdal_build/et_deps.pl
index 5deabe82b5..5032d471c7 100755
--- a/source4/heimdal_build/et_deps.pl
+++ b/source4/heimdal_build/et_deps.pl
@@ -1,7 +1,6 @@
#!/usr/bin/perl
use File::Basename;
-use Cwd 'getcwd';
my $file = shift;
my $dirname = shift;
@@ -11,7 +10,7 @@ my $header = "$dirname/$basename"; $header =~ s/\.et$/.h/;
my $source = "$dirname/$basename"; $source =~ s/\.et$/.c/;
print "$header $source: \$(heimdalsrcdir)/$file \$(ET_COMPILER)\n";
print "\t\@echo \"Compiling error table $file\"\n";
-print "\t\@\$(heimdalbuildsrcdir)/et_compile_wrapper.sh \$(builddir) $dirname \$(ET_COMPILER) " . getcwd() . "/\$(heimdalsrcdir)/$file $source\n\n";
+print "\t\@\$(heimdalbuildsrcdir)/et_compile_wrapper.sh \$(builddir) $dirname \$(ET_COMPILER) \$(call abspath,\$(heimdalsrcdir)/$file) $source\n\n";
print "clean:: \n";
print "\t\@rm -f $header $source\n\n";
diff --git a/source4/lib/events/libevents.m4 b/source4/lib/events/libevents.m4
index 552dc7c43e..d17da64b32 100644
--- a/source4/lib/events/libevents.m4
+++ b/source4/lib/events/libevents.m4
@@ -1,16 +1,18 @@
dnl find the events sources. This is meant to work both for
dnl standalone builds, and builds of packages using libevents
-eventsdir=""
-eventspaths="$srcdir $srcdir/lib/events $srcdir/events $srcdir/../events"
-for d in $eventspaths; do
- if test -f "$d/events.c"; then
- eventsdir="$d"
- AC_SUBST(eventsdir)
- break;
- fi
-done
if test x"$eventsdir" = "x"; then
- AC_MSG_ERROR([cannot find libevents source in $eventspaths])
+ eventsdir=""
+ eventspaths="$srcdir $srcdir/../samba4/source/lib/events $srcdir/lib/events $srcdir/events $srcdir/../events"
+ for d in $eventspaths; do
+ if test -f "$d/events.c"; then
+ eventsdir="$d"
+ AC_SUBST(eventsdir)
+ break;
+ fi
+ done
+ if test x"$eventsdir" = "x"; then
+ AC_MSG_ERROR([cannot find libevents source in $eventspaths])
+ fi
fi
EVENTS_OBJ="events.o events_select.o events_signal.o events_timed.o events_standard.o events_debug.o events_util.o"
diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk
index 40b4e31cc7..36a5870a3e 100644
--- a/source4/lib/ldb/config.mk
+++ b/source4/lib/ldb/config.mk
@@ -2,11 +2,11 @@
# Start MODULE ldb_asq
[MODULE::ldb_asq]
PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
INIT_FUNCTION = LDB_MODULE(asq)
SUBSYSTEM = LIBLDB
-ldb_asq_OBJ_FILES = $(ldbdir)/modules/asq.o
+ldb_asq_OBJ_FILES = $(ldbsrcdir)/modules/asq.o
# End MODULE ldb_asq
################################################
@@ -14,113 +14,113 @@ ldb_asq_OBJ_FILES = $(ldbdir)/modules/asq.o
# Start MODULE ldb_server_sort
[MODULE::ldb_server_sort]
PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
INIT_FUNCTION = LDB_MODULE(server_sort)
SUBSYSTEM = LIBLDB
# End MODULE ldb_sort
################################################
-ldb_server_sort_OBJ_FILES = $(ldbdir)/modules/sort.o
+ldb_server_sort_OBJ_FILES = $(ldbsrcdir)/modules/sort.o
################################################
# Start MODULE ldb_paged_results
[MODULE::ldb_paged_results]
INIT_FUNCTION = LDB_MODULE(paged_results)
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
SUBSYSTEM = LIBLDB
# End MODULE ldb_paged_results
################################################
-ldb_paged_results_OBJ_FILES = $(ldbdir)/modules/paged_results.o
+ldb_paged_results_OBJ_FILES = $(ldbsrcdir)/modules/paged_results.o
################################################
# Start MODULE ldb_paged_results
[MODULE::ldb_paged_searches]
INIT_FUNCTION = LDB_MODULE(paged_searches)
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
SUBSYSTEM = LIBLDB
# End MODULE ldb_paged_results
################################################
-ldb_paged_searches_OBJ_FILES = $(ldbdir)/modules/paged_searches.o
+ldb_paged_searches_OBJ_FILES = $(ldbsrcdir)/modules/paged_searches.o
################################################
# Start MODULE ldb_operational
[MODULE::ldb_operational]
SUBSYSTEM = LIBLDB
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(operational)
# End MODULE ldb_operational
################################################
-ldb_operational_OBJ_FILES = $(ldbdir)/modules/operational.o
+ldb_operational_OBJ_FILES = $(ldbsrcdir)/modules/operational.o
################################################
# Start MODULE ldb_rdn_name
[MODULE::ldb_rdn_name]
SUBSYSTEM = LIBLDB
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(rdn_name)
# End MODULE ldb_rdn_name
################################################
-ldb_rdn_name_OBJ_FILES = $(ldbdir)/modules/rdn_name.o
+ldb_rdn_name_OBJ_FILES = $(ldbsrcdir)/modules/rdn_name.o
-ldb_map_OBJ_FILES = $(addprefix $(ldbdir)/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o)
+ldb_map_OBJ_FILES = $(addprefix $(ldbsrcdir)/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o)
-$(ldb_map_OBJ_FILES): CFLAGS+=-I$(ldbdir)/ldb_map
+$(ldb_map_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/ldb_map
################################################
# Start MODULE ldb_skel
[MODULE::ldb_skel]
SUBSYSTEM = LIBLDB
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(skel)
# End MODULE ldb_skel
################################################
-ldb_skel_OBJ_FILES = $(ldbdir)/modules/skel.o
+ldb_skel_OBJ_FILES = $(ldbsrcdir)/modules/skel.o
################################################
# Start MODULE ldb_sqlite3
[MODULE::ldb_sqlite3]
SUBSYSTEM = LIBLDB
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBEVENTS
# End MODULE ldb_sqlite3
################################################
-ldb_sqlite3_OBJ_FILES = $(ldbdir)/ldb_sqlite3/ldb_sqlite3.o
+ldb_sqlite3_OBJ_FILES = $(ldbsrcdir)/ldb_sqlite3/ldb_sqlite3.o
################################################
# Start MODULE ldb_tdb
[MODULE::ldb_tdb]
SUBSYSTEM = LIBLDB
-CFLAGS = -I$(ldbdir)/include -I$(ldbdir)/ldb_tdb
+CFLAGS = -I$(ldbsrcdir)/include -I$(ldbsrcdir)/ldb_tdb
PRIVATE_DEPENDENCIES = \
LIBTDB LIBTALLOC LIBEVENTS
# End MODULE ldb_tdb
################################################
-ldb_tdb_OBJ_FILES = $(addprefix $(ldbdir)/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pack.o ldb_index.o ldb_cache.o ldb_tdb_wrap.o)
+ldb_tdb_OBJ_FILES = $(addprefix $(ldbsrcdir)/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pack.o ldb_index.o ldb_cache.o ldb_tdb_wrap.o)
################################################
# Start SUBSYSTEM ldb
[LIBRARY::LIBLDB]
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
INIT_FUNCTION_TYPE = extern const struct ldb_module_ops
PUBLIC_DEPENDENCIES = \
LIBTALLOC LIBEVENTS
PRIVATE_DEPENDENCIES = \
SOCKET_WRAPPER
-PC_FILES += $(ldbdir)/ldb.pc
+PC_FILES += $(ldbsrcdir)/ldb.pc
#
# End SUBSYSTEM ldb
################################################
@@ -128,13 +128,13 @@ PC_FILES += $(ldbdir)/ldb.pc
LIBLDB_VERSION = 0.0.1
LIBLDB_SOVERSION = 0
-LIBLDB_OBJ_FILES = $(addprefix $(ldbdir)/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) $(ldb_map_OBJ_FILES)
+LIBLDB_OBJ_FILES = $(addprefix $(ldbsrcdir)/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) $(ldb_map_OBJ_FILES)
-$(LIBLDB_OBJ_FILES): CFLAGS+=-I$(ldbdir)/include
+$(LIBLDB_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include
-PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h
+PUBLIC_HEADERS += $(ldbsrcdir)/include/ldb.h $(ldbsrcdir)/include/ldb_errors.h
-MANPAGES += $(ldbdir)/man/ldb.3
+MANPAGES += $(ldbsrcdir)/man/ldb.3
################################################
# Start BINARY ldbtest
@@ -144,7 +144,7 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ldbtest
################################################
-ldbtest_OBJ_FILES = $(ldbdir)/tools/ldbtest.o
+ldbtest_OBJ_FILES = $(ldbsrcdir)/tools/ldbtest.o
################################################
# Start BINARY oLschema2ldif
@@ -156,9 +156,9 @@ PRIVATE_DEPENDENCIES = \
################################################
-oLschema2ldif_OBJ_FILES = $(addprefix $(ldbdir)/tools/, convert.o oLschema2ldif.o)
+oLschema2ldif_OBJ_FILES = $(addprefix $(ldbsrcdir)/tools/, convert.o oLschema2ldif.o)
-MANPAGES += $(ldbdir)/man/oLschema2ldif.1
+MANPAGES += $(ldbsrcdir)/man/oLschema2ldif.1
################################################
# Start BINARY ad2oLschema
@@ -169,9 +169,9 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ad2oLschema
################################################
-ad2oLschema_OBJ_FILES = $(addprefix $(ldbdir)/tools/, convert.o ad2oLschema.o)
+ad2oLschema_OBJ_FILES = $(addprefix $(ldbsrcdir)/tools/, convert.o ad2oLschema.o)
-MANPAGES += $(ldbdir)/man/ad2oLschema.1
+MANPAGES += $(ldbsrcdir)/man/ad2oLschema.1
mkinclude tools/config.mk
mkinclude ldb_ildap/config.mk
diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk
index 94e3380038..4247bd96b7 100644
--- a/source4/lib/ldb/ldb_ildap/config.mk
+++ b/source4/lib/ldb/ldb_ildap/config.mk
@@ -2,12 +2,12 @@
# Start MODULE ldb_ildap
[MODULE::ldb_ildap]
SUBSYSTEM = LIBLDB
-CFLAGS = -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir)/include
OUTPUT_TYPE = SHARED_LIBRARY
PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS
ALIASES = ldapi ldaps ldap
# End MODULE ldb_ildap
################################################
-ldb_ildap_OBJ_FILES = $(ldbdir)/ldb_ildap/ldb_ildap.o
+ldb_ildap_OBJ_FILES = $(ldbsrcdir)/ldb_ildap/ldb_ildap.o
diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk
index 051fd0c57b..6b57929df0 100644
--- a/source4/lib/ldb/tools/config.mk
+++ b/source4/lib/ldb/tools/config.mk
@@ -1,13 +1,13 @@
################################################
# Start SUBSYSTEM LIBLDB_CMDLINE
[SUBSYSTEM::LIBLDB_CMDLINE]
-CFLAGS = -I$(ldbdir) -I$(ldbdir)/include
+CFLAGS = -I$(ldbsrcdir) -I$(ldbsrcdir)/include
PUBLIC_DEPENDENCIES = LIBLDB LIBPOPT
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL POPT_SAMBA POPT_CREDENTIALS gensec
# End SUBSYSTEM LIBLDB_CMDLINE
################################################
-LIBLDB_CMDLINE_OBJ_FILES = $(ldbdir)/tools/cmdline.o
+LIBLDB_CMDLINE_OBJ_FILES = $(ldbsrcdir)/tools/cmdline.o
################################################
# Start BINARY ldbadd
@@ -19,9 +19,9 @@ PRIVATE_DEPENDENCIES = \
################################################
-ldbadd_OBJ_FILES = $(ldbdir)/tools/ldbadd.o
+ldbadd_OBJ_FILES = $(ldbsrcdir)/tools/ldbadd.o
-MANPAGES += $(ldbdir)/man/ldbadd.1
+MANPAGES += $(ldbsrcdir)/man/ldbadd.1
################################################
# Start BINARY ldbdel
@@ -32,9 +32,9 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ldbdel
################################################
-ldbdel_OBJ_FILES = $(ldbdir)/tools/ldbdel.o
+ldbdel_OBJ_FILES = $(ldbsrcdir)/tools/ldbdel.o
-MANPAGES += $(ldbdir)/man/ldbdel.1
+MANPAGES += $(ldbsrcdir)/man/ldbdel.1
################################################
# Start BINARY ldbmodify
@@ -45,8 +45,8 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ldbmodify
################################################
-ldbmodify_OBJ_FILES = $(ldbdir)/tools/ldbmodify.o
-MANPAGES += $(ldbdir)/man/ldbmodify.1
+ldbmodify_OBJ_FILES = $(ldbsrcdir)/tools/ldbmodify.o
+MANPAGES += $(ldbsrcdir)/man/ldbmodify.1
################################################
# Start BINARY ldbsearch
@@ -57,9 +57,9 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ldbsearch
################################################
-ldbsearch_OBJ_FILES = $(ldbdir)/tools/ldbsearch.o
+ldbsearch_OBJ_FILES = $(ldbsrcdir)/tools/ldbsearch.o
-MANPAGES += $(ldbdir)/man/ldbsearch.1
+MANPAGES += $(ldbsrcdir)/man/ldbsearch.1
################################################
# Start BINARY ldbedit
@@ -70,9 +70,9 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ldbedit
################################################
-ldbedit_OBJ_FILES = $(ldbdir)/tools/ldbedit.o
+ldbedit_OBJ_FILES = $(ldbsrcdir)/tools/ldbedit.o
-MANPAGES += $(ldbdir)/man/ldbedit.1
+MANPAGES += $(ldbsrcdir)/man/ldbedit.1
################################################
# Start BINARY ldbrename
@@ -83,8 +83,8 @@ PRIVATE_DEPENDENCIES = \
# End BINARY ldbrename
################################################
-ldbrename_OBJ_FILES = $(ldbdir)/tools/ldbrename.o
+ldbrename_OBJ_FILES = $(ldbsrcdir)/tools/ldbrename.o
-MANPAGES += $(ldbdir)/man/ldbrename.1
+MANPAGES += $(ldbsrcdir)/man/ldbrename.1
diff --git a/source4/lib/popt/config.mk b/source4/lib/popt/config.mk
index 86d440ac78..e015577aea 100644
--- a/source4/lib/popt/config.mk
+++ b/source4/lib/popt/config.mk
@@ -1,5 +1,5 @@
[SUBSYSTEM::LIBPOPT]
CFLAGS = -Ilib/popt
-LIBPOPT_OBJ_FILES = $(addprefix lib/popt/, findme.o popt.o poptconfig.o popthelp.o poptparse.o)
+LIBPOPT_OBJ_FILES = $(addprefix $(poptsrcdir)/, findme.o popt.o poptconfig.o popthelp.o poptparse.o)
diff --git a/source4/nsswitch/tests/test_wbinfo.sh b/source4/nsswitch/tests/test_wbinfo.sh
new file mode 100755
index 0000000000..dfd633b656
--- /dev/null
+++ b/source4/nsswitch/tests/test_wbinfo.sh
@@ -0,0 +1,187 @@
+#!/bin/sh
+# Blackbox test for wbinfo
+if [ $# -lt 4 ]; then
+cat <<EOF
+Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET
+EOF
+exit 1;
+fi
+
+DOMAIN=$1
+USERNAME=$2
+PASSWORD=$3
+TARGET=$4
+shift 4
+
+failed=0
+samba4bindir=`dirname $0`/../../bin
+wbinfo=$samba4bindir/wbinfo
+
+. `dirname $0`/../../../testprogs/blackbox/subunit.sh
+
+testfail() {
+ name="$1"
+ shift
+ cmdline="$*"
+ echo "test: $name"
+ $cmdline
+ status=$?
+ if [ x$status = x0 ]; then
+ echo "failure: $name"
+ else
+ echo "success: $name"
+ fi
+ return $status
+}
+
+knownfail() {
+ name="$1"
+ shift
+ cmdline="$*"
+ echo "test: $name"
+ $cmdline
+ status=$?
+ if [ x$status = x0 ]; then
+ echo "failure: $name [unexpected success]"
+ status=1
+ else
+ echo "knownfail: $name"
+ status=0
+ fi
+ return $status
+}
+
+
+testit "wbinfo -u against $TARGET" $wbinfo -u || failed=`expr $failed + 1`
+# Does not work yet
+knownfail "wbinfo -g against $TARGET" $wbinfo -g || failed=`expr $failed + 1`
+knownfail "wbinfo -N against $TARGET" $wbinfo -N || failed=`expr $failed + 1`
+knownfail "wbinfo -I against $TARGET" $wbinfo -I || failed=`expr $failed + 1`
+testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=`expr $failed + 1`
+admin_sid=`$wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1`
+echo "$DOMAIN/$USERNAME resolved to $admin_sid"
+
+testit "wbinfo -s $admin_sid against $TARGET" $wbinfo -s $admin_sid || failed=`expr $failed + 1`
+admin_name=`wbinfo -s $admin_sid | cut -d " " -f1| tr a-z A-Z`
+echo "$admin_sid resolved to $admin_name"
+
+tested_name=`echo $DOMAIN/$USERNAME | tr a-z A-Z`
+
+echo "test: wbinfo -s check for sane mapping"
+if test x$admin_name != x$tested_name; then
+ echo "$admin_name does not match $tested_name"
+ echo "failure: wbinfo -s check for sane mapping"
+ failed=`expr $failed + 1`
+else
+ echo "success: wbinfo -s check for sane mapping"
+fi
+
+testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $admin_name || failed=`expr $failed + 1`
+test_sid=`$wbinfo -n $tested_name | cut -d " " -f1`
+
+echo "test: wbinfo -n check for sane mapping"
+if test x$admin_sid != x$test_sid; then
+ echo "$admin_sid does not match $test_sid"
+ echo "failure: wbinfo -n check for sane mapping"
+ failed=`expr $failed + 1`
+else
+ echo "success: wbinfo -n check for sane mapping"
+fi
+
+testit "wbinfo -U against $TARGET" $wbinfo -U 30000 || failed=`expr $failed + 1`
+
+echo "test: wbinfo -U check for sane mapping"
+sid_for_30000=`$wbinfo -U 30000`
+if test x$sid_for_30000 != "xS-1-22-1-30000"; then
+ echo "uid 30000 mapped to $sid_for_30000, not S-1-22-1-30000"
+ echo "failure: wbinfo -U check for sane mapping"
+ failed=`expr $failed + 1`
+else
+ echo "success: wbinfo -U check for sane mapping"
+fi
+
+admin_uid=`wbinfo -U $admin_sid`
+
+testit "wbinfo -G against $TARGET" $wbinfo -G 30000 || failed=`expr $failed + 1`
+
+echo "test: wbinfo -G check for sane mapping"
+sid_for_30000=`$wbinfo -G 30000`
+if test x$sid_for_30000 != "xS-1-22-2-30000"; then
+ echo "gid 30000 mapped to $sid_for_30000, not S-1-22-2-30000"
+ echo "failure: wbinfo -G check for sane mapping"
+ failed=`expr $failed + 1`
+else
+ echo "success: wbinfo -G check for sane mapping"
+fi
+
+testit "wbinfo -S against $TARGET" $wbinfo -S "S-1-22-1-30000" || failed=`expr $failed + 1`
+
+echo "test: wbinfo -S check for sane mapping"
+uid_for_sid=`$wbinfo -S S-1-22-1-30000`
+if test 0$uid_for_sid -ne 30000; then
+ echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000"
+ echo "failure: wbinfo -S check for sane mapping"
+ failed=`expr $failed + 1`
+else
+ echo "success: wbinfo -S check for sane mapping"
+fi
+
+testfail "wbinfo -S against $TARGET using invalid SID" $wbinfo -S "S-1-22-2-30000" && failed=`expr $failed + 1`
+
+testit "wbinfo -Y against $TARGET" $wbinfo -Y "S-1-22-2-30000" || failed=`expr $failed + 1`
+
+echo "test: wbinfo -Y check for sane mapping"
+gid_for_sid=`$wbinfo -Y S-1-22-2-30000`
+if test 0$gid_for_sid -ne 30000; then
+ echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000"
+ echo "failure: wbinfo -Y check for sane mapping"
+ failed=`expr $failed + 1`
+else
+ echo "success: wbinfo -Y check for sane mapping"
+fi
+
+testfail "wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-30000" && failed=`expr $failed + 1`
+
+testit "wbinfo -t against $TARGET" $wbinfo -t || failed=`expr $failed + 1`
+
+testit "wbinfo --trusted-domains against $TARGET" $wbinfo --trusted-domains || failed=`expr $failed + 1`
+testit "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=`expr $failed + 1`
+testit "wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed=`expr $failed + 1`
+
+echo "test: wbinfo --own-domain against $TARGET check output"
+own_domain=`wbinfo --own-domain`
+if test x$own_domain = x$DOMAIN; then
+ echo "success: wbinfo --own-domain against $TARGET check output"
+else
+ echo "Own domain reported as $own_domain instead of $DOMAIN"
+ echo "failure: wbinfo --own-domain against $TARGET check output"
+fi
+
+# this does not work
+knownfail "wbinfo --sequence against $TARGET" $wbinfo --sequence
+knownfail "wbinfo -D against $TARGET" $wbinfo -D $DOMAIN || failed=`expr $failed + 1`
+
+testit "wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed=`expr $failed + 1`
+
+# this does not work
+knownfail "wbinfo --uid-info against $TARGET" $wbinfo --uid-info $admin_sid
+knownfail "wbinfo --group-info against $TARGET" $wbinfo --group-info "S-1-22-2-0"
+knownfail "wbinfo -r against $TARGET" $wbinfo -r "$DOMAIN/$USERNAME"
+
+testit "wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed=`expr $failed + 1`
+
+testit "wbinfo --user-sids against $TARGET" $wbinfo --user-sids $admin_sid || failed=`expr $failed + 1`
+
+testit "wbinfo -a against $TARGET with domain creds" $wbinfo -a "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1`
+
+# this does not work
+knwonfail "wbinfo --getdcname against $TARGET" $wbinfo --getdcname=$DOMAIN
+
+testit "wbinfo -p against $TARGET" $wbinfo -p || failed=`expr $failed + 1`
+
+testit "wbinfo -K against $TARGET with domain creds" $wbinfo -K "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1`
+
+testit "wbinfo --separator against $TARGET" $wbinfo --separator || failed=`expr $failed + 1`
+
+exit $failed
+
diff --git a/source4/nsswitch/wbinfo.c b/source4/nsswitch/wbinfo.c
index 21c178cc7b..150d9a68ee 100644
--- a/source4/nsswitch/wbinfo.c
+++ b/source4/nsswitch/wbinfo.c
@@ -614,6 +614,23 @@ static bool wbinfo_sid_to_gid(char *sid)
return true;
}
+static const char *sid_type_lookup(enum lsa_SidType r)
+{
+ switch (r) {
+ case SID_NAME_USE_NONE: return "SID_NAME_USE_NONE"; break;
+ case SID_NAME_USER: return "SID_NAME_USER"; break;
+ case SID_NAME_DOM_GRP: return "SID_NAME_DOM_GRP"; break;
+ case SID_NAME_DOMAIN: return "SID_NAME_DOMAIN"; break;
+ case SID_NAME_ALIAS: return "SID_NAME_ALIAS"; break;
+ case SID_NAME_WKN_GRP: return "SID_NAME_WKN_GRP"; break;
+ case SID_NAME_DELETED: return "SID_NAME_DELETED"; break;
+ case SID_NAME_INVALID: return "SID_NAME_INVALID"; break;
+ case SID_NAME_UNKNOWN: return "SID_NAME_UNKNOWN"; break;
+ case SID_NAME_COMPUTER: return "SID_NAME_COMPUTER"; break;
+ }
+ return "Invalid sid type\n";
+}
+
/* Convert sid to string */
static bool wbinfo_lookupsid(char *sid)
@@ -634,30 +651,13 @@ static bool wbinfo_lookupsid(char *sid)
/* Display response */
- d_printf("%s%c%s %d\n", response.data.name.dom_name,
- winbind_separator(), response.data.name.name,
- response.data.name.type);
+ d_printf("%s%c%s %s\n", response.data.name.dom_name,
+ winbind_separator(), response.data.name.name,
+ sid_type_lookup(response.data.name.type));
return true;
}
-static const char *sid_type_lookup(enum lsa_SidType r)
-{
- switch (r) {
- case SID_NAME_USE_NONE: return "SID_NAME_USE_NONE"; break;
- case SID_NAME_USER: return "SID_NAME_USER"; break;
- case SID_NAME_DOM_GRP: return "SID_NAME_DOM_GRP"; break;
- case SID_NAME_DOMAIN: return "SID_NAME_DOMAIN"; break;
- case SID_NAME_ALIAS: return "SID_NAME_ALIAS"; break;
- case SID_NAME_WKN_GRP: return "SID_NAME_WKN_GRP"; break;
- case SID_NAME_DELETED: return "SID_NAME_DELETED"; break;
- case SID_NAME_INVALID: return "SID_NAME_INVALID"; break;
- case SID_NAME_UNKNOWN: return "SID_NAME_UNKNOWN"; break;
- case SID_NAME_COMPUTER: return "SID_NAME_COMPUTER"; break;
- }
- return "Invalid sid type\n";
-}
-
/* Convert string to sid */
static bool wbinfo_lookupname(char *name)
diff --git a/source4/script/installbin.sh b/source4/script/installbin.sh
deleted file mode 100755
index c2f34082dd..0000000000
--- a/source4/script/installbin.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-INSTALLPERMS=$1
-BASEDIR=$2
-BINDIR=$3
-LIBDIR=$4
-VARDIR=$5
-shift
-shift
-shift
-shift
-shift
-
-for p in $*; do
- p2=`basename $p`
- echo Installing $p as $BINDIR/$p2
- if [ -f $BINDIR/$p2 ]; then
- rm -f $BINDIR/$p2.old
- mv $BINDIR/$p2 $BINDIR/$p2.old
- fi
- cp $p $BINDIR/
- chmod $INSTALLPERMS $BINDIR/$p2
-
- # this is a special case, mount needs this in a specific location
- if [ $p2 = smbmount ]; then
- ln -sf $BINDIR/$p2 /sbin/mount.smbfs
- fi
-done
-
-
-cat << EOF
-======================================================================
-The binaries are installed. You may restore the old binaries (if there
-were any) using the command "make revert". You may uninstall the binaries
-using the command "make uninstallbin" or "make uninstall" to uninstall
-binaries, man pages and shell scripts.
-======================================================================
-EOF
-
-exit 0
diff --git a/source4/script/uninstallbin.sh b/source4/script/uninstallbin.sh
deleted file mode 100755
index a8bbdea7af..0000000000
--- a/source4/script/uninstallbin.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-#4 July 96 Dan.Shearer@UniSA.edu.au
-
-INSTALLPERMS=$1
-BASEDIR=$2
-BINDIR=$3
-LIBDIR=$4
-VARDIR=$5
-shift
-shift
-shift
-shift
-shift
-
-if [ ! -d $BINDIR ]; then
- echo Directory $BINDIR does not exist!
- echo Do a "make installbin" or "make install" first.
- exit 1
-fi
-
-for p in $*; do
- p2=`basename $p`
- if [ -f $BINDIR/$p2 ]; then
- echo Removing $BINDIR/$p2
- rm -f $BINDIR/$p2
- if [ -f $BINDIR/$p2 ]; then
- echo Cannot remove $BINDIR/$p2 ... does $USER have privileges?
- fi
- fi
-done
-
-
-cat << EOF
-======================================================================
-The binaries have been uninstalled. You may restore the binaries using
-the command "make installbin" or "make install" to install binaries,
-man pages, modules and shell scripts. You can restore a previous
-version of the binaries (if there were any) using "make revert".
-======================================================================
-EOF
-
-exit 0
diff --git a/source4/selftest/config.mk b/source4/selftest/config.mk
index 2ae49b244b..871c14898f 100644
--- a/source4/selftest/config.mk
+++ b/source4/selftest/config.mk
@@ -1,6 +1,6 @@
TEST_FORMAT = plain
-SELFTEST = $(LD_LIBPATH_OVERRIDE) $(PERL) $(srcdir)/selftest/selftest.pl --prefix=${selftest_prefix} \
+SELFTEST = $(LD_LIBPATH_OVERRIDE) $(PERL) $(selftestdir)/selftest.pl --prefix=${selftest_prefix} \
--builddir=$(builddir) --srcdir=$(srcdir) \
--expected-failures=$(srcdir)/samba4-knownfail \
--format=$(TEST_FORMAT) \
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh
index 79ebc7b0f7..e67e035c31 100755
--- a/source4/selftest/samba4_tests.sh
+++ b/source4/selftest/samba4_tests.sh
@@ -268,16 +268,16 @@ fi
bbdir=$incdir/../../testprogs/blackbox
plantest "blackbox.ndrdump" dc $bbdir/test_ndrdump.sh
-plantest "blackbox.smbclient" dc $bbdir/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
+plantest "blackbox.smbclient" dc $samba4srcdir/client/tests/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" $CONFIGURATION
-plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN"
+plantest "blackbox.cifsdd" dc $samba4srcdir/client/tests/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN"
plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
plantest "blackbox.gentest" dc $bbdir/test_gentest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
-plantest "blackbox.wbinfo" dc $bbdir/test_wbinfo.sh "\$DOMAIN" "\$USERNAME" "\$PASSWORD" "dc"
-plantest "blackbox.wbinfo" member $bbdir/test_wbinfo.sh "\$DOMAIN" "\$DC_USERNAME" "\$DC_PASSWORD" "member"
+plantest "blackbox.wbinfo" dc $samba4srcdir/nsswitch/tests/test_wbinfo.sh "\$DOMAIN" "\$USERNAME" "\$PASSWORD" "dc"
+plantest "blackbox.wbinfo" member $samba4srcdir/nsswitch/tests/test_wbinfo.sh "\$DOMAIN" "\$DC_USERNAME" "\$DC_PASSWORD" "member"
plantest "blackbox.wintest" none $bbdir/test_wintest.sh "$TORTURE_OPTIONS"
# Tests using the "Simple" NTVFS backend
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 74c87c68a4..5bd5568913 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -202,6 +202,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
init_module_fn static_init[] = { STATIC_smbd_MODULES };
init_module_fn *shared_init;
struct event_context *event_ctx;
+ uint16_t stdin_event_flags;
NTSTATUS status;
const char *model = "standard";
int max_runtime = 0;
@@ -324,15 +325,20 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[
cluster_ctdb_init(cmdline_lp_ctx, event_ctx, model);
if (opt_interactive) {
- /* catch EOF on stdin */
-#ifdef SIGTTIN
- signal(SIGTTIN, SIG_IGN);
-#endif
- event_add_fd(event_ctx, event_ctx, 0, EVENT_FD_READ,
- server_stdin_handler,
- discard_const(binary_name));
+ /* terminate when stdin goes away */
+ stdin_event_flags = EVENT_FD_READ;
+ } else {
+ /* stay alive forever */
+ stdin_event_flags = 0;
}
+ /* catch EOF on stdin */
+#ifdef SIGTTIN
+ signal(SIGTTIN, SIG_IGN);
+#endif
+ event_add_fd(event_ctx, event_ctx, 0, stdin_event_flags,
+ server_stdin_handler,
+ discard_const(binary_name));
if (max_runtime) {
event_add_timed(event_ctx, event_ctx,