]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
6 years agovfs_fruit: add a forward declaration for ad_get()
Ralph Boehme [Tue, 21 May 2019 14:00:00 +0000 (16:00 +0200)] 
vfs_fruit: add a forward declaration for ad_get()

Will be needed in the next commit.

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

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

6 years agoselftest: run vfs.fruit test against a share that deletes empty resource forks
Ralph Boehme [Tue, 21 May 2019 12:05:04 +0000 (14:05 +0200)] 
selftest: run vfs.fruit test against a share that deletes empty resource forks

This reveals a bug in the AppleDouble conversion code: the conversion code that
unlinks an empty resource fork AppleDouble sidecar file ("._file") gets
triggered as part of open_file_ntcreate(..., "file:AFP_AfpResource", ...):

after SMB_VFS_OPEN() has been called with O_CREAT, what created the file, we
call SMB_VFS_FSTAT() on the just created filehandle. This ends up in
ad_convert(), finds the resource fork empty and thus deletes the file.

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

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

6 years agos4:torture/vfs/fruit: ensure test_adouble_conversion_wo_xattr() uses a non-emtpy...
Ralph Boehme [Tue, 21 May 2019 16:39:52 +0000 (18:39 +0200)] 
s4:torture/vfs/fruit: ensure test_adouble_conversion_wo_xattr() uses a non-emtpy resourcefork

This ensures the resource fork is not deleted as part of the AppleDouble file
conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.

This is currently not a problem in selftest, as we don't enable the option, but
a subsequent commit will run all vfs.fruit tests against a share with this
option enabled.

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

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

6 years agos4:torture/vfs/fruit: ensure test_adouble_conversion() uses a non-emtpy resourcefork
Ralph Boehme [Tue, 21 May 2019 16:39:52 +0000 (18:39 +0200)] 
s4:torture/vfs/fruit: ensure test_adouble_conversion() uses a non-emtpy resourcefork

This ensures the resource fork is not deleted as part of the AppleDouble file
conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.

This is currently not a problem in selftest, as we don't enable the option, but
a subsequent commit will run all vfs.fruit tests against a share with this
option enabled.

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

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

6 years agoregistry: add a missing include
Ralph Boehme [Thu, 16 May 2019 14:05:31 +0000 (16:05 +0200)] 
registry: add a missing include

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Karolin Seeger <kseeger@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon May 27 14:29:36 UTC 2019 on sn-devel-184

(cherry picked from commit e09053faf457f69ad9b5e6a34be43c947503575f)

6 years agosamba-tool dns: use bytes for inet_ntop
Douglas Bagnall [Thu, 23 May 2019 21:58:12 +0000 (09:58 +1200)] 
samba-tool dns: use bytes for inet_ntop

From Python's point of view, array.AddrArray is a list of byte-valued
integers. In Python 3 we can convert directly using the likes of

         bytes(array.AddrArray[i].MaxSa[8:24])

but in 4.10 we need to support both, so we use struct.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed May 29 11:29:17 UTC 2019 on sn-devel-184

6 years agotests/samba-tool: test dns serverinfo/zoneinfo
Douglas Bagnall [Wed, 29 May 2019 01:38:12 +0000 (13:38 +1200)] 
tests/samba-tool: test dns serverinfo/zoneinfo

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
6 years agodocs: dfree command. Correct usage of dfree scripts.
Jeremy Allison [Sat, 18 May 2019 18:41:56 +0000 (11:41 -0700)] 
docs: dfree command. Correct usage of dfree scripts.

Add quotes to the sample scripts to prevent incorrect
parameter usage.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May 24 20:12:02 UTC 2019 on sn-devel-184

(cherry picked from commit 77eabd74e9a28b1e6decf0890a9ef4c83fa002d4)

6 years agolib: util: Finally remove possibilities of using sys_popen() unsafely.
Jeremy Allison [Sat, 18 May 2019 18:40:26 +0000 (11:40 -0700)] 
lib: util: Finally remove possibilities of using sys_popen() unsafely.

All code now uses sys_popenv() which is much
harder to use incorrectly.

Remove the extract_args() function that was the
cause of possible issues.

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

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

6 years agos3: lib: Rename all uses of file_pload_XXX -> file_ploadv_XXX.
Ralph Boehme [Fri, 24 May 2019 17:08:10 +0000 (19:08 +0200)] 
s3: lib: Rename all uses of file_pload_XXX -> file_ploadv_XXX.

Keep naming consistent across all usage.

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

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

6 years agos3: lib: Remove file_pload_send().
Jeremy Allison [Sat, 18 May 2019 18:32:05 +0000 (11:32 -0700)] 
s3: lib: Remove file_pload_send().

No longer used.

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

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

6 years agos3: winbind: Convert idmap to use file_ploadv_send().
Jeremy Allison [Sat, 18 May 2019 18:25:01 +0000 (11:25 -0700)] 
s3: winbind: Convert idmap to use file_ploadv_send().

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

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

6 years agos3: lib: Add file_ploadv_send().
Jeremy Allison [Sat, 18 May 2019 18:18:19 +0000 (11:18 -0700)] 
s3: lib: Add file_ploadv_send().

Not yet used. Preparing to remove file_pload_send()
with this safer alternative.

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

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

6 years agolib: util: Remove file_pload()
Jeremy Allison [Sat, 18 May 2019 18:14:53 +0000 (11:14 -0700)] 
lib: util: Remove file_pload()

No longer used.

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

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

