]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agolibrpc: Fix a talloc_stackframe() leak
Volker Lendecke [Sat, 14 Nov 2020 09:12:20 +0000 (10:12 +0100)] 
librpc: Fix a talloc_stackframe() leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli: Align a few integer types
Volker Lendecke [Sun, 29 Nov 2020 17:25:07 +0000 (18:25 +0100)] 
libcli: Align a few integer types

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agodocs: Fix "async dns timeout" manpage entry
Volker Lendecke [Sun, 29 Nov 2020 12:06:34 +0000 (13:06 +0100)] 
docs: Fix "async dns timeout" manpage entry

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoloadparm: Simplify lp_get_async_dns_timeout()
Volker Lendecke [Sun, 29 Nov 2020 12:05:02 +0000 (13:05 +0100)] 
loadparm: Simplify lp_get_async_dns_timeout()

Use MAX, and per README.Coding we don't need the intermediate
variable. This can be inspected in the debugger directly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agodsgetdcname: Fix talloc hierarchy
Volker Lendecke [Fri, 27 Nov 2020 21:00:10 +0000 (22:00 +0100)] 
dsgetdcname: Fix talloc hierarchy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotests python krb5: Extra canonicalization tests
Gary Lockyer [Wed, 18 Nov 2020 01:49:28 +0000 (14:49 +1300)] 
tests python krb5: Extra canonicalization tests

Add tests that set the server name to the client name for the machine
account in the kerberos AS_REQ.  This replicates the TEST_AS_REQ_SELF
test phase in source4/torture/krb5/kdc-canon-heimdal.c.

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 Nov 30 05:21:42 UTC 2020 on sn-devel-184

4 years agovfs_glusterfs: print exact cmdline for disabling write-behind translator
Günther Deschner [Tue, 24 Nov 2020 14:38:41 +0000 (15:38 +0100)] 
vfs_glusterfs: print exact cmdline for disabling write-behind translator

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

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Nov 27 17:15:07 UTC 2020 on sn-devel-184

4 years agodocs-xml: Add a section about weak crypto in testparm manpage
Andreas Schneider [Fri, 27 Nov 2020 10:22:15 +0000 (11:22 +0100)] 
docs-xml: Add a section about weak crypto in testparm manpage

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

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): Fri Nov 27 13:48:20 UTC 2020 on sn-devel-184

4 years agos4: rename source4/smbd/ to source4/samba/
Ralph Boehme [Fri, 20 Nov 2020 14:27:17 +0000 (15:27 +0100)] 
s4: rename source4/smbd/ to source4/samba/

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Nov 27 10:07:18 UTC 2020 on sn-devel-184

4 years agosamba-tool: Give better error information when the 'domain backup restore' fails...
Andrew Bartlett [Fri, 13 Nov 2020 02:26:07 +0000 (15:26 +1300)] 
samba-tool: Give better error information when the 'domain backup restore' fails with a duplicate SID

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Thu Nov 26 21:15:40 UTC 2020 on sn-devel-184

4 years agos3:libsmb: Return early if dir is NULL
Andreas Schneider [Wed, 25 Nov 2020 12:01:46 +0000 (13:01 +0100)] 
s3:libsmb: Return early if dir is NULL

This makes sure we do not dereference a NULL poineter.

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Nov 26 11:07:09 UTC 2020 on sn-devel-184

4 years agos3:mdssd: Fix creating binding string for error message
Andreas Schneider [Wed, 25 Nov 2020 11:55:56 +0000 (12:55 +0100)] 
s3:mdssd: Fix creating binding string for error message

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:lsasd: Fix creating binding string for error message
Andreas Schneider [Wed, 25 Nov 2020 11:55:24 +0000 (12:55 +0100)] 
s3:lsasd: Fix creating binding string for error message

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:spoolssd: Fix creating binding string for error message
Andreas Schneider [Wed, 25 Nov 2020 10:46:05 +0000 (11:46 +0100)] 
s3:spoolssd: Fix creating binding string for error message

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agowinexe: Fix a possible null pointer derference
Andreas Schneider [Wed, 25 Nov 2020 10:38:01 +0000 (11:38 +0100)] 
winexe: Fix a possible null pointer derference

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:libsmb: Fix clang warnings that fnum might be used uninitialized
Andreas Schneider [Wed, 25 Nov 2020 10:34:09 +0000 (11:34 +0100)] 
s3:libsmb: Fix clang warnings that fnum might be used uninitialized

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba_upgradedns: Do not print confusing logs about missing .zone files
Andrew Bartlett [Mon, 23 Nov 2020 21:15:43 +0000 (10:15 +1300)] 
samba_upgradedns: Do not print confusing logs about missing .zone files

samba_upgradedns prints confusing logs about upgrading zone files
and automatically creating DNS zones when the zone already exists.

We need to move the logging to later when we know we what we are
using the parsed information for.

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

Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Nov 26 08:16:04 UTC 2020 on sn-devel-184

4 years agoTest password removal via python proctitle
David Mulder [Fri, 8 Nov 2019 20:06:53 +0000 (20:06 +0000)] 
Test password removal via python proctitle

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoRemove password from samba-tool proctitle
Heiko Baumann [Tue, 3 Sep 2019 12:30:18 +0000 (14:30 +0200)] 
Remove password from samba-tool proctitle

This fix makes sure the password is removed from the proctitle
of samba-tool so it cannot be exposed by e.g. ps(1).
- Moved code to python/samba/getopt.py as suggested by David Mulder
- Except ModuleNotFoundError when trying to load setproctitle module
- Improved code to keep option separator (space or equal sign) while
  removing password from proctitle.

