]> git.ipfire.org Git - thirdparty/samba.git/log
thirdparty/samba.git
4 years agoselftest: Run some tests in the ad_dc_no_ntlm environment to show expected behaviour
Andrew Bartlett [Thu, 31 Mar 2022 08:16:03 +0000 (21:16 +1300)] 
selftest: Run some tests in the ad_dc_no_ntlm environment to show expected behaviour

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
4 years agoselftest: Rework password_lockout_base.py to allow logon_basics test to be run in...
Andrew Bartlett [Thu, 31 Mar 2022 09:45:40 +0000 (22:45 +1300)] 
selftest: Rework password_lockout_base.py to allow logon_basics test to be run in ad_dc_no_ntlm

We need to ensure that even if NTLM is disabled, that the test
can still bootstrap and fail normally.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
4 years agosamba-tool user: Consistently return a tuple
Joseph Sutton [Sun, 10 Apr 2022 23:50:53 +0000 (11:50 +1200)] 
samba-tool user: Consistently return a tuple

We would get an error when get_userPassword_hash() returned None, as
get_virtual_crypt_value() would try to unpack the result as a 2-element
tuple.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool user: Remove unused imports
Joseph Sutton [Sun, 10 Apr 2022 23:50:25 +0000 (11:50 +1200)] 
samba-tool user: Remove unused imports

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agosamba-tool tests: Remove unused variable
Joseph Sutton [Mon, 11 Apr 2022 01:15:23 +0000 (13:15 +1200)] 
samba-tool tests: Remove unused variable

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodsdb: Clarify that most errors in make_error_and_update_badPwdCount() are not returned
Andrew Bartlett [Thu, 31 Mar 2022 23:06:45 +0000 (12:06 +1300)] 
dsdb: Clarify that most errors in make_error_and_update_badPwdCount() are not returned

This is mainly just to be clear, and was done while failing to work around compiler
warnings.

For the curious it was gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (CentOS 7)
build with -O3, which gave with other, later patches:

