vlendec/samba-autobuild/.git
6 years agoctdb-client: Optionally return database id from ctdb_ctrl_createdb()
Amitay Isaacs [Wed, 23 Aug 2017 02:09:22 +0000 (12:09 +1000)]
ctdb-client: Optionally return database id from ctdb_ctrl_createdb()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12978

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-client: Fix ctdb_ctrl_createdb() to use database flags
Amitay Isaacs [Fri, 18 Aug 2017 03:50:39 +0000 (13:50 +1000)]
ctdb-client: Fix ctdb_ctrl_createdb() to use database flags

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12978

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-tests: Add a test to check databases are attached with correct flags
Amitay Isaacs [Fri, 18 Aug 2017 04:27:10 +0000 (14:27 +1000)]
ctdb-tests: Add a test to check databases are attached with correct flags

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12978

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-tests: Add functions to start/stop/restart a single local daemon
Amitay Isaacs [Fri, 18 Aug 2017 04:45:30 +0000 (14:45 +1000)]
ctdb-tests: Add functions to start/stop/restart a single local daemon

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12978

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoctdb-tests: Add functions to start/stop/restart ctdb on single node
Amitay Isaacs [Tue, 22 Aug 2017 02:53:43 +0000 (12:53 +1000)]
ctdb-tests: Add functions to start/stop/restart ctdb on single node

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12978

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
6 years agoschannel.idl: Fix a typo
Volker Lendecke [Thu, 24 Aug 2017 15:03:30 +0000 (17:03 +0200)]
schannel.idl: Fix a typo

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 Aug 25 04:10:25 CEST 2017 on sn-devel-144

6 years agoctdb: Fix a typo
Volker Lendecke [Wed, 23 Aug 2017 16:11:32 +0000 (18:11 +0200)]
ctdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotdb: version 1.3.15 tdb-1.3.15
Stefan Metzmacher [Thu, 24 Aug 2017 11:29:17 +0000 (13:29 +0200)]
tdb: version 1.3.15

* Add protection against EINTR.
* Truncate the file after expand failure, ENOSPC
* Use posix_fallocate() to expand the file
* Fix GCC compiler warnings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug 24 21:17:48 CEST 2017 on sn-devel-144

6 years agos3:libsmb: Print the kinit failed message with DBGLVL_NOTICE
Andreas Schneider [Thu, 24 Aug 2017 10:51:35 +0000 (12:51 +0200)]
s3:libsmb: Print the kinit failed message with DBGLVL_NOTICE

The default debug level of smbclient is set to 'log level = 1'. So we
need to use at least NOTICE to not get the message when we do not force
kerberos.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12704

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 24 17:22:18 CEST 2017 on sn-devel-144

6 years agos4:torture: The teardown function should just return
Andreas Schneider [Tue, 8 Aug 2017 10:05:24 +0000 (12:05 +0200)]
s4:torture: The teardown function should just return

The teardown functions should not return on error but finish cleaning
up!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12984

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 24 13:23:22 CEST 2017 on sn-devel-144

6 years agos4:torture: Delete printer before we remove the driver
Andreas Schneider [Tue, 8 Aug 2017 08:40:19 +0000 (10:40 +0200)]
s4:torture: Delete printer before we remove the driver

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12984

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 years agos4:torture: Use a different driver name for add_driver tests
Andreas Schneider [Tue, 8 Aug 2017 09:25:48 +0000 (11:25 +0200)]
s4:torture: Use a different driver name for add_driver tests

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12984

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 years agos3:script: Untaint user supplied data in modprinter.pl
Andreas Schneider [Tue, 8 Aug 2017 06:40:34 +0000 (08:40 +0200)]
s3:script: Untaint user supplied data in modprinter.pl

spoolss_SetPrinter fails because of the error produced by modprinter.pl.

Perl error:
Insecure dependency in open while running setgid at modprinter.pl line 76.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12950

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 years agos3:spoolss: Set timeout values to the one which Windows uses by default
Andreas Schneider [Fri, 18 Nov 2016 14:06:22 +0000 (15:06 +0100)]
s3:spoolss: Set timeout values to the one which Windows uses by default

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
6 years agodynconfig: Use INSTALL_DIR to create directories
Andreas Schneider [Thu, 10 Aug 2017 09:42:46 +0000 (11:42 +0200)]
dynconfig: Use INSTALL_DIR to create directories

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12957

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug 24 09:29:05 CEST 2017 on sn-devel-144

6 years agowafsamba: Call INSTALL_DIR in INSTALL_DIRS
Andreas Schneider [Thu, 10 Aug 2017 09:40:06 +0000 (11:40 +0200)]
wafsamba: Call INSTALL_DIR in INSTALL_DIRS

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12957

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agowafsamba: Add INSTALL_DIR function
Andreas Schneider [Thu, 10 Aug 2017 09:36:52 +0000 (11:36 +0200)]
wafsamba: Add INSTALL_DIR function

The install_dir function in waf has been deprecated and it doesn't
support setting directory permissions. So we need to implement our own
function anyway.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12957

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agotdb: Use posix_fallocate
Volker Lendecke [Wed, 23 Aug 2017 11:02:57 +0000 (13:02 +0200)]
tdb: Use posix_fallocate