Signed-off-by: Heiko Baumann <heibau@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
4 years agoDo not create an empty DB when accessing a sam.ldb
Andrew Bartlett [Mon, 23 Nov 2020 06:35:37 +0000 (19:35 +1300)] 
Do not create an empty DB when accessing a sam.ldb

Samba already does this for samba-tool and doing this should make
our errors more sensible, particularly in BIND9 if not provisioned
with the correct --dns-backend=DLZ_BIND9

The old error was like:

 named[62954]: samba_dlz: Unable to get basedn for
 /var/lib/samba/private/dns/sam.ldb
  - NULL Base DN invalid for a base search.

The new error will be like (in this case from the torture test):
 Failed to connect to Failed to connect to
 ldb:///home/abartlet/samba/st/chgdcpass/bind-dns/dns/sam.ldb:
 Unable to open tdb '/home/abartlet/samba/st/chgdcpass/bind-dns/dns/sam.ldb':
 No such file or directory: Operations error

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

Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agotorture: Do not call destroy_dlz() on uninitialised memory
Andrew Bartlett [Mon, 23 Nov 2020 07:27:51 +0000 (20:27 +1300)] 
torture: Do not call destroy_dlz() on uninitialised memory

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

Reviewed-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agowaf: upgrade to 2.0.21
Stefan Metzmacher [Wed, 25 Nov 2020 15:29:06 +0000 (16:29 +0100)] 
waf: upgrade to 2.0.21

This commit message was wrong:

    commit 5fc3a71d0f54b176d3cb2e399718d0468507e797
    Author: David Mulder <dmulder@suse.com>
    Date:   Mon Aug 24 13:12:46 2020 -0600

        waf: upgrade to 2.0.20

        This contain an important change:
        "Fix gccdeps.scan() returning nodes that no longer exist on disk."
        https://gitlab.com/ita1024/waf/-/merge_requests/2293

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
The fix was in in waf master, but not included in 2.0.20,
but it's now included in 2.0.21.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:lib: Check return code of set_blocking()
Andreas Schneider [Tue, 24 Nov 2020 16:42:24 +0000 (17:42 +0100)] 
s3:lib: Check return code of set_blocking()

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:smbd: Check return code of set_blocking()
Andreas Schneider [Tue, 24 Nov 2020 16:40:33 +0000 (17:40 +0100)] 
s3:smbd: Check return code of set_blocking()

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:smb: Check return code of set_blocking
Andreas Schneider [Tue, 24 Nov 2020 16:35:26 +0000 (17:35 +0100)] 
libcli:smb: Check return code of set_blocking

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:winbind: Check return code of set_blocking()
Andreas Schneider [Tue, 24 Nov 2020 16:33:26 +0000 (17:33 +0100)] 
s3:winbind: Check return code of set_blocking()

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:smbd: Fix a possible null pointer deref in oplock code
Andreas Schneider [Tue, 24 Nov 2020 15:57:12 +0000 (16:57 +0100)] 
s3:smbd: Fix a possible null pointer deref in oplock code

Found by cppcheck.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool domain backup: Confirm the sidForRestore we will put into the backup is...
Andrew Bartlett [Tue, 17 Nov 2020 23:11:10 +0000 (12:11 +1300)] 
samba-tool domain backup: Confirm the sidForRestore we will put into the backup is free

Otherwise the administrator might only find there is a problem once they
attempt to restore the domain!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14575
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agos3: smbd: Fix misleading comment I added for commit 382a5c4e7ec08ec9291453ffad9541ab3...
Jeremy Allison [Sat, 21 Nov 2020 23:55:08 +0000 (15:55 -0800)] 
s3: smbd: Fix misleading comment I added for commit 382a5c4e7ec08ec9291453ffad9541ab36aca274

smbd: Fix failure to check dstdir for delete on close

We're preventing ourselves from holding two locks here,
not protecting from waiting for a lock someone else
holds.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Nov 22 01:22:36 UTC 2020 on sn-devel-184

4 years agotestprogs: Fix MIT KRB5 export keytab with > 1.18
Andreas Schneider [Thu, 19 Nov 2020 16:04:07 +0000 (17:04 +0100)] 
testprogs: Fix MIT KRB5 export keytab with > 1.18

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Nov 21 00:11:02 UTC 2020 on sn-devel-184

4 years agosmbd: Fix failure to check dstdir for delete on close
Volker Lendecke [Thu, 19 Nov 2020 11:38:06 +0000 (12:38 +0100)] 
smbd: Fix failure to check dstdir for delete on close

In smb2_setinfo.c the call to smbd_do_setfilepathinfo() to perform the
rename takes place while holding a share mode lock. The function
check_parent_access() called below tries to query the destination
directory's locking.tdb entry to check whether the delete on close
flag is set on the destination directory. This fails because the
file to be renamed already has the share mode entry locked, we can't
lock two share mode entries simultaneously.

Convert the check to use fetch_share_mode_unlocked(). This might
introduce races, but this whole check is racy anyway. It does not
really matter whether we do the check for delete_on_close under a lock
or not, fetch_share_mode_unlocked() retrieves a consistent status of
the locking.tdb entry at some point in time as well.

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

4 years agotests: SMB2 rename fails to check del-on-close on dst dir
Volker Lendecke [Tue, 17 Nov 2020 14:24:43 +0000 (15:24 +0100)] 
tests: SMB2 rename fails to check del-on-close on dst dir

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Add rename()
Volker Lendecke [Mon, 16 Nov 2020 11:41:35 +0000 (12:41 +0100)] 
pylibsmb: Add rename()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotests: Factor out prep_creds()
Volker Lendecke [Tue, 17 Nov 2020 15:11:11 +0000 (16:11 +0100)] 
tests: Factor out prep_creds()

