samba.git
4 years agoclient: enable allinfo and altname tab completion
David Disseldorp [Mon, 7 May 2018 14:02:29 +0000 (16:02 +0200)]
client: enable allinfo and altname tab completion

Should tab-complete a single remote path.

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): Tue Jun 25 10:55:45 UTC 2019 on sn-devel-184

4 years agos3: torture: Add POSIX-ACL-OPLOCK test to check interaction of posix ACL operations...
Jeremy Allison [Wed, 19 Jun 2019 18:32:18 +0000 (11:32 -0700)]
s3: torture: Add POSIX-ACL-OPLOCK test to check interaction of posix ACL operations with an oplocked Windows handle.

(Spoiler alert, it breaks the oplock :-).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 24 20:05:34 UTC 2019 on sn-devel-184

4 years agos3: smbd: Posix ACLs. Now we know we have a handle, always use VFS_FCHMOD instead...
Jeremy Allison [Thu, 20 Jun 2019 18:43:17 +0000 (11:43 -0700)]
s3: smbd: Posix ACLs. Now we know we have a handle, always use VFS_FCHMOD instead of VFS_CHMOD.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: modules: Fruit. Now we know we have a handle, always use VFS_FCHMOD instead of...
Jeremy Allison [Thu, 20 Jun 2019 18:42:42 +0000 (11:42 -0700)]
s3: modules: Fruit. Now we know we have a handle, always use VFS_FCHMOD instead of VFS_CHMOD.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: If smbd_do_qfilepathinfo() causes an oplock or lease break, we must check...
Jeremy Allison [Wed, 19 Jun 2019 18:23:41 +0000 (11:23 -0700)]
s3: smbd: If smbd_do_qfilepathinfo() causes an oplock or lease break, we must check for deferred open here.

Note this isn't an issue in SMB2, as no SMB2 info level requests
called by smbd_do_qfilepathinfo()/smbd_do_setfilepathinfo() from
SMB2 can cause a oplock or lease break.

The SMB1 trans2.c: calling of smbd_do_setfilepathinfo()
correctly copes with this, this was just missed in the
SMB1 call of smbd_do_qfilepathinfo().

Needed for the following POSIX ACL query interacting
with Windows oplock file test to follow.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Make set_unix_posix_default_acl() take an fsp argument, not smb_fname.
Jeremy Allison [Tue, 18 Jun 2019 22:36:58 +0000 (15:36 -0700)]
s3: smbd: Make set_unix_posix_default_acl() take an fsp argument, not smb_fname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Add default ACLS can only be set on directory check to smb_set_posix_acl().
Jeremy Allison [Tue, 18 Jun 2019 22:29:25 +0000 (15:29 -0700)]
s3: smbd: Add default ACLS can only be set on directory check to smb_set_posix_acl().

This was already being checked in the lower layer,
so no change in behavior, just an efficiency and
clarity change.

