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

81 Commits

Author SHA1 Message Date
Stefan Metzmacher
894e5001c7 smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing
In future this will an impersonation wrapper tevent_context based on the
user session.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:21 +02:00
Stefan Metzmacher
182991c26c smbd: use sconn->root_ev_ctx for brl_timeout_fn()
This already calls change_to_root_user(), which can be removed
later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-06-18 08:59:21 +02:00
Jeremy Allison
8dabcf8948 s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it.
Will allow easier smb2-specific debugging.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2018-03-22 02:15:13 +01:00
Stefan Metzmacher
c4919d4d5f s3:smb2_server: allow logoff, close, unlock, cancel and echo on expired sessions
Windows client at least doesn't have code to replay
a SMB2 Close after getting NETWORK_SESSION_EXPIRED,
which locks out a the client and generates an endless
loop around NT_STATUS_SHARING_VIOLATION.

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

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): Thu Dec 21 23:28:42 CET 2017 on sn-devel-144
2017-12-21 23:28:41 +01:00
Volker Lendecke
246cb1961f smbd: Fix CID 1273096 Dereference before null check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-06-23 22:12:09 +02:00
Stefan Metzmacher
0b0ac41aea s3:smb2_server: use async smbprofile macros
This improves profiling and corrently counts the total and idle time for async
requests.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-11-19 20:51:37 +01:00
Stefan Metzmacher
0944797fef s3:smb2_lock: iterate over all sconn->client->connections
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-19 09:15:12 +02:00
Stefan Metzmacher
1d53557df5 s3:smb2_lock: always use tevent_req_defer_callback() if we go async
process_blocking_lock_queue_smb2() can call reprocess_blocked_smb2_lock()
multiple times, which results in multiple tevent_req_done() calls.

As we could disconnect the connection from there,
process_blocking_lock_queue_smb2() could crash as the local state might be
destroyed.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-19 09:15:12 +02:00
Stefan Metzmacher
4a07b14cea s3:smb2_server: pass smbXsrv_connection to smbd_server_connection_terminate*()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:13 +02:00
Stefan Metzmacher
92e96bedfb s3:smb2_server: move sconn->smb2.requests to xconn->smb2.requests
This prepares the structures for multi-channel support.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-06 09:51:11 +02:00
Volker Lendecke
2f86c7d3f8 smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul 22 17:57:56 CEST 2014 on sn-devel-104
2014-07-22 17:57:56 +02:00
Volker Lendecke
5a1fb2eb0d smbd: brl_lock_cancel does not need "blr" anymore
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-04 06:31:16 +02:00
Volker Lendecke
f038cf739d smbd: do_lock does not need "blr" anymore
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-04 06:31:16 +02:00
Volker Lendecke
c886e66232 smbd: brl_lock does not need "blr" anymore
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-04 06:31:16 +02:00
Volker Lendecke
f93ae07679 smbd: Factor out unlocking from smbd_do_locking
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-04 06:31:16 +02:00
Volker Lendecke
9fc9e4869f smbd: Fix some typos
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): Wed Jul  2 02:25:47 CEST 2014 on sn-devel-104
2014-07-02 02:25:47 +02:00
Volker Lendecke
f9bbb1ff0d smbd: Remove an unused variable
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-02 00:11:23 +02:00
Volker Lendecke
7d71e8d657 smbd: Clarify smb2 lock checks
When reading the code it was not immediately clear to me how one of the
conditions in [MS-SMB2] 3.3.5.14.2 was satisfied. A separate loop to me
is clearer and given that we don't expect thousands of locks in a single
call also not significantly less efficient.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-07-02 00:11:23 +02:00
Jeremy Allison
cee1531e55 s3: SMB2 : Fix leak of blocking lock records in the database.
Based on a fix from Hemanth Thummala <hemanth.thummala@gmail.com>
Bug #10673 - Increasing response times for byte range unlock requests.

The previous refactoring makes it obvious we need to call
remove_pending_lock() in all places where we are returning
from the SMB2 blocking lock call.

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

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

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jun 30 14:59:16 CEST 2014 on sn-devel-104
2014-06-30 14:59:16 +02:00
Jeremy Allison
1a02a1e6aa s3: smb2: Simplify logic in reprocess_blocked_smb2_lock().
SMB2 blocking locks can only have one lock per request, so
there can never be any other locks to wait for.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-30 12:41:10 +02:00
Jeremy Allison
508c09c6a0 s3: smb2: Remove unused code from remove_pending_lock().
SMB2 blocking locks can only have one lock per request, so
there can never be any previous locks to remove.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-06-30 12:41:10 +02:00
Stefan Metzmacher
4d1d288b89 s3:smb2_lock: return RANGE_NOT_LOCKED instead of CANCELLED for logoff and tdis
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-12 09:27:37 -07:00
Stefan Metzmacher
b498937761 s3:smb2_lock: fix whitespaces/tabs in smbd_smb2_lock_cancel()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-12 09:27:37 -07:00
Stefan Metzmacher
aa70bf5fdc s3:smb2_lock: make use of smbd_smb2_generate_outbody()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-05 13:59:22 -08:00
Volker Lendecke
c1b7cf5481 smbd: Fix a panic when a smb2 brlock times out
Found by Peter Somogyi.

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Dec  5 21:21:35 CET 2013 on sn-devel-104
2013-12-05 21:21:35 +01:00
Michael Adam
88d051f7f1 s3:smbd: remove struct member smbd_smb2_request.cancelled - it was only written 2012-09-22 10:19:00 +02:00
Stefan Metzmacher
1f8e4732c5 s3:smb2_lock: let smbd_smb2_lock_cancel() trigger NT_STATUS_CANCELED
Instead of violating the tevent_req layers.

