samba.git
2 years agocompression: Move maximum length calculation out of inner loop
Joseph Sutton [Mon, 7 Mar 2022 23:27:10 +0000 (12:27 +1300)]
compression: Move maximum length calculation out of inner loop

This makes the code clearer.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Use correct values for max len and offset
Joseph Sutton [Mon, 7 Mar 2022 23:25:59 +0000 (12:25 +1300)]
compression: Use correct values for max len and offset

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Replace divisions with shifts
Joseph Sutton [Mon, 7 Mar 2022 23:21:02 +0000 (12:21 +1300)]
compression: Replace divisions with shifts

This is more consistent with the compression code.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Remove unneeded loop variable
Joseph Sutton [Mon, 7 Mar 2022 23:19:45 +0000 (12:19 +1300)]
compression: Remove unneeded loop variable

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression: Reduce scope of variables
Joseph Sutton [Mon, 7 Mar 2022 23:17:15 +0000 (12:17 +1300)]
compression: Reduce scope of variables

This makes the code clearer.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression: Use PUSH_LE_U32 for first output buffer write
Joseph Sutton [Mon, 7 Mar 2022 23:13:12 +0000 (12:13 +1300)]
compression: Use PUSH_LE_U32 for first output buffer write

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression: Add bounds check for first output buffer write
Joseph Sutton [Mon, 7 Mar 2022 23:11:51 +0000 (12:11 +1300)]
compression: Add bounds check for first output buffer write

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Remove helper variables str1 and str2
Joseph Sutton [Mon, 7 Mar 2022 23:10:01 +0000 (12:10 +1300)]
compression: Remove helper variables str1 and str2

This simplifies the code and makes it clearer.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Fix writing output flags
Joseph Sutton [Mon, 7 Mar 2022 23:02:13 +0000 (12:02 +1300)]
compression: Fix writing output flags

If indic_bit == 0, the shift amount of 32 - indic_bit == 32 will equal
the width of a 32-bit integer type, and these shifts will invoke
undefined behaviour, which is likely to cause incorrect output. Fix this
by not shifting a 32-bit integer type by 32 bits or more.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Remove byte_left variable
Joseph Sutton [Mon, 7 Mar 2022 07:33:45 +0000 (20:33 +1300)]
compression: Remove byte_left variable

We can simplify this code using the identity:
  byte_left + uncompressed_pos = uncompressed_size

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Remove redundant bounds check
Joseph Sutton [Mon, 7 Mar 2022 07:31:33 +0000 (20:31 +1300)]
compression: Remove redundant bounds check

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Add range check for indic_pos
Joseph Sutton [Mon, 7 Mar 2022 07:30:42 +0000 (20:30 +1300)]
compression: Add range check for indic_pos

This now matches the other use of indic_pos.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Remove redundant nibble_index check
Joseph Sutton [Mon, 7 Mar 2022 07:28:05 +0000 (20:28 +1300)]
compression: Remove redundant nibble_index check

If nibble_index is non-zero, we have already written to it, and so don't
need to check again that it is in bounds.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Make use of PUSH_LE_Uxx macros
Joseph Sutton [Mon, 7 Mar 2022 07:24:48 +0000 (20:24 +1300)]
compression: Make use of PUSH_LE_Uxx macros

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression: Simplify code by making indic_pos an index
Joseph Sutton [Mon, 7 Mar 2022 07:21:32 +0000 (20:21 +1300)]
compression: Simplify code by making indic_pos an index

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Make use of CHECK_{IN,OUT}PUT_BYTES macros
Joseph Sutton [Mon, 7 Mar 2022 06:38:08 +0000 (19:38 +1300)]
compression: Make use of CHECK_{IN,OUT}PUT_BYTES macros

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Simplify code by removing metadata_size variable
Joseph Sutton [Mon, 7 Mar 2022 07:12:46 +0000 (20:12 +1300)]
compression: Simplify code by removing metadata_size variable

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Use correct value for indic_pos
Joseph Sutton [Mon, 7 Mar 2022 07:09:40 +0000 (20:09 +1300)]
compression: Use correct value for indic_pos

Previously, we were setting this to the wrong value and overwriting
existing output data.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Use correct value for nibble_index
Joseph Sutton [Mon, 7 Mar 2022 07:09:40 +0000 (20:09 +1300)]
compression: Use correct value for nibble_index