Just move an extra check here so we refuse the
set if a default ACL is sent on a file object
before we go into the lower layers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Only pass fsp to remove_posix_acl(). No longer uses smb_fname.
Jeremy Allison [Tue, 18 Jun 2019 22:21:47 +0000 (15:21 -0700)]
s3: smbd: Only pass fsp to remove_posix_acl(). No longer uses smb_fname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Only pass fsp to set_unix_posix_acl(). No longer uses smb_fname.
Jeremy Allison [Tue, 18 Jun 2019 22:18:47 +0000 (15:18 -0700)]
s3: smbd: Only pass fsp to set_unix_posix_acl(). No longer uses smb_fname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Change set_unix_posix_default_acl() to return NTSTATUS.
Jeremy Allison [Tue, 18 Jun 2019 22:14:53 +0000 (15:14 -0700)]
s3: smbd: Change set_unix_posix_default_acl() to return NTSTATUS.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Cleanup - make set_unix_posix_default_acl() use modern coding standards.
Jeremy Allison [Tue, 18 Jun 2019 22:09:34 +0000 (15:09 -0700)]
s3: smbd: Cleanup - make set_unix_posix_default_acl() use modern coding standards.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Make set_unix_posix_acl() return NTSTATUS.
Jeremy Allison [Tue, 18 Jun 2019 22:03:28 +0000 (15:03 -0700)]
s3: smbd: Make set_unix_posix_acl() return NTSTATUS.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Cleanup - make remove_posix_acl() return NTSTATUS.
Jeremy Allison [Tue, 18 Jun 2019 21:55:37 +0000 (14:55 -0700)]
s3: smbd: Cleanup - make remove_posix_acl() return NTSTATUS.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Cleanup - make set_unix_posix_acl() use modern coding standards.
Jeremy Allison [Tue, 18 Jun 2019 21:48:22 +0000 (14:48 -0700)]
s3: smbd: Cleanup - make set_unix_posix_acl() use modern coding standards.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Cleanup - make remove_posix_acl() use modern coding standards.
Jeremy Allison [Tue, 18 Jun 2019 21:44:03 +0000 (14:44 -0700)]
s3: smbd: Cleanup - make remove_posix_acl() use modern coding standards.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Fix smb_query_posix_acl() to always use fsp handle.
Jeremy Allison [Tue, 18 Jun 2019 21:14:31 +0000 (14:14 -0700)]
s3: smbd: Fix smb_query_posix_acl() to always use fsp handle.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Plumb through struct smb_request *req parameter so it can be used by smb_qu...
Jeremy Allison [Tue, 18 Jun 2019 20:11:51 +0000 (13:11 -0700)]
s3: smbd: Plumb through struct smb_request *req parameter so it can be used by smb_query_posix_acl().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Fix smb_query_posix_acl() to use modern coding standards.
Jeremy Allison [Tue, 18 Jun 2019 18:24:12 +0000 (11:24 -0700)]
s3: smbd: Fix smb_query_posix_acl() to use modern coding standards.

Add wrap protection.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Factor out code into a separate function smb_query_posix_acl().
Jeremy Allison [Tue, 18 Jun 2019 17:49:34 +0000 (10:49 -0700)]
s3: smbd: Factor out code into a separate function smb_query_posix_acl().

Will clean up coding standards next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Now we always have a handle in smb_set_posix_acl(), use it instead of smb_f...
Jeremy Allison [Thu, 13 Jun 2019 23:17:49 +0000 (16:17 -0700)]
s3: smbd: Now we always have a handle in smb_set_posix_acl(), use it instead of smb_fname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Update smb_set_posix_acl() to always use an open file handle.
Jeremy Allison [Mon, 17 Jun 2019 22:34:13 +0000 (15:34 -0700)]
s3: smbd: Update smb_set_posix_acl() to always use an open file handle.

Uses get_posix_fsp() added in the previous commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Add get_posix_fsp() utility function. Not yet used.
Jeremy Allison [Mon, 17 Jun 2019 22:30:00 +0000 (15:30 -0700)]
s3: smbd: Add get_posix_fsp() utility function. Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Clarify logic with helper variables in smb_set_posix_acl()
Jeremy Allison [Thu, 13 Jun 2019 23:07:59 +0000 (16:07 -0700)]
s3: smbd: Clarify logic with helper variables in smb_set_posix_acl()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Make data offset use clearer in smb_set_posix_acl()
Jeremy Allison [Thu, 13 Jun 2019 23:06:10 +0000 (16:06 -0700)]
s3: smbd: Make data offset use clearer in smb_set_posix_acl()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Add correct wrap checks to smb_set_posix_acl().
Jeremy Allison [Fri, 21 Jun 2019 16:25:42 +0000 (09:25 -0700)]
s3: smbd: Add correct wrap checks to smb_set_posix_acl().