6 years agos3: lib: Remove file_lines_pload().
Jeremy Allison [Sat, 18 May 2019 18:10:40 +0000 (11:10 -0700)] 
s3: lib: Remove file_lines_pload().

No longer used.

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

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

6 years agos3: smbd: Convert sysquotas.c code to use file_lines_ploadv().
Jeremy Allison [Sat, 18 May 2019 18:08:15 +0000 (11:08 -0700)] 
s3: smbd: Convert sysquotas.c code to use file_lines_ploadv().

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

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

6 years agos3: smbd: Convert print_svid code to use file_lines_ploadv().
Jeremy Allison [Fri, 17 May 2019 05:18:40 +0000 (22:18 -0700)] 
s3: smbd: Convert print_svid code to use file_lines_ploadv().

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

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

6 years agos3: smbd: Convert dfree code to use file_lines_ploadv().
Jeremy Allison [Fri, 17 May 2019 05:11:49 +0000 (22:11 -0700)] 
s3: smbd: Convert dfree code to use file_lines_ploadv().

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

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

6 years agos3: lib: util: Add file_lines_ploadv().
Jeremy Allison [Fri, 17 May 2019 05:10:51 +0000 (22:10 -0700)] 
s3: lib: util: Add file_lines_ploadv().

Not yet used.

Duplicate code to file_lines_pload() except uses vectored
argument list. file_lines_pload() will be removed once all
callers are converted.

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

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

6 years agolib: util: Add file_ploadv().
Jeremy Allison [Fri, 17 May 2019 04:56:13 +0000 (21:56 -0700)] 
lib: util: Add file_ploadv().

Not yet used.

Duplicate code to file_pload() except uses vectored
argument list. file_pload() will be removed once all
callers are converted.

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

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

6 years agolib: popen: Prepare to remove sys_popen().
Jeremy Allison [Fri, 17 May 2019 04:45:21 +0000 (21:45 -0700)] 
lib: popen: Prepare to remove sys_popen().

Add sys_popenv(char * const argl[]) that uses a NULL
terminated vector array of args. Change sys_popen() to
split up its command string and call sys_popenv().

Once all callers are converted to sys_popenv() we
can remove sys_popen().

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

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

6 years agos3:util: Move static file_pload() function to lib/util
Aliaksei Karaliou [Thu, 27 Dec 2018 09:25:47 +0000 (04:25 -0500)] 
s3:util: Move static file_pload() function to lib/util

file_pload() is static private function in Samba3 library, however it
does not have any special dependencies and might be widely used as
common function, so moving it into common samba-util library.

Extra fix needed to enable easy back-port of code for:

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

Signed-off-by: Aliaksei Karaliou <akaraliou@panasas.com>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit d21fc7d8b86b0cddc619ffe528d9cd93eeedbb0b)

6 years agos3:util: Move popen wrappers to lib/util
Aliaksei Karaliou [Thu, 27 Dec 2018 09:18:28 +0000 (04:18 -0500)] 
s3:util: Move popen wrappers to lib/util

When linked into Samba3 libraries, sys_popen()/sys_pclose()
cannot be used in lower level libraries because of circular
dependencies.

This patch moves them into common samba-util library.

Extra fix needed to enable easy back-port of code for:

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

Signed-off-by: Aliaksei Karaliou <akaraliou@panasas.com>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 65ea3f2a461c0eeca7d14c4258eea52e19f0ed06)

6 years agosmbd: Fix a panic
Volker Lendecke [Tue, 21 May 2019 13:26:55 +0000 (15:26 +0200)] 
smbd: Fix a panic

Opening a file with a stale (smbd died) LEVEL_II oplock makes

vfs_set_filelen-> ... ->contend_level2_oplocks_begin_default

trigger the immediate leading to do_break_to_none. This goes through
because fsp->oplock_type is not initialized yet, thus 0. Also,
file_has_read_oplocks is still valid, because the smbd that has died
could not clean up the brlock.tdb entry.

Later in the code the exclusive oplock is granted, which is then found
by do_break_to_none, making it panic.

This patch just runs the direct FTRUNCATE instead of vfs_set_filelen.
This means the contend_level2_oplock code is skipped.

The relevant break (LEVEL_II to NONE) is now done in delay_for_oplock()
with the nice effect of removing a comment that was very confusing to
me.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May 22 20:09:29 UTC 2019 on sn-devel-184

6 years agosmbtorture: Add a test to make smbd panic
Volker Lendecke [Tue, 21 May 2019 12:53:46 +0000 (14:53 +0200)] 
smbtorture: Add a test to make smbd panic

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agosmbd: Enable "smbd:suicide mode" for smb2
Volker Lendecke [Tue, 21 May 2019 12:52:22 +0000 (14:52 +0200)] 
smbd: Enable "smbd:suicide mode" for smb2

The next commit needs an smbd to just exit and leave data behind in the
locking.tdb file. Don't make it harder to eventually phase out SMB1: Do
the test in SMB2.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agos3: winbind: Fix crash when invoking winbind idmap scripts.
Jeremy Allison [Thu, 23 May 2019 20:33:21 +0000 (13:33 -0700)] 
s3: winbind: Fix crash when invoking winbind idmap scripts.

Previously the private context was caching a pointer to
a string returned from lp_XXX(). This string can change
on config file reload. Ensure the string is talloc_strup'ed
onto the owning context instead.

Reported by Heinrich Mislik <Heinrich.Mislik@univie.ac.at>

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

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