Previously, we were setting this to the wrong value and overwriting
existing output data.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Simplify redundant branches
Joseph Sutton [Mon, 7 Mar 2022 06:58:51 +0000 (19:58 +1300)]
compression: Simplify redundant branches

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: Consistently use PUSH_LE_Uxx macros
Joseph Sutton [Mon, 7 Mar 2022 06:34:00 +0000 (19:34 +1300)]
compression: Consistently use PUSH_LE_Uxx macros

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression: Use explicit data sizes
Joseph Sutton [Mon, 7 Mar 2022 06:30:43 +0000 (19:30 +1300)]
compression: Use explicit data sizes

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression tests: Add additional compression tests
Joseph Sutton [Mon, 7 Mar 2022 21:38:09 +0000 (10:38 +1300)]
compression tests: Add additional compression tests

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression: fix lzxpress-compress
Matt Suiche [Tue, 23 Mar 2021 16:33:34 +0000 (20:33 +0400)]
compression: fix lzxpress-compress

Signed-off-by: Matt Suiche <msuiche@comae.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: lzxpress_compress: fix no-op shift of 0
Matt Suiche [Mon, 14 Jun 2021 23:14:51 +0000 (11:14 +1200)]
compression: lzxpress_compress: fix no-op shift of 0

Signed-off-by: Matt Suiche <msuiche@comae.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression: fix lzxpress_decompress
Matt Suiche [Mon, 14 Jun 2021 23:52:37 +0000 (11:52 +1200)]
compression: fix lzxpress_decompress

Signed-off-by: Matt Suiche <msuiche@comae.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agocompression tests: add test for legacy compressed data
Matt Suiche [Thu, 25 Mar 2021 12:50:42 +0000 (16:50 +0400)]
compression tests: add test for legacy compressed data

Signed-off-by: Matt Suiche <msuiche@comae.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agocompression tests: add LZXpress tests based on [MS-XCA]
Matt Suiche [Mon, 14 Jun 2021 22:45:19 +0000 (10:45 +1200)]
compression tests: add LZXpress tests based on [MS-XCA]

MS-XCA contains examples, and we should at least get those right.

Signed-off-by: Matt Suiche <msuiche@comae.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoutil/base64: decode_data_blob_talloc catches talloc error
Douglas Bagnall [Tue, 6 Apr 2021 18:53:16 +0000 (06:53 +1200)]
util/base64: decode_data_blob_talloc catches talloc error

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3: libsmbclient: Cope with SMB2 servers that return STATUS_USER_SESSION_DELETED...
Jeremy Allison [Wed, 11 Dec 2019 23:06:40 +0000 (15:06 -0800)]
s3: libsmbclient: Cope with SMB2 servers that return STATUS_USER_SESSION_DELETED on a SMB2_ECHO (SMB2_OP_KEEPALIVE) call with a NULL session.

This is already tested by smb2.session.expire which
shows that Windows and Samba servers don't need this,
but some third party server are returning STATUS_USER_SESSION_DELETED
with a NULL sessionid.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Wed May 11 18:06:42 UTC 2022 on sn-devel-184

2 years agogitignore: Add .ropeproject for pylsp-rope plugin
Andreas Schneider [Tue, 10 May 2022 06:38:33 +0000 (08:38 +0200)]
gitignore: Add .ropeproject for pylsp-rope plugin

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): Wed May 11 00:04:55 UTC 2022 on sn-devel-184

2 years agotests/user_check_password_script: Don't try to delete user after failed add
Joseph Sutton [Tue, 10 May 2022 04:18:14 +0000 (16:18 +1200)]
tests/user_check_password_script: Don't try to delete user after failed add

The user account should not exist if account creation failed.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/user_check_password_script: Remove unused imports
Joseph Sutton [Tue, 10 May 2022 20:47:40 +0000 (08:47 +1200)]
tests/user_check_password_script: Remove unused imports

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamdb: Avoid half-created accounts
Joseph Sutton [Tue, 10 May 2022 01:02:30 +0000 (13:02 +1200)]
samdb: Avoid half-created accounts