../../source4/dsdb/samdb/ldb_modules/password_hash.c: In function ‘check_password_restrictions_and_log’:
../../source4/dsdb/samdb/ldb_modules/password_hash.c:3231:5: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
  if (ret == LDB_SUCCESS) {
     ^

Regardless, we make it clear that all values assigned to "ret" are
local small constants.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
4 years agogpo: Add Cert Auto Enroll Advanced Config
David Mulder [Tue, 12 Apr 2022 18:50:25 +0000 (12:50 -0600)] 
gpo: Add Cert Auto Enroll Advanced Config

Advanced configuration for Certifcate Auto
Enrollment is stored on the sysvol, and needs
to be parsed/used when provided.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue May  3 21:48:57 UTC 2022 on sn-devel-184

4 years agogpo: Test Cert Auto Enroll Advanced Config
David Mulder [Tue, 12 Apr 2022 18:27:41 +0000 (12:27 -0600)] 
gpo: Test Cert Auto Enroll Advanced Config

Adds advanced configuration to the testing of
certificate auto enrollment. Currently fails.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agogpo: Generalize Cert Auto Enroll CA data
David Mulder [Tue, 12 Apr 2022 16:29:39 +0000 (10:29 -0600)] 
gpo: Generalize Cert Auto Enroll CA data

This will simplify fetching CAs from the
Registry.pol in a follow up commit.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agogpo: Fix crash in Cert Auth Enroll RSOP
David Mulder [Tue, 12 Apr 2022 16:25:51 +0000 (10:25 -0600)] 
gpo: Fix crash in Cert Auth Enroll RSOP

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agogpo: Certificate Auto Enroll correctly check templates
David Mulder [Mon, 11 Apr 2022 20:26:50 +0000 (14:26 -0600)] 
gpo: Certificate Auto Enroll correctly check templates

[MS-CAESO] 4.4.5.3.2.4 and 4.4.5.3.2.4.2 explain
to fetch templates via cep, then to gather attrs
for the templates after. This code was reversed.
This will matter when implementing advanced
endpoint configuration.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agogpo: Correct CA Initilization to obey [MS-CAESO]
David Mulder [Fri, 8 Apr 2022 19:42:55 +0000 (13:42 -0600)] 
gpo: Correct CA Initilization to obey [MS-CAESO]

fetch_certification_authorities() did not
correctly obey the [MS-CAESO] spec.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoctdb-tests: Add backtrace on abort to some tests
Martin Schwenke [Mon, 28 Feb 2022 04:44:59 +0000 (15:44 +1100)] 
ctdb-tests: Add backtrace on abort to some tests

These are easier to debug with a backtrace.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue May  3 10:13:23 UTC 2022 on sn-devel-184

4 years agoctdb-tests: Provide a method to dump the stack on abort
Martin Schwenke [Wed, 5 Jan 2022 02:45:33 +0000 (13:45 +1100)] 
ctdb-tests: Provide a method to dump the stack on abort

Some tests make generous use of assert() and it can be difficult to
guess the cause of failures without resorting to GDB.  This provides
some help.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agobuild: Add missing ctdb-client dependencies
Martin Schwenke [Mon, 2 May 2022 04:25:42 +0000 (14:25 +1000)] 
build: Add missing ctdb-client dependencies

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-build: Drop unnecessary uses of include/ sub-directory
Martin Schwenke [Sun, 6 Feb 2022 22:37:14 +0000 (09:37 +1100)] 
ctdb-build: Drop unnecessary uses of include/ sub-directory

None of these include any files from the include/ sub-directory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-tests: Use test_case() to help document test cases
Martin Schwenke [Mon, 28 Feb 2022 04:44:04 +0000 (15:44 +1100)] 
ctdb-tests: Use test_case() to help document test cases

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-locking: Don't pass NULL to tevent_req_is_unix_error()
Martin Schwenke [Fri, 21 Jan 2022 01:14:05 +0000 (12:14 +1100)] 
ctdb-locking: Don't pass NULL to tevent_req_is_unix_error()

If there is an error then this pointer is unconditionally
dereferenced.

However, the only possible error appears to be ENOMEM, where a crash
caused by dereferencing a NULL pointer isn't a terrible outcome.  In
the absence of a security issue this is probably not worth
backporting.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agoctdb-mutex: Don't pass NULL to tevent_req_is_unix_error()
Martin Schwenke [Fri, 21 Jan 2022 01:09:45 +0000 (12:09 +1100)] 
ctdb-mutex: Don't pass NULL to tevent_req_is_unix_error()

If there is an error then this pointer is unconditionally
dereferenced.

However, the only possible error appears to be ENOMEM, where a crash
caused by dereferencing a NULL pointer isn't a terrible outcome.  In
the absence of a security issue this is probably not worth
backporting.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
4 years agos3:tests: Reformat test_deadtime.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat test_deadtime.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue May  3 00:10:53 UTC 2022 on sn-devel-184

4 years agos3:tests: Reformat test_close_denied_share.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat test_close_denied_share.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:tests: Reformat test_chdir_cache.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat test_chdir_cache.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:tests: Reformat test_async_req.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat test_async_req.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:tests: Reformat test_aio_outstanding.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat test_aio_outstanding.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:tests: Reformat test_acl_xattr.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat test_acl_xattr.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:tests: Reformat printing_var_exp_lpr_cmd.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat printing_var_exp_lpr_cmd.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agos3:tests: Reformat dlopen.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)] 
s3:tests: Reformat dlopen.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
4 years agodocs: Explain the impact of "ntlm auth = disabled" on simple bind forwarding
Andrew Bartlett [Tue, 12 Apr 2022 00:23:54 +0000 (12:23 +1200)] 
docs: Explain the impact of "ntlm auth = disabled" on simple bind forwarding

An RODC will forward an LDAP Simple bind, just like any other authentication,
when the password is not present locally.

If the full DC does not support NTLMv2 authentication this forwarded password
will be rejected.  A future Samba version should prefer Kerberos or send the
plaintext, but we can not change the MS Windows behaviour, so we document this.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agolibcli/smb: allow SMB2 Negotiate responses with security_offset = 0 and security_leng...
Stefan Metzmacher [Tue, 26 Apr 2022 08:38:15 +0000 (10:38 +0200)] 
libcli/smb: allow SMB2 Negotiate responses with security_offset = 0 and security_length = 0

This fixes connections against the Azure SMB3 server.