6 years agos3:loadparm: Ensure to truncate FS Volume Label at multibyte boundary
Shyamsunder Rathi [Mon, 13 May 2019 06:06:17 +0000 (23:06 -0700)] 
s3:loadparm: Ensure to truncate FS Volume Label at multibyte boundary

For FS_VOLUME_INFO/FS_INFO operation, a maximum of 32 characters are
sent back. However, since Samba chops off any share name with >32
bytes at 32, it is possible that a multi-byte share name can get chopped
off between a full character. This causes the string decoding for unicode
failure which sends back NT_STATUS_ILLEGAL_CHARACTER (EILSEQ) to the client
applications.

On Windows, Notepad doesn't like it, and refuses to open a file in this
case and fails with the following error:

  Invalid character. For multibyte character sets, only the leading byte is
  included without the trailing byte. For Unicode character sets, include
  the characters 0xFFFF and 0xFFFE.

Proposed fix:
- Find the last starting point of a multibyte codepoint if the character
  at 32nd byte is a subsequent byte of a MB codepoint.

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

Signed-off-by: Shyamsunder Rathi <shyam.rathi@nutanix.com>
Reviewed-by: Hemanth Thummala <hemanth.thummala@nutanix.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0fa490e8476a2a5020ff2c253167b8a9454e8b97)

6 years agos4 dsdb: fix use after free in samldb_rename_search_base_callback
Gary Lockyer [Tue, 14 May 2019 01:10:22 +0000 (13:10 +1200)] 
s4 dsdb: fix use after free in samldb_rename_search_base_callback

Fix use after free detected by AddressSanitizer

AddressSanitizer: heap-use-after-free on address 0x60f0002b2738
                  at pc 0x7f89b1a213b5 bp 0x7ffce9528810 sp 0x7ffce9528800
                  READ of size 8 at 0x60f0002b2738 thread T0
    #0 0x7f89b1a213b4 in samldb_rename_search_base_callback
        ../../source4/dsdb/samdb/ldb_modules/samldb.c:4203
    #1 0x7f89d3a0db4a in ldb_module_send_entry
        ../../lib/ldb/common/ldb_modules.c:793
    #2 0x7f89b6f27356 in es_callback
        ../../source4/dsdb/samdb/ldb_modules/encrypted_secrets.c:1418

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit b0cc6d217485c317b2138347216fac5d74684328)

6 years agos4 dsdb/repl_meta_data: fix use after free in dsdb_audit_add_ldb_value
Gary Lockyer [Tue, 14 May 2019 03:53:22 +0000 (15:53 +1200)] 
s4 dsdb/repl_meta_data: fix use after free in dsdb_audit_add_ldb_value

Fix use after free detected by AddressSanitizer

AddressSanitizer: heap-use-after-free on address 0x61400026a4a0
                  at pc 0x7fd555c52f12 bp 0x7ffed7231180 sp 0x7ffed7231170
                  READ of size 1 at 0x61400026a4a0 thread T0
    #0 0x7fd555c52f11 in ldb_should_b64_encode
       ../../lib/ldb/common/ldb_ldif.c:197
    #1 0x7fd539dc9417 in dsdb_audit_add_ldb_value
       ../../source4/dsdb/samdb/ldb_modules/audit_util.c:491
    #2 0x7fd539dc9417 in dsdb_audit_attributes_json
       ../../source4/dsdb/samdb/ldb_modules/audit_util.c:651
    #3 0x7fd539dc6a7e in operation_json
       ../../source4/dsdb/samdb/ldb_modules/audit_log.c:305

The problem is that at the successful end of these functions
el->values is overwritten with new_values.  However get_parsed_dns()
points p->v at the supplied el and it effectively gets used
as a working area by replmd_build_la_val().  So we must duplicate it
because our caller only called ldb_msg_copy_shallow().

The reason this matters is that the audit_log module is
above repl_meta_data in the stack, and tries to log the
ldb_message it saw after the reply (to include the error code).
If that ldb_message is changed it is not only misleading,
it can point to memory that has since gone away.

In this case the memory for the full extended DN in the
member attribute ended up on 'ac', a context lost by
the time repl_meta_data has finished processing.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed May 15 05:35:47 UTC 2019 on sn-devel-184

(cherry picked from commit 0daa0ff921b270df9b794f02acbaa391c95cd89b)

6 years agos4 dsdb/repl_meta_data: allocate new extended DNs during ADD on a better context
Andrew Bartlett [Wed, 15 May 2019 02:47:53 +0000 (14:47 +1200)] 
s4 dsdb/repl_meta_data: allocate new extended DNs during ADD on a better context

Lower down in this function new_values is assigned over el->values and is
filled in with the values of all the parsed DNs.  Therefore it is the natural
talloc parent.

This will allow el->values to be allocated on tmp_ctx in the next commit for
a working area during the function call.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 4aa9924310287ff3b36618496fa6c707c615ad4c)

6 years agos3:smbspool: Use NTSTATUS return codes
Andreas Schneider [Tue, 14 May 2019 09:35:46 +0000 (11:35 +0200)] 
s3:smbspool: Use NTSTATUS return codes

This allows us to simplify some code and return better errors.

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

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

6 years agos3:smbspool: Add debug messages to kerberos_ccache_is_valid()
Andreas Schneider [Thu, 16 May 2019 16:24:32 +0000 (18:24 +0200)] 
s3:smbspool: Add debug messages to kerberos_ccache_is_valid()

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

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