This should be significantly faster than pwriting.

openbsd doesn't have posix_fallocate, so we do need the fallback. Also, it
might have weird failure modes, so we keep the old code in place except for
posix_fallocate returning success or ENOSPC.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 24 05:38:49 CEST 2017 on sn-devel-144

6 years agotdb: Add an intermediate variable
Volker Lendecke [Wed, 23 Aug 2017 10:59:19 +0000 (12:59 +0200)]
tdb: Add an intermediate variable

More README.Coding, but I need "ret" in the next commit as well :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agotdb: Truncate the file after expand failure
Volker Lendecke [Wed, 23 Aug 2017 10:48:03 +0000 (12:48 +0200)]
tdb: Truncate the file after expand failure

Without this it's very easy to create virtually huge files: ftruncate expands a
file, the pwrites fail with ENOSPC, thus the write fails. The next writer runs
into the same situation, and ftruncate-expands the file even further. tdb_check
will then spend ages reading the 4GB of zeros byte by byte.

Here we hold the freelist lock or are inside a transaction, so it is safe to
cut the file again. Nobody can have used the space that we have tried to
allocate, so we can't have any stray pointers corrupting the database.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agotdb: Protect against EINTR
Volker Lendecke [Wed, 23 Aug 2017 10:00:00 +0000 (12:00 +0200)]
tdb: Protect against EINTR

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agoconfigure: Centralize check for posix_fallocate
Volker Lendecke [Tue, 22 Aug 2017 15:09:01 +0000 (17:09 +0200)]
configure: Centralize check for posix_fallocate

This checks for posix_fallocate unless we are sitting on an ancient glibc.
With this we don't need HAVE_BROKEN_POSIX_FALLOCATE anymore,
HAVE_POSIX_FALLOCATE will only be defined if we have a valid [g]libc.

./configure tested on Debian, FreeBSD (which does have posix_fallocate) and
OpenBSD (which does not have posix_fallocate). Also tested with changing the
not have an old-enough glibc around. All did the right thing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agotdb: Fix a typo
Volker Lendecke [Tue, 22 Aug 2017 12:51:18 +0000 (14:51 +0200)]
tdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agovfs_default: Fix passing of errno from async calls
Christof Schmitt [Wed, 23 Aug 2017 21:37:28 +0000 (14:37 -0700)]
vfs_default: Fix passing of errno from async calls

Current code assigns errno from async pthreadpool calls to the
vfs_default internal vfswrap_*_state.  The callers of the vfs_*_recv
functions expect the value from errno in vfs_aio_state.error.

Correctly assign errno to vfs_aio_state.error and remove the unused
internal err variable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12983

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoacl_common: Avoid "#include vfs_acl_common.c"
Volker Lendecke [Fri, 18 Aug 2017 12:41:57 +0000 (14:41 +0200)]
acl_common: Avoid "#include vfs_acl_common.c"

This makes vfs_acl_common.c a subsystem of its own that acl_xattr and acl_tdb
now link against, not #include it.

This patch is a bit on the large and clumsy side, but splitting it up would
(I believe) involve a separate intermediate copy of acl_common.c.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoacl_common: Pass store_acl_blob_fsp through store_v3_blob
Volker Lendecke [Fri, 18 Aug 2017 11:52:31 +0000 (13:52 +0200)]
acl_common: Pass store_acl_blob_fsp through store_v3_blob

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoacl_common: Pass get_acl_blob_fn as a pointer to get_nt_acl_internal
Volker Lendecke [Fri, 18 Aug 2017 11:46:14 +0000 (13:46 +0200)]
acl_common: Pass get_acl_blob_fn as a pointer to get_nt_acl_internal

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:tests: Add test for changing the local user password with smbpasswd
Andreas Schneider [Mon, 21 Aug 2017 10:23:56 +0000 (12:23 +0200)]
s3:tests: Add test for changing the local user password with smbpasswd

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Aug 23 17:05:48 CEST 2017 on sn-devel-144

6 years agos3:utils: Remove pointless if-clause for remote_machine
Andreas Schneider [Tue, 22 Aug 2017 13:46:07 +0000 (15:46 +0200)]
s3:utils: Remove pointless if-clause for remote_machine

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Review with: git show -U20

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
6 years agos3:utils: Make sure we authenticate against our SAM name in smbpasswd
Andreas Schneider [Fri, 18 Aug 2017 14:17:08 +0000 (16:17 +0200)]
s3:utils: Make sure we authenticate against our SAM name in smbpasswd

If a local user wants to change his password using smbpasswd and the
machine is a domain member, we need to make sure we authenticate against
our SAM and not ask winbind.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
6 years agos3:utils: Pass domain to password_change() in smbpasswd
Andreas Schneider [Fri, 18 Aug 2017 14:14:57 +0000 (16:14 +0200)]
s3:utils: Pass domain to password_change() in smbpasswd

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
6 years agos3:utils: Make strings const passed to password_change() in smbpasswd
Andreas Schneider [Fri, 18 Aug 2017 14:13:15 +0000 (16:13 +0200)]
s3:utils: Make strings const passed to password_change() in smbpasswd

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
6 years agos3:libsmb: Move prototye of remote_password_change()
Andreas Schneider [Fri, 18 Aug 2017 14:10:06 +0000 (16:10 +0200)]
s3:libsmb: Move prototye of remote_password_change()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
6 years agos3:libsmb: Pass domain to remote_password_change()
Andreas Schneider [Fri, 18 Aug 2017 14:08:46 +0000 (16:08 +0200)]
s3:libsmb: Pass domain to remote_password_change()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12975

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
6 years agos3:utils: Do not report an invalid range for AD DC role
Andreas Schneider [Fri, 18 Aug 2017 08:35:55 +0000 (10:35 +0200)]
s3:utils: Do not report an invalid range for AD DC role

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12629

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 23 03:23:55 CEST 2017 on sn-devel-144