3 times the same code can be put together

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make cli_nt_pipes_close() static
Volker Lendecke [Mon, 9 Nov 2020 18:32:57 +0000 (19:32 +0100)] 
libsmb: Make cli_nt_pipes_close() static

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: g_lock.h references "struct server_id", add #include
Volker Lendecke [Wed, 11 Nov 2020 15:52:07 +0000 (16:52 +0100)] 
lib: g_lock.h references "struct server_id", add #include

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove unused security_descriptor_append()
Volker Lendecke [Wed, 11 Nov 2020 07:03:46 +0000 (08:03 +0100)] 
lib: Remove unused security_descriptor_append()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agobuild: fcvt() and fcvtl() are not used
Volker Lendecke [Mon, 16 Nov 2020 13:37:43 +0000 (14:37 +0100)] 
build: fcvt() and fcvtl() are not used

No need to check for them in the configure phase

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: avoid a smb_fname copy in call_trans2setfilepathinfo()
Ralph Boehme [Tue, 17 Nov 2020 10:02:31 +0000 (11:02 +0100)] 
smbd: avoid a smb_fname copy in call_trans2setfilepathinfo()

There's no point in doing a copy here, we can just point smb_fname at
fsp->fsp_name.

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 Nov 19 21:24:23 UTC 2020 on sn-devel-184

4 years agosmbd: avoid a smb_fname copy in call_trans2qfilepathinfo()
Ralph Boehme [Tue, 20 Oct 2020 15:07:35 +0000 (17:07 +0200)] 
smbd: avoid a smb_fname copy in call_trans2qfilepathinfo()

No point in making a copy here.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: replace calls to check_access() with smbd_check_access_rights()
Ralph Boehme [Tue, 27 Oct 2020 11:23:00 +0000 (12:23 +0100)] 
smbd: replace calls to check_access() with smbd_check_access_rights()

check_access() is a 1:1 wrapper arounf smbd_check_access_rights().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: use SMB2_INFO_SPECIAL in call_trans2qfilepathinfo()
Ralph Boehme [Mon, 26 Oct 2020 16:57:00 +0000 (17:57 +0100)] 
smbd: use SMB2_INFO_SPECIAL in call_trans2qfilepathinfo()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture: avoid OPLOCK-CANCEL flapping on busy gitlab CI
Ralph Boehme [Mon, 16 Nov 2020 09:44:48 +0000 (10:44 +0100)] 
torture: avoid OPLOCK-CANCEL flapping on busy gitlab CI

I saw this test fail a few times on gitlab CI with
NT_STATUS_SHARING_VIOLATION:

  Running OPLOCK-CANCEL
  cli_unlink failed: NT_STATUS_SHARING_VIOLATION
  TEST OPLOCK-CANCEL FAILED!

The only possible explanation I could come up for
this flapping test is that the fnum1 filehandle in cli1 is still not closed when
cli2 tries to open the file deletion 5 seconds after cli1 is thrown away. As
fnum1 doesn't have FILE_SHARE_DELELE the open-for-delete fails with a
SHARING_VIOLATION.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agodocs-xml: add "smbd force process locks"
Ralph Boehme [Mon, 16 Nov 2020 10:06:08 +0000 (11:06 +0100)] 
docs-xml: add "smbd force process locks"

Avoid a parametric option in a hot codepath.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoselftest: remove selftest/knownfail.d/samba3.smbtorture_s3
Ralph Boehme [Mon, 26 Oct 2020 09:03:24 +0000 (10:03 +0100)] 
selftest: remove selftest/knownfail.d/samba3.smbtorture_s3

This hunk was inadvertently included in 5161edbdb28.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Multi-threaded use is now possible with SMB2
Volker Lendecke [Wed, 18 Nov 2020 14:00:07 +0000 (15:00 +0100)] 
pylibsmb: Multi-threaded use is now possible with SMB2

No non-async callees are used anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Nov 19 04:12:11 UTC 2020 on sn-devel-184

4 years agopylibsmb: Remove unused py_cli_state->is_smb1
Volker Lendecke [Wed, 18 Nov 2020 13:59:15 +0000 (14:59 +0100)] 
pylibsmb: Remove unused py_cli_state->is_smb1

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Remove unused sync cli_smb2_list()
Volker Lendecke [Tue, 17 Nov 2020 11:31:20 +0000 (12:31 +0100)] 
libsmb: Remove unused sync cli_smb2_list()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Remove SMB2 special case for cli_list()
Volker Lendecke [Mon, 16 Nov 2020 07:26:56 +0000 (08:26 +0100)] 
pylibsmb: Remove SMB2 special case for cli_list()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Use async cli_smb2_list_send() in cli_list_send()
Volker Lendecke [Mon, 16 Nov 2020 07:26:09 +0000 (08:26 +0100)] 
libsmb: Use async cli_smb2_list_send() in cli_list_send()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Prepare cli_list_send()/recv() for single-issue subreqs
Volker Lendecke [Wed, 18 Nov 2020 13:13:22 +0000 (14:13 +0100)] 
libsmb: Prepare cli_list_send()/recv() for single-issue subreqs

This prepares cli_list_recv() for the lowerlevel NT_STATUS_RETRY that
will come in once cli_list_send() uses cli_smb2_list_send() as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Convert cli_list_recv() to single-recv
Volker Lendecke [Mon, 26 Oct 2020 08:21:17 +0000 (09:21 +0100)] 
libsmb: Convert cli_list_recv() to single-recv

This converts the higher-level cli_list_recv() to the new
cli_smb2_list_recv() calling convention to just issue one entry per
recv() call in preparation of using the async cli_smb2_list_send() in
cli_list_send().