It's not possible to demonstrate the bug with a test and a knownfail
entry, because it fails to even startup the test environments,
but the following change to our server demonstrates the problem
and shows the fix works:

    diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
    index da567951c0bf..25fdaea2df7b 100644
    --- a/source3/smbd/smb2_negprot.c
    +++ b/source3/smbd/smb2_negprot.c
    @@ -711,6 +711,8 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
                    }
            }

    +       security_buffer = data_blob_null;
    +
            if (out_negotiate_context_blob.length != 0) {
                    static const uint8_t zeros[8];
                    size_t pad = 0;
    @@ -759,6 +761,8 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
                    return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
            }

    +       security_offset = 0;
    +
            SSVAL(outbody.data, 0x00, 0x40 + 1);    /* struct size */
            SSVAL(outbody.data, 0x02,
                  security_mode);                   /* security mode */

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May  2 20:13:10 UTC 2022 on sn-devel-184

4 years agolib/util: data_blob_append() should not fail if both parts have length=0
Stefan Metzmacher [Thu, 28 Apr 2022 14:08:42 +0000 (16:08 +0200)] 
lib/util: data_blob_append() should not fail if both parts have length=0

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib/util: add tests for data_blob_append() with the resulting blob length=0
Stefan Metzmacher [Thu, 28 Apr 2022 14:08:28 +0000 (16:08 +0200)] 
lib/util: add tests for data_blob_append() with the resulting blob length=0

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos4/dsdb/repl_meta_data: Receive function arguments in correct order
Joseph Sutton [Tue, 15 Feb 2022 23:10:19 +0000 (12:10 +1300)] 
s4/dsdb/repl_meta_data: Receive function arguments in correct order

The incorrect ordering was introduced in commit
b9c5417b523c4c53cb275c12ec84bbc849705bec.

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agorpc_server/lsa: Match Windows security descriptor
Joseph Sutton [Mon, 28 Mar 2022 21:03:55 +0000 (10:03 +1300)] 
rpc_server/lsa: Match Windows security descriptor

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: optimize and streamline smbd_smb2_close()
Ralph Boehme [Mon, 2 May 2022 14:29:49 +0000 (16:29 +0200)] 
smbd: optimize and streamline smbd_smb2_close()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: pass fsp as pointer-pointer to smbd_smb2_close()
Ralph Boehme [Fri, 1 Apr 2022 10:19:34 +0000 (12:19 +0200)] 
smbd: pass fsp as pointer-pointer to smbd_smb2_close()

Prepares for NULLing state->in_fsp in the next commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: add fstat_before_close fsp flag and logic
Ralph Boehme [Fri, 29 Apr 2022 16:55:31 +0000 (18:55 +0200)] 
smbd: add fstat_before_close fsp flag and logic

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Remove unused functions
Samuel Cabrero [Fri, 25 Feb 2022 13:26:07 +0000 (14:26 +0100)] 
s3:winbind: Remove unused functions

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 30 01:07:12 UTC 2022 on sn-devel-184

4 years agoexamples: Update winbind.stp and generate script
Samuel Cabrero [Fri, 25 Feb 2022 13:53:16 +0000 (14:53 +0100)] 
examples: Update winbind.stp and generate script

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Convert PAM_AUTH_CRAP from struct based to NDR based
Samuel Cabrero [Fri, 25 Feb 2022 10:32:14 +0000 (11:32 +0100)] 
s3:winbind: Convert PAM_AUTH_CRAP from struct based to NDR based

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Refactor winbindd_pam_auth_crap_{send,recv}
Samuel Cabrero [Thu, 24 Feb 2022 17:02:42 +0000 (18:02 +0100)] 
s3:winbind: Refactor winbindd_pam_auth_crap_{send,recv}

The winbindd_dual_pam_auth_crap() will be converted to a local RPC call
handler and the winbindd_response won't be filled by the child process
but in the parent's winbindd_pam_auth_crap_recv() function.

Move all code filling the winbindd_response struct to a common place,
winbindd_pam_auth_crap_recv().

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Refactor winbindd_pam_auth_crap_{send,recv}
Samuel Cabrero [Fri, 18 Feb 2022 14:29:13 +0000 (15:29 +0100)] 
s3:winbind: Refactor winbindd_pam_auth_crap_{send,recv}