Use unsigned for wrap checks.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Update smb_set_posix_acl() to have only one exit path.
Jeremy Allison [Thu, 13 Jun 2019 22:45:51 +0000 (15:45 -0700)]
s3: smbd: Update smb_set_posix_acl() to have only one exit path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Update smb_set_posix_acl() argument list to prepare for handle open.
Jeremy Allison [Thu, 13 Jun 2019 22:41:56 +0000 (15:41 -0700)]
s3: smbd: Update smb_set_posix_acl() argument list to prepare for handle open.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Update smb_set_posix_acl() to modern coding standards.
Jeremy Allison [Thu, 13 Jun 2019 22:40:22 +0000 (15:40 -0700)]
s3: smbd: Update smb_set_posix_acl() to modern coding standards.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: torture: Fix a debug typo.
Jeremy Allison [Thu, 13 Jun 2019 22:27:39 +0000 (15:27 -0700)]
s3: torture: Fix a debug typo.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agos3: smbd: Ensure open for security descriptor access actually opens an fd.
Jeremy Allison [Thu, 13 Jun 2019 16:44:27 +0000 (09:44 -0700)]
s3: smbd: Ensure open for security descriptor access actually opens an fd.

Change test to check two things:
1) Open a symlink for SD read or write access should fail.
2) Request attribute open. Getsd/Setsd on this handle should
fail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
4 years agopy3: Remove duplicated PyUnicode_Check() after the py3 compat macros were removed
Andrew Bartlett [Sat, 15 Jun 2019 11:14:49 +0000 (23:14 +1200)]
py3: Remove duplicated PyUnicode_Check() after the py3 compat macros were removed

This came about because in py2 we had to check for strings and unicode.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Jun 24 18:48:53 UTC 2019 on sn-devel-184

4 years agopy3: Remove PyStr_AsUTF8AndSize() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 09:44:48 +0000 (11:44 +0200)]
py3: Remove PyStr_AsUTF8AndSize() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_AsUTF8() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 09:21:15 +0000 (11:21 +0200)]
py3: Remove PyStr_AsUTF8() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_AsString() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 09:16:25 +0000 (11:16 +0200)]
py3: Remove PyStr_AsString() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_FromFormatV() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 09:13:03 +0000 (11:13 +0200)]
py3: Remove PyStr_FromFormatV() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_FromFormat() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 09:08:55 +0000 (11:08 +0200)]
py3: Remove PyStr_FromFormat() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_FromStringAndSize() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 09:01:19 +0000 (11:01 +0200)]
py3: Remove PyStr_FromStringAndSize() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_FromString() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 08:45:52 +0000 (10:45 +0200)]
py3: Remove PyStr_FromString() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_Check() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 08:39:11 +0000 (10:39 +0200)]
py3: Remove PyStr_Check() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agopy3: Remove PyStr_Type() compatability macro
Andrew Bartlett [Fri, 7 Jun 2019 08:27:34 +0000 (10:27 +0200)]
py3: Remove PyStr_Type() compatability macro

We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
4 years agos4:ntp_signd: Use gnutls_error_to_ntstatus() in ntp_signd
Andreas Schneider [Thu, 13 Jun 2019 09:30:55 +0000 (11:30 +0200)]
s4:ntp_signd: Use gnutls_error_to_ntstatus() in ntp_signd

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jun 24 07:27:21 UTC 2019 on sn-devel-184