6 years agos3:smbspool: Always try to authenticate using Kerberos
Andreas Schneider [Mon, 13 May 2019 16:54:02 +0000 (18:54 +0200)] 
s3:smbspool: Always try to authenticate using Kerberos

If username and password is given, then fallback to NTLM. However try
kinit first. Also we correctly handle NULL passwords in the meantime and
this makes it easier to deal with issues.

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

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

6 years agos3:smbspool: Print the filename we failed to open
Andreas Schneider [Mon, 13 May 2019 14:48:31 +0000 (16:48 +0200)] 
s3:smbspool: Print the filename we failed to open

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

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

6 years agos3:smbspool: Fallback to default ccache if KRB5CCNAME is not set
Andreas Schneider [Thu, 16 May 2019 15:40:43 +0000 (17:40 +0200)] 
s3:smbspool: Fallback to default ccache if KRB5CCNAME is not set

This could also support the new KCM credential cache storage.

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

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

6 years agos3:smbspool: Use %u format specifier to print uid
Andreas Schneider [Thu, 16 May 2019 15:10:57 +0000 (17:10 +0200)] 
s3:smbspool: Use %u format specifier to print uid

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

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

6 years agos3:smbspool: Add debug for finding KRB5CCNAME
Andreas Schneider [Thu, 16 May 2019 12:25:00 +0000 (14:25 +0200)] 
s3:smbspool: Add debug for finding KRB5CCNAME

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

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

6 years agos3:smbspool: Print the principal we use to authenticate with
Andreas Schneider [Thu, 16 May 2019 11:41:02 +0000 (13:41 +0200)] 
s3:smbspool: Print the principal we use to authenticate with

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

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

6 years agos3:smbspool: Add the 'lp' group to the users groups
Andreas Schneider [Mon, 13 May 2019 14:55:49 +0000 (16:55 +0200)] 
s3:smbspool: Add the 'lp' group to the users groups

This is required to access files in /var/spool/cups which have been
temporarily created in there by CUPS.

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

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

6 years agopython/ntacls: we only need security.SEC_STD_READ_CONTROL in order to get the ACL
Stefan Metzmacher [Fri, 26 Apr 2019 15:07:20 +0000 (17:07 +0200)] 
python/ntacls: we only need security.SEC_STD_READ_CONTROL in order to get the ACL

We should avoid security.SEC_FLAG_MAXIMUM_ALLOWED otherwise
we may get NT_STATUS_SHARING_VIOLATION when we run
'samba-tool domain backup online' against a Windows DC.
Windows DCs have hidden folders for the NtFrs or Dfsr services,
which are locked by the running service.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 15032ec6df1abbb53f1b1d5377aab369f83ae707)

6 years agodsdb:samdb: schemainfo update with relax control
Aaron Haslett [Wed, 3 Apr 2019 03:34:42 +0000 (16:34 +1300)] 
dsdb:samdb: schemainfo update with relax control

Currently schema info's revision field isn't incremented if relax
control is present.  This is so that no increment is done during
provision, but we need the relax control in other situations where
the increment is desired, so we should use the provision control instead
to disable schema info update.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit b7c1752754da1e8a83a53670cf4a410ec6e9d7b7)

6 years agopython/provision: use provision and relax controls for schema provision
Stefan Metzmacher [Fri, 8 Mar 2019 10:28:42 +0000 (11:28 +0100)] 
python/provision: use provision and relax controls for schema provision

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 7652439fa1aab92945f5540a43fc49568d446917)

6 years agos4:provision: split out provision_self_join_modify_schema.ldif
Stefan Metzmacher [Fri, 8 Mar 2019 10:27:14 +0000 (11:27 +0100)] 
s4:provision: split out provision_self_join_modify_schema.ldif

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 5ea84af2d69e0b3a2a801ea0cc3f4ffc66bf1764)

6 years agoldapcmp: ignore 'schemaInfo' if two domains are compared
Stefan Metzmacher [Thu, 21 Feb 2019 08:20:48 +0000 (09:20 +0100)] 
ldapcmp: ignore 'schemaInfo' if two domains are compared

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit b5b572d5f71e2b9783ddb25c21ac32904fbfd661)

6 years agosamdb: test for schemainfo update with relax control
Aaron Haslett [Thu, 4 Apr 2019 01:39:41 +0000 (14:39 +1300)] 
samdb: test for schemainfo update with relax control

Currently schema info's revision field isn't incremented if relax
control is present.  This is so that no increment is done during
provision, but we need the relax control in other situations where the
increment is desired.  This patch adds a failing test to expose the
problem.

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

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit e34abefb77729330cd48bc039c82b03fe545f8a9)

6 years agodrsuapi.idl: add DRSUAPI_ATTID_schemaInfo
Stefan Metzmacher [Fri, 22 Feb 2019 23:14:31 +0000 (00:14 +0100)] 
drsuapi.idl: add DRSUAPI_ATTID_schemaInfo

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 140a6733a458d0afa20237a09ef4ee2546a83a8f)

6 years agodsdb/repl: we need to replicate the whole schema before we can apply it
Stefan Metzmacher [Fri, 8 Feb 2019 14:49:55 +0000 (14:49 +0000)] 
dsdb/repl: we need to replicate the whole schema before we can apply it

Otherwise we may not be able to construct a working schema that's
required to apply the changes.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 661dc4574110b0f13c127c8aa6ed0c385292b77c)

6 years agoMerge tag 'samba-4.10.4' into v4-10-test
Karolin Seeger [Wed, 22 May 2019 10:31:17 +0000 (12:31 +0200)] 
Merge tag 'samba-4.10.4' into v4-10-test