Move the code filling the winbindd_response to a common place,
winbindd_pam_auth_crap_recv().

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Use temp memory context in winbindd_pam_auth_pac_verify()
Samuel Cabrero [Fri, 25 Feb 2022 11:11:36 +0000 (12:11 +0100)] 
s3:winbind: Use temp memory context in winbindd_pam_auth_pac_verify()

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:rpc_client: Fix memory allocation hierarchy
Samuel Cabrero [Fri, 25 Feb 2022 12:36:31 +0000 (13:36 +0100)] 
s3:rpc_client: Fix memory allocation hierarchy

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Move big NTLMv2 blob checks to parent process
Samuel Cabrero [Thu, 24 Feb 2022 16:48:27 +0000 (17:48 +0100)] 
s3:winbind: Move big NTLMv2 blob checks to parent process

The winbindd_dual_pam_auth_crap() function will be converted to a local
RPC call handler and it won't receive a winbindd_cli_state struct. Move
the checks accessing this struct to the parent.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Use uint8_t for authoritative flag
Samuel Cabrero [Mon, 18 Apr 2022 14:44:23 +0000 (16:44 +0200)] 
s3:winbind: Use uint8_t for authoritative flag

It is the type used in the winbindd_response struct.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Remove unnecessary jump to label
Samuel Cabrero [Tue, 15 Jun 2021 12:18:22 +0000 (14:18 +0200)] 
s3:winbind: Remove unnecessary jump to label

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Remove unnecesary condition to reduce indentation level
Samuel Cabrero [Tue, 15 Jun 2021 12:16:25 +0000 (14:16 +0200)] 
s3:winbind: Remove unnecesary condition to reduce indentation level

Best viewed with git show --ignore-space-change.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:winbind: Pass the challenge to winbind_dual_SamLogon() as a data blob
Samuel Cabrero [Tue, 15 Jun 2021 12:06:27 +0000 (14:06 +0200)] 
s3:winbind: Pass the challenge to winbind_dual_SamLogon() as a data blob

Next commits will covert the winbindd_dual_pam_auth_crap() function to a
local RPC call handler receiving the challenge as a DATA_BLOB in the 'r'
struct.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3: smbd: Allow a durable handle on a leased stat-open.
Jeremy Allison [Wed, 27 Apr 2022 21:08:13 +0000 (14:08 -0700)] 
s3: smbd: Allow a durable handle on a leased stat-open.

Remove knownfail.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Apr 29 15:50:21 UTC 2022 on sn-devel-184

4 years agos4: torture: Add a new test - samba3.smb2.durable-open.stat-open.
Jeremy Allison [Wed, 27 Apr 2022 19:50:59 +0000 (12:50 -0700)] 
s4: torture: Add a new test - samba3.smb2.durable-open.stat-open.

Passes against Windows. Shows that Windows allows a durable handle
on a leased open for READ_ATTRUBUTES only (a stat open).

Mark as knownfail for now.

NB. Not sure why we are testing smb2.durable-open against ad_dc
as that provisioning has "smb2 leases = no" which precludes
granting durable handles. Not changing for this bug but this
should be looked at in future.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoscript/autobuild.py: allow to run from within git rebase -i
Stefan Metzmacher [Tue, 12 Apr 2022 15:04:53 +0000 (15:04 +0000)] 
script/autobuild.py: allow to run from within git rebase -i

The 'git clone' used by autobuild.py fails if
GIT_DIR and GIT_WORK_TREE are already defined in the
environment.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Apr 28 15:23:24 UTC 2022 on sn-devel-184

4 years agosmbd: Use filename_convert_dirfsp() in smbd_smb2_create_send()
Volker Lendecke [Fri, 8 Apr 2022 11:27:39 +0000 (13:27 +0200)] 
smbd: Use filename_convert_dirfsp() in smbd_smb2_create_send()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Apr 28 14:02:53 UTC 2022 on sn-devel-184

4 years agosmbd: Use filename_convert_dirfsp() in reply_ntcreate_and_X()
Volker Lendecke [Fri, 8 Apr 2022 11:27:20 +0000 (13:27 +0200)] 
smbd: Use filename_convert_dirfsp() in reply_ntcreate_and_X()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Add filename_convert_dirfsp()
Volker Lendecke [Wed, 8 Dec 2021 06:08:10 +0000 (07:08 +0100)] 
smbd: Add filename_convert_dirfsp()