4 years agos4:rpc_server: Use gnutls_error_to_ntstatus() in samr_password
Andreas Schneider [Thu, 13 Jun 2019 09:32:28 +0000 (11:32 +0200)]
s4:rpc_server: Use gnutls_error_to_ntstatus() in samr_password

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:libnet: Use gnutls_error_to_ntstatus() in libnet_passwd
Andreas Schneider [Thu, 13 Jun 2019 09:28:43 +0000 (11:28 +0200)]
s3:libnet: Use gnutls_error_to_ntstatus() in libnet_passwd

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:creds: Use gnutls_error_to_ntstatus() in credentials_ntlm
Andreas Schneider [Tue, 11 Jun 2019 13:22:06 +0000 (15:22 +0200)]
auth:creds: Use gnutls_error_to_ntstatus() in credentials_ntlm

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_sign
Andreas Schneider [Tue, 11 Jun 2019 13:21:03 +0000 (15:21 +0200)]
auth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_sign

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_server
Andreas Schneider [Tue, 11 Jun 2019 13:18:26 +0000 (15:18 +0200)]
auth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_server

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_client
Andreas Schneider [Tue, 11 Jun 2019 13:16:31 +0000 (15:16 +0200)]
auth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_client

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:smb: Use gnutls_error_to_ntstatus() in smb_signing
Andreas Schneider [Tue, 11 Jun 2019 13:14:42 +0000 (15:14 +0200)]
libcli:smb: Use gnutls_error_to_ntstatus() in smb_signing

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:auth: Use gnutls_error_to_ntstatus() in credentials
Andreas Schneider [Tue, 11 Jun 2019 13:11:30 +0000 (15:11 +0200)]
libcli:auth: Use gnutls_error_to_ntstatus() in credentials

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:smbd: Use gnutls_error_to_ntstatus() in smb2_sesssetup
Andreas Schneider [Tue, 11 Jun 2019 12:44:10 +0000 (14:44 +0200)]
s3:smbd: Use gnutls_error_to_ntstatus() in smb2_sesssetup

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:smbd: Use gnutls_error_to_ntstatus() in smb2_server
Andreas Schneider [Tue, 11 Jun 2019 12:35:25 +0000 (14:35 +0200)]
s3:smbd: Use gnutls_error_to_ntstatus() in smb2_server

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:smb: Use gnutls_error_to_ntstatus() in smbXcli_base.c
Andreas Schneider [Tue, 11 Jun 2019 10:18:01 +0000 (12:18 +0200)]
libcli:smb: Use gnutls_error_to_ntstatus() in smbXcli_base.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoauth:gensec: Use gnutls_error_to_ntstatus() in schannel
Andreas Schneider [Tue, 11 Jun 2019 10:13:50 +0000 (12:13 +0200)]
auth:gensec: Use gnutls_error_to_ntstatus() in schannel

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_check_pdu()
Andreas Schneider [Tue, 11 Jun 2019 10:10:38 +0000 (12:10 +0200)]
libcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_check_pdu()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_sign_pdu()
Andreas Schneider [Tue, 11 Jun 2019 10:09:31 +0000 (12:09 +0200)]
libcli:smb: Use gnutls_error_to_ntstatus() in smb2_signing_sign_pdu()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:smb: Return NSTATUS for smb2_signing_check_pdu()
Andreas Schneider [Tue, 11 Jun 2019 10:03:33 +0000 (12:03 +0200)]
libcli:smb: Return NSTATUS for smb2_signing_check_pdu()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos4:libcli: Use gnutls_error_to_ntstatus() or singing
Andreas Schneider [Tue, 11 Jun 2019 08:26:23 +0000 (10:26 +0200)]
s4:libcli: Use gnutls_error_to_ntstatus() or singing

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolibcli:util: Add gnutls_error
Andreas Schneider [Wed, 22 May 2019 15:09:50 +0000 (17:09 +0200)]
libcli:util: Add gnutls_error

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodnsp.idl: fix payload for DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME
Stefan Metzmacher [Fri, 24 May 2019 16:36:48 +0000 (18:36 +0200)]
dnsp.idl: fix payload for DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun 21 11:02:21 UTC 2019 on sn-devel-184

4 years agodnsp.idl: fix the dnsp_dns_addr_array definition
Stefan Metzmacher [Tue, 30 Apr 2019 12:21:22 +0000 (14:21 +0200)]
dnsp.idl: fix the dnsp_dns_addr_array definition

The endian changes are needed in order to get the following result
from the blobs Windows generated (see the torture test):

  AddrArray: ARRAY(3)
      AddrArray: struct dnsp_dns_addr
          family                   : 0x0002 (2)
          port                     : 0x0035 (53)
          ipv4                     : 172.31.99.33
          ipv6                     : 0000:0000:0000:0000:0000:0000:0000:0000

[MS-DNSP] states that the port is supposed to be ignored, but it's still
good to decode it as port '53' (0x0035) instead of '13568' (0x3500).

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
4 years agodnsp.idl: fix dnsp_ip4_array definition
Stefan Metzmacher [Tue, 30 Apr 2019 08:07:51 +0000 (10:07 +0200)]
dnsp.idl: fix dnsp_ip4_array definition