6 years agotdb: fix tbdtool list freelist output
Ralph Boehme [Sun, 9 Jul 2017 16:39:27 +0000 (18:39 +0200)]
tdb: fix tbdtool list freelist output

Due to the non-fixable bug in the BUCKET macro tdbtool list printed some
other hash chainlist, not the freelist.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12888

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotdb: document hashtable bucket offset calculation madness
Ralph Boehme [Sun, 2 Jul 2017 09:41:43 +0000 (11:41 +0200)]
tdb: document hashtable bucket offset calculation madness

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotbd: BUCKET(-1) returns wrong offset because tdb->hash_size is an unsigned int
Ralph Boehme [Sat, 1 Jul 2017 20:21:26 +0000 (22:21 +0200)]
tbd: BUCKET(-1) returns wrong offset because tdb->hash_size is an unsigned int

The following C program demonstrates the issue:

  #include <stdio.h>
  #include <stdlib.h>
  #include <stdarg.h>
  #include <stdbool.h>
  #include <string.h>
  #include <unistd.h>
  #include <errno.h>
  #include <dirent.h>
  #include <sys/types.h>

  int main(int argc, char **argv)
  {
      int hash = -1;
      int tsize_signed = 10;
      unsigned int tsize_unsigned = 10;
      int bucket;

  #define BUCKET(hash, tsize) ((hash) % (tsize))

      bucket = BUCKET(hash, tsize_unsigned);
      printf("hash [%d] tsize [%d] bucket [%d]\n", hash, tsize_unsigned, bucket);

      bucket = BUCKET(hash, tsize_signed);
      printf("hash [%d] tsize [%d] bucket [%d]\n", hash, tsize_signed, bucket);

      return 0;
  }

Output:

$ ./tmp
hash [-1] tsize [10] bucket [5]
hash [-1] tsize [10] bucket [-1]

The first version is what the current BUCKET() macro does. As a result
we lock the hashtable chain in bucket 5, NOT the freelist.

-1 is sign converted to an unsigned int 4294967295 and

  4294967295 % 10 = 5.

As all callers will lock the same wrong list consistently locking is
still consistent.

Stumpled across this when looking at the output of `tdbtool DB list`
which always printed some other hashchain and not the freelist.

The freelist bucket offset computation doesn't use the BUCKET macro in
freelist.c (directly or indirectly) when working on the freelist, it
just directly uses the FREELIST_TOP define, so this problem only affects
tdbtool list.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agotdb: rename struct tdb_traverse_lock hash member to list
Ralph Boehme [Sun, 2 Jul 2017 05:46:17 +0000 (07:46 +0200)]
tdb: rename struct tdb_traverse_lock hash member to list

The variable stores the hashtable bucket, not the hash. No change in
behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agopython: Make generated modules samba.ntstatus and samba.werror Python 3 compatible.
Lumir Balhar [Tue, 8 Aug 2017 09:50:30 +0000 (11:50 +0200)]
python: Make generated modules samba.ntstatus and samba.werror Python 3 compatible.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Aug 22 17:38:17 CEST 2017 on sn-devel-144

6 years agopython: scripting: Port ntstatus and werror generators to Python 3 compatible form.
Lumir Balhar [Tue, 8 Aug 2017 08:56:17 +0000 (10:56 +0200)]
python: scripting: Port ntstatus and werror generators to Python 3 compatible form.

Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
6 years agos3:printing: Add NULL check for state_path()
Andreas Schneider [Mon, 31 Jul 2017 08:09:52 +0000 (10:09 +0200)]
s3:printing: Add NULL check for state_path()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug 19 05:33:41 CEST 2017 on sn-devel-144

6 years agos3:libsmb: let do_connect() debug the negotiation result similar to "session request ok"
Stefan Metzmacher [Wed, 16 Aug 2017 10:42:48 +0000 (12:42 +0200)]
s3:libsmb: let do_connect() debug the negotiation result similar to "session request ok"

Also modify non-specified max_protocol to be PROTOCOL_LATEST
(currently PROTOCOL_SMB3_11).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12881

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:libsmb: don't call cli_NetServerEnum() on SMB2/3 connections in SMBC_opendir_ctx()
Stefan Metzmacher [Wed, 16 Aug 2017 10:38:30 +0000 (12:38 +0200)]
s3:libsmb: don't call cli_NetServerEnum() on SMB2/3 connections in SMBC_opendir_ctx()