As part of the filename_convert() process, keep a pathref dirfsp of
the containing directory for later use. This avoids having to do
another non_widelink_open() on every SMB2_CREATE and ntcreate&x in
later patches.

Future work will be to go through other filename_convert() calls and
make them use filename_convert_dirfsp(). If we manage to convert all
of them except the one in filename_convert_dirfsp() itself, we can
simplify filename_convert() and unix_convert() significantly.

Too large a patch, but I don't know how to split this up into smaller
logic pieces.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Only create an artificial dirfsp when necessary
Volker Lendecke [Fri, 8 Apr 2022 11:10:15 +0000 (13:10 +0200)] 
smbd: Only create an artificial dirfsp when necessary

parent_pathref() is expensive, and we should avoid it if possible.

Not effective at this point, we always pass in NULL, but will be used
soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Pass dirfsp to create_file_unixpath()
Volker Lendecke [Thu, 7 Apr 2022 09:50:52 +0000 (11:50 +0200)] 
smbd: Pass dirfsp to create_file_unixpath()

Will be used soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoCI: use native Python functions to detect system and release
Ralph Boehme [Wed, 2 Mar 2022 15:10:28 +0000 (16:10 +0100)] 
CI: use native Python functions to detect system and release

This ensures we detect the runtime system and release, not the ones
when Samba was build. It's necessary to detect the correct kernel
version we're running on because for kernels before 5.3.1 O_PATH opens
unnecessarily broke kernel oplocks, which breaks our tests. And in
gitlab it can happen that we build on kernels after 5.3.1 and later
run on older kernels. In this situation we can't run kernel oplock
tests.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoRevert "vfs: remove dirfsp arg from SMB_VFS_CREATE_FILE()"
Volker Lendecke [Tue, 23 Nov 2021 11:29:17 +0000 (12:29 +0100)] 
Revert "vfs: remove dirfsp arg from SMB_VFS_CREATE_FILE()"

This reverts commit 322574834f1e71bc01f21be9059ca4d386517c84.

Not strictly a revert anymore, but for future work we do need "dirfsp"
in create_file_default() passed through the VFS.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Remove name-based SMB_VFS_GET_REAL_FILENAME()
Volker Lendecke [Wed, 16 Mar 2022 09:14:14 +0000 (10:14 +0100)] 
vfs: Remove name-based SMB_VFS_GET_REAL_FILENAME()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Use SMB_VFS_GET_REAL_FILENAME_AT() in dptr_ReadDirName()
Volker Lendecke [Tue, 15 Mar 2022 11:45:48 +0000 (12:45 +0100)] 
smbd: Use SMB_VFS_GET_REAL_FILENAME_AT() in dptr_ReadDirName()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Implement snapper_gmt_get_real_filename_at()
Volker Lendecke [Wed, 16 Mar 2022 09:01:40 +0000 (10:01 +0100)] 
vfs: Implement snapper_gmt_get_real_filename_at()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Implement shadow_copy2_get_real_filename_at()
Volker Lendecke [Wed, 16 Mar 2022 07:57:16 +0000 (08:57 +0100)] 
vfs: Implement shadow_copy2_get_real_filename_at()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Implement vfs_gpfs_get_real_filename_at()
Volker Lendecke [Tue, 15 Mar 2022 11:40:14 +0000 (12:40 +0100)] 
vfs: Implement vfs_gpfs_get_real_filename_at()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Implement vfs_gluster_get_real_filename_at()
Volker Lendecke [Tue, 15 Mar 2022 11:39:14 +0000 (12:39 +0100)] 
vfs: Implement vfs_gluster_get_real_filename_at()

gluster seems not to implement O_PATH, so it should be possible to do
a glfs_fgetxattr() on the pathref dirfsp.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Implement vfs_gluster_fuse_get_real_filename_at()
Volker Lendecke [Tue, 15 Mar 2022 11:13:23 +0000 (12:13 +0100)] 
vfs: Implement vfs_gluster_fuse_get_real_filename_at()