samba: tag release samba-4.10.4

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
6 years agoVERSION: Disable GIT_SNAPSHOT for the 4.10.4 release. samba-4.10.4
Karolin Seeger [Wed, 22 May 2019 09:49:22 +0000 (11:49 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the 4.10.4 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoMerge 'origin/v4-10-stable' into the real 4.10.4 release
Karolin Seeger [Wed, 22 May 2019 10:14:55 +0000 (12:14 +0200)] 
Merge 'origin/v4-10-stable' into the real 4.10.4 release

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
6 years agoMerge tag 'samba-4.10.3' into v4-10-stable
Karolin Seeger [Wed, 22 May 2019 10:05:26 +0000 (12:05 +0200)] 
Merge tag 'samba-4.10.3' into v4-10-stable

samba: tag release samba-4.10.3

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
6 years agoVERSION: Bump version up to 4.10.5...
Karolin Seeger [Wed, 22 May 2019 09:50:17 +0000 (11:50 +0200)] 
VERSION: Bump version up to 4.10.5...

and re-enable GIT_SNAPSHOT.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoVERSION: Disable GIT_SNAPSHOT for the 4.10.4 release.
Karolin Seeger [Wed, 22 May 2019 09:49:22 +0000 (11:49 +0200)] 
VERSION: Disable GIT_SNAPSHOT for the 4.10.4 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoWHATSNEW: Add release notes for Samba 4.10.4.
Karolin Seeger [Wed, 22 May 2019 09:48:35 +0000 (11:48 +0200)] 
WHATSNEW: Add release notes for Samba 4.10.4.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
6 years agoctdb-common: Fix memory leak in run_proc
Amitay Isaacs [Mon, 13 May 2019 07:07:59 +0000 (17:07 +1000)] 
ctdb-common: Fix memory leak in run_proc

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue May 14 08:59:03 UTC 2019 on sn-devel-184

(cherry picked from commit b1f4c86eea022999d5439e4a6ef3494fe41479b6)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Thu May 16 13:56:00 UTC 2019 on sn-devel-144

6 years agoctdb-common: Fix memory leak
Martin Schwenke [Sat, 11 May 2019 07:33:57 +0000 (17:33 +1000)] 
ctdb-common: Fix memory leak

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

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

6 years agoctdb-recoverd: Fix memory leak
Martin Schwenke [Sat, 11 May 2019 04:24:24 +0000 (14:24 +1000)] 
ctdb-recoverd: Fix memory leak

state is always freed before exiting this function, so allocate fde
off it instead of long-lived ctdb context.

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

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

6 years agovfs_ceph: fix cephwrap_flistxattr() debug message
David Disseldorp [Fri, 10 May 2019 11:18:49 +0000 (13:18 +0200)] 
vfs_ceph: fix cephwrap_flistxattr() debug message

The @list buffer may be uninitialised prior to ceph_flistxattr()
invocation, so only log the address.

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Fri May 10 12:59:05 UTC 2019 on sn-devel-184

(cherry picked from commit 21dc6f8e8d82f84e4afda355a48fbbd39c7fe800)

6 years agos3:smbspool: Fix regression printing with Kerberos credentials
Andreas Schneider [Thu, 9 May 2019 14:18:51 +0000 (16:18 +0200)] 
s3:smbspool: Fix regression printing with Kerberos credentials

This is a regression which has been introduced with Samba 4.8.

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

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

6 years agos3: SMB1: Don't allow recvfile on stream fsp's.
Jeremy Allison [Thu, 9 May 2019 19:53:11 +0000 (12:53 -0700)] 
s3: SMB1: Don't allow recvfile on stream fsp's.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May 10 01:14:02 UTC 2019 on sn-devel-184

(cherry picked from commit 667db8e8c7836c750085729f5062807669cbb204)

6 years agos3:smbd: don't use recvfile on streams
Ralph Boehme [Thu, 25 Apr 2019 08:57:58 +0000 (10:57 +0200)] 
s3:smbd: don't use recvfile on streams

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

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): Thu May  9 20:43:53 UTC 2019 on sn-devel-184

(cherry picked from commit 219bc189472acff24410009ee16a409e0aaf8eef)

6 years agos3:utils: If share is NULL in smbcacls, don't print it
Andreas Schneider [Wed, 8 May 2019 15:12:12 +0000 (17:12 +0200)] 
s3:utils: If share is NULL in smbcacls, don't print it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 2b957bde5a2f0f670ee0c8acde6edae1f4aaf253)

6 years agos3:utils: If share is NULL in smbcquotas, don't print it
Andreas Schneider [Wed, 8 May 2019 15:11:13 +0000 (17:11 +0200)] 
s3:utils: If share is NULL in smbcquotas, don't print it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 3653dc7013518d90e6deb08a1f21d7472dc86675)

6 years agos3:winbindd: Do not free db_path in idmap_tdb2 before we printed it
Andreas Schneider [Wed, 8 May 2019 15:05:58 +0000 (17:05 +0200)] 
s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e333425e0ff6be5691b74a920610b508e7d26892)

6 years agoctdb:common: Do not print NULL if we don't get a sockpath
Andreas Schneider [Wed, 8 May 2019 15:03:54 +0000 (17:03 +0200)] 
ctdb:common: Do not print NULL if we don't get a sockpath

sock_socket_start_recv() might not fill sockpath if we return early.

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 830cb7e67568de5f3ce359cb6af3be8ab545c824)