For SMB1 this will be a performance degradation, as we have to make
copies out of the arrays that cli_trans_recv() returns, but soon this
will become a performance improvement for the SMB2 directory
listing. And as hopefully most deployments these days are SMB2, I
think we can live with the SMB1 client directory listing
degradation. Also, we can also convert the lowerlevel SMB1 directory
listing routines in case someone actually sees problems from this
here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make cli_smb2_list() asynchronous
Volker Lendecke [Sat, 14 Nov 2020 17:31:22 +0000 (18:31 +0100)] 
libsmb: Make cli_smb2_list() asynchronous

Return directory entries as soon as possible via
cli_smb2_list_recv(). This returns just one entry per call to
cli_smb2_list_recv() right out of the buffer without assembling
potentially thousands of entries in a big array. You must call
cli_smb2_recv() until an error (except NT_STATUS_RETRY) happens. This
reduces our latency for smbclient's "dir" command significantly for
large directories. In the future I hope I can do the same thing also for
SMBC_readdir_ctx() to improve all users of our published libsmbclient.

Initial attempts of this routine issued fresh smb2_query_directory
requests asynchronously while the receivers of the entries did their
processing, for example showing them in smbclient's "dir"
command. However, this breaks because for example the "showacls"
smbclient option needs to do synchronous smb requests to do their job,
which we can't do while async requests are pending. Thus I came up
with a semi-synchronous approach to issue additional
smb2_query_directory requests from within cli_smb2_list_recv() and
return NT_STATUS_RETRY. This means that we will call back our caller
via the tevent_req_notify function when a fresh entry is available.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agouptodateness.py: remove what appears to be debugging lines
Rowland Penny [Wed, 18 Nov 2020 12:09:16 +0000 (12:09 +0000)] 
uptodateness.py: remove what appears to be debugging lines

They do nothing except confuse users.

Signed-off-by: Rowland Penny <rpenny@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Nov 19 00:36:58 UTC 2020 on sn-devel-184

4 years agobootstrap: Add OpenSUSE 15.2
Samuel Cabrero [Tue, 17 Nov 2020 12:32:19 +0000 (13:32 +0100)] 
bootstrap: Add OpenSUSE 15.2

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Tue Nov 17 18:50:05 UTC 2020 on sn-devel-184

4 years agoautobuild: Encode text/plain into base64 to wrap long-lines
SATOH Fumiyasu [Tue, 10 Nov 2020 08:15:42 +0000 (17:15 +0900)] 
autobuild: Encode text/plain into base64 to wrap long-lines

MIMEText(text, 'plain', 'utf-8') encodes the text into
base64 and adds 'Content-Transfer-Encoding: base64' header.

Signed-off-by: SATOH Fumiyasu <fumiyas@osstech.co.jp>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Nov 16 22:43:35 UTC 2020 on sn-devel-184

4 years agolibsmb: Remove unused sync cli_smb2_rename()
Volker Lendecke [Fri, 13 Nov 2020 15:32:16 +0000 (16:32 +0100)] 
libsmb: Remove unused sync cli_smb2_rename()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Nov 16 21:18:16 UTC 2020 on sn-devel-184

4 years agolibsmb: Make cli_rename_send()/recv() smb2-capable
Volker Lendecke [Fri, 13 Nov 2020 15:29:23 +0000 (16:29 +0100)] 
libsmb: Make cli_rename_send()/recv() smb2-capable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make cli_rename_send()/_recv() a proper tevent_req engine
Volker Lendecke [Fri, 13 Nov 2020 15:23:48 +0000 (16:23 +0100)] 
libsmb: Make cli_rename_send()/_recv() a proper tevent_req engine

This will make it more obvious to add SMB2 soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make cli_smb2_rename async
Volker Lendecke [Fri, 13 Nov 2020 14:31:16 +0000 (15:31 +0100)] 
libsmb: Make cli_smb2_rename async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make get_fnum_from_path() async
Volker Lendecke [Fri, 13 Nov 2020 11:59:55 +0000 (12:59 +0100)] 
libsmb: Make get_fnum_from_path() async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Move set_acl() to python
Volker Lendecke [Thu, 12 Nov 2020 08:26:10 +0000 (09:26 +0100)] 
pylibsmb: Move set_acl() to python

The previous code was not available in threaded environments

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Add set_sd()
Volker Lendecke [Tue, 10 Nov 2020 20:25:56 +0000 (21:25 +0100)] 
pylibsmb: Add set_sd()

setacl() on a fnum, available asynchronously

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Remove unused sync cli_smb2_set_security_descriptor()
Volker Lendecke [Mon, 9 Nov 2020 20:43:19 +0000 (21:43 +0100)] 
libsmb: Remove unused sync cli_smb2_set_security_descriptor()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make cli_set_security_descriptor() async
Volker Lendecke [Tue, 10 Nov 2020 19:55:29 +0000 (20:55 +0100)] 
libsmb: Make cli_set_security_descriptor() async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture3: cli_set_security_descriptor() does smb2 as well
Volker Lendecke [Mon, 9 Nov 2020 20:40:28 +0000 (21:40 +0100)] 
torture3: cli_set_security_descriptor() does smb2 as well

Remove a direct caller

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Move get_acl() to python
Volker Lendecke [Wed, 11 Nov 2020 12:20:39 +0000 (13:20 +0100)] 
pylibsmb: Move get_acl() to python

The previous code was not available in threaded environments

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Add get_sd()
Volker Lendecke [Tue, 10 Nov 2020 20:25:56 +0000 (21:25 +0100)] 
pylibsmb: Add get_sd()

