1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
Commit Graph

139582 Commits

Author SHA1 Message Date
Volker Lendecke
a2d47e989e libcli: Speed up sddl_decode_ace()
Factor out talloc-less sddl_transition_decode_sid()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Dec  3 09:03:01 UTC 2024 on atb-devel-224
2024-12-03 09:03:01 +00:00
Volker Lendecke
b65a4b9c90 libcli: Remove a special case
dom_sid_parse_endp does accept the lowercase "s" in "s-1-1-0".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-12-03 08:01:30 +00:00
Volker Lendecke
37e7203b0d libcli: Simplify sddl_decode_err_msg()
We have security_descriptor_initialise() for this

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-12-03 08:01:30 +00:00
Volker Lendecke
4def2a698d libcli: README.Coding for dom_sid routines
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-12-03 08:01:30 +00:00
Volker Lendecke
e4f57feed0 lib: Simplify security_descriptor_initialise() with a struct init
Rely no the default NULL init.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2024-12-03 08:01:30 +00:00
Volker Lendecke
963d54c8ee libcli: Fix a signed/unsigned comparison warning
With this we compare pointers, not numbers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Dec  2 05:52:56 UTC 2024 on atb-devel-224
2024-12-02 05:52:56 +00:00
Volker Lendecke
0045975c9e libcli: Use dom_sid_dup() instead of talloc_memdup()
We have specialized code for this, why not use it...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
b3db4d66d9 libcli: Apply a little const
Probably does not matter code-wise, but looks nicer to me.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
aede32aed1 libcli: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
c708407be5 libcli: Fix whitespace
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
24ef76e960 libcli: Avoid an unnecessary "else"
We return in the error case anyway

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
8327539651 smbd: Modernize DEBUGs
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
2af389de9a smbd: Simplify smb_set_posix_lock()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
824a70fe89 smbd: Simplify smb_file_position_information()
We've asserted fsp!=NULL in the caller

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
e868e6c2f1 smbd: Simplify smb_file_position_information()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
ef7ff7286f smbd: Simplify smb_set_file_allocation_info()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
e9c14626ac smbd: Simplify smb_set_file_allocation_info()
We've asserted fsp!=NULL in the caller

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
38c59f7840 smbd: Simplify smb_set_info_standard()
We've asserted fsp!=NULL in the caller

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
ae97ebd9bc smbd: Simplify smbd_smb2_query_directory_send()
We don't need to call strcmp() to find an empty string.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
82f2ce43fd smbd: Remove a pointless comment
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
a129fcd697 pdbedit: Avoid a use of convert_time_t_to_uint32_t()
We should avoid converting time_t to 32 bit wherever possible

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
3a4260cb7b libndr: Apply const to the ndr_print_* functions's void *
ndr_print_fn_t has a const void *, so we can extend this to the
callers. Keep ABI at 6.0.0, 4.21 is 5.0.0 and 4.22 is not there yet.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
32c492e851 smbd: TALLOC_FREE(sd) where it was allocated
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
ae7e1cb053 smbd: Avoid a cast
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
421cab80d8 printing: Fix Coverity ID 1508942 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
81253373c8 printing: Fix Coverity ID 1509000 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
a14fa71db5 lib: Simplify smbconf_txt_load_file()
file_modtime() returns errno, so we can skip the racy file_exist()
call.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
edc1f99ffa lib: Move some R/W "data" segment to R/O "text"
Doesn't really matter for tests, but I just came across it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
9558cb6ef6 net: Fix Coverity ID 1509022 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
6421b82c1d libndr: Fix Coverity ID 1509020 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
deea7792ad rpcclient: Fix Coverity ID 1509018 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
370f1d932e passdb: Fix Coverity ID 1509016 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
3001df6989 libsmb: Fix Coverity ID 1509012 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:33 +00:00
Volker Lendecke
177c35604b pdb_ldap: Fix Coverity ID 1508985 Use of 32-bit time_t
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02 04:53:32 +00:00
Andreas Schneider
fe96aa111c s4:smbtorture: Fix samba3.smb.dir on btrfs
"If a file is removed from or added to the directory after the most recent call
to opendir() or rewinddir(), whether a subsequent call to readdir() returns
an entry for that file is unspecified."
https://pubs.opengroup.org/onlinepubs/009604599/functions/readdir.html

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Nov 29 15:10:13 UTC 2024 on atb-devel-224
2024-11-29 15:10:13 +00:00
Andreas Schneider
38b8a4f223 s4:torture: Fix samba3.smb2.name-mangling on btrfs
If a file is removed from or added to the directory after the most recent call
to opendir() or rewinddir(), whether a subsequent call to readdir() returns
an entry for that file is unspecified."
https://pubs.opengroup.org/onlinepubs/009604599/functions/readdir.html

