]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
5 years agolibsmb: Don't try to find posix stat info in SMBC_getatr()
Volker Lendecke [Thu, 19 Mar 2020 10:01:41 +0000 (11:01 +0100)] 
libsmb: Don't try to find posix stat info in SMBC_getatr()

This wrongly used "frame" instead of "fname", which can never have
worked. A first attempt to fix in 51551e0d53fa6 caused a few followup
patches in an attempt to clean up the test failures 51551e0d53fa6
introduced. They were reverted after a few discussions. So rather than
changing behaviour, just remove the code that introduced the valgrind
error again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 20 05:06:07 UTC 2020 on sn-devel-184

(cherry picked from commit 39c910fd9cba3caf7414274b678b9eee33d7e20b)

5 years agoVERSION: Bump version up to 4.11.9.
Karolin Seeger [Tue, 28 Apr 2020 11:50:45 +0000 (13:50 +0200)] 
VERSION: Bump version up to 4.11.9.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
5 years agoMerge tag 'samba-4.11.8' into v4-11-test
Karolin Seeger [Tue, 28 Apr 2020 11:50:10 +0000 (13:50 +0200)] 
Merge tag 'samba-4.11.8' into v4-11-test

samba: tag release samba-4.11.8

5 years agoVERSION: Disable GIT_SNAPSHOT for the 4.11.8 release. samba-4.11.8
Karolin Seeger [Tue, 21 Apr 2020 11:23:38 +0000 (13:23 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the 4.11.8 release.

o CVE-2020-10700: Use-after-free in Samba AD DC LDAP Server with ASQ
o CVE-2020-10704: LDAP Denial of Service (stack overflow) in Samba AD DC

Signed-off-by: Karolin Seeger <kseeger@samba.org>
5 years agoWHATSNEW: Add release notes for Samba 4.11.8.
Karolin Seeger [Tue, 21 Apr 2020 11:23:09 +0000 (13:23 +0200)] 
WHATSNEW: Add release notes for Samba 4.11.8.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
5 years agoCVE-2020-10704 libcli ldap: Check search request lengths.
Gary Lockyer [Tue, 7 Apr 2020 22:46:44 +0000 (10:46 +1200)] 
CVE-2020-10704 libcli ldap: Check search request lengths.

Check the search request lengths against the limits passed to
ldap_decode.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10704: libcli ldap_message: Add search size limits to ldap_decode
Gary Lockyer [Tue, 7 Apr 2020 20:49:23 +0000 (08:49 +1200)] 
CVE-2020-10704: libcli ldap_message: Add search size limits to ldap_decode

Add search request size limits to ldap_decode calls.

The ldap server uses the smb.conf variable
"ldap max search request size" which defaults to 250Kb.
For cldap the limit is hard coded as 4096.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10704: S4 ldap server: Limit request sizes
Gary Lockyer [Wed, 8 Apr 2020 03:32:22 +0000 (15:32 +1200)] 
CVE-2020-10704: S4 ldap server: Limit request sizes

Check the size of authenticated and anonymous ldap requests and reject
them if they exceed the limits in smb.conf

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10704: smb.conf: Add max ldap request sizes
Gary Lockyer [Mon, 6 Apr 2020 21:09:01 +0000 (09:09 +1200)] 
CVE-2020-10704: smb.conf: Add max ldap request sizes

Add two new smb.conf parameters to control the maximum permitted ldap
request size.

Adds:
   ldap max anonymous request size       default 250Kb
   ldap max authenticated request size   default 16Mb

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10704: ldapserver tests: Limit search request sizes
Gary Lockyer [Tue, 14 Apr 2020 01:32:32 +0000 (13:32 +1200)] 
CVE-2020-10704: ldapserver tests: Limit search request sizes

Add tests to ensure that overly long (> 256000 bytes) LDAP search
requests are rejected.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10704: lib util asn1: Check parse tree depth
Gary Lockyer [Wed, 8 Apr 2020 03:30:52 +0000 (15:30 +1200)] 
CVE-2020-10704: lib util asn1: Check parse tree depth

Check the current depth of the parse tree and reject the input if the
depth exceeds that passed to asn1_init

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10704: libcli ldap: test recursion depth in ldap_decode_filter_tree
Gary Lockyer [Thu, 2 Apr 2020 02:25:53 +0000 (15:25 +1300)] 
CVE-2020-10704: libcli ldap: test recursion depth in ldap_decode_filter_tree

Add tests to check that ASN.1 ldap requests with deeply nested elements
are rejected.  Previously there was no check on the on the depth of
nesting and excessive nesting could cause a stack overflow.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10704: lib util asn1: Add ASN.1 max tree depth
Gary Lockyer [Thu, 2 Apr 2020 23:18:03 +0000 (12:18 +1300)] 
CVE-2020-10704: lib util asn1: Add ASN.1 max tree depth

Add maximum parse tree depth to the call to asn1_init, which will be
used to limit the depth of the ASN.1 parse tree.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20454
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14334

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoCVE-2020-10700: ldb: Bump version up to 2.0.10. ldb-2.0.10
Karolin Seeger [Fri, 17 Apr 2020 11:28:52 +0000 (13:28 +0200)] 
CVE-2020-10700: ldb: Bump version up to 2.0.10.

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

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoCVE-2020-10700: dsdb: Do not permit the ASQ control for the GUID search in paged_results
Andrew Bartlett [Wed, 11 Mar 2020 03:43:31 +0000 (16:43 +1300)] 
CVE-2020-10700: dsdb: Do not permit the ASQ control for the GUID search in paged_results

ASQ is a very strange control and a BASE search can return multiple results
that are NOT the requested DN, but the DNs pointed to by it!

Thanks to Andrei Popa <andrei.popa@next-gen.ro> for finding,
reporting and working with us to diagnose this issue!

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
5 years agoCVE-2020-10700: ldb: Always use ldb_next_request() in ASQ module
Andrew Bartlett [Wed, 11 Mar 2020 03:41:34 +0000 (16:41 +1300)] 
CVE-2020-10700: ldb: Always use ldb_next_request() in ASQ module

We want to keep going down the module stack, and not start from the top again.

ASQ is above the ACL modules, but below paged_results and we do not wish to
re-trigger that work.

Thanks to Andrei Popa <andrei.popa@next-gen.ro> for finding,
reporting and working with us to diagnose this issue!

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
5 years agoCVE-2020-10700: dsdb: Add test for ASQ and ASQ in combination with paged_results
Andrew Bartlett [Mon, 30 Mar 2020 09:44:20 +0000 (09:44 +0000)] 
CVE-2020-10700: dsdb: Add test for ASQ and ASQ in combination with paged_results

Thanks to Andrei Popa <andrei.popa@next-gen.ro> for finding,
reporting and working with us to diagnose this issue!

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
5 years agoVERSION: Bump version up to 4.11.8...
Karolin Seeger [Tue, 10 Mar 2020 09:55:01 +0000 (10:55 +0100)] 
VERSION: Bump version up to 4.11.8...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
(cherry picked from commit 46e19f9f40258855d84e747bcb02019262e72057)

5 years agos3/librpc/crypto: Fix double free with unresolved credential cache
Noel Power [Tue, 14 Apr 2020 10:21:22 +0000 (11:21 +0100)] 
s3/librpc/crypto: Fix double free with unresolved credential cache

We free gse_ctx->k5ctx but then free it again in the
talloc dtor. This patch just lets the talloc dtor handle
things and removes the extra krb5_free_context

Failed to resolve credential cache 'DIR:/run/user/1000/krb5cc'! (No credentials cache found)
==30762== Invalid read of size 8
==30762==    at 0x108100F4: k5_os_free_context (in /usr/lib64/libkrb5.so.3.3)
==30762==    by 0x107EA661: krb5_free_context (in /usr/lib64/libkrb5.so.3.3)
==30762==    by 0x7945D2E: gse_context_destructor (gse.c:84)
==30762==    by 0x645FB49: _tc_free_internal (talloc.c:1157)
==30762==    by 0x645FEC5: _talloc_free_internal (talloc.c:1247)
==30762==    by 0x646118D: _talloc_free (talloc.c:1789)
==30762==    by 0x79462E4: gse_context_init (gse.c:241)
==30762==    by 0x794636E: gse_init_client (gse.c:268)
==30762==    by 0x7947602: gensec_gse_client_start (gse.c:786)
==30762==    by 0xBC87A3A: gensec_start_mech (gensec_start.c:743)
==30762==    by 0xBC87BC6: gensec_start_mech_by_ops (gensec_start.c:774)
==30762==    by 0xBC8167F: gensec_spnego_client_negTokenInit_step (spnego.c:633)
==30762==  Address 0x17259928 is 40 bytes inside a block of size 496 free'd
==30762==    at 0x4C2F50B: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==30762==    by 0x79462CA: gse_context_init (gse.c:238)
==30762==    by 0x794636E: gse_init_client (gse.c:268)
==30762==    by 0x7947602: gensec_gse_client_start (gse.c:786)
==30762==    by 0xBC87A3A: gensec_start_mech (gensec_start.c:743)
==30762==    by 0xBC87BC6: gensec_start_mech_by_ops (gensec_start.c:774)
==30762==    by 0xBC8167F: gensec_spnego_client_negTokenInit_step (spnego.c:633)
==30762==    by 0xBC813E2: gensec_spnego_client_negTokenInit_start (spnego.c:537)
==30762==    by 0xBC84084: gensec_spnego_update_pre (spnego.c:1943)
==30762==    by 0xBC83AE5: gensec_spnego_update_send (spnego.c:1741)
==30762==    by 0xBC85622: gensec_update_send (gensec.c:449)
==30762==    by 0x551BFD0: cli_session_setup_gensec_local_next (cliconnect.c:997)
==30762==  Block was alloc'd at
==30762==    at 0x4C306B5: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==30762==    by 0x107EA7AE: krb5_init_context_profile (in /usr/lib64/libkrb5.so.3.3)
==30762==    by 0xB853215: smb_krb5_init_context_common (krb5_samba.c:3597)
==30762==    by 0x794615B: gse_context_init (gse.c:209)
==30762==    by 0x794636E: gse_init_client (gse.c:268)
==30762==    by 0x7947602: gensec_gse_client_start (gse.c:786)
==30762==    by 0xBC87A3A: gensec_start_mech (gensec_start.c:743)
==30762==    by 0xBC87BC6: gensec_start_mech_by_ops (gensec_start.c:774)
==30762==    by 0xBC8167F: gensec_spnego_client_negTokenInit_step (spnego.c:633)
==30762==    by 0xBC813E2: gensec_spnego_client_negTokenInit_start (spnego.c:537)
==30762==    by 0xBC84084: gensec_spnego_update_pre (spnego.c:1943)
==30762==    by 0xBC83AE5: gensec_spnego_update_send (spnego.c:1741)
==30762==

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14344
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Apr 14 22:55:51 UTC 2020 on sn-devel-184

(cherry picked from commit 34f8ab774d1484b0e60dbdec8ad2a1607ad92122)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Wed Apr 15 14:34:51 UTC 2020 on sn-devel-184

5 years agotestprogs: Add 'net ads join createupn' test also verifying the keytab
Andreas Schneider [Fri, 3 Apr 2020 13:40:48 +0000 (15:40 +0200)] 
testprogs: Add 'net ads join createupn' test also verifying the keytab

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Apr  6 19:09:53 UTC 2020 on sn-devel-184

(cherry picked from commit c4be195da2845be4f64e47883e3c911dedd90e48)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Tue Apr  7 10:51:07 UTC 2020 on sn-devel-184

5 years agos3:libads: Fix ads_get_upn()
Andreas Schneider [Fri, 3 Apr 2020 13:58:28 +0000 (15:58 +0200)] 
s3:libads: Fix ads_get_upn()

This adds the userPrincipalName to ads_find_machine_acct() which
fetches the data for us.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit ec69752cb963ae850568d3f4905d2941e485627e)

5 years agosmbd: let delayed update handler also update on-disk timestamps
Ralph Boehme [Sun, 15 Mar 2020 07:30:21 +0000 (08:30 +0100)] 
smbd: let delayed update handler also update on-disk timestamps

Let delayed update handler also update on-disk timestamps by calling
trigger_write_time_update_immediate().

trigger_write_time_update_immediate() sets fsp->update_write_time_on_close to
false which prevents updating the write-time on close if there was ever only one
write to the file.

Besides resetting fsp->update_write_time_on_close and setting the on-disk timestamps
trigger_write_time_update_immediate() takes the same steps as the removed code.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 19 03:05:40 UTC 2020 on sn-devel-184

(back ported from commit 81c1a14e3271aeed7ed4fe6311171b19ba963555)

5 years agosmbd: let mark_file_modified() always call trigger_write_time_update()
Ralph Boehme [Sun, 15 Mar 2020 07:30:21 +0000 (08:30 +0100)] 
smbd: let mark_file_modified() always call trigger_write_time_update()

Preperatory change: the next commit will reset fsp->update_write_time_on_close
in the event handler, so this change ensures it gets set again for any
subsequent write.

This will NOT always result in a write-time update because
trigger_write_time_update() has its own only-once logic using the internal
variable fsp->update_write_time_triggered.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 53de2da7acfc24513082190502d93306c12b7434)