If newuser() or newcomputer() create an account over LDAP, and an
attempt to modify it (e.g. to change the password) fails, ensure that we
properly clean up the account. If we are connected over LDAP, we won't
have transactions to clean things up for us.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/samba-tool user: Add test for adding a user over LDAP
Joseph Sutton [Tue, 10 May 2022 01:01:43 +0000 (13:01 +1200)]
tests/samba-tool user: Add test for adding a user over LDAP

Ensure that we do not end up with half-created accounts.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/samba-tool user_wdigest: Check command results
Joseph Sutton [Tue, 10 May 2022 00:59:59 +0000 (12:59 +1200)]
tests/samba-tool user_wdigest: Check command results

Ensure that the commands to create and delete the user execute
successfully.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/samba-tool user_wdigest: Add accounts to local database
Joseph Sutton [Tue, 10 May 2022 00:59:06 +0000 (12:59 +1200)]
tests/samba-tool user_wdigest: Add accounts to local database

Adding accounts over LDAP means transactions cannot be used, potentially
leading to problems.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/samba-tool user_wdigest: Fix flapping test
Joseph Sutton [Tue, 10 May 2022 00:49:50 +0000 (12:49 +1200)]
tests/samba-tool user_wdigest: Fix flapping test

The randomly-generated password for the user account may be too weak,
causing account creation to fail. This leads to further problems, as the
result of the command is not checked, and connecting over LDAP means
transactions cannot be used, leading to a half-created account and
failing tests.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotests/samba-tool user_wdigest: Remove unused imports
Joseph Sutton [Tue, 10 May 2022 20:45:24 +0000 (08:45 +1200)]
tests/samba-tool user_wdigest: Remove unused imports

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agobootstrap: matplotlib is not a real Samba dep
Andrew Bartlett [Thu, 5 May 2022 03:44:05 +0000 (15:44 +1200)]
bootstrap: matplotlib is not a real Samba dep

This came in via the original list of packages used
at Catalyst when building Samba for testing, in particular
related to an example LDB module to trace LDB requests.

There is no testing need for this even in make test.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agobootstrap: chown the whole cloned repo, not just the subfolders
Andrew Bartlett [Fri, 6 May 2022 01:29:05 +0000 (13:29 +1200)]
bootstrap: chown the whole cloned repo, not just the subfolders

Modern git versions have started to notice the possible security issue.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years ago.gitlab-ci: Work around new git restrictions arising from CVE-2022-24765
Andrew Bartlett [Fri, 6 May 2022 05:53:29 +0000 (17:53 +1200)]
.gitlab-ci: Work around new git restrictions arising from CVE-2022-24765

It was realised that git would run commands found in a git repo
(eg from configuration).

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agogpo: Add Centrify Compatible Crontab Extensions
David Mulder [Fri, 29 Apr 2022 21:21:33 +0000 (15:21 -0600)]
gpo: Add Centrify Compatible Crontab Extensions

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 10 20:05:48 UTC 2022 on sn-devel-184

2 years agogpo: Test Centrify Compatible Crontab Extensions
David Mulder [Fri, 29 Apr 2022 20:40:41 +0000 (14:40 -0600)]
gpo: Test Centrify Compatible Crontab Extensions

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agogpo: Add Centrify Compatible Sudoers Extension
David Mulder [Fri, 29 Apr 2022 16:29:01 +0000 (10:29 -0600)]
gpo: Add Centrify Compatible Sudoers Extension

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agogpo: Test Centrify Compatible Sudoers Extension
David Mulder [Fri, 29 Apr 2022 15:14:10 +0000 (09:14 -0600)]
gpo: Test Centrify Compatible Sudoers Extension

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agowinbind: send "debug traceid" from winbindd parent to child
Pavel Filipenský [Sun, 5 Sep 2021 18:37:55 +0000 (20:37 +0200)]
winbind: send "debug traceid" from winbindd parent to child

Bumping WINBIND_INTERFACE_VERSION to 32

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue May 10 18:25:01 UTC 2022 on sn-devel-184