As it is unspecified, the different filesystems on Linux implement this
differently:

ext4:

./a.out
opendir(foo)
creat(foo/bar)
readdir() loop
  readdir entry: bar
  readdir entry: ..
  readdir entry: .
readdir() detected the newly created file `foo`

btrfs:

./a.out
opendir(foo)
creat(foo/bar)
readdir() loop
  readdir entry: .
  readdir entry: ..
readdir() did not detect the newly created file `foo`

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-29 14:09:35 +00:00
Stefan Metzmacher
bb92c70f0e libcli/auth: let netlogon_creds_copy() make use of ndr_deepcopy_struct()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Nov 28 13:53:25 UTC 2024 on atb-devel-224
2024-11-28 13:53:25 +00:00
Stefan Metzmacher
63a5269a77 librpc/ndr: add ndr_deepcopy_struct() helper
Keep libndr at 6.0.0, this has not been released yet.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-28 12:58:32 +00:00
Ralph Boehme
6d71edab5a smbd: use fsctl_get_reparse_point() in smb3_file_posix_information_init()
This allows returning the POSIX type info from fsctl_get_reparse_point().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Nov 27 19:32:45 UTC 2024 on atb-devel-224
2024-11-27 19:32:45 +00:00
Ralph Boehme
b51a827e47 smbd: move calling fsctl_get_reparse_tag() into smb3_file_posix_information_init()
This already fixes SMB2-GETINFO with POSIX infolevel to return the reparse tag
of reparse points.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:29 +00:00
Ralph Boehme
a10755881e smbd: simplify smb3_file_posix_information_init()
The dos attributes are already setup by fdos_mode(). Still assert
FILE_ATTRIBUTE_REPARSE_POINT is correctly set just in case.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:29 +00:00
Ralph Boehme
306d4e7fff smbd: fix DOS attributes for reparse points in fdos_mode()
Reparse have only FILE_ATTRIBUTE_REPARSE_POINT set, but never
FILE_ATTRIBUTE_NORMAL or FILE_ATTRIBUTE_DIRECTORY at the same time.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:29 +00:00
Ralph Boehme
21ef00d0f0 tests: test POSIX file type on reparse point
Create a symlink reparse point over SMB2. Then query file info over SMB2 and
check the POSIX file type is correctly assigned in the POSIX info levels.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:29 +00:00
Ralph Boehme
26e8105518 tests: check reparse tag and POSIX file type from query-file with POSIX infolevel
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:29 +00:00
Ralph Boehme
44a2458ca4 tests: fix test teardown/cleanup of test_create_reparse_directory()
This kept failing in a local make test not being able to cleanup the test
directory in the *subsequent* test test_create_reparse_nonempty_directory().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:28 +00:00
Ralph Boehme
8c468c6e5c tests: prepare reparsepoints.py for using POSIX on the SMB2 connection
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:28 +00:00
Ralph Boehme
d46bfc5d50 tests: move wire_mode_to_unix() to libsmb.py
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:28 +00:00
Ralph Boehme
02cc280710 pylibsmb: implement getinfo level FSCC_FILE_POSIX_INFORMATION
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:28 +00:00
Ralph Boehme
239d8f463b smbd: rename SMB2_FS_POSIX_INFORMATION to FSCC_FS_POSIX_INFORMATION
Streamline the info-level defines. Also get rid of
SMB2_FS_POSIX_INFORMATION_INTERNAL which is not needed for an info-level that
is exclusive to SMB2.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:28 +00:00
Ralph Boehme
27198998ed smbd: rename SMB2_FILE_POSIX_INFORMATION to FSCC_FILE_POSIX_INFORMATION
Streamline the info-level defines. Also get rid of
SMB2_FILE_POSIX_INFORMATION_INTERNAL which is not needed for an info-level that
is exclusive to SMB2.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-27 18:22:28 +00:00