6 years agos4:torture: Do not free full_name before we printed it
Andreas Schneider [Wed, 8 May 2019 14:58:07 +0000 (16:58 +0200)] 
s4:torture: Do not free full_name before we printed it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 46f036d3231bc99cf37c7cabf82757d3c28c5cff)

6 years agolib:torture: Fix string comparison macros where we directly pass NULL
Andreas Schneider [Wed, 8 May 2019 14:54:30 +0000 (16:54 +0200)] 
lib:torture: Fix string comparison macros where we directly pass NULL

See e.g. lib/util/tests/strlist.c +177

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a8f773e326d6bdfc1c9eb87a74c00108f6620c56)

6 years agos4:torture: Do not print NULL strings we just checked before
Andreas Schneider [Wed, 8 May 2019 14:51:20 +0000 (16:51 +0200)] 
s4:torture: Do not print NULL strings we just checked before

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit be72dfbc8edc53ed191dc01668a53cafb5cd785d)

6 years agos4:ntvfs: Do not free eadb before we printed an error
Andreas Schneider [Wed, 8 May 2019 14:32:45 +0000 (16:32 +0200)] 
s4:ntvfs: Do not free eadb before we printed an error

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6da032df5450ef72f8608a19b3b5cc6e9185cd6e)

6 years agos3:rpc_server: Do not free the tdbname before we printed it
Andreas Schneider [Wed, 8 May 2019 14:31:10 +0000 (16:31 +0200)] 
s3:rpc_server: Do not free the tdbname before we printed it

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 790d7e34cbe4e190d6acdd24696efe53944cd4a6)

6 years agos4:auth: Fix debug statement in gensec_gssapi
Andreas Schneider [Wed, 8 May 2019 14:27:57 +0000 (16:27 +0200)] 
s4:auth: Fix debug statement in gensec_gssapi

The 'role' is set to null, we should first set it to the correct value
before printing anything.

Found by GCC 9.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit bd29f3fcc023d00afde8e9cc2f9db22dcae49877)

6 years agos3 rpc_client: Fix Asan stack use after scope
Gary Lockyer [Thu, 9 May 2019 20:47:46 +0000 (08:47 +1200)] 
s3 rpc_client: Fix Asan stack use after scope

Fixes Asan error:

==1924==ERROR: AddressSanitizer: stack-use-after-scope on address
    0x7ffe63f873d0 at pc 0x7fb99dae1733 bp 0x7ffe63f86a00 sp 0x7ffe63f861a8
READ of size 24 at 0x7ffe63f873d0 thread T0
    #0 0x7fb99dae1732  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x79732)
    #1 0x7fb99cfe5549 in memcpy
        /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
    #2 0x7fb99cfe5549 in ndr_push_bytes
        ../../librpc/ndr/ndr_basic.c:729
    #3 0x7fb99cfe5646 in ndr_push_array_uint8
        ../../librpc/ndr/ndr_basic.c:754
    #4 0x7fb99a69dd1b in ndr_push_netr_ChallengeResponse
        librpc/gen_ndr/ndr_netlogon.c:462
    #5 0x7fb99a6c5fab in ndr_push_netr_NetworkInfo
        librpc/gen_ndr/ndr_netlogon.c:556
    #6 0x7fb99a6c749d in ndr_push_netr_LogonLevel
         librpc/gen_ndr/ndr_netlogon.c:783
    #7 0x7fb99a7222de in ndr_push_netr_LogonSamLogonEx
         librpc/gen_ndr/ndr_netlogon.c:16547
    #8 0x7fb99c982c97 in dcerpc_binding_handle_call_send
         ../../librpc/rpc/binding_handle.c:416

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 10 10:02:21 UTC 2019 on sn-devel-184

(cherry picked from commit a5d1df4a8f9c535ff2f7ef11d7dfea4d79d65e7e)

6 years agoctdb-daemon: Never use 0 as a client ID
Martin Schwenke [Mon, 6 May 2019 05:22:49 +0000 (15:22 +1000)] 
ctdb-daemon: Never use 0 as a client ID

ctdb_control_db_attach() and ctdb_control_db_detach() assume that any
control with client ID 0 comes from another daemon and treat it
specially.

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

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

6 years agos4 lib socket: Ensure address string owned by parent struct
Gary Lockyer [Tue, 7 May 2019 04:30:22 +0000 (16:30 +1200)] 
s4 lib socket: Ensure address string owned by parent struct

The local address string was not owned by it's parent structure, which
caused a use after free error in
continue_ip_open_socket source4/librpc/rpc/dcerpc_sock.c:267

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed May  8 20:03:42 UTC 2019 on sn-devel-184

(cherry picked from commit ae9fb93393bcadbc71328335e481e4381ecb65bf)

6 years agonsswitch pam_winbind: Fix Asan use after free
Gary Lockyer [Wed, 17 Apr 2019 21:29:28 +0000 (09:29 +1200)] 
nsswitch pam_winbind: Fix Asan use after free

Fix use after free condition detected by Address Sanitizer triggered by
wbcLogonUserInfoDestructor, wbcFreeMemory has code to detect and prevent a
double free.  This patch prevents the Address Sanitizer error, allowing
tests to be run with Address Sanitizer enabled.

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

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon May  6 08:55:22 UTC 2019 on sn-devel-184

(cherry picked from commit 193b44466ba05deba8f2b1fdc16ab55c102e82ad)