2 years agowinbind: enable "debug traceid" in main winbindd
Pavel Filipenský [Sun, 5 Sep 2021 18:36:15 +0000 (20:36 +0200)]
winbind: enable "debug traceid" in main winbindd

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodocs-xml: document "winbind debug traceid" in smb.conf
Pavel Filipenský [Sun, 5 Sep 2021 20:18:11 +0000 (22:18 +0200)]
docs-xml: document "winbind debug traceid" in smb.conf

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:winbindd add "'winbind debug traceid" support via tevent tracing
Pavel Březina [Wed, 1 Sep 2021 14:05:37 +0000 (16:05 +0200)]
s3:winbindd add "'winbind debug traceid" support via tevent tracing

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodebug: add debug_traceid_set/get() interface
Pavel Filipenský [Sun, 8 May 2022 19:06:13 +0000 (21:06 +0200)]
debug: add debug_traceid_set/get() interface

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agodebug: fix trailing whitespace
Pavel Filipenský [Sun, 8 May 2022 19:09:04 +0000 (21:09 +0200)]
debug: fix trailing whitespace

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:lib: reset all tevent trace callbacks in reinit_after_fork()
Pavel Filipenský [Tue, 10 May 2022 11:06:53 +0000 (13:06 +0200)]
s3:lib: reset all tevent trace callbacks in reinit_after_fork()

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
With "tevent: add event trace api" we have now more callbacks to reset.
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agos3:lib: fix trailing whitespaces
Pavel Filipenský [Tue, 10 May 2022 11:06:05 +0000 (13:06 +0200)]
s3:lib: fix trailing whitespaces

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2 years agopython: Use 'is' for identity when comparing against None
Joseph Sutton [Thu, 5 May 2022 09:42:47 +0000 (21:42 +1200)]
python: Use 'is' for identity when comparing against None

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue May 10 06:12:10 UTC 2022 on sn-devel-184

2 years agokcc: Don't reuse outer loop variable for inner loop
Joseph Sutton [Thu, 5 May 2022 09:40:34 +0000 (21:40 +1200)]
kcc: Don't reuse outer loop variable for inner loop

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agopython: Remove redundant assignments
Joseph Sutton [Thu, 5 May 2022 09:32:13 +0000 (21:32 +1200)]
python: Remove redundant assignments

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agosource4/scripting/bin: Remove unnecessary global declarations
Joseph Sutton [Thu, 5 May 2022 09:23:10 +0000 (21:23 +1200)]
source4/scripting/bin: Remove unnecessary global declarations

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agopython/wscript: Remove unused format() argument
Joseph Sutton [Thu, 5 May 2022 09:21:28 +0000 (21:21 +1200)]
python/wscript: Remove unused format() argument

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agowintest: Remove unreachable return statement
Joseph Sutton [Thu, 5 May 2022 09:19:34 +0000 (21:19 +1200)]
wintest: Remove unreachable return statement

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoselftest: Remove unreachable return statement
Joseph Sutton [Thu, 5 May 2022 09:18:49 +0000 (21:18 +1200)]
selftest: Remove unreachable return statement

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agosamba-tool: Don't try to delete local_tdo_handle twice.
Joseph Sutton [Thu, 5 May 2022 09:16:17 +0000 (21:16 +1200)]
samba-tool: Don't try to delete local_tdo_handle twice.

This code is unreachable, as local_tdo_handle has already been deleted
and set to None earlier.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agowafsamba: Fix previously unreachable exception path
Joseph Sutton [Thu, 5 May 2022 09:12:05 +0000 (21:12 +1200)]
wafsamba: Fix previously unreachable exception path

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agopython: Remove unnecessary 'pass' statements
Joseph Sutton [Thu, 5 May 2022 09:11:07 +0000 (21:11 +1200)]
python: Remove unnecessary 'pass' statements

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agosamba-tool gpo: Fix unintended string concatenations
Joseph Sutton [Thu, 5 May 2022 09:08:06 +0000 (21:08 +1200)]
samba-tool gpo: Fix unintended string concatenations

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agosamba-tool gpo tests: Fix unintended string concatenations
Joseph Sutton [Thu, 5 May 2022 23:59:28 +0000 (11:59 +1200)]
samba-tool gpo tests: Fix unintended string concatenations

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoexamples: Make samr.py work with Python 3
Joseph Sutton [Thu, 5 May 2022 09:07:36 +0000 (21:07 +1200)]
examples: Make samr.py work with Python 3

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoexamples: Make netbios.py work with Python 3
Joseph Sutton [Thu, 5 May 2022 09:06:46 +0000 (21:06 +1200)]
examples: Make netbios.py work with Python 3

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agoexamples: Remove unused imports
Joseph Sutton [Thu, 5 May 2022 09:04:48 +0000 (21:04 +1200)]
examples: Remove unused imports

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agopython/xattr: Properly process system.posix_acl_access
Joseph Sutton [Thu, 5 May 2022 08:42:18 +0000 (20:42 +1200)]
python/xattr: Properly process system.posix_acl_access

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agosamba-tool processes: Remove unused loop
Joseph Sutton [Thu, 5 May 2022 08:41:26 +0000 (20:41 +1200)]
samba-tool processes: Remove unused loop

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agolib/smbconf: add python wrapper functions for transaction management
John Mulligan [Mon, 25 Apr 2022 16:04:20 +0000 (12:04 -0400)]
lib/smbconf: add python wrapper functions for transaction management