5 years agosmbd: remove stat call from mark_file_modified()
Ralph Boehme [Sun, 15 Mar 2020 14:51:18 +0000 (15:51 +0100)] 
smbd: remove stat call from mark_file_modified()

This stat dates back to d03453864ab1bc5fd3b4a3abaf96176a006c102b where the call
to trigger_write_time_update() had been to the file IO codepath. It was present
there for other reasons: to setup the write-cache based on the file's size.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 2c19d27113036d607850f370bb9afd62856d671e)

5 years agosmbd: avoid double chdir() in chdir_current_service()
Ralph Boehme [Wed, 22 Jan 2020 09:52:39 +0000 (10:52 +0100)] 
smbd: avoid double chdir() in chdir_current_service()

Since 8e81090789e4cc3ba9e5aa792d4e52971909c894 we're doing chdir() twice, first
into conn->connectpath, then into conn->origpath.

Before commit 8e81090789e4cc3ba9e5aa792d4e52971909c894 if
chdir(conn->connectpath) succeeded, we wouldn't do the second chdir().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14256
RN: smbd does a chdir() twice per request

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Feb  6 11:44:07 UTC 2020 on sn-devel-184

(backported from commit f705629a171c1411131164f3adff36175154c093)

5 years agosmbd: flush pending writetime update when setting timestamps file
Ralph Boehme [Thu, 12 Mar 2020 18:23:40 +0000 (19:23 +0100)] 
smbd: flush pending writetime update when setting timestamps file