Needs testing in a real gluster environment

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Implement ceph_snap_gmt_get_real_filename_at()
Volker Lendecke [Tue, 15 Mar 2022 11:06:08 +0000 (12:06 +0100)] 
vfs: Implement ceph_snap_gmt_get_real_filename_at()

Copy the logic from ceph_snap_gmt_get_real_filename(). This is
untested in autobuild, but as ceph is broken anyway due to
812cb602e3be, we need to talk to the ceph developers before 4.17.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Add get_real_filename_at()
Volker Lendecke [Sun, 13 Mar 2022 15:31:20 +0000 (16:31 +0100)] 
smbd: Add get_real_filename_at()

Make get_real_filename() a wrapper.

Right now shadow_copy2 does a fallback to do get_real_filename() on
the twrp=0 tree in case of snapdirseverywhere because snapdirs can be
somewhere deep in the tree, and doing that correctly would be a
full-tree walk. I'd say that snapdirseverywhere is impossible to
implement if you want symlink safety, i.e. careful top-down tree
traversal together with snapdirseverywhere. If you have
snapdirseverywhere you need to pass down the full path very deep down,
which contradicts our fd-based approach we want to take.

Also, I believe that our test does not 100% correctly reflect what
actually is there: My understanding is that if you activate
snapdirseverywhere for example in GPFS, you see all snapshots at every
level (this would need to be verified). Our test does something more
nasty: It creates and tests a specific snapshot only at one place deep
in the directory hierarchy, which makes it impossible to find without
the full path.

This is all a big mess, but for now we need to deal with it. This adds
the twrp=0 fallback to core smbd, but I don't see any other way to do
that properly. And I do want a fd-based getrealfilename....

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Introduce get_real_filename_full_scan_at()
Volker Lendecke [Sun, 13 Mar 2022 14:55:25 +0000 (15:55 +0100)] 
smbd: Introduce get_real_filename_full_scan_at()

Make get_real_filename_full_scan() a wrapper.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Add OpenDir_from_pathref
Volker Lendecke [Sun, 13 Mar 2022 14:42:31 +0000 (15:42 +0100)] 
smbd: Add OpenDir_from_pathref

Like OpenDir() starting from a directory pathref fsp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Add openat_internal_dir_from_pathref()
Volker Lendecke [Sun, 13 Mar 2022 09:48:12 +0000 (10:48 +0100)] 
smbd: Add openat_internal_dir_from_pathref()

If we have a directory pathref fsp, do an openat(dirfd, ".", O_RDONLY)
to cheaply get a real directory handle.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs: Add SMB_VFS_GET_REAL_FILENAME_AT
Volker Lendecke [Sun, 13 Mar 2022 11:15:59 +0000 (12:15 +0100)] 
vfs: Add SMB_VFS_GET_REAL_FILENAME_AT

In a patchset that I'm working on right now there's the need to call
getrealfilename while the code does have a pathref fsp already
around. Doing the name-based call including non_widelink_open is not
necessary in this case. Start by adding the _at based call to the VFS.

For now, fall back to the name-based call. glusterfs-fuse will in a
future patch be converted to fgetxattr.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agosmbd: Pass up stat-info from openat_pathref_fsp() on error
Volker Lendecke [Mon, 14 Mar 2022 21:52:11 +0000 (22:52 +0100)] 
smbd: Pass up stat-info from openat_pathref_fsp() on error

If openat_pathref_fsp() fails, callers might want to inspect the stat
info. If we really failed on STOPPED_ON_SYMLINK, the caller might need
to know this, although openat_pathref_fsp() masked this error.

As there is no smb_fname->fsp returned from openat_pathref_fsp() on
error, we need to pass this up in smb_fname itself.

This essentially reverts de439cd03047, which does basically the same
thing but is too specific. We need to cover the general !O_PATH case
more broadly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agovfs_gpfs: Ignore pathref fds for gpfs:recalls check
Christof Schmitt [Wed, 27 Apr 2022 22:37:18 +0000 (15:37 -0700)] 
vfs_gpfs: Ignore pathref fds for gpfs:recalls check

Setting gpfs:recalls=no should prevent data access to offline files.
Since Samba 4.14, the VFS openat function is also called with O_PATH to
get a reference to the path. These accesses should not be blocked,
otherwise this would prevent offline files from being included in
directory listings.