This is all we can do with when using we allow SMB2/3 and the server supports
it, 'smb://' can't work unless we implement LLMNR and maybe WSD.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12876

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:smbclient: don't try any workgroup listing with "client min protocol = SMB2"
Stefan Metzmacher [Wed, 16 Aug 2017 06:56:39 +0000 (08:56 +0200)]
s3:smbclient: don't try any workgroup listing with "client min protocol = SMB2"

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:smbclient: improve the error messages for smbclient -L
Stefan Metzmacher [Wed, 16 Aug 2017 06:55:43 +0000 (08:55 +0200)]
s3:smbclient: improve the error messages for smbclient -L

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agos3:libsmb: let get_ipc_connect() use CLI_FULL_CONNECTION_FORCE_SMB1
Stefan Metzmacher [Fri, 7 Jul 2017 22:57:59 +0000 (00:57 +0200)]
s3:libsmb: let get_ipc_connect() use CLI_FULL_CONNECTION_FORCE_SMB1

get_ipc_connect() is only used in code paths that require cli_NetServerEnum()
to work, so it must already require SMB1 only.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12876

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agoxattr.id: Fix a typo
Volker Lendecke [Fri, 18 Aug 2017 12:59:58 +0000 (14:59 +0200)]
xattr.id: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Aug 18 20:49:42 CEST 2017 on sn-devel-144

6 years agos3:utils: Allow to run smbpasswd as user
Andreas Schneider [Fri, 18 Aug 2017 07:41:36 +0000 (09:41 +0200)]
s3:utils: Allow to run smbpasswd as user

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12974

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Aug 18 14:01:27 CEST 2017 on sn-devel-144

6 years agos3:gse_krb5: make use of precalculated krb5 keys in fill_mem_keytab_from_secrets()
Stefan Metzmacher [Thu, 17 Aug 2017 15:45:21 +0000 (17:45 +0200)]
s3:gse_krb5: make use of precalculated krb5 keys in fill_mem_keytab_from_secrets()

This avoids a lot of cpu cycles, which were wasted for each single smb
connection, even if the client didn't use kerberos.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12973

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Aug 18 10:04:57 CEST 2017 on sn-devel-144

6 years agos3:secrets: allow secrets_fetch_or_upgrade_domain_info() on an AD DC
Stefan Metzmacher [Thu, 17 Aug 2017 19:42:34 +0000 (21:42 +0200)]
s3:secrets: allow secrets_fetch_or_upgrade_domain_info() on an AD DC

The reason for the check is for write access as secrets.ldb is the
master database.

But secrets_fetch_or_upgrade_domain_info() just syncs the values
we got from if they got overwritten by secrets_store_machine_pw_sync().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12973

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agogetncchanges.py: Add test for GET_ANC and linked attributes
Tim Beale [Tue, 11 Jul 2017 22:16:00 +0000 (10:16 +1200)]
getncchanges.py: Add test for GET_ANC and linked attributes

Add a basic test that when we use GET_ANC and the parents have linked
attributes, then we receive all the expected links and all the expected
objects by the end of the test.

This extends the test code to track what linked attributes get received
and check whether they match what's present on the DC.

Also made some minor cleanups to store the received objects/links each
time we successfully receive a GETNCChanges response (this saves the
test case having to repeat this code every time).

Note that although this test involves linked attributes, it shouldn't
exercise the GET_TGT case at all.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agogetncchanges.py: Add GET_ANC replication test case
Tim Beale [Tue, 6 Jun 2017 06:21:40 +0000 (18:21 +1200)]
getncchanges.py: Add GET_ANC replication test case

This test:
- creates blocks of parent/child objects
- modifies the parents, so the child gets received first in the
  replication (which means the client has to use GET_ANC)
- checks that we always receive the parent before the child (if not, it
  either retries with GET_ANC, or asserts if GET_ANC is already set)
- modifies the parent objects to change their USN while the
  replication is in progress
- checks that all expected objects are received by the end of the
  test

I've added a repl_get_next() function to help simulate a client's
behaviour - if it encounters an object it doesn't know the parent of,
then it retries with GET_ANC.

Also added some debug to drs_base.py that developers can turn on to make
it easier to see what objects we're actually receiving in the
responses.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agogetncchanges.py: Add a new test for replication
Tim Beale [Tue, 6 Jun 2017 06:06:22 +0000 (18:06 +1200)]
getncchanges.py: Add a new test for replication

This adds a new test to check that if objects are modified during a
replication, then those objects don't wind up missing from the
replication data.

Note that when this scenario occurs, samba returns the objects in a
different order to Windows. This test doesn't care what order the
replicated objects get returned in, so long as they all have been
received by the end of the test.

As part of this, I've refactored _check_replication() in drs_base.py so
it can be reused in new tests. In these cases, the objects are split up
over multiple different chunks. So asserting that the objects are returned
in a specific order makes it difficult to run the same test on both Samba
and Windows.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agoreplmd: Try to add forward-link for unknown cross-partition links
Tim Beale [Mon, 24 Jul 2017 04:20:58 +0000 (16:20 +1200)]
replmd: Try to add forward-link for unknown cross-partition links

Previously Samba would just drop cross-partition links where the link
target object is unknown. Instead, what we want to do is try to add the
forward link for the GUID specified. We can't add the backlink because
we don't know the target, however, dbcheck should be able to fix any
missing backlinks.