6 years agoctdb-tests: Fix logic error in simple ctdb reloadips test
Martin Schwenke [Tue, 7 May 2019 05:42:49 +0000 (15:42 +1000)] 
ctdb-tests: Fix logic error in simple ctdb reloadips test

There is a chance that restoring IP addresses to the test node will
result in different IP addresses being assigned to that node.
Removing a single IP address may then fail (or be a no-op) if it is
done after the restore.

So, swap the single IP address removal to happen first, then restore,
then remove all IP addresses.

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

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

6 years agoctdb-tests: Make ctdb reloadips tests more reliable
Martin Schwenke [Tue, 7 May 2019 05:29:19 +0000 (15:29 +1000)] 
ctdb-tests: Make ctdb reloadips tests more reliable

ctdb reloadips will fail if it can't disable takover runs.  The most
likely reason for this is that there is already a takeover run in
progress.  We can't predict when this will happen, so retry if this
occurs.

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

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

6 years agoctdb-tests: Capture output in $out on failure as well
Martin Schwenke [Mon, 13 May 2019 07:40:15 +0000 (17:40 +1000)] 
ctdb-tests: Capture output in $out on failure as well

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

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

6 years agoctdb-tests: Remove old socket wrapper state directory during setup
Martin Schwenke [Sat, 11 May 2019 21:52:13 +0000 (07:52 +1000)] 
ctdb-tests: Remove old socket wrapper state directory during setup

Otherwise, when looping tests for a long time, nodes are unable to
connect to each other.

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

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): Mon May 13 08:42:44 UTC 2019 on sn-devel-184

(cherry picked from commit c75fbeaa96108cd4dc193ef5f4170977804e5104)

6 years agoctdb-tests: Actually restart if cluster doesn't become healthy
Martin Schwenke [Fri, 10 May 2019 09:22:16 +0000 (19:22 +1000)] 
ctdb-tests: Actually restart if cluster doesn't become healthy

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

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

6 years agoctdb-tests: Don't clean up test var directory in autotest target
Martin Schwenke [Wed, 1 May 2019 05:17:14 +0000 (15:17 +1000)] 
ctdb-tests: Don't clean up test var directory in autotest target

If the directory is always cleaned up then it is not possible to look
at daemon logs to debug test failures.

This target is only really used by autobuild.py, which (optionally)
cleans up the parent directory anyway.

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

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 May  7 06:56:01 UTC 2019 on sn-devel-184

(cherry picked from commit 5a9e338330fe136908a3a17a5df81c054c5cc5b0)

6 years agoctdb-tests: Fix usage message
Martin Schwenke [Wed, 1 May 2019 05:10:28 +0000 (15:10 +1000)] 
ctdb-tests: Fix usage message

Since commit 0e9ead8f28fced3ebfa888786a1dc5bb59e734a3 daemons have
been shut down after each test, so this option no longer has anything
to do with killing daemons.

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

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

6 years agoctdb-tests: Wait to allow database attach/detach to take effect
Martin Schwenke [Sat, 27 Apr 2019 04:54:09 +0000 (14:54 +1000)] 
ctdb-tests: Wait to allow database attach/detach to take effect

Sometimes the detach test fails:

  Check detaching single test database detach_test1.tdb
  BAD: database detach_test1.tdb is still attached
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.0/db/volatile/detach_test4.tdb.0
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.0/db/volatile/detach_test3.tdb.0
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.0/db/volatile/detach_test2.tdb.0
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.0/db/volatile/detach_test1.tdb.0
  Number of databases:3
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.1/db/volatile/detach_test4.tdb.1
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.1/db/volatile/detach_test3.tdb.1
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.1/db/volatile/detach_test2.tdb.1
  Number of databases:4
  dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.2/db/volatile/detach_test4.tdb.2
  dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.2/db/volatile/detach_test3.tdb.2
  dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.2/db/volatile/detach_test2.tdb.2
  dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.2/db/volatile/detach_test1.tdb.2
  *** TEST COMPLETED (RC=1) AT 2019-04-27 03:35:40, CLEANING UP...

When issued from a client, the detach control re-broadcasts itself
asynchronously to all nodes and then returns success.  The controls to
some nodes to do the actual detach may still be in flight when success
is returned to the client.  Therefore, the test should wait for a few
seconds to allow the asynchronous controls to complete.

The same is true for the attach control, so workaround the problem in
the attach test too.

An alternative is to make the attach and detach controls synchronous
by avoiding the broadcast and waiting for the results of the
individual controls sent to the nodes.  However, a simple
implementation would involve adding new nested event loops.

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

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

6 years agoctdb-tests: Avoid bulk output in $out, prefer $outfile
Martin Schwenke [Thu, 11 Apr 2019 10:55:20 +0000 (20:55 +1000)] 
ctdb-tests: Avoid bulk output in $out, prefer $outfile

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

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

6 years agoctdb-tests: Make try_command_on_node less error-prone
Martin Schwenke [Thu, 28 Mar 2019 03:26:52 +0000 (14:26 +1100)] 
ctdb-tests: Make try_command_on_node less error-prone

This sometimes fails, apparently due to a cat process in onnode
getting EAGAIN.  The conclusion is that tests that process large
amounts of output should not depend on a sub-shell delivering that
output into a shell variable.

Change try_command_on_node() to leave all of the output in file
$outfile and just put the first 1KB into $out.  $outfile is removed
after each test completes.

Change the implementation of sanity_check_output() to use $outfile
instead of $out.

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

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

6 years agoctdb-tests: Change sanity_check_output() to internally use $out
Martin Schwenke [Tue, 30 Apr 2019 02:09:26 +0000 (12:09 +1000)] 
ctdb-tests: Change sanity_check_output() to internally use $out