The smbconf API supports transactions. This changes adds wrapper
functions transaction_start, transaction_commit, and transaction_cancel.
It also adds tests for the functions, one of which demonstrates a
semi-pythonic way to use said functions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May  6 18:14:30 UTC 2022 on sn-devel-184

2 years agolib/smbconf: add delete_global_parameter method to SMBConf
John Mulligan [Mon, 25 Apr 2022 14:16:56 +0000 (10:16 -0400)]
lib/smbconf: add delete_global_parameter method to SMBConf

Add a delete_global_parameter method wrapping smbconf_delete_global_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add delete_parameter method to SMBConf
John Mulligan [Mon, 25 Apr 2022 13:59:36 +0000 (09:59 -0400)]
lib/smbconf: add delete_parameter method to SMBConf

Add a delete_parameter method wrapping smbconf_delete_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add create_set_share method to SMBConf
John Mulligan [Sun, 24 Apr 2022 15:48:41 +0000 (11:48 -0400)]
lib/smbconf: add create_set_share method to SMBConf

Add the create_set_share method wrapping smbconf_create_set_share.
This method is one of the most complex as it must "unpack" the list
of key-value pairs from python and convert that to a `struct
smbconf_service` for the smbconfig C API.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add delete_share method to SMBConf
John Mulligan [Sun, 24 Apr 2022 14:25:50 +0000 (10:25 -0400)]
lib/smbconf: add delete_share method to SMBConf

Add a delete_share method wrapping smbconf_delete_share.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add set_global_parameter method to SMBConf
John Mulligan [Sun, 24 Apr 2022 14:19:37 +0000 (10:19 -0400)]
lib/smbconf: add set_global_parameter method to SMBConf

Add a set_global_parameter method wrapping smbconf_set_global_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add set_parameter method to SMBConf
John Mulligan [Sun, 24 Apr 2022 14:18:42 +0000 (10:18 -0400)]
lib/smbconf: add set_parameter method to SMBConf

Add a set_parameter method wrapping smbconf_set_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add drop method to SMBConf
John Mulligan [Sun, 24 Apr 2022 12:17:53 +0000 (08:17 -0400)]
lib/smbconf: add drop method to SMBConf

Add a drop method wrapping smbconf_drop.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add create_share method to SMBConf
John Mulligan [Sun, 24 Apr 2022 12:10:36 +0000 (08:10 -0400)]
lib/smbconf: add create_share method to SMBConf

Add a create_share method wrapping smbconf_create_share.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopython/samba/tests: add test cases for s3/registry init funcs
John Mulligan [Sat, 23 Apr 2022 18:42:44 +0000 (14:42 -0400)]
python/samba/tests: add test cases for s3/registry init funcs

A previous change added smbconf initialization functions that allow
access to the registry back-end. Add some simple tests cases that
exercise these new functions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agosource3/lib/smbconf: add python bindings for init functions
John Mulligan [Sat, 23 Apr 2022 18:38:42 +0000 (14:38 -0400)]
source3/lib/smbconf: add python bindings for init functions

Add functions that allow python to access the registry back-end
initialization function as well as the "general" init function
that parses the back-end out of given string "path".
With the registry back-end it will be possible to implement and
test read-write functions of smbconf API in the future.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: add a python function for raising smbconf exceptions
John Mulligan [Sat, 23 Apr 2022 18:19:59 +0000 (14:19 -0400)]
lib/smbconf: add a python function for raising smbconf exceptions

