s3:waf fix build on AIX

AIX acl code needs to be built by default on AIX,
otherwise smbd will fail to start because of missing symbols

This fixes Bug 9557 - build succeeds, but binaries don't run

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>

Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Thu Mar 21 16:31:19 CET 2013 on sn-devel-104
BUG 9735: Fix winbind seperator in upn to username conversion.

Reviewed-by: Günther Deschner <gd@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Mar 22 16:18:06 CET 2013 on sn-devel-104
Solaris/Illumos/Nexenta creates pipes that are bi-directional by default.

Ensure the test code will pass against such a system (allow writes/reads
going both ways).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Fix tevent testsuite issue on Solaris.

On Solaris/Nexenta/Illumos once a pipe is full it will not be reported
as writable until PIPE_BUF (actually on Solaris 4096, which is less than
PIPE_BUF) bytes have been read from it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Mar 22 18:16:45 CET 2013 on sn-devel-104
Fix bug #9733 - smbcontrol close-share is not working.

As part of forcibly disconnecting a client from a share,
smbd must atomically call reload_services() to ensure that
the entry in the ServicePtrs[] array corresponding to
that share is removed if the share was removed from
the smb.conf or registry entries.

Otherwise the ServicePtrs[] array entry for the share
remains active and the client races to auto-reconnect to
the share before a second message to reload the smb.conf
file can be sent.

This has to be done as part of the close-share message
processing, as removing the share from the smb.conf file
first, then telling the smbd to reload followed by the
forcible disconnect message doesn't work as in this
sequence of events when the reload message is received
the client is still connected to the share, so the
ServicePtrs[] entry is still left active.

The forcible-disconnect + service reload has to be done
together as an atomic operation in order for this to work.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Fri Mar 22 20:10:11 CET 2013 on sn-devel-104
smbd: Tune "dir" a bit.

for i in $(seq 1 20000) ; do echo dir ; done | smbclient //127.0.0.1/tmp -U%

without and with this patch:

$ time bin/smbd -d0 -i
smbd version 4.1.0pre1-GIT-1f139ae started.
Copyright Andrew Tridgell and the Samba Team 1992-2013
Beendet

real    0m28.342s
user    0m10.249s
sys     0m10.513s

$ time bin/smbd -d0 -i
smbd version 4.1.0pre1-GIT-1f139ae started.
Copyright Andrew Tridgell and the Samba Team 1992-2013
Beendet

real    0m27.348s
user    0m9.089s
sys     0m10.853s

The "real" timestamp is irrelevant, this also contains the time between
starting smbd and the smbclient job. It's the "user" time. The result that this
patch improves the time spent in user space by 10% is consistent.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 22 22:10:57 CET 2013 on sn-devel-104
vfs_btrfs: fix compile on 32-bit platforms.

uint64_t are not unsigned longs on 32-bit platforms:

[3265/3996] Compiling source3/modules/vfs_btrfs.c
../source3/modules/vfs_btrfs.c: In function ‘btrfs_copy_chunk_send’:
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c:118:3: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘uint64_t’ [-Werror=format]
../source3/modules/vfs_btrfs.c: In function ‘btrfs_copy_chunk_recv’:
../source3/modules/vfs_btrfs.c:180:2: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘off_t’ [-Werror=format]
cc1: some warnings being treated as errors

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ntdb: don't call open hook when re-opening an existing database.

In particular, the Samba dbwrap wrapper can do this for schannel_store,
with the openhook set to clear the database if it can get the lock
(which, being in the same process, it can).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Sat Mar 23 09:39:50 CET 2013 on sn-devel-104
Revert "vfs_btrfs: fix compile on 32-bit platforms."

This reverts commit fd6d0361d6fef5f8175967ddbae4a2b1d79dfcad.

Unreviewed, and Andrew has a better fix.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
vfs-btrfs: Fix build on 32 bit platforms by using long long types

Reviewed-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Sun Mar 24 06:17:55 CET 2013 on sn-devel-104
build: Remove the forced use of only the first part of the compiler string

This corrects parts of 378295c3fe813c70815a14c7de608e4a859bd6cc and
301d59caf2ee6f49e108b748b0e38221dec9bb96.  This is seen if CC="ccache
gcc" and CPP isn't used for some reason.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
build: Do not pass CPP="" to pidl, skip the env variable entirely

This will cause pidl to use $CC -E instead.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
scripting: Move the list of well known SDs to samba.provision.descriptor

This will allow us to call this from dbcheck.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
scripting: Fix documentation comment on upgradehelpers.py:get_clean_sd

Reviewed-by: Stefan Metzmacher <metze@samba.org>
scripting: Make samba.provision.descriptor.get_wellknown_sds() return ldb.Dn objects

As we look to use this function in more places, it does not make sense to constantly create
Dn objects from the strings.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
scripting: Move samba.provision.descriptor to samba.descriptor

This will allow dbcheck to import it, without a cirucular dependency via
samba.provision importing dbcheck.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
scripting: Modify samba.descriptor.get_wellknown_sds() use samdb calls only

We need this routine not to use the names context as this is tied to
provision, and we end up in a circular dependency if we use that in
dbcheck.

Andrew Bartlett
scripting: Move get_diff_sds from samba.upgradehelpers to samba.descriptor

This helps avoid a dependency loop when we use get_diff_sds in dbcheck.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
samba-tool dbcheck: Add --reset-well-known-acls

This will allow an upgrade from Samba 4.0.0 without needing to run
samba_upgradeprovision, which for now is not the preferred upgrade
tool.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
samba-tool dbcheck: Allow dbcheck to correct an nTSecurityDescriptor without an owner or group

This is done by making a modification to the SD, which triggers it to be
filled in if we have the correct session_info established on the DB.

However, we normally want dbcheck running as system, so we wrap
the session_info set around this operation only.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>