Cf the explanations in the previous commits.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(back-ported from commit 7b90fe69a865ae8648b6548eabbcf2fa8237ebd8)

5 years agosmbd: flush pending writetime update when flushing file
Ralph Boehme [Thu, 12 Mar 2020 18:23:40 +0000 (19:23 +0100)] 
smbd: flush pending writetime update when flushing file

Cf the explanations in the previous commit.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(back-ported from commit d99d5bf2c6d0a818ef2f3920e0c93fac38761c36)

5 years agosmbd: always flush pending write time update when setting filesize
Ralph Boehme [Thu, 12 Mar 2020 15:52:34 +0000 (16:52 +0100)] 
smbd: always flush pending write time update when setting filesize

We need to flush a pending write time update even when we're setting the
filesize to current filesize.

Note that we're already doing it this way in the relevant places listed my
dochelp@MS in

https://lists.samba.org/archive/cifs-protocol/2019-December/003364.html

  Cleanup (= Close)
  SetBasicInfo
  SetAllocationInfo
  SetEndOfFileInfo
  SetValidDataLengthInfo
  Flush
  FSCTL_SET_ENCRYPTION
  FSCTL_OFFLOAD_WRITE

Cleanup (= Close):

  Already implemented by update_write_time_on_close() and friends.

SetBasicInfo:

  Currently doesn't flush pending updates. Fixed by a subsequent commit.

SetAllocationInfo:

  smb_set_file_allocation_info() when setting a file's allocation size.

SetEndOfFileInfo:

  Currently doesn't flush pending updates. Fixed by a subsequent commit.

SetValidDataLengthInfo:

  Not implemented, returns NT_STATUS_NOT_SUPPORTED which seems wrong btw, as
  SetValidDataLengthInfo IS listed in MS-SMB2 2.2.39.

Flush:

  Currently doesn't flush pending updates. Fixed by subsequent commit.

FSCTL_SET_ENCRYPTION:

  Windows 2016 doesn't flush a pending writetime update, verified with a
  smbtorture test.

FSCTL_OFFLOAD_WRITE:

  NT_STATUS_NOT_IMPLEMENTED

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(back-ported from commit 79d7d6b9d01b8547f16b74a62926d0b471f18c39)

5 years agonsswitch: fix use-after-free causing segfault in _pam_delete_cred
Günther Deschner [Fri, 27 Mar 2020 09:13:11 +0000 (10:13 +0100)] 
nsswitch: fix use-after-free causing segfault in _pam_delete_cred

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Mar 30 13:01:20 UTC 2020 on sn-devel-184

(cherry picked from commit 047b0d8ab534c7a10a8572fd9f21e2456fd30710)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Tue Mar 31 16:14:54 UTC 2020 on sn-devel-184

5 years agoctdb-recoverd: Avoid dereferencing NULL rec->nodemap
Martin Schwenke [Sun, 22 Mar 2020 02:46:46 +0000 (13:46 +1100)] 
ctdb-recoverd: Avoid dereferencing NULL rec->nodemap

Inside the nested event loop in ctdb_ctrl_getnodemap(), various
asynchronous handlers may dereference rec->nodemap, which will be
NULL.

One example is lost_reclock_handler(), which causes rec->nodemap to be
unconditionally dereferenced in list_of_nodes() via this call chain:

  list_of_nodes()
  list_of_active_nodes()
  set_recovery_mode()
  force_election()
  lost_reclock_handler()