Fix this by skipping the check for pathref fds.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Apr 28 07:59:47 UTC 2022 on sn-devel-184

4 years agosmbd: Slightly simplify call_trans2qpipeinfo()
Volker Lendecke [Thu, 21 Apr 2022 13:48:09 +0000 (15:48 +0200)] 
smbd: Slightly simplify call_trans2qpipeinfo()

Pass down "fsp" and "info_level", no need to parse this inside
call_trans2qpipeinfo() when the caller also has to do it.

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): Tue Apr 26 22:38:59 UTC 2022 on sn-devel-184

4 years agosmbd: Remove unused arguments from dup_file_fsp()
Volker Lendecke [Sat, 23 Apr 2022 12:01:33 +0000 (14:01 +0200)] 
smbd: Remove unused arguments from dup_file_fsp()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agosmbd: fd_handle.h does not need includes.h
Volker Lendecke [Thu, 21 Apr 2022 10:20:20 +0000 (12:20 +0200)] 
smbd: fd_handle.h does not need includes.h

Move includes.h for struct files_struct to fd_handle.c. Both
printing.c and smb1_utils.c depended on fd_handle.h to include the
prototypes. Do that explicitly in those files.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoldb: Avoid an "else"
Volker Lendecke [Wed, 20 Apr 2022 05:53:38 +0000 (07:53 +0200)] 
ldb: Avoid an "else"

We return in the if-branch, easier to read this way.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove smb_threads from includes.h
Volker Lendecke [Tue, 19 Apr 2022 19:24:36 +0000 (21:24 +0200)] 
lib: Remove smb_threads from includes.h

Only used in libsmb_context.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove an unneeded includes.h
Volker Lendecke [Tue, 19 Apr 2022 19:30:08 +0000 (21:30 +0200)] 
lib: Remove an unneeded includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove an unneeded includes.h
Volker Lendecke [Tue, 19 Apr 2022 19:21:57 +0000 (21:21 +0200)] 
lib: Remove an unneeded includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove an unneeded includes.h
Volker Lendecke [Tue, 19 Apr 2022 19:17:17 +0000 (21:17 +0200)] 
lib: Remove an unneeded includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove an unneeded includes.h
Volker Lendecke [Tue, 19 Apr 2022 19:07:30 +0000 (21:07 +0200)] 
lib: Remove an unneeded includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolib: Remove an unused includes.h
Volker Lendecke [Tue, 19 Apr 2022 18:55:03 +0000 (20:55 +0200)] 
lib: Remove an unused includes.h

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopassdb: Introduce helper variables in make_pdb_method_name()
Volker Lendecke [Sat, 9 Apr 2022 06:59:43 +0000 (08:59 +0200)] 
passdb: Introduce helper variables in make_pdb_method_name()

Easier debugging

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopassdb: Split lines in make_pdb_method_name()
Volker Lendecke [Sat, 9 Apr 2022 07:18:52 +0000 (09:18 +0200)] 
passdb: Split lines in make_pdb_method_name()

Looks nicer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoldb: Introduce "colon" variable in ldb_module_connect_backend()
Volker Lendecke [Sat, 9 Apr 2022 06:15:54 +0000 (08:15 +0200)] 
ldb: Introduce "colon" variable in ldb_module_connect_backend()

Easier debugging, avoid a second call to strchr()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoldb: Save a few lines with TALLOC_FREE()
Volker Lendecke [Sat, 9 Apr 2022 07:32:58 +0000 (09:32 +0200)] 
ldb: Save a few lines with TALLOC_FREE()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoldb: Avoid "==true/false" in a boolean expression
Volker Lendecke [Sun, 10 Apr 2022 16:22:55 +0000 (18:22 +0200)] 
ldb: Avoid "==true/false" in a boolean expression

That's what we have boolean variables and expressions for

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agoldap_server: Fix typos
Volker Lendecke [Sun, 10 Apr 2022 17:20:53 +0000 (19:20 +0200)] 
ldap_server: Fix typos

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agopassdb: Fix a typo
Volker Lendecke [Sun, 10 Apr 2022 18:08:49 +0000 (20:08 +0200)] 
passdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agodsdb: Fix a typo
Volker Lendecke [Sun, 10 Apr 2022 18:14:38 +0000 (20:14 +0200)] 
dsdb: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agovfs: Remove unused last_lock_failure from files_struct
Volker Lendecke [Sun, 17 Apr 2022 11:08:39 +0000 (13:08 +0200)] 
vfs: Remove unused last_lock_failure from files_struct