getacl() on a fnum, available asynchronously

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Remove unused sync cli_smb2_query_security_descriptor()
Volker Lendecke [Mon, 9 Nov 2020 20:43:19 +0000 (21:43 +0100)] 
libsmb: Remove unused sync cli_smb2_query_security_descriptor()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmb: Make cli_query_security_descriptor() async
Volker Lendecke [Mon, 9 Nov 2020 20:37:10 +0000 (21:37 +0100)] 
libsmb: Make cli_query_security_descriptor() async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agotorture3: cli_query_security_descriptor() does smb2 as well
Volker Lendecke [Mon, 9 Nov 2020 20:40:28 +0000 (21:40 +0100)] 
torture3: cli_query_security_descriptor() does smb2 as well

Remove a direct caller

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Export a few SMB constants
Volker Lendecke [Wed, 11 Nov 2020 10:33:18 +0000 (11:33 +0100)] 
pylibsmb: Export a few SMB constants

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Merge remove_dir() into its only caller
Volker Lendecke [Mon, 9 Nov 2020 18:48:21 +0000 (19:48 +0100)] 
pylibsmb: Merge remove_dir() into its only caller

Now that delete_tree is in python code, align py_smb_rmdir() with the
other functions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Merge unlink_file() into its only caller
Volker Lendecke [Mon, 9 Nov 2020 18:48:21 +0000 (19:48 +0100)] 
pylibsmb: Merge unlink_file() into its only caller

Now that delete_tree is in python code, align py_smb_unlink() with the
other functions.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Move deltree to python code
Volker Lendecke [Fri, 6 Nov 2020 21:08:00 +0000 (22:08 +0100)] 
pylibsmb: Move deltree to python code

This is much shorter. There's also another aspect: I'm working on
improving cli_list() to not collect all files before starting to call
the callback function. This means that the cli_list cb will be called
from within tevent_loop_once(). In pylibsmb.c's deltree code this
would create a nested event loop. By moving the deltree code into the
python world this nested event loop is avoided. Now the python code
will first collect everything and then start to delete, avoiding the
nesting. A future development should make listing directories a
generator or something like that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopylibsmb: Add a compatible python-level wrapper
Volker Lendecke [Wed, 11 Nov 2020 10:20:29 +0000 (11:20 +0100)] 
pylibsmb: Add a compatible python-level wrapper

Right now this is empty, but it is the basis for moving complexity out
or pylibsmb.c into python code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibcli: smb2: Never print length if smb2_signing_key_valid() fails for crypto blob.
Jeremy Allison [Fri, 13 Nov 2020 22:18:43 +0000 (14:18 -0800)] 
libcli: smb2: Never print length if smb2_signing_key_valid() fails for crypto blob.

Blob could be NULL.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Nov 16 09:47:38 UTC 2020 on sn-devel-184

4 years agos4-torture: test file_line_parse as well
Günther Deschner [Tue, 10 Nov 2020 16:10:27 +0000 (17:10 +0100)] 
s4-torture: test file_line_parse as well

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Nov 13 17:47:33 UTC 2020 on sn-devel-184

4 years agolib: Fix file_lines_parse() to do what people expect. Much safer to use.
Jeremy Allison [Tue, 10 Nov 2020 21:52:01 +0000 (13:52 -0800)] 
lib: Fix file_lines_parse() to do what people expect. Much safer to use.

Take an incoming const char * pointer and return an allocated
array that must be freed. Don't expose the internal optimization
of file_lines_parse_internal() breaking the passed in string
into lines.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 years agolib: create a wrapper for file_lines_parse().
Jeremy Allison [Tue, 10 Nov 2020 21:43:24 +0000 (13:43 -0800)] 
lib: create a wrapper for file_lines_parse().

Make the internal function file_lines_parse_internal().

Currently file_lines_parse() just wraps file_lines_parse_internal(),
but this allows me to change file_lines_parse() to take
a const char * to make it safe for callers (no talloc tricks).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
4 years agotests python krb5: add arcfour salt tests
Gary Lockyer [Tue, 10 Nov 2020 03:57:11 +0000 (16:57 +1300)] 
tests python krb5: add arcfour salt tests

MIT kerberos returns a salt when ARCFOUR_HMAC_MD5 encryption selected,
Heimdal does not.

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): Thu Nov 12 22:54:22 UTC 2020 on sn-devel-184

4 years agotests python krb5: refactor compatability tests
Gary Lockyer [Tue, 10 Nov 2020 03:56:46 +0000 (16:56 +1300)] 
tests python krb5: refactor compatability tests

Refactor to aid the adding of tests for the inclusion of a salt when
ARCFOUR_HMAC_MD5 encryption selected

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests python krb5: Convert kdc-heimdal to python
Gary Lockyer [Thu, 5 Nov 2020 20:07:04 +0000 (09:07 +1300)] 
tests python krb5: Convert kdc-heimdal to python

Implement the tests in source4/torture/krb5/kdc-heimdal.c in python.
The following tests were not re-implemented as they are client side
tests for the "Orpheus Lyre" attack:
       TORTURE_KRB5_TEST_CHANGE_SERVER_OUT
       TORTURE_KRB5_TEST_CHANGE_SERVER_IN
       TORTURE_KRB5_TEST_CHANGE_SERVER_BOTH

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests python krb5: raw_testcase permit RC4 salts
Gary Lockyer [Tue, 10 Nov 2020 00:51:39 +0000 (13:51 +1300)] 
tests python krb5: raw_testcase permit RC4 salts

MIT kerberos returns a salt when ARCFOUR_HMAC_MD5, this commit removes
the check that a salt is not returned.  A test for the difference
between MIT and Heimdal will be added in the subsequent commits.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests python krb5: Refactor compatability test constants
Gary Lockyer [Mon, 9 Nov 2020 22:20:58 +0000 (11:20 +1300)] 
tests python krb5: Refactor compatability test constants