Instead of attempting to trace all of the cases, just avoid leaving
rec->nodemap set to NULL.  Attempting to use an old value is generally
harmless, especially since it will be the same as the new value in
most cases.

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

Reported-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Mar 24 01:22:45 UTC 2020 on sn-devel-184

(cherry picked from commit 716f52f68b248ae7cfd66479b3fc678c4a0d8b38)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Mon Mar 30 11:22:26 UTC 2020 on sn-devel-184

5 years agoctdb-daemon: Don't allow attach from recovery if recovery is not active
Martin Schwenke [Tue, 25 Feb 2020 06:32:56 +0000 (17:32 +1100)] 
ctdb-daemon: Don't allow attach from recovery if recovery is not active

Neither the recovery daemon nor the recovery helper should attach
databases outside of the recovery process.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 147afe77de372ddb9c180228d6fe1b04cca4610f)

5 years agoctdb-daemon: Remove more unused old client database functions
Martin Schwenke [Mon, 24 Feb 2020 19:20:32 +0000 (06:20 +1100)] 
ctdb-daemon: Remove more unused old client database functions

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 052f1bdb9cf78f53f584edd32f81ae8e01e8e86e)

5 years agoctdb-recovery: Remove old code for creating missing databases
Martin Schwenke [Mon, 24 Feb 2020 08:51:19 +0000 (19:51 +1100)] 
ctdb-recovery: Remove old code for creating missing databases

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 3a66d181b6f6199fca362fcb0aa06513645b589d)

5 years agoctdb-recovery: Create database on nodes where it is missing
Martin Schwenke [Mon, 24 Feb 2020 00:31:33 +0000 (11:31 +1100)] 
ctdb-recovery: Create database on nodes where it is missing

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 76a8174279f42486b36cc41d5831d4e6613f172e)

5 years agoctdb-recovery: Fetch database name from all nodes where it is attached
Martin Schwenke [Sun, 23 Feb 2020 23:26:34 +0000 (10:26 +1100)] 
ctdb-recovery: Fetch database name from all nodes where it is attached

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit e6e63f8fb8194634135bf34cda18f6cc8ff69a7c)

5 years agoctdb-recovery: Pass db structure for each database recovery
Martin Schwenke [Fri, 21 Feb 2020 05:51:10 +0000 (16:51 +1100)] 
ctdb-recovery: Pass db structure for each database recovery

Instead of db_id and db_flags.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 1bdfeb3fdc06947a607957ab3d114f97bad5d7d7)

5 years agoctdb-recovery: GET_DBMAP from all nodes
Martin Schwenke [Fri, 21 Feb 2020 05:10:05 +0000 (16:10 +1100)] 
ctdb-recovery: GET_DBMAP from all nodes

This builds a complete list of databases across the cluster so it can
be used to create databases on the nodes where they are missing.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit c6f74e590f602e2ed38fe293468770a5e669aefa)

5 years agoctdb-recovery: Replace use of ctdb_dbid_map with local db_list
Martin Schwenke [Fri, 21 Feb 2020 01:24:39 +0000 (12:24 +1100)] 
ctdb-recovery: Replace use of ctdb_dbid_map with local db_list

This will be used to build a merged list of databases from all nodes,
allowing the recovery helper to create missing databases.

It would be possible to also include the db_name field in this
structure but that would cause a lot of churn.  This field is used
locally in the recovery of each database so can continue to live in
the relevant state structure(s).

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 4c0b9c36050a0ed8a180d4ac1853224089528e8e)

5 years agoctdb-daemon: Respect CTDB_CTRL_FLAG_ATTACH_RECOVERY when attaching databases
Martin Schwenke [Wed, 26 Feb 2020 00:50:09 +0000 (11:50 +1100)] 
ctdb-daemon: Respect CTDB_CTRL_FLAG_ATTACH_RECOVERY when attaching databases

This is currently only set by the recovery daemon when it attaches
missing databases, so there is no obvious behaviour change.  However,
attaching missing databases can now be moved to the recovery helper as
long as it sets this flag.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 7e5a8a4884ea87bb985fe0e2b65ff130fc2ba8aa)

5 years agoctdb-recovery: Use CTDB_CTRL_FLAG_ATTACH_RECOVERY to attach during recovery
Martin Schwenke [Fri, 21 Feb 2020 00:13:05 +0000 (11:13 +1100)] 
ctdb-recovery: Use CTDB_CTRL_FLAG_ATTACH_RECOVERY to attach during recovery

ctdb_ctrl_createdb() is only called by the recovery daemon, so this is
a safe, temporary change.  This is temporary because
ctdb_ctrl_createdb(), create_missing_remote_databases() and
create_missing_local_databases() will all go away soon.

Note that this doesn't cause a change in behaviour.  The main daemon
will still only defer attaches from non-recoverd processes during
recovery.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 98e3d0db2bc5f33217e26fab1dfb4bb91eae534f)

5 years agoctdb-protocol: Add control flag CTDB_CTRL_FLAG_ATTACH_RECOVERY
Martin Schwenke [Fri, 21 Feb 2020 00:04:14 +0000 (11:04 +1100)] 
ctdb-protocol: Add control flag CTDB_CTRL_FLAG_ATTACH_RECOVERY

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 17ed0425904a98624284d351ab7617b3e02c0f7b)

5 years agoctdb-daemon: Remove unused old client database functions
Martin Schwenke [Wed, 26 Feb 2020 06:03:49 +0000 (17:03 +1100)] 
ctdb-daemon: Remove unused old client database functions

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit fc23cd1b9cdd1d70067491614b16e616291e8ff2)

5 years agoctdb-daemon: Fix database attach deferral logic
Martin Schwenke [Thu, 20 Feb 2020 02:48:13 +0000 (13:48 +1100)] 
ctdb-daemon: Fix database attach deferral logic

Commit 3cc230b5eeca749ab68d19cfda969f72c269f1f6 says:

  Dont allow clients to connect to databases untile we are well past
  and through the initial recovery phase