All callers are currently passed $out.  Global variable $out is used
in many other places so use it here to simplify the interface and make
future changes simpler.

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

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

6 years agoctdb-tests: Extend test to cover ctdb rddumpmemory
Martin Schwenke [Thu, 11 Apr 2019 06:58:10 +0000 (16:58 +1000)] 
ctdb-tests: Extend test to cover ctdb rddumpmemory

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

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

6 years agoctdb-tools: Fix ctdb dumpmemory to avoid printing trailing NUL
Martin Schwenke [Thu, 11 Apr 2019 06:56:32 +0000 (16:56 +1000)] 
ctdb-tools: Fix ctdb dumpmemory to avoid printing trailing NUL

Fix ctdb rddumpmemory too.

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

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

6 years agosmbd: implement SMB_FILE_NORMALIZED_NAME_INFORMATION handling
Stefan Metzmacher [Thu, 25 Apr 2019 12:57:33 +0000 (14:57 +0200)] 
smbd: implement SMB_FILE_NORMALIZED_NAME_INFORMATION handling

Windows 10 (1803 and higher) support and use
SMB_FILE_NORMALIZED_NAME_INFORMATION calls over the network. As a
fallback (in case the server don't support it) the client traverses all
path components, which is very expensive.

Implementing SMB_FILE_NORMALIZED_NAME_INFORMATION is very cheap for us
as the open already went through unix_convert() and we have the
information the client is asking for.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May  1 18:33:00 UTC 2019 on sn-devel-184

(cherry picked from commit b20fd15e04ce9292f90a7f70f4184e43034b4b9d)

6 years agos4:torture/smb2: add smb2.getinfo.normalized test
Stefan Metzmacher [Thu, 25 Apr 2019 12:57:02 +0000 (14:57 +0200)] 
s4:torture/smb2: add smb2.getinfo.normalized test

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8a5828de2bdd95223e5f30996d0490fef53742dd)

6 years agos4:libcli/raw: add RAW_FILEINFO_NORMALIZED_NAME_INFORMATION support
Stefan Metzmacher [Thu, 25 Apr 2019 10:12:34 +0000 (12:12 +0200)] 
s4:libcli/raw: add RAW_FILEINFO_NORMALIZED_NAME_INFORMATION support

This is supported over the wire in SMB 3.1.1 on starting with
Windows 10 1803.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0c602319194bda6b2a0efdd7c186078583f79264)

6 years agosmbd: allow case insensitive opens of named streams
Stefan Metzmacher [Thu, 25 Apr 2019 15:30:43 +0000 (17:30 +0200)] 
smbd: allow case insensitive opens of named streams

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 2a69c0915586fb9fb2148239965d06bf9f93c803)

6 years agos4:torture/smb2: add smb2.stream.names3 test
Stefan Metzmacher [Mon, 29 Apr 2019 12:53:13 +0000 (14:53 +0200)] 
s4:torture/smb2: add smb2.stream.names3 test

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b5c4fdbf99caa3a9e7c6446cfbc4f1b23b84b3c8)

6 years agos3: modules: ceph: use current working directory instead of share path
Robert Sander [Thu, 2 May 2019 18:20:44 +0000 (11:20 -0700)] 
s3: modules: ceph: use current working directory instead of share path

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

Signed-off-by: Robert Sander <r.sander@heinlein-support.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May  2 19:34:11 UTC 2019 on sn-devel-184

(cherry picked from commit 966fc0dc604299a87e40e7170d80911475317db5)

6 years agos3:debug: enable logging for early startup failures
Ralph Wuerthner [Mon, 25 Mar 2019 14:17:07 +0000 (15:17 +0100)] 
s3:debug: enable logging for early startup failures

Commit c89a33a07a 'debug: Use backends instead of explicitly logging to
syslog or file' introduced a regression where early startup failures (e.g.
unable to connect to CTDB) are no longer logged because the debug subsystem
is not yet fully initialized. Enable logging again with reasonable defaults
when reopen_logs() is called and the parameter file is not yet parsed.

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Thu Apr 18 22:21:15 UTC 2019 on sn-devel-144

(cherry picked from commit 9b30fcda64080592d20de64b384fd6d3d0775cbf)

6 years agos3:debug: adjust indention
Ralph Wuerthner [Thu, 11 Apr 2019 11:11:34 +0000 (13:11 +0200)] 
s3:debug: adjust indention

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit a45675879ddcb43ab274d28496eedd6833466ae4)

6 years agos3:debug: use struct initializer
Ralph Wuerthner [Thu, 11 Apr 2019 11:01:16 +0000 (13:01 +0200)] 
s3:debug: use struct initializer

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

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit b9e1b4ad0033c211710da285c30d603ccb8b8d40)

6 years agowinbind: Fix overlapping id ranges
Volker Lendecke [Fri, 12 Apr 2019 14:56:45 +0000 (16:56 +0200)] 
winbind: Fix overlapping id ranges

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 24 02:25:56 UTC 2019 on sn-devel-184

(cherry picked from commit 3020050bdf9df077ec9a0e962a689557187174ac)

6 years agoselftest: Add trusted domain tests for idmap_ad
Christof Schmitt [Mon, 22 Apr 2019 23:41:42 +0000 (16:41 -0700)] 
selftest: Add trusted domain tests for idmap_ad

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 2577f43a133f8b8eb997b9529a38e21c77b5da22)