Modify tests to use the constants defined in rfc4120_constants.py

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests python krb5: Refactor canonicalization test constants
Gary Lockyer [Mon, 9 Nov 2020 22:20:03 +0000 (11:20 +1300)] 
tests python krb5: Refactor canonicalization test constants

Modify tests to use the constants defined in rfc4120_constants.py

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agotests python krb5: Add constants module
Gary Lockyer [Mon, 9 Nov 2020 22:19:02 +0000 (11:19 +1300)] 
tests python krb5: Add constants module

Extract the constants used in the tests into a separate module.
To reduce code duplication

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agovfs_shadow_copy2: Preserve all open flags assuming ROFS
Anoop C S [Thu, 12 Nov 2020 14:57:24 +0000 (20:27 +0530)] 
vfs_shadow_copy2: Preserve all open flags assuming ROFS

Instead of replacing open flags with just O_RDONLY, filter out all those
flags unrelated to a Read Only File System

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

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Nov 12 17:23:19 UTC 2020 on sn-devel-184

4 years agos3:smbd: Fix possible null pointer dereference in token_contains_name()
Andreas Schneider [Wed, 11 Nov 2020 12:42:06 +0000 (13:42 +0100)] 
s3:smbd: Fix possible null pointer dereference in token_contains_name()

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Thu Nov 12 15:13:47 UTC 2020 on sn-devel-184

4 years agoauth_sam: use pdb_get_domain_info to look up DNS forest information
Alexander Bokovoy [Wed, 11 Nov 2020 12:42:55 +0000 (14:42 +0200)] 
auth_sam: use pdb_get_domain_info to look up DNS forest information

When Samba is used as a part of FreeIPA domain controller, Windows
clients for a trusted AD forest may try to authenticate (perform logon
operation) as a REALM\name user account.

Fix auth_sam plugins to accept DNS forest name if we are running on a DC
with PASSDB module providing domain information (e.g. pdb_get_domain_info()
returning non-NULL structure). Right now, only FreeIPA or Samba AD DC
PASSDB backends return this information but Samba AD DC configuration is
explicitly ignored by the two auth_sam (strict and netlogon3) modules.

Detailed logs below:

[2020/11/11 09:23:53.281296,  1, pid=42677, effective(65534, 65534), real(65534, 0), class=rpc_parse] ../../librpc/ndr/ndr.c:482(ndr_print_function_debug)
       netr_LogonSamLogonWithFlags: struct netr_LogonSamLogonWithFlags
          in: struct netr_LogonSamLogonWithFlags
              server_name              : *
                  server_name              : '\\master.ipa.test'
              computer_name            : *
                  computer_name            : 'AD1'
              credential               : *
                  credential: struct netr_Authenticator
                      cred: struct netr_Credential
                          data                     : 529f4b087c5f6546
                      timestamp                : Wed Nov 11 09:23:55 AM 2020 UTC
              return_authenticator     : *
                  return_authenticator: struct netr_Authenticator
                      cred: struct netr_Credential
                          data                     : 204f28f622010000
                      timestamp                : Fri May  2 06:37:50 AM 1986 UTC
              logon_level              : NetlogonNetworkTransitiveInformation (6)
              logon                    : *
                  logon                    : union netr_LogonLevel(case 6)
                  network                  : *
                      network: struct netr_NetworkInfo
                          identity_info: struct netr_IdentityInfo
                              domain_name: struct lsa_String
                                  length                   : 0x0010 (16)
                                  size                     : 0x01fe (510)
                                  string                   : *
                                      string                   : 'IPA.TEST'
                              parameter_control        : 0x00002ae0 (10976)
                                     0: MSV1_0_CLEARTEXT_PASSWORD_ALLOWED
                                     0: MSV1_0_UPDATE_LOGON_STATISTICS
                                     0: MSV1_0_RETURN_USER_PARAMETERS
                                     0: MSV1_0_DONT_TRY_GUEST_ACCOUNT
                                     1: MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT
                                     1: MSV1_0_RETURN_PASSWORD_EXPIRY
                                     1: MSV1_0_USE_CLIENT_CHALLENGE
                                     0: MSV1_0_TRY_GUEST_ACCOUNT_ONLY
                                     1: MSV1_0_RETURN_PROFILE_PATH
                                     0: MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY
                                     1: MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT
                                     0: MSV1_0_DISABLE_PERSONAL_FALLBACK
                                     1: MSV1_0_ALLOW_FORCE_GUEST
                                     0: MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED
                                     0: MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY
                                     0: MSV1_0_ALLOW_MSVCHAPV2
                                     0: MSV1_0_S4U2SELF
                                     0: MSV1_0_CHECK_LOGONHOURS_FOR_S4U
                                     0: MSV1_0_SUBAUTHENTICATION_DLL_EX
                              logon_id                 : 0x0000000000884ef2 (8933106)
                              account_name: struct lsa_String
                                  length                   : 0x000e (14)
                                  size                     : 0x000e (14)
                                  string                   : *
                                      string                   : 'idmuser'
                              workstation: struct lsa_String
                                  length                   : 0x0000 (0)
                                  size                     : 0x0000 (0)
                                  string                   : *
                                      string                   : ''
                         challenge                : 417207867bd33c74
                          nt: struct netr_ChallengeResponse
                              length                   : 0x00c0 (192)
                              size                     : 0x00c0 (192)
                              data                     : *
                                  data: ARRAY(192)
  [0000] A5 24 62 6E 31 DF 69 66   9E DC 54 D6 63 4C D6 2F   .$bn1.if ..T.cL./
  [0010] 01 01 00 00 00 00 00 00   50 37 D7 60 0C B8 D6 01   ........ P7.`....
  [0020] 15 1B 38 4F 47 95 4D 62   00 00 00 00 02 00 0E 00   ..8OG.Mb ........
  [0030] 57 00 49 00 4E 00 32 00   30 00 31 00 36 00 01 00   W.I.N.2. 0.1.6...
  [0040] 06 00 41 00 44 00 31 00   04 00 18 00 77 00 69 00   ..A.D.1. ....w.i.
  [0050] 6E 00 32 00 30 00 31 00   36 00 2E 00 74 00 65 00   n.2.0.1. 6...t.e.
  [0060] 73 00 74 00 03 00 20 00   61 00 64 00 31 00 2E 00   s.t... . a.d.1...
  [0070] 77 00 69 00 6E 00 32 00   30 00 31 00 36 00 2E 00   w.i.n.2. 0.1.6...
  [0080] 74 00 65 00 73 00 74 00   05 00 18 00 77 00 69 00   t.e.s.t. ....w.i.
  [0090] 6E 00 32 00 30 00 31 00   36 00 2E 00 74 00 65 00   n.2.0.1. 6...t.e.
  [00A0] 73 00 74 00 07 00 08 00   50 37 D7 60 0C B8 D6 01   s.t..... P7.`....
  [00B0] 06 00 04 00 02 00 00 00   00 00 00 00 00 00 00 00   ........ ........
                          lm: struct netr_ChallengeResponse
                              length                   : 0x0018 (24)
                              size                     : 0x0018 (24)
                              data                     : *
                                  data                     : 000000000000000000000000000000000000000000000000
              validation_level         : 0x0006 (6)
              flags                    : *
                  flags                    : 0x00000000 (0)
                         0: NETLOGON_SAMLOGON_FLAG_PASS_TO_FOREST_ROOT
                         0: NETLOGON_SAMLOGON_FLAG_PASS_CROSS_FOREST_HOP
                         0: NETLOGON_SAMLOGON_FLAG_RODC_TO_OTHER_DOMAIN
                         0: NETLOGON_SAMLOGON_FLAG_RODC_NTLM_REQUEST