It is unclear what this commit was attempting to do.  The commit
message implies that more attaches should be deferred but the code
change adds a conjunction that causes less attaches to be deferred.
In particular, no attaches will be deferred after startup is complete.
This seems wrong.

To implement what seems to be stated in the commit message an "or"
needs to be used so that non-recovery daemon attaches are deferred
either when in recovery or before startup is complete.  Making this
change highlights that attaches need to be allowed during the
"startup" event because this is when smbd is started.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit c6c89495fbe9b6f238d10a538eccc92b937a69de)

5 years agoctdb-recovery: Refactor banning a node into separate computation
Amitay Isaacs [Mon, 2 Mar 2020 05:16:26 +0000 (16:16 +1100)] 
ctdb-recovery: Refactor banning a node into separate computation

If a node is marked for banning, confirm that it's not become inactive
during the recovery.  If yes, then don't ban the node.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 1c56d6413f86cc15ebac232f39ef1e2a53ae4297)

5 years agoctdb-recovery: Don't trust nodemap obtained from local node
Amitay Isaacs [Tue, 18 Feb 2020 05:17:00 +0000 (16:17 +1100)] 
ctdb-recovery: Don't trust nodemap obtained from local node

It's possible to have a node stopped, but recovery master not yet
updated flags on the local ctdb daemon when recovery is started.  So do
not trust the list of active nodes obtained from the local node.  Query
the connected nodes to calculate the list of active nodes.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit c6a0ff1bed0265e44fd6135d16bfc41919fe5bf5)

5 years agoctdb-recovery: Consolidate node state
Amitay Isaacs [Mon, 2 Mar 2020 04:07:21 +0000 (15:07 +1100)] 
ctdb-recovery: Consolidate node state

This avoids passing multiple arguments to async computation.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 6e2f8756f1bce4dfc7fdc435e082f400116e29ec)

5 years agoctdb-recovery: Fetched vnnmap is never used, so don't fetch it
Amitay Isaacs [Mon, 2 Mar 2020 02:59:42 +0000 (13:59 +1100)] 
ctdb-recovery: Fetched vnnmap is never used, so don't fetch it

New vnnmap is constructed using the information from all the connected
nodes.  So there is no need to fetch the vnnmap from recovery master.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 072ff4d12b8f34766120ddae888d772e97bca491)

5 years agoctdb-client: Factor out function client_db_tdb()
Martin Schwenke [Fri, 27 Sep 2019 06:49:01 +0000 (16:49 +1000)] 
ctdb-client: Factor out function client_db_tdb()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 439ef65d290357e513103530183091a9a6fed197)

5 years agoctdb-daemon: Implement DB_VACUUM control
Martin Schwenke [Tue, 30 Jul 2019 04:17:11 +0000 (14:17 +1000)] 
ctdb-daemon: Implement DB_VACUUM control

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 41a41d5f3e2b8e16e25221e14939dc5962997ac7)

5 years agoctdb-vacuum: Only schedule next vacuum event if vacuuuming is scheduled
Martin Schwenke [Tue, 15 Oct 2019 05:36:44 +0000 (16:36 +1100)] 
ctdb-vacuum: Only schedule next vacuum event if vacuuuming is scheduled

At the moment vacuuming is always scheduled.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit d462d64cdf001fd5d1cbf2a109df62e087ad0c49)

5 years agoctdb-daemon: Factor out code to create vacuuming child
Martin Schwenke [Tue, 30 Jul 2019 04:16:13 +0000 (14:16 +1000)] 
ctdb-daemon: Factor out code to create vacuuming child

This changes the behaviour for some failures from exiting to simply
attempting to schedule the next run.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 13cedaf0195c6bda3a3820aedb1ee65f36dfc23e)

5 years agoctdb-vacuum: Simplify recording of in-progress vacuuming child
Martin Schwenke [Fri, 4 Oct 2019 02:06:21 +0000 (12:06 +1000)] 
ctdb-vacuum: Simplify recording of in-progress vacuuming child

There can only be one, so simplify the logic.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 5539edfdbe69d1d5f084d06753cce8ed6e524999)

5 years agoctdb-protocol: Add marshalling for control DB_VACUUM
Martin Schwenke [Tue, 30 Jul 2019 00:52:05 +0000 (10:52 +1000)] 
ctdb-protocol: Add marshalling for control DB_VACUUM

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 496204feb0e2b6eb2f3d9a74e45596a3e74ad9b1)

5 years agoctdb-protocol: Add marshalling for struct ctdb_db_vacuum
Martin Schwenke [Tue, 30 Jul 2019 06:59:37 +0000 (16:59 +1000)] 
ctdb-protocol: Add marshalling for struct ctdb_db_vacuum

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit a896486b62bbcf9915727ba7bfc768fb5383f0c7)

5 years agoctdb-protocol: Add new control CTDB_CONTROL_DB_VACUUM
Martin Schwenke [Tue, 30 Jul 2019 00:34:03 +0000 (10:34 +1000)] 
ctdb-protocol: Add new control CTDB_CONTROL_DB_VACUUM

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit b314835341e4028f0770fa7f9a37d2d21448ddfd)

5 years agoctdb-vacuum: Avoid processing any more packets
Amitay Isaacs [Tue, 1 Oct 2019 05:05:10 +0000 (15:05 +1000)] 
ctdb-vacuum: Avoid processing any more packets

All the vacuum operations if required have an event loop to ensure
completion of pending operations.  Once all the steps are complete,
there is no reason to process any more packets.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit d0cc9edc05b6218a8e20a0a8009cbb9918ff4d02)

5 years agoctdb-daemon: Avoid memory leak when packet is deferred
Amitay Isaacs [Wed, 6 Jun 2018 13:47:13 +0000 (15:47 +0200)] 
ctdb-daemon: Avoid memory leak when packet is deferred

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 680df07630a94b3e76edefe98ee0986e7e5e1f12)

5 years agoctdb-recoverd: No need for database detach handler
Amitay Isaacs [Fri, 16 Feb 2018 06:17:38 +0000 (17:17 +1100)] 
ctdb-recoverd: No need for database detach handler

The only reason for recoverd attaching to databases was to migrate
records to the local node as part of vacuuming.  Recovery daemon does
not take part in database vacuuming any more.