metze
2012-09-22 10:18:59 +02:00
Stefan Metzmacher
e281b9f798 s3:smb2_lock: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:40 +02:00
Stefan Metzmacher
1a0c40f537 s3:smb2_lock: remove unused in_smbpid
metze
2012-08-05 16:39:31 +02:00
Stefan Metzmacher
7d1395536b s3:smbd: make use of smbXsrv_open for smb1/2/3
This makes sure we generate unique persistent file ids,
which are stored in smbXsrv_open_global.tdb.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 29 21:01:11 CEST 2012 on sn-devel-104
2012-06-29 21:01:11 +02:00
Michael Adam
ec111bd050 s3:smbd: change smb2_lock.c to use fsp_fnum_dbg() for fsp->fnum logging.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:15 +02:00
Stefan Metzmacher
7753a4a01b s3:smb2_lock: make use of file_fsp_smb2()
metze
2012-06-09 21:23:45 +02:00
Stefan Metzmacher
4ae96bb952 s3:smb2_lock: use fsp->fnum as locking context
fsp->fnum is the same as in_file_id_volatile.

When we start to support durable handles we should pass
in_file_id_persistent.

metze
2012-06-09 15:02:47 +02:00
Stefan Metzmacher
3b2e5929ec s3:smb2_lock: use smb2req->compat_chain_fsp instead of looking it up again
metze
2012-06-09 15:02:47 +02:00
Stefan Metzmacher
704cf10645 s3:smbd: avoid using sconn_server_id()
metze
2011-12-16 13:19:32 +01:00
Stefan Metzmacher
ffa996e479 s3:smb2_lock: use talloc_get_type_abort() as private_data can't be NULL
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Dec 14 13:34:25 CET 2011 on sn-devel-104
2011-12-14 13:34:25 +01:00
Stefan Metzmacher
f59d358653 s3:smb2_lock: pass smbd_server_connection as private_data to received_unlock_msg()
metze
2011-12-12 20:14:41 +01:00
Stefan Metzmacher
763fe4216b s3:smb2_server: use sconn->ev_ctx instead of sconn->smb2.event_ctx
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Mon Dec 12 16:08:59 CET 2011 on sn-devel-104
2011-12-12 16:08:59 +01:00
Stefan Metzmacher
7081d7e78f s3:smb2_lock: avoid using server_event_context()
metze
2011-12-12 14:35:43 +01:00
Stefan Metzmacher
88dd90d928 s3:smb2_server: pass explicit defer_times to smbd_smb2_request_pending_queue()
metze
2011-11-15 17:14:13 +01:00
Stefan Metzmacher
a358eee2d8 s3:smb2_server: use smbd_smb2_request_verify_sizes() in smb2_lock.c
metze
2011-09-07 10:38:06 +02:00
Rusty Russell
56e72337b0 lib/util/time.c: timeval_current_ofs_msec
Several places want "milliseconds from current time", and several were
simply doing "msec * 1000" which can (and does in one place) result in
a usec value over 1 a million.

Using a helper to do this is safer and more readable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-01 10:38:47 +02:00
Andrew Bartlett
e5dd03d199 s3-globals Remove smbd_event_context() (use server_event_context())
This has been a wrapper around server_event_context() for some time
now, and removing this from dummmysmbd.c assists with library
dependencies.

Andrew Bartlett
2011-05-31 00:32:07 +02:00
Günther Deschner
50883cfeb4 s3-tevent: only include ../lib/util/tevent wrappers where needed.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Fri Apr 29 14:00:30 CEST 2011 on sn-devel-104
2011-04-29 14:00:30 +02:00
Günther Deschner
ab36d597e7 s3-messages: make ndr_messaging.h part of messages.h.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
b2af281e50 s3-messages: only include messages.h where needed.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Volker Lendecke
898f7c9603 s3: Remove smbd_server_conn from smb2 receive_unlock_msg 2010-10-03 18:17:08 +02:00
Volker Lendecke
b0f76a37d3 s3: Remove procid_self() from cancel_pending_lock_requests_by_fid_smb2() 2010-07-05 11:06:31 +02:00
Volker Lendecke
a521ad4b5a s3: Remove procid_self() from remove_pending_lock() 2010-07-05 11:06:31 +02:00