Save 72 bytes per open file handle

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:passdb: Also allow to handle UPNs in lookup_name_smbconf()
Andreas Schneider [Tue, 26 Apr 2022 05:39:12 +0000 (07:39 +0200)] 
s3:passdb: Also allow to handle UPNs in lookup_name_smbconf()

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 26 20:16:33 UTC 2022 on sn-devel-184

4 years agos3:passdb: Refactor lookup_name_smbconf()
Andreas Schneider [Tue, 26 Apr 2022 05:24:10 +0000 (07:24 +0200)] 
s3:passdb: Refactor lookup_name_smbconf()

This will be changed to support UPNs too in the next patch.

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:passdb: Use already defined pointer in lookup_name_smbconf()
Andreas Schneider [Tue, 26 Apr 2022 10:26:25 +0000 (12:26 +0200)] 
s3:passdb: Use already defined pointer in lookup_name_smbconf()

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:passdb: Add support to handle UPNs in lookup_name()
Andreas Schneider [Tue, 26 Apr 2022 05:12:02 +0000 (07:12 +0200)] 
s3:passdb: Add support to handle UPNs in lookup_name()

This address an issue if sssd is running and handling nsswitch. If we look up
a user with getpwnam("DOMAIN\user") it will return user@REALM in the passwd
structure. We need to be able to deal with that.

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agos3:passdb: Remove trailing spaces in lookup_sid.c
Andreas Schneider [Tue, 26 Apr 2022 05:10:56 +0000 (07:10 +0200)] 
s3:passdb: Remove trailing spaces in lookup_sid.c

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

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
4 years agolibsmbconf: Avoid initial declaration inside 'for' loop
Anoop C S [Mon, 25 Apr 2022 06:54:28 +0000 (12:24 +0530)] 
libsmbconf: Avoid initial declaration inside 'for' loop

Building Samba on CentOS 7 with GCC version 4.8.5 results in the
following error:

[2725/3398] Compiling libcli/echo/tests/echo.c
../../lib/smbconf/pysmbconf.c: In function 'py_from_smbconf_service':
../../lib/smbconf/pysmbconf.c:72:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < svc->num_params; i++) {
  ^
../../lib/smbconf/pysmbconf.c:72:2: note: use option -std=c99 or
                                         -std=gnu99 to compile your code
../../lib/smbconf/pysmbconf.c: In function 'obj_share_names':
../../lib/smbconf/pysmbconf.c:181:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < num_shares; i++) {
  ^
../../lib/smbconf/pysmbconf.c: In function 'obj_get_config':
../../lib/smbconf/pysmbconf.c:267:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < num_shares; i++) {
  ^

Therefore declare variables right at the start aligning to default C90
standard available with GCC version on CentOS 7.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Apr 25 13:23:18 UTC 2022 on sn-devel-184

4 years agopython/samba/tests: add SMBConfTests suite
John Mulligan [Fri, 1 Apr 2022 17:51:40 +0000 (13:51 -0400)] 
python/samba/tests: add SMBConfTests suite

Add an initial suite of tests for the smbconf python bindings.
Currently only simple read-only methods are available.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Apr 21 15:33:38 UTC 2022 on sn-devel-184

4 years agolib/smbconf: add an initial set of python bindings
John Mulligan [Thu, 31 Mar 2022 20:54:49 +0000 (16:54 -0400)] 
lib/smbconf: add an initial set of python bindings

The smbconf library provides a generic interface for Samba configuration
backends. In order to access these backends, including the read-write
registry backend, we add a new python binding for smbconf - the general
interface library.

This initial set of bindings covers some basic read-only calls.  This
includes function calls for listing shares (config sections) and getting
the parameters of the shares. The `init_txt` construction function must
be used to get a new SMBConf object.  This is done so that other
backends, specifically the registry backend from source3 can be used in
the future. Those will provide their own construction funcs.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Guenther Deschner <gd@samba.org>