In future we should use ipv4address, but that would result in a much
larger change.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
4 years agos4:torture: add local.ndr.dnsp tests
Stefan Metzmacher [Fri, 24 May 2019 15:39:17 +0000 (17:39 +0200)]
s4:torture: add local.ndr.dnsp tests

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
4 years agolib ldb key value: use TALLOC_FREE() per README.Coding
Gary Lockyer [Fri, 21 Jun 2019 02:32:08 +0000 (14:32 +1200)]
lib ldb key value: use TALLOC_FREE() per README.Coding

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
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 Jun 21 05:45:02 UTC 2019 on sn-devel-184

4 years agolib ldb key value: fix index buffering
Gary Lockyer [Wed, 6 Mar 2019 02:28:45 +0000 (15:28 +1300)]
lib ldb key value: fix index buffering

As a performance enhancement the key value layer maintains a cache of
the index records, which is written to disk as part of a prepare commit.
This patch adds an extra cache at the operation layer to ensure that the
cached indexes remain consistent in the event of an operation failing.

Add test to test for index corruption in a failed modify.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib ldb key value: Remove check_parent from ldb_kv_index_idxptr()
Gary Lockyer [Fri, 21 Jun 2019 02:52:24 +0000 (14:52 +1200)]
lib ldb key value: Remove check_parent from ldb_kv_index_idxptr()

The callers will soon have two possible parents for this pointer, so
we need to remove this check, which was added out of caution given
the rather strange pattern of putting an active memory pointer into a
TDB (as a hash map).

That is, the only callers that did call this with "true" would
have to call this with "false", so just remove the complexity.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib ldb ldb_key_value tests: Add tests for wrapped operations
Gary Lockyer [Mon, 25 Mar 2019 23:42:32 +0000 (12:42 +1300)]
lib ldb ldb_key_value tests: Add tests for wrapped operations

Add test exercising the sub/nested transactions wrapping the key value
operations.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib ldb key value: add nested transaction support.
Gary Lockyer [Wed, 6 Mar 2019 21:37:18 +0000 (10:37 +1300)]
lib ldb key value: add nested transaction support.

Use the nested transaction support added to the key value back ends to
make key value operations atomic. This will ensure that rename
operation failures, which delete the original record and add a new
record, leave the database in a consistent state.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib ldb key value backends: Add nested txn support
Gary Lockyer [Wed, 6 Mar 2019 21:18:00 +0000 (10:18 +1300)]
lib ldb key value backends: Add nested txn support

Add limited nested transaction support to the back ends to make the key value
operations atomic (for those back ends that support nested transactions).

Note: that only the lmdb backend currently supports nested transactions.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib ldb tests: remove deprecation warning from api.py
Gary Lockyer [Wed, 6 Mar 2019 02:45:54 +0000 (15:45 +1300)]
lib ldb tests: remove deprecation warning from api.py

Remove the "DeprecationWarning: Please use assertEqual instead."
warnings from api.py

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agolib ldb tests: Test nested transactions
Gary Lockyer [Wed, 6 Mar 2019 02:32:08 +0000 (15:32 +1300)]
lib ldb tests: Test nested transactions

Add a test to document that ldb does not currently support nested
transactions.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoprovision: Suggest "minimal-responses yes;" by default
Andrew Bartlett [Wed, 19 Jun 2019 17:11:41 +0000 (05:11 +1200)]
provision: Suggest "minimal-responses yes;" by default

This improves Samba AD DC performance as a DNS server dramatically, because NS records do not
need to be looked up and there is less risk the response will have to fall back
to TCP, doubling the cost again.

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

4 years agoREADME: fix samba mailman list address
Björn Jacke [Thu, 20 Jun 2019 10:27:46 +0000 (12:27 +0200)]
README: fix samba mailman list address

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: make code more pythonic
Joe Guo [Tue, 21 May 2019 01:56:12 +0000 (13:56 +1200)]
script/autobuild.py: make code more pythonic

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: avoid nested try except block
Joe Guo [Thu, 23 May 2019 02:07:49 +0000 (14:07 +1200)]
script/autobuild.py: avoid nested try except block

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: rm redundant empty str in options
Joe Guo [Thu, 23 May 2019 02:04:18 +0000 (14:04 +1200)]
script/autobuild.py: rm redundant empty str in options

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: define cwd for builder and avoid chdir
Joe Guo [Wed, 22 May 2019 11:50:01 +0000 (23:50 +1200)]
script/autobuild.py: define cwd for builder and avoid chdir