The actual database recovery is handled via the recovery_helper and
recovery daemon should not need to attach to the databases any more.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit c6427dddf5425b267d8c09e8df18653a48679646)

5 years agoctdb-recoverd: Drop VACUUM_FETCH message handling
Amitay Isaacs [Fri, 16 Feb 2018 06:13:35 +0000 (17:13 +1100)] 
ctdb-recoverd: Drop VACUUM_FETCH message handling

This is now implemented in the ctdb daemon using VACUMM_FETCH control.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit fc81729dd2d8eddea1e60e22b183894d6541c7dc)

5 years agoctdb-vacuum: Replace VACUUM_FETCH message with control
Amitay Isaacs [Fri, 16 Feb 2018 06:01:21 +0000 (17:01 +1100)] 
ctdb-vacuum: Replace VACUUM_FETCH message with control

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 498932c0e8e8614bd52f3270c4d63e2b5f9e26a4)

5 years agoctdb-vacuum: Add processing of fetch queue
Amitay Isaacs [Fri, 16 Feb 2018 06:00:40 +0000 (17:00 +1100)] 
ctdb-vacuum: Add processing of fetch queue

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 86521837b684df3b7c5a0a1e3b7e606c8b91f63e)

5 years agoctdb-daemon: Add implementation of VACUUM_FETCH control
Amitay Isaacs [Fri, 16 Feb 2018 04:30:13 +0000 (15:30 +1100)] 
ctdb-daemon: Add implementation of VACUUM_FETCH control

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit da617f90d90151f955ee354c57bdc4bc6f6498f2)

5 years agoctdb-tests: Add marshalling tests for new control
Amitay Isaacs [Fri, 16 Feb 2018 06:28:49 +0000 (17:28 +1100)] 
ctdb-tests: Add marshalling tests for new control

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 36f9b4953a8def40681a6f02f6576795a1ba5fbe)

5 years agoctdb-protocol: Add marshalling for new control VACUUM_FETCH
Amitay Isaacs [Thu, 15 Feb 2018 00:57:44 +0000 (11:57 +1100)] 
ctdb-protocol: Add marshalling for new control VACUUM_FETCH

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit b71d8cd80f84169bacf2dd1e753e468a305c50ce)

5 years agoctdb-protocol: Add new control VACUUM_FETCH
Amitay Isaacs [Thu, 15 Feb 2018 00:57:24 +0000 (11:57 +1100)] 
ctdb-protocol: Add new control VACUUM_FETCH

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 0872c52ef0497f96f53318cf7e4d31be0854adde)

5 years agoctdb-tests: Drop code releated to obsolete controls
Amitay Isaacs [Thu, 15 Feb 2018 01:28:11 +0000 (12:28 +1100)] 
ctdb-tests: Drop code releated to obsolete controls

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 913bd331f65e9fe3d7cb16e041cd37b01987841f)

5 years agoctdb-protocol: Drop code related to obsolete controls
Amitay Isaacs [Thu, 15 Feb 2018 01:13:53 +0000 (12:13 +1100)] 
ctdb-protocol: Drop code related to obsolete controls

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 688567f080156892270cbfb2907cd712cb77cb7a)

5 years agoctdb-client: Fix some typos in debug messages
Martin Schwenke [Wed, 4 Sep 2019 04:14:22 +0000 (14:14 +1000)] 
ctdb-client: Fix some typos in debug messages

  tdb_sore -> tdb_store
  SCHDULE_FOR_DELETION -> SCHEDULE_FOR_DELETION

Switch to modern debug macros while touching the lines.

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): Tue Sep 17 05:52:15 UTC 2019 on sn-devel-184

(cherry picked from commit 84f544b55f235e2f08596bf4b7854460af008f88)

5 years agoselftest: test samba-tool group commands with groupnames with brackets and spaces
Björn Baumbach [Thu, 27 Feb 2020 10:06:34 +0000 (11:06 +0100)] 
selftest: test samba-tool group commands with groupnames with brackets and spaces

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 534809a0f09775390e89fa1cbfae3a1d0fafecb8)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Fri Mar 27 11:54:17 UTC 2020 on sn-devel-184

5 years agosamba-tool group edit: use binary encoded group name
Björn Baumbach [Wed, 26 Feb 2020 12:56:14 +0000 (13:56 +0100)] 
samba-tool group edit: use binary encoded group name

Allows to edit groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit f3e7ea0405d46ddfbeba9b3a84c13b7878464180)

5 years agosamba-tool group delete: use binary encoded group name
Björn Baumbach [Wed, 26 Feb 2020 12:55:01 +0000 (13:55 +0100)] 
samba-tool group delete: use binary encoded group name

Allows to delete groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 104582b73caf008600e15d76d57424263a0f28d4)

5 years agosamba-tool group move: use binary encoded group name
Björn Baumbach [Wed, 26 Feb 2020 12:40:50 +0000 (13:40 +0100)] 
samba-tool group move: use binary encoded group name

Allows to move groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 626209beab2fc9b0fdb7e90338cdfec5cfa48dd7)

5 years agosamba-tool group listmembers: use binary encoded group names
Björn Baumbach [Wed, 26 Feb 2020 12:38:50 +0000 (13:38 +0100)] 
samba-tool group listmembers: use binary encoded group names

Allows to find groups with names like e.g. 'group1 (xy)'.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit d0f8e833653df652df01a472c4bbfd256f10f810)

5 years agosamba-tool group listmembers: find group members by groups SID
Björn Baumbach [Wed, 26 Feb 2020 12:39:44 +0000 (13:39 +0100)] 
samba-tool group listmembers: find group members by groups SID

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 1d2e9f27fa9cff55245e45a194f696fc9ca4376d)

5 years agosamba-tool group listmembers: handle group-does-not-exist error
Björn Baumbach [Wed, 26 Feb 2020 12:08:43 +0000 (13:08 +0100)] 
samba-tool group listmembers: handle group-does-not-exist error

Return a error with a proper message instead of just do nothing when
the target group does not exist.

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

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 40e498e743e4677a42030373e8d97f6f9763080a)