In such case checks for a workgroup name will not match the DNS forest
name used in the username specification:

[2020/11/11 09:23:53.283055,  3, pid=42677, effective(65534, 65534), real(65534, 0), class=auth] ../../source3/auth/auth.c:200(auth_check_ntlm_password)
  check_ntlm_password:  Checking password for unmapped user [IPA.TEST]\[idmuser]@[] with the new password interface
[2020/11/11 09:23:53.283073,  3, pid=42677, effective(65534, 65534), real(65534, 0), class=auth] ../../source3/auth/auth.c:203(auth_check_ntlm_password)
  check_ntlm_password:  mapped user is: [IPA.TEST]\[idmuser]@[]
[2020/11/11 09:23:53.283082, 10, pid=42677, effective(65534, 65534), real(65534, 0), class=auth] ../../source3/auth/auth.c:213(auth_check_ntlm_password)
  check_ntlm_password: auth_context challenge created by fixed
[2020/11/11 09:23:53.283091, 10, pid=42677, effective(65534, 65534), real(65534, 0), class=auth] ../../source3/auth/auth.c:216(auth_check_ntlm_password)
  challenge is:
[2020/11/11 09:23:53.283099,  5, pid=42677, effective(65534, 65534), real(65534, 0)] ../../lib/util/util.c:678(dump_data)
  [0000] 41 72 07 86 7B D3 3C 74                             Ar..{.<t
[2020/11/11 09:23:53.283113, 10, pid=42677, effective(65534, 65534), real(65534, 0), class=auth] ../../source3/auth/auth_sam.c:209(auth_sam_netlogon3_auth)
  auth_sam_netlogon3_auth: Check auth for: [IPA.TEST]\[idmuser]
[2020/11/11 09:23:53.283123,  5, pid=42677, effective(65534, 65534), real(65534, 0), class=auth] ../../source3/auth/auth_sam.c:234(auth_sam_netlogon3_auth)
  auth_sam_netlogon3_auth: IPA.TEST is not our domain name (DC for IPA)
[2020/11/11 09:23:53.283131, 10, pid=42677, effective(65534, 65534), real(65534, 0), class=auth] ../../source3/auth/auth.c:249(auth_check_ntlm_password)
  auth_check_ntlm_password: sam_netlogon3 had nothing to say

and overall authentication attempt will fail: auth_winbind will complain
that this domain is not a trusted one and refuse operating on it:

[2020/11/11 09:23:53.283784, 10, pid=42663, effective(0, 0), real(0, 0), class=winbind] ../../source3/winbindd/winbindd.c:742(process_request_send)
  process_request_send: process_request: Handling async request smbd(42677):PAM_AUTH_CRAP
[2020/11/11 09:23:53.283796,  3, pid=42663, effective(0, 0), real(0, 0), class=winbind] ../../source3/winbindd/winbindd_pam_auth_crap.c:110(winbindd_pam_auth_crap_send)
  [42677]: pam auth crap domain: [IPA.TEST] user: idmuser
[2020/11/11 09:23:53.283810,  3, pid=42663, effective(0, 0), real(0, 0), class=winbind] ../../source3/winbindd/winbindd_pam.c:409(find_auth_domain)
  Authentication for domain [IPA.TEST] refused as it is not a trusted domain
[2020/11/11 09:23:53.283825, 10, pid=42663, effective(0, 0), real(0, 0), class=winbind] ../../source3/winbindd/winbindd.c:810(process_request_done)
  process_request_done: [smbd(42677):PAM_AUTH_CRAP]: NT_STATUS_NO_SUCH_USER
[2020/11/11 09:23:53.283844, 10, pid=42663, effective(0, 0), real(0, 0), class=winbind] ../../source3/winbindd/winbindd.c:855(process_request_written)
  process_request_written: [smbd(42677):PAM_AUTH_CRAP]: delivered response to client

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoselftest/subunithelper: also output as much of unterminated DETAILS
Stefan Metzmacher [Fri, 6 Nov 2020 11:35:04 +0000 (12:35 +0100)] 
selftest/subunithelper: also output as much of unterminated DETAILS

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Nov 11 22:43:46 UTC 2020 on sn-devel-184

4 years agoselftest/subunithelper: only let ']\n' lines to terminate
Stefan Metzmacher [Thu, 5 Nov 2020 13:19:11 +0000 (14:19 +0100)] 
selftest/subunithelper: only let ']\n' lines to terminate

It should not be enough that a line ends with ']\n' is accident,
subunit DETAILS are terminated with '\n]\n'!

This gives a much higher chance to see the actual problem
without having them filtered by various 'filter-subunit' invocations.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agoSambaToolCmdTest: let assertCmdSuccess() escape ']\n' lines
Stefan Metzmacher [Thu, 5 Nov 2020 12:46:27 +0000 (13:46 +0100)] 
SambaToolCmdTest: let assertCmdSuccess() escape ']\n' lines

This gives a much higher chance to see the actual problem
without having them filtered by various 'filter-subunit' invocations.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agotestprogs/blackbox: make sure subunit.sh always terminates DETAILS with '\n]\n'
Stefan Metzmacher [Fri, 6 Nov 2020 11:32:10 +0000 (12:32 +0100)] 
testprogs/blackbox: make sure subunit.sh always terminates DETAILS with '\n]\n'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
4 years agos3: modules: gluster. Fix the error I made in preventing talloc leaks from a function.
Jeremy Allison [Tue, 10 Nov 2020 18:18:18 +0000 (10:18 -0800)] 
s3: modules: gluster. Fix the error I made in preventing talloc leaks from a function.

file_lines_parse() plays horrible tricks with
the passed-in talloc pointers and the hierarcy
which makes freeing hard to get right.

As we know mem_ctx is freed by the caller, after
calling file_lines_parse don't free on exit and let the caller
handle it. This violates good Samba coding practice
but we know we're not leaking here.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Nov 11 15:02:27 UTC 2020 on sn-devel-184

4 years agolookup_name: allow lookup names prefixed with DNS forest root for FreeIPA DC
Alexander Bokovoy [Tue, 10 Nov 2020 15:35:24 +0000 (17:35 +0200)] 
lookup_name: allow lookup names prefixed with DNS forest root for FreeIPA DC

In FreeIPA deployment with active Global Catalog service, when a two-way
trust to Active Directory forest is established, Windows systems can
look up FreeIPA users and groups. When using a security tab in Windows
Explorer on AD side, a lookup over a trusted forest might come as
realm\name instead of NetBIOS domain name:

--------------------------------------------------------------------
[2020/01/13 11:12:39.859134,  1, pid=33253, effective(17324010041732401004), real(1732401004, 0), class=rpc_parse] ../../librpc/ndr/ndr.c:471(ndr_print_function_debug)
       lsa_LookupNames3: struct lsa_LookupNames3
          in: struct lsa_LookupNames3
              handle                   : *
                  handle: struct policy_handle
                      handle_type              : 0x00000000 (0)
                      uuid                     : 0000000e-0000-0000-1c5e-a750e5810000
              num_names                : 0x00000001 (1)
              names: ARRAY(1)
                  names: struct lsa_String
                      length                   : 0x001e (30)
                      size                     : 0x0020 (32)
                      string                   : *
                          string                   : 'ipa.test\admins'
              sids                     : *
                  sids: struct lsa_TransSidArray3
                      count                    : 0x00000000 (0)
                      sids                     : NULL
              level                    : LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 (6)
              count                    : *
                  count                    : 0x00000000 (0)
              lookup_options           : LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES (0)
              client_revision          : LSA_CLIENT_REVISION_2 (2)
--------------------------------------------------------------------

If we are running as a DC and PASSDB supports returning domain info
(pdb_get_domain_info() returns a valid structure), check domain of the
name in lookup_name() against DNS forest name and allow the request to
be done against the primary domain. This corresponds to FreeIPA's use of
Samba as a DC. For normal domain members a realm-based lookup falls back
to a lookup over to its own domain controller with the help of winbindd.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Wed Nov 11 10:59:01 UTC 2020 on sn-devel-184

4 years agoselftest: Windows 2019 implements the RemoveDollar behaviour for Enterprise principals
Andrew Bartlett [Tue, 10 Nov 2020 00:50:37 +0000 (13:50 +1300)] 
selftest: Windows 2019 implements the RemoveDollar behaviour for Enterprise principals

This is documented in MS-KILE.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Wed Nov 11 02:38:46 UTC 2020 on sn-devel-184

4 years agoselftest: Add in encrypted-pa-data from RFC 6806
Andrew Bartlett [Mon, 9 Nov 2020 22:27:06 +0000 (11:27 +1300)] 
selftest: Add in encrypted-pa-data from RFC 6806

This comes from Windows 2019 which supports FAST.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoselftest: Fix formatting of failure (traceback and options swapped in format string)
Andrew Bartlett [Mon, 9 Nov 2020 22:21:24 +0000 (11:21 +1300)] 
selftest: Fix formatting of failure (traceback and options swapped in format string)

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agoselftest: Make as_canonicalization_tests.py auto-detect the NT4 domain name
Andrew Bartlett [Tue, 10 Nov 2020 00:47:30 +0000 (13:47 +1300)] 
selftest: Make as_canonicalization_tests.py auto-detect the NT4 domain name

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>