We can pass cwd in Popen, no need to chdir for each cmd.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: improve run_cmd with check_output
Joe Guo [Wed, 22 May 2019 00:15:40 +0000 (12:15 +1200)]
script/autobuild.py: improve run_cmd with check_output

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: add helper functions to simplify make test cmd
Joe Guo [Wed, 22 May 2019 11:29:56 +0000 (23:29 +1200)]
script/autobuild.py: add helper functions to simplify make test cmd

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: replace random-sleep.sh with python function
Joe Guo [Wed, 22 May 2019 10:34:57 +0000 (22:34 +1200)]
script/autobuild.py: replace random-sleep.sh with python function

The random-sleep.sh script is tricky, and there is no need to rely on another
script just for random sleep.

Using the python function, the random number generation will happen when
load autobuild.py other than execute cmd, but shouldn't affect the
result.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: rm unused mime type text/plain in tasks
Joe Guo [Wed, 22 May 2019 10:17:28 +0000 (22:17 +1200)]
script/autobuild.py: rm unused mime type text/plain in tasks

The mime type `text/plain` is repeated everywhere but not used any more.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoscript/autobuild.py: fix tasks indent
Joe Guo [Wed, 22 May 2019 10:11:28 +0000 (22:11 +1200)]
script/autobuild.py: fix tasks indent

Indent tasks at same level, make it easier to copy/move lines arround.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agogitlab-ci: Add Fedora 30
Andreas Schneider [Mon, 17 Jun 2019 11:18:36 +0000 (13:18 +0200)]
gitlab-ci: Add Fedora 30

Fedora 30 ships with gcc9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agoregfio: Return instead of assert for short blocks
Michael Hanselmann [Thu, 4 Apr 2019 00:26:13 +0000 (02:26 +0200)]
regfio: Return instead of assert for short blocks

Assertions should only be used when there's absolutely no recovery or to
verify data structure invariants. In this case the supplied registry
hive file may have a malformed block with a size of zero. Such a block
should not terminate the whole program.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
4 years agosmbd: Remove struct blocking_lock_record
Volker Lendecke [Thu, 20 Jun 2019 18:58:42 +0000 (20:58 +0200)]
smbd: Remove struct blocking_lock_record

Forgot that one in the last patches

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 Jun 20 23:39:34 UTC 2019 on sn-devel-184

4 years agovfs: Remove SMB_VFS_BRL_CANCEL_WINDOWS
Volker Lendecke [Thu, 20 Jun 2019 11:42:12 +0000 (13:42 +0200)]
vfs: Remove SMB_VFS_BRL_CANCEL_WINDOWS

This is not called anymore, bump the VFS version number in a separate
commit

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 Jun 20 18:34:20 UTC 2019 on sn-devel-184

4 years agosmbd: Remove unused brlock code
Volker Lendecke [Thu, 20 Jun 2019 09:07:17 +0000 (11:07 +0200)]
smbd: Remove unused brlock code

No PENDING locks in brlock.tdb anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Cancel smbd_smb1_do_locks requests in reply_ntcancel
Volker Lendecke [Wed, 19 Jun 2019 20:00:25 +0000 (22:00 +0200)]
smbd: Cancel smbd_smb1_do_locks requests in reply_ntcancel

Last link to the specialized brlock queue

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Add a clarifying comment on triggering waiters
Volker Lendecke [Wed, 19 Jun 2019 14:08:49 +0000 (16:08 +0200)]
smbd: Add a clarifying comment on triggering waiters

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Don't call cancel_pending_lock_requests_by_fid on close
Volker Lendecke [Wed, 19 Jun 2019 13:49:46 +0000 (15:49 +0200)]
smbd: Don't call cancel_pending_lock_requests_by_fid on close

We don't use that queue anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Base smb2_lock.c on tevent_req
Volker Lendecke [Sat, 15 Jun 2019 22:23:50 +0000 (15:23 -0700)]
smbd: Base smb2_lock.c on tevent_req