5 years agosamba-tool group listmembers: hide python backtracke on command error
Björn Baumbach [Wed, 26 Feb 2020 12:05:16 +0000 (13:05 +0100)] 
samba-tool group listmembers: hide python backtracke on command error

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 789d84c0a9a406f7e0c9ab48cf2f31afdc4d3829)

5 years agoctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()
Martin Schwenke [Fri, 6 Mar 2020 05:11:23 +0000 (16:11 +1100)] 
ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()

The only place the outgoing connection needs to be stopped is when
there is a timeout when waiting for the connection to become writable.
Add a new function ctdb_tcp_node_connect_timeout() to handle this
case.

All of the other cases are attempts to establish a new outgoing
connection (initial attempt, retry after an error or disconnect, ...)
so drop stopping the connection in those cases.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Mar 12 05:29:20 UTC 2020 on sn-devel-184

(cherry picked from commit 319c93f0c6a949545229b616dfbd4f51baf11171)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Thu Mar 19 10:55:49 UTC 2020 on sn-devel-184

5 years agoctdb-tcp: Factor out function ctdb_tcp_start_outgoing()
Martin Schwenke [Fri, 6 Mar 2020 04:59:32 +0000 (15:59 +1100)] 
ctdb-tcp: Factor out function ctdb_tcp_start_outgoing()

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 3c8747fe29486a4f95308b335a5e3ec1807f62cb)

5 years agoctdb-tcp: add ctdb_tcp_stop_incoming()
Ralph Boehme [Sat, 29 Feb 2020 10:54:51 +0000 (11:54 +0100)] 
ctdb-tcp: add ctdb_tcp_stop_incoming()

No change in behaviour.  This makes the code self-documenting.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 2c73dbafba50b28e72a8ec7b4382fae42fca6d17)

5 years agoctdb-tcp: rename ctdb_tcp_stop_connection() to ctdb_tcp_stop_outgoing()
Ralph Boehme [Fri, 28 Feb 2020 10:36:00 +0000 (11:36 +0100)] 
ctdb-tcp: rename ctdb_tcp_stop_connection() to ctdb_tcp_stop_outgoing()

No change in behaviour.  This makes the code self-documenting.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 1e2a967ff41cc29c3a0d7f61a46937c68fdb90ba)

5 years agoctdb-tcp: Remove redundant restart in ctdb_tcp_tnode_cb()
Ralph Boehme [Sat, 29 Feb 2020 11:28:20 +0000 (12:28 +0100)] 
ctdb-tcp: Remove redundant restart in ctdb_tcp_tnode_cb()

The node dead upcall has already restarted the outgoing connection.
There's no need to repeat it.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit ea37ecdcd5960311f54a7a5510b88a654da23daa)

5 years agoctdb-tcp: always call node_dead() upcall in ctdb_tcp_tnode_cb()
Ralph Boehme [Sat, 29 Feb 2020 11:13:12 +0000 (12:13 +0100)] 
ctdb-tcp: always call node_dead() upcall in ctdb_tcp_tnode_cb()

ctdb_tcp_tnode_cb() is called when we receive data on the outgoing connection.

This can happen when we get an EOF on the connection because the other side as
closed. In this case data will be NULL.

It would also be called if we received data from the peer. In this case data
will not be NULL.

The latter case is a fatal error though and we already call
ctdb_tcp_stop_connection() for this case as well, which means even though the
node is not fully connected anymore, by not calling the node_dead() upcall
NODE_FLAGS_DISCONNECTED will not be set.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit b83ef98c7466b2a81968555de83fb977bb6ca9f0)

5 years agoctdb-tcp: move free of inbound queue to TCP restart
Noel Power [Sat, 29 Feb 2020 15:49:28 +0000 (15:49 +0000)] 
ctdb-tcp: move free of inbound queue to TCP restart

Since commit 77deaadca8e8dbc3c92ea16893099c72f6dc874e, a nodeA which
had previously accepted a connection from nodeB (where nodeB dies
e.g. as as result of fencing) when nodeB attempts to connect again
after restarting is always rejected with

 ctdb_listen_event: Incoming queue active, rejecting connection from w.x.y.z

messages.

Consolidate dead node handling in the TCP restart handling.

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

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 0ff1b78fc2f0491f9e11131d0040bdaba8873770)

5 years agoctdb-daemon: more logical whitespace, debug modernisation
Martin Schwenke [Sun, 1 Mar 2020 05:40:41 +0000 (16:40 +1100)] 
ctdb-daemon: more logical whitespace, debug modernisation

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 15762a34559599cf908e30651a2d4c11560068ed)

5 years agoctdb-daemon: ensure restart() callback is called in half-connected state
Ralph Boehme [Sat, 29 Feb 2020 11:26:19 +0000 (12:26 +0100)] 
ctdb-daemon: ensure restart() callback is called in half-connected state

If NODE_FLAGS_DISCONNECTED is set the node can be in half-connected state. With
this change we ensure to restart the transport for this case.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 6a4fa0785fc83561939fa41617d526eb96c1af89)

5 years agoctdb-daemon: Rename ctdb_context private_data to transport_data
Martin Schwenke [Tue, 12 Nov 2019 01:12:46 +0000 (12:12 +1100)] 
ctdb-daemon: Rename ctdb_context private_data to transport_data

This gives a casual reader a useful clue.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 750f3938e4fcd6743954db6b1132751a90ee6107)

5 years agoctdb-daemon: Rename ctdb_node private_data to transport_data
Martin Schwenke [Tue, 12 Nov 2019 01:04:22 +0000 (12:04 +1100)] 
ctdb-daemon: Rename ctdb_node private_data to transport_data

This gives a casual reader a useful clue.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 53f8492caafa8556d0c2d3f272d08ce5ce098c25)

5 years agonmblib: avoid undefined behaviour in handle_name_ptrs()
Douglas Bagnall [Sun, 19 Jan 2020 02:08:58 +0000 (15:08 +1300)] 
nmblib: avoid undefined behaviour in handle_name_ptrs()

