1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-05 09:18:06 +03:00
Commit Graph

130524 Commits

Author SHA1 Message Date
Jeremy Allison
f42b5be412 s3: smbd: Add dirfsp return parameter to driver_unix_convert().
Not yet used, but (dirfsp=NULL) value passed to functions
called after driver_unix_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
87835c69cc s3: smbd: In filename_convert_dirfsp_nosymlink() only use synthetic_smb_fname_split() for fake_files, not printer shares too.
Printer shares can have real filenames.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
ffc19ac985 s3: smbd: Remove filename_convert().
(\  _  /)
                            ( \ O / )
                             (// \\)
                                X
                               / \
                              /___\
                       _____/      \\_____
                      |         +         ||
                      |                   ||
                      |  filename_convert ||
                      |                   ||
                      |                   ||
                      |                   ||
                      |                   ||
                      |  _     ___   _    ||
                      | | \     |   | \   ||
                      | |  |    |   |  |  ||
                      | |_/     |   |_/   ||
                      | | \     |   |     ||
                      | |  \    |   |     ||
                      | |   \. _|_. | .   ||
                      |                   ||
              *     * | *   **    * **    |**     **
               \)),.,\(/.,(//,,..,,\||(,,.,\\,.((//

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
6848358363 s3: smbd: Convert filename_convert_smb1_search_path() to use filename_convert_dirfsp().
There are now no more users of filename_convert().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
7bd5c05fbd s3: smbd: Add returned dirfsp pointer to filename_convert_smb1_search_path().
Preparation for convertion of the last filename_convert() -> filename_convert_dirfsp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
5a923ae36a s3: smbd: We now know get_original_lcomp() never has to deal with an MSDFS pathname.
Remove the call to dfs_redirect() within it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
4112bab9ae s3: smbd: In filename_convert_smb1_search_path(), after we have called dfs_redirect(), the path separator is always '/'.
This will allow us to remove the call to dfs_redirect() from get_original_lcomp().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
2d9938dac3 s3: smbd: Remove TWRP handing inside get_original_lcomp().
Now we know all @GMT paths are removed before get_original_lcomp()
is called, we can eliminate this code.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
acff075a72 s3: smbd: In reply_ntrename(), move the call to get_original_lcomp(..newname..) after the call to extract_snapshot_token(..newname..).
This was the last case where the snapshot TWRP token could be
passed into get_original_lcomp(). get_original_lcomp() can now
be changed to ignore TWRP tokens.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
5eed3f48b6 s3: smbd: Remove code for unused strip_gmt_from_raw_dfs().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
df5455c438 s3: smbd: Change filename_convert_smb1_search_path() to use extract_snapshot_token().
strip_gmt_from_raw_dfs() is now no longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
2ad3e63fe0 s3: smbd: Remove const from name_in parameter to filename_convert_smb1_search_path().
We're going to need to convert in place if it's an MSDFS path
with an SMB1 @GMT token.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
74715a7505 s3: smbd: Remove separate talloc_stackframe() from filename_convert_smb1_search_path().
We're soon going to change this to return dirfsp and use convert_filename_dirfsp()
so we need to return values on the passed in talloc ctx.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
7a823d44d2 s3: smbd: Allow extract_snapshot_token() to cope with MSDFS paths.
"raw" MSDFS paths are passed here as \server\share\path.

find_snapshot_token() only looks for a '/' as a separator
in SMB1 shapshot paths.

Allow extract_snapshot_token() to cope with SMB1 MSDFS paths by
converting in place, looking for the @GMT token with a '/'
separator via find_snapshot_token(), and then converting back.

Note, this a temporary measure until we handle DFS paths better
and will be removed in the next patchset.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Jeremy Allison
8b9fdc8ab1 s3: smbd: Add ucf_flags parameter to extract_snapshot_token().
Will be needed to cope with MSDFS paths which can be passed in
to this function.

Note, this a temporary measure until we handle DFS paths better
and will be removed in the next patchset.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Reviewed-by: Volker Lendecke <vl@samba.org>
2022-08-04 17:09:31 +00:00
Andreas Schneider
2120b21587 testprogs: Reformat test_ktpass.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_ktpass.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug  4 13:49:54 UTC 2022 on sn-devel-184
2022-08-04 13:49:54 +00:00
Andreas Schneider
faf8c190b4 testprogs: Reformat test_kpasswd_mit.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_kpasswd_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
9d1cf12da1 testprogs: Reformat test_kpasswd_heimdal.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_kpasswd_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
a68d75f9c1 testprogs: Reformat test_kinit_trusts_mit.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_trusts_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
ce97396ecb testprogs: Reformat test_kinit_trusts_heimdal.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_trusts_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
8c19e475aa testprogs: Reformat test_kinit_mit.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
da0049b01d testprogs: Reformat test_kinit_heimdal.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_kinit_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
848bf1bf59 testprogs: Reformat test_export_keytab_mit.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_export_keytab_mit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
708582deef testprogs: Reformat test_export_keytab_heimdal.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_export_keytab_heimdal.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
fcdcad8781 testprogs: Reformat test_client_kerberos.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_client_kerberos.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
2c8681cca7 testprogs: Reformat test_client_etypes.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_client_etypes.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
f222b2a229 testprogs: Reformat test_chgdcpass.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/test_chgdcpass.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
561e925655 testprogs: Reformat subunit.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/subunit.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
de6335d47a testprogs: Reformat schemaupgrade.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/schemaupgrade.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
a59460d279 testprogs: Reformat runtime-links.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/runtime-links.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
7b4e06d225 testprogs: Reformat renamedc.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/renamedc.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
d0f2791830 testprogs: Reformat nsstest.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/nsstest.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
084bddcf10 testprogs: Reformat ldapcmp_restoredc.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/ldapcmp_restoredc.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
65b3797352 testprogs: Reformat join_ldapcmp.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/join_ldapcmp.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
f2591ff727 testprogs: Reformat functionalprep.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/functionalprep.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
91035d48f2 testprogs: Reformat dom_parse.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/dom_parse.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
eab5cdb66f testprogs: Reformat dfree.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/dfree.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
9bc3ba8f37 testprogs: Reformat demote-saveddb.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/demote-saveddb.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 12:56:37 +00:00
Andreas Schneider
0cdd204693 testprogs: Reformat dbcheck.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/dbcheck.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>

Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org>
Autobuild-Date(master): Thu Aug  4 10:11:30 UTC 2022 on sn-devel-184
2022-08-04 10:11:30 +00:00
Andreas Schneider
ae3452244d testprogs: Reformat dbcheck-oldrelease.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/dbcheck-oldrelease.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 09:11:29 +00:00
Andreas Schneider
9757229b2b testprogs: Reformat dbcheck-links.sh
shfmt -w -p -i 0 -fn testprogs/blackbox/dbcheck-links.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-08-04 09:11:29 +00:00
Ralph Boehme
61c6a00f55 mdssvc: check if the user closed the query before trying to read the HTTP response from Elasticsearch
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14915

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>

Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Wed Aug  3 14:00:36 UTC 2022 on sn-devel-184
2022-08-03 14:00:36 +00:00
Ralph Boehme
c9ecd33ad7 mdssvc: fold two if blocks into one
No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00
Ralph Boehme
ac13935a58 mdssvc: don't trigger http reconnect if a search was cancelled
Calling tevent_req_error() triggers a HTTP reconnect in mds_es_search_done() as
mds_es_search_recv() returns the error so we call mds_es_reconnect_on_error().

slq (which is s->slq) or s->mds_es_ctx will be NULL if the user closed a search
or disconnected a share with an active mdssvc IPC pipe, no need to trigger a
HTTP reconnect for those cases.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00
Ralph Boehme
1150d121b7 mdssvc: fix check if search connection state is gone
This was dead code: before this patchset noone set s->mds_es_ctx->mds_ctx to
NULL. A previous commit changed that so now the mds_es_ctx destructor sets
s->mds_es_ctx to NULL if a search "s" was currently in-flight.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00
Ralph Boehme
9b0e61ff75 mdssvc: reapply default search destructor when marking a search non-pending
This is needed to ensure searches that are scheduled more then once to the
Elasticsarch server (because the first run didn't return all results) get
removed from the list of searches in case the user closes the query.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00
Ralph Boehme
9b56c7030f mdssvc: prevent a crash when pending search finishes after the client closed the search connection
When a search is in-flight and currently being processed against the
Elasticsearch server, we set s->pending. In the destructor of "s" we check "pending"
and reject deallocation of the object.

One instance where "s" is requested to be deallocated is when the client closes
the top-level per-share search connection. This will implicitly close all
searches associated with the mds_ctx from mds_ctx_destructor_cb():

	while (mds_ctx->query_list != NULL) {
		/*
		 * slq destructor removes element from list.
		 * Don't use TALLOC_FREE()!
		 */
		talloc_free(mds_ctx->query_list);
	}

So when this happens the Elasticsearch backend query object stays around,
alongside with any active tevent_req request and a tevent_req timer set with
tevent_req_set_endtime() in mds_es_search_send().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14915
RN: mdssvc crashes when searches are pending and the client closes the mdssvc IPC pipe

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00
Ralph Boehme
2fc2c7d4b0 mdssvc: move calling mds_es_search_set_pending() to mds_es_next_search_trigger()
This makes the calls to mds_es_search_set_pending() and
mds_es_search_unset_pending() symmetric. No change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00
Ralph Boehme
5b750d6b33 mdssvc: consolidate calls of mds_es_search_unset_pending()
Both codepaths were mds_es_search_unset_pending() is currently called end up
going through the higher level callback mds_es_search_done(). Moving the call to
mds_es_search_unset_pending() ensures we call it consistently and don't miss it
in some error code path.

Otherwise no change in behaviour.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00
Ralph Boehme
c0d46796d4 mdssvc: update a comment
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14915

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2022-08-03 13:00:36 +00:00