The new behaviour should now mean dbcheck will detect the problem and be
able to fix it. It's still not ideal, but it's better than dropping the
link completely.

I've updated the log so that it has higher severity and tells the user
what they need to do to fix it.

These changes now mean that the selftests now detect an error - instead
of completely dropping the serverReference, we now have a missing
backlink. I've updated the selftests to fix up any missing
serverReference backlinks before running dbcheck.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agoreplmd: Don't fail cycle if we get link for deleted object with GET_TGT
Tim Beale [Wed, 19 Jul 2017 23:14:27 +0000 (11:14 +1200)]
replmd: Don't fail cycle if we get link for deleted object with GET_TGT

We are going to end up supporting 2 different server schemes:
A. the old/default behaviour of sending all the linked attributes last,
   at the end of the replication cycle.
B. the new/Microsoft way of sending the linked attributes interleaved
   with the source/target objects.

Normally if we're talking to a server using the old scheme-A, we won't
ever use the GET_TGT flag. However, there are a couple of cases where
it can happen:
- A link to a new object was added during the replication cycle.
- An object was deleted while the replication was in progress (and
the linked attribute got queued before the object was deleted).

Talking to an Samba DC running the old scheme will just cause it to
start the replication cycle from scratch again, which is fairly
harmless. However, there is a chance that the same thing can happen
again, in which case the replication cycle will fail (because GET_TGT
was already set).

Even if we're using the new scheme (B), we could still potentially hit
this case, as we can still queue up linked attributes between requests
(group memberships can be larger than what can fit into a single
replication chunk).

If GET_TGT is set in the GetNcChanges request, then the local copy of
the target object should always be up-to-date when we process the linked
attribute. So if we still think the target object is deleted/recycled at
this point, then it's safe to ignore the linked attribute (because we
know our local copy is up-to-date). This logic matches the MS spec logic
in ProcessLinkValue().

Not failing the replication cycle may be beneficial if we're trying to
do a full-sync of a large database. Otherwise it might be time-consuming
and frustrating to repeat the sync unnecessarily.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agoreplmd: Avoid dropping links if link target is deleted
Tim Beale [Wed, 19 Jul 2017 04:18:20 +0000 (16:18 +1200)]
replmd: Avoid dropping links if link target is deleted

The server-side can potentially send the linked attribute before the
target-object. This happens on Microsoft, and will happen on Samba once
server-side GET_TGT support is added. In these cases there is a hole
where the Samba client can silently drop the linked attribute.

If the old copy of the target object was deleted/recycled, then the
client can receive the new linked attribute before it realizes the target
has now been reincarnated. It silently ignores the linked attribute,
thinking its receiving out of date information, when really it's the
client's copy of the target object that's out of date.

In this case we want to retry with the GET_TGT flag set, which will
force the updated version of the target object to be sent along with the
linked attribute. This deleted/recycled target case is the main reason
that Windows added the GET_TGT flag.

If the server sends all the links at the end, instead of along with the
source object, then this case can still be hit. If so, it will cause the
server to restart the replication from the beginning again. This is
probably preferential to silently dropping links.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agoreplmd: Move where we store linked attributes
Tim Beale [Wed, 21 Jun 2017 22:43:31 +0000 (10:43 +1200)]
replmd: Move where we store linked attributes

There was a bug in my previous patch where the code would verify
*all* links in the list, rather than just the ones that are new. And it
would do this for every replication chunk it received, regardless of
whether there were actually any links in that chunk.

The problem is by the time we want to verify the attributes, we don't
actually know which attributes are new. We can fix this by moving where
we store the linked attributes from the start of processing the
replication chunk to the end of processing the chunk. We can then verify
the new linked attributes at the same time we store them.

Longer-term we may want to try to apply the linked attribute at this
point. This would save looking up the source/target objects twice, but
it makes things a bit more complicated (attributes will usually apply at
this point *most* of the time, but not *all* the time).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agodrs_utils: Add GET_TGT support to 'samba-tool drs replicate --local'
Tim Beale [Fri, 16 Jun 2017 00:54:32 +0000 (12:54 +1200)]
drs_utils: Add GET_TGT support to 'samba-tool drs replicate --local'

Update drs_Replicate.replicate() so it handles being passed the GET_TGT
flag (more_flags). To do this, we need to always use a v10 GetNCChanges
request (v8 and v10 are essentially the same except for the more_flags).

If the replicate_chunk() call into the C bindings throws an error, check
to see whether the error could be fixed by setting the GET_TGT flag, and
re-send the request if so.

Unfortunately because WERR_DS_DRA_RECYCLED_TARGET isn't documented with
the other AD error codes, I've left it hardcoded for now (Microsoft
should be fixing up their Docs).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agoreplmd: Set GET_ANC if Windows sends a link with unknown source object
Tim Beale [Thu, 15 Jun 2017 21:49:16 +0000 (09:49 +1200)]
replmd: Set GET_ANC if Windows sends a link with unknown source object

Windows replication can send the linked attribute before it sends the
source object. The MS-DRSR spec says that in this case the client should
resend the GetNCChanges request with the GET_ANC flag set. In my testing
this resolves the problem - Windows will include the source object for the
linked attribute in the same replication chunk.