smb2 locking is a lot more regular than reply_lockingX. So this is a
much smaller change.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use smbd_smb1_do_locks_send() in smb_set_posix_lock()
Volker Lendecke [Fri, 14 Jun 2019 22:17:12 +0000 (15:17 -0700)]
smbd: Use smbd_smb1_do_locks_send() in smb_set_posix_lock()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use smbd_smb1_do_locks_send() in reply_lockingX()
Volker Lendecke [Thu, 13 Jun 2019 10:59:54 +0000 (03:59 -0700)]
smbd: Use smbd_smb1_do_locks_send() in reply_lockingX()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use smbd_smb1_do_locks_send() in reply_lock()
Volker Lendecke [Thu, 13 Jun 2019 10:56:13 +0000 (03:56 -0700)]
smbd: Use smbd_smb1_do_locks_send() in reply_lock()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Use smbd_smb1_do_locks_send() in reply_lockread()
Volker Lendecke [Thu, 13 Jun 2019 10:48:31 +0000 (03:48 -0700)]
smbd: Use smbd_smb1_do_locks_send() in reply_lockread()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Remove SMB1 special case handling from brlock.c
Volker Lendecke [Thu, 13 Jun 2019 10:46:01 +0000 (03:46 -0700)]
smbd: Remove SMB1 special case handling from brlock.c

This is now handled in smbd_smb1_do_locks_send/recv.

From here on for a few commits we won't survive make test.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Ping dbwrap_watch on locking.tdb for in smbd_do_unlocking()
Volker Lendecke [Thu, 13 Jun 2019 10:58:02 +0000 (03:58 -0700)]
smbd: Ping dbwrap_watch on locking.tdb for in smbd_do_unlocking()

smbd_smb1_do_locks_send() watches the file's locking.tdb record for
changes, like the oplock code does. Unlocking a byte range thus must
trigger a retry.

With the share mode cache get_existing_share_mode_lock() is pretty
cheap. We have to write out the share mode record with the current
code, but an obvious optimization will be a share_mode_do_locked doing
all this without actually unmarshalling the locking.tdb entry. And --
there's precedence for this pattern in downgrade_lease()...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Add smbd_smb1_do_locks_send/recv()
Volker Lendecke [Thu, 13 Jun 2019 10:38:57 +0000 (03:38 -0700)]
smbd: Add smbd_smb1_do_locks_send/recv()

This contains the SMB1-specific brlock logic. Right now our core
brlock code has specialized code to deal with pending locks. For
dealing with pending requests waiting for something nowadays we
recommend to use tevent_req. This code also provides the basis to
remove the SMB1 special case handling from the core logic, isolating
protocol features specific to SMB1 and not exposed in SMB2 in
SMB1-specific code.

The core brlock code will not see blocking locks anymore. Instead, the
code in this patch will always immediately fail and take care of the
retries and timeouts.

Retries are implemented by a dbwrap_watch_record_send on the
corresponding locking.tdb entry. A later commit will make unlocks
trigger wakeups there. I chose locking.tdb and not brlock itself to
simplify the implementation. We already have oplock break watchers on
locking.tdb, this will only add one more. This might lead to spurious
wakeups, but they are taken care of by careful retries. An advantage
of doing that is the implicit handling of a killed blocker PID through
dbwrap_watch, obsoleting brl_revalidate.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Slightly simplify smbd_smb2_lock_send()
Volker Lendecke [Mon, 27 May 2019 15:03:38 +0000 (17:03 +0200)]
smbd: Slightly simplify smbd_smb2_lock_send()

For unlocking we don't need the error mapping, do an early return

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Return "blocker_pid" from do_lock()
Volker Lendecke [Thu, 20 Jun 2019 10:20:39 +0000 (12:20 +0200)]
smbd: Return "blocker_pid" from do_lock()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: Add some paranoia against NULL dereference
Volker Lendecke [Thu, 20 Jun 2019 10:42:23 +0000 (12:42 +0200)]
smbd: Add some paranoia against NULL dereference

Quite a few callers set "psmblctx" to NULL, and I could not really
follow 100% that brl_lock only assigns that in the blocking lock
case. Too many layers :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>