If *offset is length - 1, we would read ubuf[(*offset)+1] as the lower
bits of the new *offset. This value is undefined, but because it is
checked against the valid range, there is no way to read further
beyond that one byte.

Credit to oss-fuzz.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14242
OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20193

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Feb  7 10:19:39 UTC 2020 on sn-devel-184

(cherry picked from commit 3bc7acc62646b105b03fd3c65e9170a373f95392)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Wed Mar 18 14:15:45 UTC 2020 on sn-devel-184

5 years agovfs_recycle: prevent flooding the log if we're called on non-existant paths
Ralph Boehme [Fri, 6 Mar 2020 11:22:25 +0000 (12:22 +0100)] 
vfs_recycle: prevent flooding the log if we're called on non-existant paths

vfs_recycle is assuming that any path passed to unlink must exist, otherwise it
logs this error. Turn this into a DEBUG level message.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14316
See also: https://bugzilla.redhat.com/show_bug.cgi?id=1780802

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Mon Mar  9 14:15:06 UTC 2020 on sn-devel-184

5 years agolibrpc: fix IDL for svcctl_ChangeServiceConfigW
Günther Deschner [Wed, 4 Mar 2020 14:23:43 +0000 (15:23 +0100)] 
librpc: fix IDL for svcctl_ChangeServiceConfigW

Found while trying to run winexe against Windows Server 2019.

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit ebda529b59105e9b70cc74377fe4d54cc16b4f37)

5 years agos4-torture: add ndr svcctl testsuite
Günther Deschner [Thu, 5 Mar 2020 19:42:21 +0000 (20:42 +0100)] 
s4-torture: add ndr svcctl testsuite

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit c3fa0b2df9fc53dddcc3160b6a3dc751bbb389a4)

5 years agos4-torture: add rpc test for ChangeServiceConfigW
Günther Deschner [Thu, 5 Mar 2020 21:45:48 +0000 (22:45 +0100)] 
s4-torture: add rpc test for ChangeServiceConfigW

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0825324bc75d2ab10164a1f137be782d84c822b8)

5 years agolib:torture: add torture_assert_u32_[not_]equal[_goto] macros
Ralph Boehme [Tue, 16 Apr 2019 14:46:43 +0000 (16:46 +0200)] 
lib:torture: add torture_assert_u32_[not_]equal[_goto] macros

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4162ba78f8146ad9b39d0749a36fab674197c78e)

5 years agoVFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode
Ralph Boehme [Mon, 24 Feb 2020 14:03:56 +0000 (15:03 +0100)] 
VFS: default: add support for FILE_ATTRIBUTE_OFFLINE to async dosmode

This had been missing in the initial async dosmode implementation. It's the
responsibility of the sync and async dosmode functions to call
vfswrap_is_offline() since the offline functionality has been converted from a
first class VFS function to be a part of the DOS attributes VFS functions.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a23f8d913fa8d77bab394aea9a8e7df2704e8b19)

5 years agoVFS: default: use correct type for pathlen in vfswrap_getxattrat_do_sync()
Ralph Boehme [Mon, 24 Feb 2020 13:30:37 +0000 (14:30 +0100)] 
VFS: default: use correct type for pathlen in vfswrap_getxattrat_do_sync()

full_path_tos() returns a ssize_t.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ace296b97642d9160ea66db89dcd0f24a21dba4e)

5 years agoVFS: default: avoid a crash in vfswrap_getxattrat_do_sync()
Ralph Boehme [Mon, 24 Feb 2020 13:29:01 +0000 (14:29 +0100)] 
VFS: default: avoid a crash in vfswrap_getxattrat_do_sync()

Must use tevent_req_data() to get our tevent_req state, talloc_get_type_abort()
will just crash as struct tevent_req != struct vfswrap_getxattrat_state.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit cbca811212a930b94f9917e5a82b6a95ab085e91)

5 years agoVFS: default: remove unused arg from vfswrap_is_offline()
Ralph Boehme [Mon, 24 Feb 2020 13:28:19 +0000 (14:28 +0100)] 
VFS: default: remove unused arg from vfswrap_is_offline()

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 99873724cd493366c9957fd9fe230d52a6f02691)

5 years agoVFS: default: let vfswrap_is_offline() take conn, not handle
Ralph Boehme [Mon, 24 Feb 2020 13:24:12 +0000 (14:24 +0100)] 
VFS: default: let vfswrap_is_offline() take conn, not handle

vfswrap_is_offline() has been converted to a "helper" function some time ago, it
had been a VFS interface function before. To make this change more obvious let
it take a struct connection_struct instead of a struct vfs_handle_struct which
is the canonical first parameter to VFS functions.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d4c69d82bdc0fa029609032a9d32f32fa1708beb)

5 years agosmbd: ignore set NTACL requests which contain S-1-5-88 NFS ACEs
Ralph Boehme [Thu, 27 Feb 2020 16:01:10 +0000 (17:01 +0100)] 
smbd: ignore set NTACL requests which contain S-1-5-88 NFS ACEs

We apply the same "ignore" logic already in the POSIX ACL code and in the
vfs_acl_xattr|tdb VFS modules to smb_set_nt_acl_nfs4() in the nfs4_acl helper
subsystem which is common to a bunch of VFS modules: GPFS, ZFS, NFS4_xattr and
aixacl2.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Mar  3 19:15:10 UTC 2020 on sn-devel-184

(cherry picked from commit f89c7ad851681c0e0ab39a1bedb3eeb672516fbb)

5 years agovfs_fruit: tmsize prevent overflow Force the type during arithmetic in order to preve...
Art M. Gallagher [Tue, 3 Mar 2020 21:51:46 +0000 (21:51 +0000)] 
vfs_fruit: tmsize prevent overflow Force the type during arithmetic in order to prevent overflow when summing the Time Machine folder size. Increase the precision to off_t (used for file sizes), leave the overflow error traps but with more precise wording.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13622
Signed-off-by: Art M. Gallagher <smblock@artmg.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Mar  7 01:37:31 UTC 2020 on sn-devel-184

(cherry picked from commit b0ba7cd4f96a6ea227943cb05ef51a463e292b2d)