This problem doesn't happen with Samba-to-Samba replication, because the
source object for the linked attribute is guaranteed to have already been
sent.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agodrepl: Support GET_TGT on periodic replication client
Tim Beale [Thu, 15 Jun 2017 04:52:33 +0000 (16:52 +1200)]
drepl: Support GET_TGT on periodic replication client

- Update IDL comments to include Microsoft reference doc
- Add support for sending v10 GetNCChanges request (needed for the
  GET_TGT flag, which is in the new 'more_flags' field)
- Update to also set the GET_TGT flag in the same place we were setting
  GET_ANC (I split this logic out into a separate function).
- The state struct now needs to hold a 'more_flags' field as well (this
  flag is different to the GET_ANC replica flag)

Note that using the GET_TGT when replicating from a Windows DC could be
highly inefficient. Because Samba keeps the GET_TGT flag set throughout
the replication cycle, it will basically receive a repeated object from
Windows for every single linked attribute that it receives.

I believe Windows behaviour only expects the client to set the GET_TGT
flag when it actually needs to (i.e. when it receives a target object it
doesn't know about), rather than throughout the replication cycle.
However, this approach won't work with Samba-to-Samba replication,
because when the server receives the GET_TGT flag it restarts the
replication cycle from scratch. So if we only set the GET_TGT flag when
the client encountered an unknown target then Samba-to-Samba could
potentially get into an endless replication loop.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agodrs: Check target object is known after applying objects
Tim Beale [Thu, 15 Jun 2017 02:09:27 +0000 (14:09 +1200)]
drs: Check target object is known after applying objects

Currently we only check that the target object is known at the end of
the transaction (i.e. the .prepare_commit hook). It's too late at this
point to resend the request with GET_TGT. Move this processing earlier
on, after we've applied all the objects (i.e. off the .extended hook).

In reality, we need to perform the checks at both points. I've
split the common code that gets the source/target details out of the
la_entry into a helper function. It's not the greatest function ever,
but seemed to make more sense than duplicating the code.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agodrs: Fail replication transaction instead of dropping links
Tim Beale [Tue, 13 Jun 2017 23:35:36 +0000 (11:35 +1200)]
drs: Fail replication transaction instead of dropping links

If the DRS client received a linked attribute that it couldn't resolve
the target for, then it would just ignore that link and keep going. That
link would then be lost forever (although a full-sync would resolve
this). Instead of silently ignoring the link, fail the transaction.

This *can* happen on Samba, but it is unusual. The target object and
linked-attribute would need to be added while a replication is still in
progress. It can also happen fairly easily when talking to a Windows DC.

There are two import exceptions to this:

1). Linked attributes that span partitions. We can never guarantee that
we will have received the target object, because it may be in a partition
we haven't replicated yet. Samba doesn't have a great way of handling
this currently, but we shouldn't fail the replication (because that breaks
basic join tests). Just skip that linked attribute and hope that a
subsequent full-sync will fix it.
(I queried Microsoft and they said resolving cross-partition linked
attributes is a implementation-specific problem to solve. GET_TGT won't
resolve it)

2). When the replication involves a subset of objects, e.g.
critical-only. In these cases, we don't increase the highwater-mark, so
it is probably not such a dire problem if we don't add the link. In the
case of critical-only, we will do a subsequent full sync which will then
add the links.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agoreplmd: Split checking link attr target into new function
Tim Beale [Tue, 13 Jun 2017 22:51:59 +0000 (10:51 +1200)]
replmd: Split checking link attr target into new function

We want to re-use this code to check that the linked attribute's target
object exists *before* we try to commit the transaction. This will allow
us to re-request the block with the GET_TGT flag set.

This splits checking the target object exists into a separate function.

Minor changes of note:
- the 'parent' argument was passed to replmd_process_linked_attribute()
  as NULL, so I've just replaced where it was used in the refactored code
  with NULL.
- I've tweaked the "Failed to find GUID" error message slightly to display
  the attribute ID rather than the attribute name (saves repeating
  lookups and/or passing extra arguments).
- Tweaked the replmd_deletion_state() logic - it only made sense to call
  it in the code block where we actually found the target

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agowerror: Add WERR_DS_DRA_RECYCLED_TARGET
Tim Beale [Tue, 30 May 2017 03:08:44 +0000 (15:08 +1200)]
werror: Add WERR_DS_DRA_RECYCLED_TARGET

When the DRS client encounters a linked attribute with an unknown target
object, it should return a RECYCLED_TARGET error, which should result in
the client resending the GETNCChanges request with the GET_TGT flag set.

This error code is currently documented by Microsoft under System Error
Codes (8200-8999). I contacted them and they will also add it to the
MS-ERREF doc in future.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12972

6 years agolibcli/smb: debug an error if smb1cli_req_writev_submit() is called for SMB2/3
Stefan Metzmacher [Wed, 16 Aug 2017 20:27:15 +0000 (22:27 +0200)]
libcli/smb: debug an error if smb1cli_req_writev_submit() is called for SMB2/3

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12968

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug 18 04:45:03 CEST 2017 on sn-devel-144

