ambi/samba-autobuild/.git
7 years agoctdb-scripts: Avoid shellcheck warning SC2059 ($ in printf format)
Martin Schwenke [Thu, 14 Jul 2016 02:08:04 +0000 (12:08 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2059 ($ in printf format)

SC2059: Don't use variables in the printf format string.
        Use printf "..%s.." "$foo".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid chellcheck warning SC2012 (ls for file list)
Martin Schwenke [Wed, 13 Jul 2016 01:50:58 +0000 (11:50 +1000)]
ctdb-scripts: Avoid chellcheck warning SC2012 (ls for file list)

SC2012: Use find instead of ls to better handle non-alphanumeric filenames.

Make this cope better with unexpected whitespace.

Unfortunately, this results in shellcheck warning:

  SC2035: Use ./*.tdb.* so names with dashes won't become options.

No!  Then stat(1) will print ./file.tdb.X.  We want the basenames and
we know the filenames don't start with dashes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2012 (ls for file list)
Martin Schwenke [Tue, 12 Jul 2016 20:53:21 +0000 (06:53 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2012 (ls for file list)

SC2012: Use find instead of ls to better handle non-alphanumeric filenames.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2038 (find without -print0)
Martin Schwenke [Tue, 12 Jul 2016 03:27:08 +0000 (13:27 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2038 (find without -print0)

SC2038: Use -print0/-0 or -exec + to allow for non-alphanumeric filenames.

The suggested options aren't POSIX-compliant.  This is more portable.

Base filenames can't have whitespace so rework to avoid problems with
whitespace in directory name.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2039 (non-portable ulimit options)
Martin Schwenke [Tue, 12 Jul 2016 02:15:12 +0000 (12:15 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2039 (non-portable ulimit options)

SC2039: In POSIX sh, ulimit -c/-n is not supported.

Have shellcheck suppress the warnings.  If -n is not supported then
don't set CTDB_MAX_OPEN_FILES.  If packaging for a platform where -c
is not supported then remove this code and associated documentation.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2039 (test -nt operator)
Martin Schwenke [Tue, 12 Jul 2016 01:57:55 +0000 (11:57 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2039 (test -nt operator)

SC2039: In POSIX sh, -nt is not supported.

This script is specific to the Linux NFS implementation.  The -nt
operator is well supported in Linux shells (e.g. dash, bash, ksh).
The alternatives (e.g. using stat(1)) would result in less readable
code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2094 (read/write same file)
Martin Schwenke [Mon, 11 Jul 2016 10:53:56 +0000 (20:53 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2094 (read/write same file)

SC2094: Make sure not to read and write the same file in the same pipeline.

The semantics here are unclear, so use a separate flock file in each
case for clarity.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2039 (echo -n)
Martin Schwenke [Wed, 6 Jul 2016 20:41:27 +0000 (06:41 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2039 (echo -n)

SC2039: In POSIX sh, echo flags are not supported.

echo -n is well supported but the changes are simple.

Improve some logic, replace some instances with printf.  Who knew
printf was in POSIX?

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2039 (type command)
Martin Schwenke [Wed, 6 Jul 2016 10:43:29 +0000 (20:43 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2039 (type command)

SC2039: In POSIX sh, 'type' is not supported.

type is commonly supported and is more portable than which(1).

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2015 (A && B || C)
Martin Schwenke [Wed, 6 Jul 2016 10:40:23 +0000 (20:40 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2015 (A && B || C)

SC2015: Note that A && B || C is not if-then-else. C may run when A is
true.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warnings SC2119, SC2120 (function arguments)
Martin Schwenke [Wed, 6 Jul 2016 10:25:57 +0000 (20:25 +1000)]
ctdb-scripts: Avoid shellcheck warnings SC2119, SC2120 (function arguments)

SC2119: Use FUNC "$@" if function's $1 should meanscript's $1.
SC2120: FUNC references arguments, but none are ever passed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2002 (useless cat)
Martin Schwenke [Wed, 6 Jul 2016 10:17:26 +0000 (20:17 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2002 (useless cat)

SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2017 (arithmetic precision)
Martin Schwenke [Wed, 6 Jul 2016 10:14:03 +0000 (20:14 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2017 (arithmetic precision)

SC2017: Increase precision by replacing a/b*c with a*c/b.

This code intentionally rounds to an even value.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC1004 (backslash in quotes)
Martin Schwenke [Wed, 6 Jul 2016 10:09:07 +0000 (20:09 +1000)]
ctdb-scripts: Avoid shellcheck warning SC1004 (backslash in quotes)

SC1004: You don't break lines with \ in single quotes, it results in
literal backslash-linefeed.

These don't hurt, since awk can cope with the continuations.  However,
they don't add anything.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2154 (unassigned variables)
Martin Schwenke [Wed, 6 Jul 2016 07:41:55 +0000 (17:41 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2154 (unassigned variables)

SC2154: VAR is referenced but not assigned.

Change ctdb_setup_service_state_dir(), ctdb_get_pnn() and
ctdb_get_ip_address() to print the value so it can be assigned to a
variable.  The performance gain from avoiding the sub-shells when
calling these functions is close to zero.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warnings SC2046, SC2086 (double-quoting)
Martin Schwenke [Wed, 6 Jul 2016 07:31:51 +0000 (17:31 +1000)]
ctdb-scripts: Avoid shellcheck warnings SC2046, SC2086 (double-quoting)

SC2046: Quote this to prevent word splitting.
SC2086: Double quote to prevent globbing and word splitting.

Add some quoting where it makes sense.  Use shellcheck directives for
false-positives.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2034 (unused variables)
Martin Schwenke [Wed, 6 Jul 2016 07:16:44 +0000 (17:16 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2034 (unused variables)

SC2034: VAR appears unused. Verify it or export it.

Drop some variables that are unnecessarily used.  Use shellcheck
directive for false-positives.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2004 ($ in arithmetic)
Martin Schwenke [Wed, 6 Jul 2016 06:50:30 +0000 (16:50 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2004 ($ in arithmetic)

SC2004: $/${} is unnecessary on arithmetic variables.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warnings SC2030, SC2031 (subshell variables)
Martin Schwenke [Wed, 6 Jul 2016 06:13:27 +0000 (16:13 +1000)]
ctdb-scripts: Avoid shellcheck warnings SC2030, SC2031 (subshell variables)

SC2030: Modification of VAR is local (to subshell caused by (..) group).
SC2031: VAR was modified in a subshell. That change might be lost.

Fix a related, incorrect comment.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Avoid shellcheck warning SC2016 ($ in single quotes)
Martin Schwenke [Wed, 6 Jul 2016 05:22:19 +0000 (15:22 +1000)]
ctdb-scripts: Avoid shellcheck warning SC2016 ($ in single quotes)

SC2016: Expressions don't expand in single quotes, use double quotes for that.

Error messages are now arguably more readable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Drop function ctdb_check_counter()
Martin Schwenke [Wed, 6 Jul 2016 05:11:43 +0000 (15:11 +1000)]
ctdb-scripts: Drop function ctdb_check_counter()

It is no longer used and adds needless complexity.

As a side-effect, the functions file can now be parsed by shellcheck.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Drop use of ctdb_check_counter from vsftpd event script
Martin Schwenke [Wed, 6 Jul 2016 05:06:24 +0000 (15:06 +1000)]
ctdb-scripts: Drop use of ctdb_check_counter from vsftpd event script

This makes the logic more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Drop use of ctdb_check_counter from reclock event script
Martin Schwenke [Wed, 6 Jul 2016 04:28:06 +0000 (14:28 +1000)]
ctdb-scripts: Drop use of ctdb_check_counter from reclock event script

This makes the logic more obvious.

Fix the (probably) accidental fall-through to the regular monitor
failure.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Drop use of ctdb_check_counter from httpd event script
Martin Schwenke [Wed, 6 Jul 2016 04:24:18 +0000 (14:24 +1000)]
ctdb-scripts: Drop use of ctdb_check_counter from httpd event script

This makes the logic more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Drop use of service_tcp_ports
Martin Schwenke [Wed, 6 Jul 2016 04:32:38 +0000 (14:32 +1000)]
ctdb-scripts: Drop use of service_tcp_ports

This makes the logic more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Event script indentation and whitespace cleanups
Martin Schwenke [Wed, 6 Jul 2016 04:44:14 +0000 (14:44 +1000)]
ctdb-scripts: Event script indentation and whitespace cleanups

* Re-indent case labels as per new script style

  Other indentation can be tweaked later as code changes, but the
  labels are an obvious bulk change.

* Minor whitespace fixes

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Drop use of ctdb_standard_event_handler()
Martin Schwenke [Mon, 11 Jul 2016 05:04:16 +0000 (15:04 +1000)]
ctdb-scripts: Drop use of ctdb_standard_event_handler()

It doesn't do anything.  Add a comment to its definition to explain
why it is still there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-tests: New event script test for corrupt TDB checking
Martin Schwenke [Tue, 12 Jul 2016 20:44:08 +0000 (06:44 +1000)]
ctdb-tests: New event script test for corrupt TDB checking

Ensures that backups of corrupt TDB files are correctly limited in
number.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-tests: Add new httpd event script test
Martin Schwenke [Mon, 11 Jul 2016 04:44:45 +0000 (14:44 +1000)]
ctdb-tests: Add new httpd event script test

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-tests: Add new vsftpd event script test
Martin Schwenke [Tue, 5 Jul 2016 10:10:06 +0000 (20:10 +1000)]
ctdb-tests: Add new vsftpd event script test

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-tests: Add reclock event script tests
Martin Schwenke [Wed, 6 Jul 2016 04:06:14 +0000 (14:06 +1000)]
ctdb-tests: Add reclock event script tests

Tweak eventscript unit test infrastructure to support.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agoctdb-scripts: Fix a bug in counter checking
Martin Schwenke [Tue, 5 Jul 2016 10:09:12 +0000 (20:09 +1000)]
ctdb-scripts: Fix a bug in counter checking

If there are insufficient arguments then they can't be shifted.

This function will be removed shortly.  However, it needs to work for
now as tests will be added that depend on it to work.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
7 years agos4:torture/ndr: add more krb5pac tests with PAC blobs from pkinit
Stefan Metzmacher [Tue, 19 Jul 2016 14:32:06 +0000 (16:32 +0200)]
s4:torture/ndr: add more krb5pac tests with PAC blobs from pkinit

We validate everything except the whole LOGON_INFO structure,
we even decrypt the PAC_CREDENTIALS_INFO blob and verify
PAC_CREDENTIAL_DATA_NDR and PAC_CREDENTIAL_NTLM_SECPKG.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul 21 01:07:28 CEST 2016 on sn-devel-144

7 years agos4:torture/ndr: make use of torture_suite_add_ndr_pull_validate_test() in krb5pac...
Stefan Metzmacher [Tue, 19 Jul 2016 14:38:56 +0000 (16:38 +0200)]
s4:torture/ndr: make use of torture_suite_add_ndr_pull_validate_test() in krb5pac when possible

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agokrb5_wrap: provide CKSUMTYPE_HMAC_SHA1_96_AES_*
Stefan Metzmacher [Tue, 19 Jul 2016 14:31:01 +0000 (16:31 +0200)]
krb5_wrap: provide CKSUMTYPE_HMAC_SHA1_96_AES_*

MIT only defined this as CKSUMTYPE_HMAC_SHA1_96_AES128,
while Heimdal has CKSUMTYPE_HMAC_SHA1_96_AES_128.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agokrb5pac/netlogon: add a comment regarding PAC_LOGON_INFO unique pointers on push
Stefan Metzmacher [Thu, 14 Jul 2016 07:34:43 +0000 (09:34 +0200)]
krb5pac/netlogon: add a comment regarding PAC_LOGON_INFO unique pointers on push

This difference is the reason why we can't fully (ndr)validate some
PAC blobs.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agotorture: Add another sample of a PAC that broke the old PAC_UPN_DNS_INFO handling
Andrew Bartlett [Tue, 19 Jul 2016 04:48:18 +0000 (16:48 +1200)]
torture: Add another sample of a PAC that broke the old PAC_UPN_DNS_INFO handling

This is included because this sample helped us addres issues in the previous attempt at
handling PAC_UPN_DNS_INFO correctly, and I have Tris's permission to include this in our
tests.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agos4-torture: add another krb5pac buffer to the ndr test.
Günther Deschner [Wed, 6 Feb 2013 12:10:44 +0000 (13:10 +0100)]
s4-torture: add another krb5pac buffer to the ndr test.

This one nicely demonstrates that the strings are really non-null terminated.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agos4-torture: add ndr krb5pac testsuite.
Günther Deschner [Thu, 13 Dec 2012 11:28:19 +0000 (12:28 +0100)]
s4-torture: add ndr krb5pac testsuite.

Someone changed the PAC buffer union without adding proper tests, now we
sometimes fail to parse the PAC completely due to that...

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agokrb5pac.idl: implement PAC_UPN_DNS_INFO correct
Stefan Metzmacher [Wed, 6 Jan 2016 12:27:21 +0000 (13:27 +0100)]
krb5pac.idl: implement PAC_UPN_DNS_INFO correct

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agokrb5pac: fix push/pull of subcontexts in PAC_BUFFER
Stefan Metzmacher [Wed, 6 Feb 2013 15:44:12 +0000 (16:44 +0100)]
krb5pac: fix push/pull of subcontexts in PAC_BUFFER

We need to have two subcontexts to get the padding right,
the outer subcontext uses NDR_ROUND(_ndr_size, 8), while
the inner subcontext only uses _ndr_size.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agokrb5pac: no need for a noprint PAC_BUFFER.
Günther Deschner [Mon, 18 Mar 2013 15:25:06 +0000 (16:25 +0100)]
krb5pac: no need for a noprint PAC_BUFFER.

Guenther

@@ -1,6 +1,7 @@
 _PUBLIC_ void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER *r)
 {
        ndr_print_struct(ndr, name, "PAC_BUFFER");
+       if (r == NULL) { ndr_print_null(ndr); return; }
        ndr->depth++;
        ndr_print_PAC_TYPE(ndr, "type", r->type);
        ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,0):r->_ndr_size);
@@ -11,7 +12,7 @@
                ndr_print_PAC_INFO(ndr, "info", r->info);
        }
        ndr->depth--;
-       ndr_print_uint32(ndr, "_pad", r->_pad);
+       ndr_print_uint32(ndr, "_pad", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->_pad);
        ndr->depth--;
 }

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agos4:torture/ndr: Add supplementalCredentials blob from Win2012R2
Andrew Bartlett [Wed, 20 Jul 2016 04:45:34 +0000 (16:45 +1200)]
s4:torture/ndr: Add supplementalCredentials blob from Win2012R2

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agos4:torture/ndr: Add supplementalCredentials blobs from alpha13 and release_4_1_0rc3
Andrew Bartlett [Wed, 20 Jul 2016 02:53:42 +0000 (14:53 +1200)]
s4:torture/ndr: Add supplementalCredentials blobs from alpha13 and release_4_1_0rc3

This coveres the case without AES keys, and before the IDL was changed for SambaGPG support

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agos4:torture/ndr: add validation checks for strange supplementalCredentials blobs
Stefan Metzmacher [Fri, 15 Jul 2016 07:10:03 +0000 (09:10 +0200)]
s4:torture/ndr: add validation checks for strange supplementalCredentials blobs

From the mail to dochelp:

  I've also got cases (where I created an account with
  UF_NORMAL_ACCOUNT|UF_ACCOUNTDISABLE|UF_SMARTCARD_REQUIRED
  in the LDAP add) with the following strange blobs:

  One time:
  [0000] 00 00 00 00 00 00 00 00 00 00 00 00 00

  and once:
  [0000] 00 00 00 00 00 00 00 00 00 00 00 00 53

  The original issue I reported was the following, a user was created
  with a password and then userAccountControl was changed to
  UF_NORMAL_ACCOUNT|UF_SMARTCARD_REQUIRED. In that case I'm getting:

  [0000] 00 00 00 00 62 00 00 00   00 00 00 00 20 00 20 00
  [0010] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00
  [0020] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00
  [0030] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00
  [0040] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00
  [0050] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00
  [0060] 20 00 20 00 20 00 20 00   20 00 20 00 50 00 30

As you see the last byte (unknown3) is always different on Windows,
but always 0x00 from Samba, so I used 0x00 in order to allow the
test to pass.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agos4-torture: rename torture_suite_add_ndr_pullpush_test to torture_suite_add_ndr_pull_...
Günther Deschner [Wed, 6 Feb 2013 11:34:53 +0000 (12:34 +0100)]
s4-torture: rename torture_suite_add_ndr_pullpush_test to torture_suite_add_ndr_pull_validate_test.

Hoping the new name is not as confusing as the old name.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agotorture: show the first differing byte and a dump in torture_assert_data_blob_equal().
Günther Deschner [Wed, 6 Feb 2013 11:25:43 +0000 (12:25 +0100)]
torture: show the first differing byte and a dump in torture_assert_data_blob_equal().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Günther Deschner <gd@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 years agodrsblobs.idl: supplementalCredentialsSubBlob make it possible to parse strange blobs
Stefan Metzmacher [Fri, 20 May 2016 16:59:20 +0000 (18:59 +0200)]
drsblobs.idl: supplementalCredentialsSubBlob make it possible to parse strange blobs

Windows omits the uint16 num_packages field when the packages array is empty.
This happens if the UF_SMARTCARD_REQUIRED flag is set for an account.

A user was created with a password and then userAccountControl was changed to
UF_NORMAL_ACCOUNT|UF_SMARTCARD_REQUIRED. In that case I'm getting
(as the whole supplementalCredentialsBlob):

[0000] 00 00 00 00 62 00 00 00   00 00 00 00 20 00 20 00   ....b... .... . .
[0010] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00    . . . .  . . . .
[0020] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00    . . . .  . . . .
[0030] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00    . . . .  . . . .
[0040] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00    . . . .  . . . .
[0050] 20 00 20 00 20 00 20 00   20 00 20 00 20 00 20 00    . . . .  . . . .
[0060] 20 00 20 00 20 00 20 00   20 00 20 00 50 00 30       . . . .  . .P.0

I've also got cases (where I created an account with
UF_NORMAL_ACCOUNT|UF_ACCOUNTDISABLE|UF_SMARTCARD_REQUIRED
in the LDAP add) with the following strange blobs:

One time:
[0000] 00 00 00 00 00 00 00 00   00 00 00 00 00
and once:
[0000] 00 00 00 00 00 00 00 00   00 00 00 00 53

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agodrsblobs.idl: mark supplementalCredentialsSubBlob as nopull,nopush
Stefan Metzmacher [Fri, 20 May 2016 15:06:23 +0000 (17:06 +0200)]
drsblobs.idl: mark supplementalCredentialsSubBlob as nopull,nopush

This commit moves the autogenerated ndr_{pull,push}_supplementalCredentialsSubBlob()
function to the handwritten librpc/ndr/ndr_drsblobs.c

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agos4:dsdb/password_hash: explicitly set SUPPLEMENTAL_CREDENTIALS_SIGNATURE
Stefan Metzmacher [Thu, 2 Jun 2016 17:57:15 +0000 (19:57 +0200)]
s4:dsdb/password_hash: explicitly set SUPPLEMENTAL_CREDENTIALS_SIGNATURE

Typically this is automatically set in ndr_push_supplementalCredentialsBlob(),
but we need to change that behavior in order to handle strange formated
values.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agos3:libnet_dssync_keytab: ignore empty supplementalCredentialsBlob structures
Stefan Metzmacher [Fri, 3 Jun 2016 14:34:08 +0000 (16:34 +0200)]
s3:libnet_dssync_keytab: ignore empty supplementalCredentialsBlob structures

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agos4:kdc: ignore empty supplementalCredentialsBlob structures
Stefan Metzmacher [Fri, 3 Jun 2016 14:34:08 +0000 (16:34 +0200)]
s4:kdc: ignore empty supplementalCredentialsBlob structures

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
7 years agoctdb-tools: Avoid uninitialised memory access
Martin Schwenke [Wed, 20 Jul 2016 06:42:32 +0000 (16:42 +1000)]
ctdb-tools: Avoid uninitialised memory access

==27786== Syscall param write(buf) points to uninitialised byte(s)
==27786==    at 0x62820D0: __write_nocancel (syscall-template.S:84)
==27786==    by 0x428B57: ctdb_queue_send (ctdb_io.c:322)
==27786==    by 0x41F3B1: ctdb_client_queue_pkt (ctdb_client.c:153)
==27786==    by 0x41F3B1: ctdb_client_send_message (ctdb_client.c:603)
==27786==    by 0x419FA3: srvid_broadcast.constprop.26 (ctdb.c:1965)
==27786==    by 0x41B869: control_reload_nodes_file (ctdb.c:5696)
==27786==    by 0x404DBA: main (ctdb.c:6008)
==27786==  Address 0x7ead310 is 144 bytes inside a block of size 168 alloc'd
==27786==    at 0x4C2BBCF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27786==    by 0x564DBEC: __talloc_with_prefix (talloc.c:675)
==27786==    by 0x564DBEC: __talloc (talloc.c:716)
==27786==    by 0x564DBEC: _talloc_named_const (talloc.c:873)
==27786==    by 0x564DBEC: _talloc_zero (talloc.c:2318)
==27786==    by 0x41E1E2: _ctdbd_allocate_pkt (ctdb_client.c:59)
==27786==    by 0x41F37D: ctdb_client_send_message (ctdb_client.c:594)
==27786==    by 0x419FA3: srvid_broadcast.constprop.26 (ctdb.c:1965)
==27786==    by 0x41B869: control_reload_nodes_file (ctdb.c:5696)
==27786==    by 0x404DBA: main (ctdb.c:6008)
==27786==

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agoctdb-client: Fix access after free error
Martin Schwenke [Wed, 20 Jul 2016 04:41:13 +0000 (14:41 +1000)]
ctdb-client: Fix access after free error

State is stolen onto tmp_ctx above so can't be referenced after
tmp_ctx is freed.  So, state->status has to be looked at earlier.

Moving it immediately before the talloc_free(tmp_ctx) isn't sufficient
because invoking the callback appears to cause a recursive call to
ctdb_control_recv(), which also frees state.

Referencing it at the top seems safe.

==23982== Invalid read of size 4
==23982==    at 0x4204AE: ctdb_control_recv (ctdb_client.c:1181)
==23982==    by 0x420645: invoke_control_callback (ctdb_client.c:971)
==23982==    by 0x5E675EC: tevent_common_loop_timer_delay (tevent_timed.c:341)
==23982==    by 0x5E68639: epoll_event_loop_once (tevent_epoll.c:911)
==23982==    by 0x5E66BD6: std_event_loop_once (tevent_standard.c:114)
==23982==    by 0x5E622EC: _tevent_loop_once (tevent.c:533)
==23982==    by 0x4255F7: ctdb_client_async_wait (ctdb_client.c:3385)
==23982==    by 0x42578A: ctdb_client_async_control (ctdb_client.c:3442)
==23982==    by 0x41B405: ctdb_get_nodes_files (ctdb.c:5488)
==23982==    by 0x41B405: check_all_node_files_are_identical (ctdb.c:5530)
==23982==    by 0x41B405: control_reload_nodes_file (ctdb.c:5673)
==23982==    by 0x404DBA: main (ctdb.c:6008)
==23982==  Address 0x7e98d9c is 108 bytes inside a block of size 168 free'd
==23982==    at 0x4C2CDFB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23982==    by 0x5652692: _tc_free_internal (talloc.c:1125)
==23982==    by 0x5652692: _tc_free_children_internal (talloc.c:1570)
==23982==    by 0x564B952: _tc_free_internal (talloc.c:1081)
==23982==    by 0x564B952: _talloc_free_internal (talloc.c:1151)
==23982==    by 0x564B952: _talloc_free (talloc.c:1693)
==23982==    by 0x4204C9: ctdb_control_recv (ctdb_client.c:1182)
==23982==    by 0x4207AA: async_callback (ctdb_client.c:3350)
==23982==    by 0x4204AD: ctdb_control_recv (ctdb_client.c:1179)
==23982==    by 0x420645: invoke_control_callback (ctdb_client.c:971)
==23982==    by 0x5E675EC: tevent_common_loop_timer_delay (tevent_timed.c:341)
==23982==    by 0x5E68639: epoll_event_loop_once (tevent_epoll.c:911)
==23982==    by 0x5E66BD6: std_event_loop_once (tevent_standard.c:114)
==23982==    by 0x5E622EC: _tevent_loop_once (tevent.c:533)
==23982==    by 0x4255F7: ctdb_client_async_wait (ctdb_client.c:3385)
==23982==  Block was alloc'd at
==23982==    at 0x4C2BBCF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23982==    by 0x564DBEC: __talloc_with_prefix (talloc.c:675)
==23982==    by 0x564DBEC: __talloc (talloc.c:716)
==23982==    by 0x564DBEC: _talloc_named_const (talloc.c:873)
==23982==    by 0x564DBEC: _talloc_zero (talloc.c:2318)
==23982==    by 0x42017F: ctdb_control_send (ctdb_client.c:1086)
==23982==    by 0x425746: ctdb_client_async_control (ctdb_client.c:3431)
==23982==    by 0x41B405: ctdb_get_nodes_files (ctdb.c:5488)
==23982==    by 0x41B405: check_all_node_files_are_identical (ctdb.c:5530)
==23982==    by 0x41B405: control_reload_nodes_file (ctdb.c:5673)
==23982==    by 0x404DBA: main (ctdb.c:6008)
==23982==

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agoctdb-client: Fix incorrect variable reference
Martin Schwenke [Wed, 20 Jul 2016 04:46:58 +0000 (14:46 +1000)]
ctdb-client: Fix incorrect variable reference

The point of this code is almost certainly to return non-zero when
state->errormsg is set.  So, return state->status if non-zero, -1
otherwise.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agoWHATSNEW: Add features added for Samba 4.5
Andrew Bartlett [Tue, 19 Jul 2016 03:48:28 +0000 (15:48 +1200)]
WHATSNEW: Add features added for Samba 4.5

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agosamba-tool: Speed up all samba-tool commands
Garming Sam [Fri, 15 Jul 2016 02:29:02 +0000 (14:29 +1200)]
samba-tool: Speed up all samba-tool commands

This in particular helps the docs.py test halve in time (at least on my machine)

NOTE: The removal of enable_null_tracking is required because we are no
longer importing join.py in every single samba-tool invocation. Without
removing this line, memory would be hanging from both the actual NULL
context and the talloc_null_context (causing a segfault at system_exit).

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Wed Jul 20 12:47:24 CEST 2016 on sn-devel-144

7 years agonotifyd: Move BlockSignals calls to server.c
Volker Lendecke [Tue, 19 Jul 2016 12:36:07 +0000 (14:36 +0200)]
notifyd: Move BlockSignals calls to server.c

notifyd_send() is called as part of smbd initialization both in normal daemon
mode after a fork, but also in interactive mode. In interactive mode, notifyd
should not modify the global signal state with BlockSignals(). This patch moves
the signal blocking to the place where we know that notifyd is a child daemon.

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 Jul 20 09:04:00 CEST 2016 on sn-devel-144

7 years agosmbd: Re-register notify requests
Volker Lendecke [Tue, 21 Jun 2016 14:23:19 +0000 (16:23 +0200)]
smbd: Re-register notify requests

When notifyd is restarted, the parent will broadcast that fact to all workers.
They will then re-register their notify requests.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Restart notifyd
Volker Lendecke [Fri, 24 Jun 2016 14:29:28 +0000 (16:29 +0200)]
smbd: Restart notifyd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Store notify filters in fsp->notify
Volker Lendecke [Fri, 24 Jun 2016 14:27:34 +0000 (16:27 +0200)]
smbd: Store notify filters in fsp->notify

When notifyd crashes, it will be restarted. We need to restore the filters with
notifyd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Log which notifyd was found
Volker Lendecke [Thu, 23 Jun 2016 12:24:32 +0000 (14:24 +0200)]
smbd: Log which notifyd was found

Just a debugging aid

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Remember notifyd's serverid
Volker Lendecke [Tue, 21 Jun 2016 12:13:06 +0000 (14:13 +0200)]
smbd: Remember notifyd's serverid

Similarly to cleanupd, this is necessary to restart notifyd

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agonotify_msg: Deregister handler upon talloc_free
Volker Lendecke [Tue, 21 Jun 2016 11:04:25 +0000 (13:04 +0200)]
notify_msg: Deregister handler upon talloc_free

So far, we haven't TALLOC_FREE'ed the notify context. This will change.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Remove "listel" from notify_msg
Volker Lendecke [Tue, 14 Jun 2016 13:03:35 +0000 (15:03 +0200)]
smbd: Remove "listel" from notify_msg

We have all information that was kept in "notify_list" in other parts of smbd
as well. The only possible downside of this patch is that we possibly have a
lot more fsp's than fsp's with notifies, so notify_callback() might be a bit
slower in this situation. If this turns out to be a problem, I'd rather put
some more smarts into the notifyd protocol to enable a better indexed
notify_callback(). For now, this avoids data to be kept in two places.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Protect notify_callback from stray pointers
Volker Lendecke [Tue, 14 Jun 2016 13:00:29 +0000 (15:00 +0200)]
smbd: Protect notify_callback from stray pointers

This protection right now lives in notify_msg.c with the notify_list, but that
will go.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Pass "sconn" via notify to notify_callback()
Volker Lendecke [Tue, 14 Jun 2016 12:54:32 +0000 (14:54 +0200)]
smbd: Pass "sconn" via notify to notify_callback()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: There's only one notify_callback
Volker Lendecke [Tue, 14 Jun 2016 09:55:13 +0000 (11:55 +0200)]
smbd: There's only one notify_callback

We do not have different callbacks per notify, put the callback function into
the notify context

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Make notify_callback() public
Volker Lendecke [Tue, 14 Jun 2016 04:54:11 +0000 (06:54 +0200)]
smbd: Make notify_callback() public

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: "path" is no longer needed in notify_list
Volker Lendecke [Mon, 13 Jun 2016 16:08:58 +0000 (18:08 +0200)]
smbd: "path" is no longer needed in notify_list

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Add "path" to notify_remove
Volker Lendecke [Mon, 13 Jun 2016 16:06:08 +0000 (18:06 +0200)]
smbd: Add "path" to notify_remove

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Avoid a talloc_asprintf
Volker Lendecke [Mon, 13 Jun 2016 14:22:31 +0000 (16:22 +0200)]
smbd: Avoid a talloc_asprintf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Add fsp_fullbasepath
Volker Lendecke [Mon, 13 Jun 2016 14:12:54 +0000 (16:12 +0200)]
smbd: Add fsp_fullbasepath

Okay, this is similar to full_path_tos, but with variable arrays now and much
simpler :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Factor out notify_init
Volker Lendecke [Thu, 23 Jun 2016 10:53:47 +0000 (12:53 +0200)]
smbd: Factor out notify_init

Before this patch, failure of notify_init was ignored. Also, no proper error
handling of a messaging_register failure was done. Fix those, also adding some
debug messages.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: sconn->sys_notify_ctx is not used
Volker Lendecke [Wed, 15 Jun 2016 08:21:48 +0000 (10:21 +0200)]
smbd: sconn->sys_notify_ctx is not used

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agosmbd: Don't stop sending to children when one send fails
Volker Lendecke [Tue, 21 Jun 2016 14:10:14 +0000 (16:10 +0200)]
smbd: Don't stop sending to children when one send fails

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos3: torture: Regression test case to specify exactly how UNIX extensions should act...
Jeremy Allison [Tue, 19 Jul 2016 16:24:38 +0000 (09:24 -0700)]
s3: torture: Regression test case to specify exactly how UNIX extensions should act on files with streams.

If a stream is open, refuse the unlink. Ensure UNIX unlink
request can remove a file containing streams.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jul 20 05:20:29 CEST 2016 on sn-devel-144

7 years agos3: smbd: Fix delete operations enumerating streams inside a file. This must always...
Jeremy Allison [Tue, 19 Jul 2016 16:21:08 +0000 (09:21 -0700)]
s3: smbd: Fix delete operations enumerating streams inside a file. This must always be done as a Windows operation.

When using UNIX extensions to delete a file containing streams,
the open for delete and close operations need to enumerate the
contained streams and do CREATE and UNLINK operations on the
stream names. These must always be done as Windows operations
(remove the SMB_FILENAME_POSIX_PATH flag) as the stream names
are Windows paths.

Without this the create operation under the unlink will
recurse and cause the client to time out (or a server crash).

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agoVLV tests: remove vestigial pdb stub
Douglas Bagnall [Tue, 19 Jul 2016 02:03:57 +0000 (14:03 +1200)]
VLV tests: remove vestigial pdb stub

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul 19 17:22:51 CEST 2016 on sn-devel-144

7 years agoVLV tests: add tests with show_deleted control
Douglas Bagnall [Tue, 19 Jul 2016 01:39:45 +0000 (13:39 +1200)]
VLV tests: add tests with show_deleted control

These tests add a few deleted users and ensure they are VLV-able.

In a `make test` context there will be other deleted users lying
around, so we can't assert the expected results of the search without
looking first.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoVLV: fix handling with show_deleted and similar controls
Douglas Bagnall [Fri, 8 Jul 2016 02:20:15 +0000 (14:20 +1200)]
VLV: fix handling with show_deleted and similar controls

The first search in each round of VLV performs the search then saves
the results in the form of an array of GUIDs, which subsequent calls
refer to to get different ranges from the same search. These
subsequent calls make an individual search for each GUID. If the
original search had the show_deleted control, the array may contain
GUIDs for deleted items, which would not be seen on the later
searches without the same control.

So we save all controls except the VLV itself and the sort control
(which won't affect the search for a single GUID) and reuse them on
the  subsequent VLV searches.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoVLV tests: comment typo
Douglas Bagnall [Tue, 19 Jul 2016 01:16:25 +0000 (13:16 +1200)]
VLV tests: comment typo

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoVLV tests: reduce test duplication hence elapsed time
Douglas Bagnall [Tue, 12 Jul 2016 02:07:13 +0000 (14:07 +1200)]
VLV tests: reduce test duplication hence elapsed time

This makes before/after lattice sparser for the slower tests. While
we're doing that, some of the  tests are changed to traverse the
lattice in a different order just in case that matters.

There is very little chance that any particular combination of before
and after parameters will behave uniquely wrongly.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agojoin.py: Remove talloc enable_null_tracking
Garming Sam [Mon, 18 Jul 2016 04:58:04 +0000 (16:58 +1200)]
join.py: Remove talloc enable_null_tracking

The removal of enable_null_tracking is required because we will no
longer importing join.py in every single samba-tool invocation. Without
removing this line, memory would be hanging from both the actual NULL
context and the talloc_null_context (causing a segfault at system_exit).

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agopytalloc: Add a warning about enable_null_tracking
Garming Sam [Sun, 17 Jul 2016 21:54:16 +0000 (09:54 +1200)]
pytalloc: Add a warning about enable_null_tracking

If it is called in the middle of a script such as samba-tool, memory
would be hanging from both the actual NULL context and the
talloc_null_context (causing a segfault at system_exit).

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoselftest: Disable all replication during most replication tests
Andrew Bartlett [Mon, 18 Jul 2016 04:55:50 +0000 (16:55 +1200)]
selftest: Disable all replication during most replication tests

Rather than just disabling inbound replication, consider that there may be another server
in the test network, and ensure we do not replicate to or from it either.

replica_sync.py is omitted, as it tests some more subtle variations
of the DISABLE_INBOUND_REPL flag.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoselftest: Ensure we can call DRSUAPI_EXOP_REPL_OBJ with replication disabled
Andrew Bartlett [Tue, 19 Jul 2016 01:04:02 +0000 (13:04 +1200)]
selftest: Ensure we can call DRSUAPI_EXOP_REPL_OBJ with replication disabled

We add the forced flag, so that we can leave replication otherwise disabled

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agodrs: pass the forced-replication flag from DsReplicaSync to GetNCChanges
Andrew Bartlett [Mon, 18 Jul 2016 05:05:40 +0000 (17:05 +1200)]
drs: pass the forced-replication flag from DsReplicaSync to GetNCChanges

This ensures we and sync from a server with DISABLE_OUTBOUND_REPL set

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoselftest: Disable replication before doing forced pre-test replicate
Andrew Bartlett [Mon, 18 Jul 2016 04:53:27 +0000 (16:53 +1200)]
selftest: Disable replication before doing forced pre-test replicate

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoselftest: Make repl_move more robust by disabling replication before the test
Andrew Bartlett [Mon, 18 Jul 2016 04:35:28 +0000 (16:35 +1200)]
selftest: Make repl_move more robust by disabling replication before the test

We do this before we ensure the two DCs are in sync, and then force the sync

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoselftest: Make repl_schema more robust by disabling replication before the test
Andrew Bartlett [Mon, 18 Jul 2016 03:53:20 +0000 (15:53 +1200)]
selftest: Make repl_schema more robust by disabling replication before the test

We also ensure the two DCs are in sync before the test starts

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agosamba-tool: Put full command and subcommand in informative name when testing samba...
Andrew Bartlett [Mon, 18 Jul 2016 03:47:03 +0000 (15:47 +1200)]
samba-tool: Put full command and subcommand in informative name when testing samba-tool

These are not used for anything other than to print in the usage, but
it seems nicer to match normal invocation of these commands

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoldb: Add better debugging to ldb_wait()
Andrew Bartlett [Thu, 7 Jul 2016 22:03:38 +0000 (10:03 +1200)]
ldb: Add better debugging to ldb_wait()

To keep line lengths short, the code is re-factored to the
early return pattern.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agorepl: Remove check for parentGUID being NULL in dsdb_convert_object_ex()
Andrew Bartlett [Sat, 9 Jul 2016 04:51:56 +0000 (16:51 +1200)]
repl: Remove check for parentGUID being NULL in dsdb_convert_object_ex()

We find that Windows 2012R2 sends a NULL parent_guid here, probably when no change to name is replicated.

That is, if there has not been a rename, this is not required information, as we
can just merge with the existing object, not matter where it is

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoRemove unused and untested source4 ntptr and spoolss systems
Andrew Bartlett [Sun, 10 Jul 2016 09:53:04 +0000 (21:53 +1200)]
Remove unused and untested source4 ntptr and spoolss systems

These were never finished, were not tested and clearly will not be revived

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agoparam: Correct the defaults for "dcerpc endpoint services"
Andrew Bartlett [Sat, 9 Jul 2016 05:36:18 +0000 (17:36 +1200)]
param: Correct the defaults for "dcerpc endpoint services"

We must not list any services that we skip building, as otherwise all RPC services fail to start.

We now build without the source4 spoolss server in non-developer builds

This fixes commit 0b4c741b9c03d147ee5f56d027bacda75c1b5282

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12025
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agobuild: Always build eventlog6. This is not a duplicate of eventlog
Andrew Bartlett [Sat, 9 Jul 2016 05:34:39 +0000 (17:34 +1200)]
build: Always build eventlog6. This is not a duplicate of eventlog

The eventlog6 pipe is not a duplicate with the source3 code, so should be built even
for the default build with smbd for file serving

This fixes commit 0b4c741b9c03d147ee5f56d027bacda75c1b5282

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12026
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
7 years agovfs_acl_xattr: objects without NT ACL xattr
Ralph Boehme [Fri, 15 Jul 2016 15:48:19 +0000 (17:48 +0200)]
vfs_acl_xattr: objects without NT ACL xattr

Even with "ignore system acls" set to "yes", for objects without NT ACL
xattr we use the underlying filesystem permissions to construct an NT
ACL. This can result in *very* unexpected permissions, eg:

- a directory with the following ACL:

$ ./bin/smbcacls -Uslow%pass //localhost/normal ""
REVISION:1
CONTROL:SR|DP
OWNER:SLOW\slow
GROUP:Unix Group\root
ACL:SLOW\slow:ALLOWED/0x0/FULL

So only one non-inheritable(!) ACE.

- creating a subdirectory:

$ ./bin/smbclient -Uslow%pass //localhost/normal -c "mkdir dir1"

- checking whether there's an ACL xattr:

$ getfattr -m "" /Volumes/normal/dir1
getfattr: Removing leading '/' from absolute path names
system.posix_acl_access
system.posix_acl_default
user.DOSATTRIB

So there isn't an ACL xattr, because there where no inheritable ACEs on
the parent folder.

- reading the new subdirectories ACL:

$ ./bin/smbcacls -Uslow%pass //localhost/normal "dir1"
REVISION:1
CONTROL:SR|DP
OWNER:SLOW\slow
GROUP:Unix Group\slow
ACL:SLOW\slow:ALLOWED/0x0/FULL
ACL:Unix Group\slow:ALLOWED/0x0/READ
ACL:Everyone:ALLOWED/0x0/READ
ACL:NT Authority\SYSTEM:ALLOWED/0x0/FULL

The ACES for "SLOW\slow", "Unix Group\slow" and "Everyone" are coming
from the underlying filesystem. This is the problem.

- Windows assigns the following ACL in this situation:

$ ./bin/smbcacls -UAdministrator%Passw0rd //10.10.10.14/data "dir"
REVISION:1
CONTROL:SR|PD|DI|DP
OWNER:VORDEFINIERT\Administratoren
GROUP:WIN2008R2\Domänen-Benutzer
ACL:WIN2008R2\Administrator:ALLOWED/0x0/FULL

$ ./bin/smbclient -UAdministrator%Passw0rd //10.10.10.14/data -c "mkdir dir\dir1"

$ ./bin/smbcacls -UAdministrator%Passw0rd //10.10.10.14/data "dir\dir1"
REVISION:1
CONTROL:SR|DI|DP
OWNER:VORDEFINIERT\Administratoren
GROUP:WIN2008R2\Domänen-Benutzer
ACL:VORDEFINIERT\Administratoren:ALLOWED/0x0/FULL
ACL:NT-AUTORITÄT\SYSTEM:ALLOWED/0x0/FULL

By changing make_default_filesystem_acl() to only adds user and system
ACE to the ACL of objects that lack an ACL xattr, we match Windows
behaviour:

$ ./bin/smbclient -Uslow%pass //localhost/normal -c "mkdir dir2"

$ ./bin/smbcacls -Uslow%pass //localhost/normal "dir2"
REVISION:1
CONTROL:SR|DP
OWNER:SLOW\slow
GROUP:Unix Group\slow
ACL:SLOW\slow:ALLOWED/0x0/FULL
ACL:NT Authority\SYSTEM:ALLOWED/0x0/FULL

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Jul 19 10:22:05 CEST 2016 on sn-devel-144

7 years agos3/smbd: move make_default_filesystem_acl() to vfs_acl_common.c
Ralph Boehme [Fri, 15 Jul 2016 15:56:02 +0000 (17:56 +0200)]
s3/smbd: move make_default_filesystem_acl() to vfs_acl_common.c

This function is only used in vfs_acl_common.c and will be modified in
the next commit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agonotify_inotify: Map inotify mask back to filter
Christof Schmitt [Fri, 15 Jul 2016 19:16:18 +0000 (12:16 -0700)]
notify_inotify: Map inotify mask back to filter

Instead of reporting that an inotify event triggered all possible filter
masks, map the inotify event back to the filter mask. This is slightly
more accurate, although there can still be mismatches due to the
mapping.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jul 18 18:50:55 CEST 2016 on sn-devel-144