The previous implementation in C was private to the module. Add
a small python wrapper function so that a different python module
may reuse the implementation.

The python level function is prefixed with "_" to mark it as
"private". Only future cooperating modules in the samba sources
should make use of it.

The function is shared at the python level as per the recommendation:
    https://stackoverflow.com/a/2136670

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agolib/smbconf: move python smbconf type definition to header
John Mulligan [Sat, 23 Apr 2022 18:17:48 +0000 (14:17 -0400)]
lib/smbconf: move python smbconf type definition to header

Moving the definition of the type to a header file will allow
future reuse of the C-type fields in a different C-API python
module.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agos3/lib/smbconf: add talloc_stackframe to smbconf_init_reg
John Mulligan [Thu, 5 May 2022 14:05:49 +0000 (10:05 -0400)]
s3/lib/smbconf: add talloc_stackframe to smbconf_init_reg

Previously, if this function was called without an existing stackframe
then uses of talloc_tos in source3/registry trigger a panic. Since we
intend to add patches that allow access to this call with Python
bindings, that will not typically have a talloc_stackframe already,  we
add a talloc_stackframe call around the call to
smbconf_init_reg_internal. This hides the use of talloc_tos in the
registry code from higher level code that needs to call smbconf.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agos3/lib/smbconf: replace uses of talloc_tos with talloc_stackframe
John Mulligan [Wed, 4 May 2022 14:57:49 +0000 (10:57 -0400)]
s3/lib/smbconf: replace uses of talloc_tos with talloc_stackframe

There are two calls to talloc_tos in the smbconf registry code.
In order not to make callers of this library have to "know" what
calls need an existing talloc stackframe, convert these uses
to match other functions in the same file that already use
talloc_stackframe.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2 years agopython/gp_cert_auto_enroll: removed unused imports
Douglas Bagnall [Thu, 5 May 2022 04:21:45 +0000 (16:21 +1200)]
python/gp_cert_auto_enroll: removed unused imports

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Thu May  5 14:39:50 UTC 2022 on sn-devel-184

2 years agopy/gp_cert_auto_enroll_ext: avoid redundant iteration
Douglas Bagnall [Thu, 5 May 2022 04:35:18 +0000 (16:35 +1200)]
py/gp_cert_auto_enroll_ext: avoid redundant iteration

self.__read_cep_data() does a 'for end_point_group in end_point_information:',
and we don't need to do it outside

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
2 years agopy/gp_cert_auto_enroll_ext: avoid shadowing loop variable
Douglas Bagnall [Thu, 5 May 2022 04:33:34 +0000 (16:33 +1200)]
py/gp_cert_auto_enroll_ext: avoid shadowing loop variable

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
2 years agos3:tests: Reformat test_forceuser_validusers.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:09 +0000 (15:34 +0200)]
s3:tests: Reformat test_forceuser_validusers.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): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu May  5 11:53:51 UTC 2022 on sn-devel-184

2 years agos3:tests: Reformat test_force_user_unlink.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:09 +0000 (15:34 +0200)]
s3:tests: Reformat test_force_user_unlink.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>
2 years agos3:tests: Reformat test_force_group_change.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:09 +0000 (15:34 +0200)]
s3:tests: Reformat test_force_group_change.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>
2 years agos3:tests: Reformat test_force_create_mode.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:09 +0000 (15:34 +0200)]
s3:tests: Reformat test_force_create_mode.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>
2 years agos3:tests: Reformat test_force_close_share.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)]
s3:tests: Reformat test_force_close_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>
2 years agos3:tests: Reformat test_fifo.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)]
s3:tests: Reformat test_fifo.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>
2 years agos3:tests: Reformat test_failure.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)]
s3:tests: Reformat test_failure.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>
2 years agos3:tests: Reformat test_durable_handle_reconnect.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)]
s3:tests: Reformat test_durable_handle_reconnect.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): Thu May  5 03:42:13 UTC 2022 on sn-devel-184

2 years agos3:tests: Reformat test_dropbox.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)]
s3:tests: Reformat test_dropbox.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>
2 years agos3:tests: Reformat test_dfree_quota.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)]
s3:tests: Reformat test_dfree_quota.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>
2 years agos3:tests: Reformat test_dfree_command.sh
Andreas Schneider [Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)]
s3:tests: Reformat test_dfree_command.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>