6 years agos3: libsmb: Add cli_smb2_chkpath() and use from cli_chkpath().
Jeremy Allison [Wed, 16 Aug 2017 22:48:01 +0000 (15:48 -0700)]
s3: libsmb: Add cli_smb2_chkpath() and use from cli_chkpath().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12968

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
6 years agoutil: Add documentation for PID file handling
Martin Schwenke [Wed, 2 Aug 2017 02:10:18 +0000 (12:10 +1000)]
util: Add documentation for PID file handling

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Aug 17 19:45:32 CEST 2017 on sn-devel-144

6 years agoctdb-daemon: Fix a return value
Martin Schwenke [Fri, 11 Aug 2017 06:08:51 +0000 (16:08 +1000)]
ctdb-daemon: Fix a return value

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agoctdb-daemon: Fix default socket location
Martin Schwenke [Fri, 11 Aug 2017 05:18:13 +0000 (15:18 +1000)]
ctdb-daemon: Fix default socket location

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
6 years agogencache: Simplify gencache_stabilize
Volker Lendecke [Wed, 16 Aug 2017 15:37:41 +0000 (17:37 +0200)]
gencache: Simplify gencache_stabilize

The only record that must remain in gencache_notrans.tdb is the last_stabilize
marker. Use tdb_wipe_all and store the marker under the allrecord lock.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 17 15:49:00 CEST 2017 on sn-devel-144

6 years agogencache: Remove tdb_check from gencache_init()
Volker Lendecke [Wed, 16 Aug 2017 14:22:27 +0000 (16:22 +0200)]
gencache: Remove tdb_check from gencache_init()

This was legacy from times when we had just one non-transactioned gencache.tdb.
With the split into transactioned gencache.tdb and fast, non-transactioned,
mutexed clear-if-first gencache_notrans.tdb this has become unnecessary.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agotdb: Clarify the CLEAR_IF_FIRST locked logic
Volker Lendecke [Wed, 16 Aug 2017 13:21:14 +0000 (15:21 +0200)]
tdb: Clarify the CLEAR_IF_FIRST locked logic

This is another level of indentation, but it took me a while staring at the
if-condition to find that "locked" was assigned the result of "==0", not the
return value of tdb_nest_lock().

Best viewed with "git show -b".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agoutil: Add error handling to become_daemon()
Martin Schwenke [Tue, 15 Aug 2017 02:41:03 +0000 (12:41 +1000)]
util: Add error handling to become_daemon()

Log failure and exit if fork() or setsid() fails.

Leave the logic in the non-setsid() code as it is.  This is probably
meant to fall through on failure of either opening /dev/tty or
ioctl().  Documentation for the ioctl() failure case is far from
clear.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 17 11:48:32 CEST 2017 on sn-devel-144

6 years agoutil: Move become_daemon.c to samba-util-core
Martin Schwenke [Tue, 15 Aug 2017 01:43:12 +0000 (11:43 +1000)]
util: Move become_daemon.c to samba-util-core

So that CTDB can use it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agoutil: Modernise logging
Martin Schwenke [Tue, 15 Aug 2017 01:41:58 +0000 (11:41 +1000)]
util: Modernise logging

Switch to using DBG_ERR(), wrap logging/sd_notifyf() lines.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agoutil: Make function definitions consistent with header file
Martin Schwenke [Tue, 15 Aug 2017 01:22:45 +0000 (11:22 +1000)]
util: Make function definitions consistent with header file

no_process_group -> no_session, name -> daemon, drop _PUBLIC_.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agoutil: Add become_daemon.h
Martin Schwenke [Tue, 15 Aug 2017 01:12:35 +0000 (11:12 +1000)]
util: Add become_daemon.h

Rename argument no_process_group to no_session to describe what it
actually does.  Consistently use "daemon" for name of daemon argument.
Add documentation.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agoutil: Avoid use of includes.h
Martin Schwenke [Tue, 15 Aug 2017 01:11:39 +0000 (11:11 +1000)]
util: Avoid use of includes.h

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agotests: replace traffic_summary test with python blackbox test
Gary Lockyer [Sun, 6 Aug 2017 22:08:28 +0000 (10:08 +1200)]
tests: replace traffic_summary test with python blackbox test

Replace the shell subunit test for script/traffic_summary.pl with a
python black box test.

This involves moving the test files to more standard locations.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Aug 17 07:59:38 CEST 2017 on sn-devel-144

6 years agoscripts: Scripts to replay and generate samba traffic
Gary Lockyer [Wed, 28 Jun 2017 23:08:37 +0000 (11:08 +1200)]
scripts: Scripts to replay and generate samba traffic

Scripts to generate representative network traffic and replay this to a
samba instance.  For load testing, performance profiling and capacity
planning.

traffic_learner  process a file generated by traffic_summary and
                 generate a model that can be used by traffic_replay to
                 generate samba network traffic.

traffic_replay   Replay a summary file generated by traffic_summary, or
                 use a model created by traffic_learner to generate
                 network traffic.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Pair-programmed-with: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Tim Beale <timbeale@catalyst.net.nz>

6 years agoblackbox tests: method to check specific exit codes
Gary Lockyer [Wed, 16 Aug 2017 01:52:25 +0000 (13:52 +1200)]
blackbox tests: method to check specific exit codes

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
6 years agotraffic_summary: avoid uninitialised variable warning
Douglas Bagnall [Fri, 23 Jun 2017 02:16:53 +0000 (14:16 +1200)]
traffic_summary: avoid uninitialised variable warning

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
6 years agolib: talloc: Use the system <talloc.h> include.
Jeremy Allison [Mon, 14 Aug 2017 23:04:18 +0000 (16:04 -0700)]
lib: talloc: Use the system <talloc.h> include.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 17 00:53:48 CEST 2017 on sn-devel-144

6 years agolib: tevent: Use system <tevent.h>, not internal header path (except in self-test).
Jeremy Allison [Mon, 14 Aug 2017 22:54:39 +0000 (15:54 -0700)]
lib: tevent: Use system <tevent.h>, not internal header path (except in self-test).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agos3: messaging: Add background job send failure message
Anoop C S [Mon, 14 Aug 2017 09:54:20 +0000 (15:24 +0530)]
s3: messaging: Add background job send failure message

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Aug 16 16:26:12 CEST 2017 on sn-devel-144

6 years agolibhttp: Remove an unneeded include
Volker Lendecke [Wed, 26 Jul 2017 13:18:16 +0000 (15:18 +0200)]
libhttp: Remove an unneeded include

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): Wed Aug 16 04:11:47 CEST 2017 on sn-devel-144

6 years agodbwrap: Simplify dbwrap_unmarshall_fn
Volker Lendecke [Wed, 26 Jul 2017 13:14:51 +0000 (15:14 +0200)]
dbwrap: Simplify dbwrap_unmarshall_fn

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap: Simplify dbwrap_trans_delete
Volker Lendecke [Wed, 26 Jul 2017 13:12:21 +0000 (15:12 +0200)]
dbwrap: Simplify dbwrap_trans_delete

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap: Simplify dbwrap_trans_store
Volker Lendecke [Wed, 26 Jul 2017 13:10:55 +0000 (15:10 +0200)]
dbwrap: Simplify dbwrap_trans_store

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap: Simplify dbwrap_store_uint32_bystring
Volker Lendecke [Wed, 26 Jul 2017 12:56:53 +0000 (14:56 +0200)]
dbwrap: Simplify dbwrap_store_uint32_bystring

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap: Simplify dbwrap_store_int32_bystring
Volker Lendecke [Wed, 26 Jul 2017 12:56:53 +0000 (14:56 +0200)]
dbwrap: Simplify dbwrap_store_int32_bystring

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap: Convert dbwrap_delete to dbwrap_do_locked
Volker Lendecke [Wed, 9 Nov 2016 15:37:49 +0000 (16:37 +0100)]
dbwrap: Convert dbwrap_delete to dbwrap_do_locked

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agodbwrap: Convert dbwrap_store to dbwrap_do_locked
Volker Lendecke [Wed, 9 Nov 2016 15:34:28 +0000 (16:34 +0100)]
dbwrap: Convert dbwrap_store to dbwrap_do_locked

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
6 years agopy-librpc: Strictly check the type of the incoming sid pointer
Andrew Bartlett [Wed, 9 Aug 2017 01:57:13 +0000 (13:57 +1200)]
py-librpc: Strictly check the type of the incoming sid pointer

This avoids casting another type of object to a void* and then to a SID

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Tue Aug 15 12:00:58 CEST 2017 on sn-devel-144

6 years agos4/lib/tls: Use SHA256 to sign the TLS certificates
Andrew Bartlett [Wed, 9 Aug 2017 04:44:24 +0000 (16:44 +1200)]
s4/lib/tls: Use SHA256 to sign the TLS certificates

The use of SHA-1 has been on the "do not" list for a while now, so make our
self-signed certificates use SHA256 using the new
gnutls_x509_crt_sign2 provided since GNUTLS 1.2.0

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12953

6 years agosamba-tool dns query: Allow '*' in names
Gary Lockyer [Wed, 19 Jul 2017 21:13:43 +0000 (09:13 +1200)]
samba-tool dns query: Allow '*' in names

As DNS wild cards are now supported we need to allow '*' characters in
the domain names.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952

6 years agosamba-tool dns: Test support of DNS wild card in names
Gary Lockyer [Mon, 7 Aug 2017 01:42:02 +0000 (13:42 +1200)]
samba-tool dns: Test support of DNS wild card in names

As DNS wild cards are now supported we need to allow '*' characters in
the domain names.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952

6 years agodnsserver: Add support for dns wildcards
Gary Lockyer [Thu, 3 Aug 2017 03:12:02 +0000 (15:12 +1200)]
dnsserver: Add support for dns wildcards

Add support for dns wildcard records. i.e. if the following records
exist

  exact.samba.example.com 3600 A 1.1.1.1
  *.samba.example.com     3600 A 1.1.1.2

look up on exact.samba.example.com will return 1.1.1.1
look up on *.samba.example.com     will return 1.1.1.2
look up on other.samba.example.com will return 1.1.1.2

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952

6 years agodnsserver: Tighten DNS name checking
Gary Lockyer [Thu, 3 Aug 2017 03:12:51 +0000 (15:12 +1200)]
dnsserver: Tighten DNS name checking

Add checks for the maximum permitted length, maximum number of labels
and the maximum label length.  These extra checks will be used by the
DNS wild card handling.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12952