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

217 Commits

Author SHA1 Message Date
Jeremy Allison
a796542a93 Implement oplocks within SMB2. Plumb into the existing SMB1 oplock system.
Seems to work but needs more tests (to be added).

Jeremy.
2010-04-24 00:29:41 -07:00
Jeremy Allison
247273196f When sending the initial async response, this is never part of a chain.
Get the reply flags correct.

Jeremy.
2010-04-23 15:35:34 -07:00
Jeremy Allison
8f67f873ac Make deferred opens (NT_STATUS_SHARING_VIOLATION) work over SMB2.
Makes SMB2Create call re-entrant internally.
Now this infrastructure is in place, oplocks will follow shortly.
Tested with Win7 client and with W2K8R2.

Jeremy.
2010-04-22 23:52:19 -07:00
Jeremy Allison
60d3692918 Now SMB2 error messages are correctly being returned with the 1 byte data area, smbd_smb2_request_error_ex() must call smbd_smb2_request_done_ex() in order to do the padding correctly on compound replies.
Jeremy.
2010-04-19 14:35:46 -07:00
Jeremy Allison
8bf7942fa4 Ensure vectors are always allocated with consistent size. Removes one byte alloc on SMB2 error packet. Always use talloc_zero_array on out vectors - fixes valgrind errors in tevent writes.
Jeremy.
2010-04-19 14:35:39 -07:00
Jeremy Allison
cea24c4620 Remove an unused auto variable.
Jeremy.
2010-04-19 11:38:49 -07:00
Günther Deschner
0b2e5debb0 s3-smb2: fix some c++ warnings.
Guenther
2010-04-19 11:54:00 +02:00
Jeremy Allison
59fa1e1890 Final fix for #7331 - Compound async SMB 2 requests don't work right.
Don't free the cancelled SMB2 req early, let the cancelation
function take care of it. Return a NT_STATUS_CANCELLED when
we find and cancel a request. Fix our SMB2 error returns to
correctly set the structuresize to 9, and add the expected
zero byte (see section 2.2.2 in the SMB2 spec.).

This causes Samba to pass the test program in this bug report
that W2K8R2 fails (heh heh :-). This is because we always cause
compound requests to get to a cancelation point before dealing
with a cancel request.

Jeremy.
2010-04-18 20:23:54 -07:00
Jeremy Allison
1aa80f5788 Second part of fix for bug #7331 - Compound async SMB 2 requests don't work right.
Cause us to match W2K8R2 by sending an interim compound reply
followed by a async reply.

Jeremy.
2010-04-17 22:42:23 -07:00
Jeremy Allison
bf45b4f4fd First part of fix for bug #7331 - Compound async SMB 2 requests don't work right.
Gets us handling SMB2 compound async requests similar to W2K8R2
(and triggers the same client bug in the Win7 redirector). Great
thanks to Ira Cooper <samba@ira.wakeful.net> for helping with
this and to Metze for the wonderful async framework. The one
thing I need to fix to make us identical to W2K8R2 is that
when a compound request goes async at the end W2K8R2 splits
the replies up into a compound non-async reply followed by
a separate async reply. Currently we're doing the whole thing
in a compound reply.

Jeremy.
2010-04-17 21:20:17 -07:00
Jeremy Allison
146c1618e4 Don't forget to initialize *p_creds_requested.
Jeremy.
2010-04-07 10:31:43 -07:00
Jeremy Allison
3d113a6ffb Ensure we total up the correct number of creds requested in a compound request. 2010-04-06 16:31:26 -07:00
Jeremy Allison
6800fdbb81 Make smbd_lock_socket/smbd_unlock_socket recursive with a ref_count.
As these always call exit_server, make that part of the function.
Use _internal functions for the echo client.

Metze please check !

Jeremy.
2010-03-31 17:40:30 -07:00
Jeremy Allison
26891651ec Change the credential handling so that we start with maxmux creds,
and then return to the client the number of credits per operation
that they asked for. This is a more sensible algorithm than just
blindly returning "20" on every reply, although we will probably
still need more changes to this going forward.
Jeremy.
2010-02-24 16:16:30 -08:00
Stefan Metzmacher
d60f049eaf s3:smbd: implement SMB2 Cancel correctly.
metze
2009-08-17 09:25:45 +02:00
Stefan Metzmacher
168a7cb6a8 s3:smbd: allow SMB2 Cancel to have the async flag set
metze
2009-08-14 13:27:50 +02:00
Stefan Metzmacher
86ea1c4d24 s3:smbd: fix parsing of the SMB2 body
Maybe there's no dynamic part on the wire.

metze
2009-08-14 13:27:49 +02:00
Stefan Metzmacher
1df883aa39 libcli: move some common SMB and SMB2 stuff into libcli/smb/
This will hold code that's shared between source3 and source4.

metze
2009-08-12 18:28:32 +02:00
Stefan Metzmacher
9aa1d25907 s3:smbd: rename conn => sconn for smbd_server_connection structs
This should avoid confusion between smbd_server_connection
and connection_struct variables.

metze
2009-08-08 10:48:39 +02:00
Volker Lendecke
79fd60dd38 Fix a few uninitialized variable warnings
I know those warnings are bogus, but both Coverity and gcc don't get it.
2009-07-24 10:23:04 -04:00
Stefan Metzmacher
12ed9ca36a s3:smbd: fix parsing of invalid SMB2 requests.
Because of 0 - 2 => 0xFFFFFFFE, we got EMSGSIZE
from the tstream layer. And terminate the transport
connection. Instead we should let the caller deal with
the invalid parameter, when checking the body size.
So the caller always gets at least a 2 byte body.

metze
2009-07-10 12:24:23 +02:00
Stefan Metzmacher
909d42278a s3:smbd: add marshalling layer for SMB2 Lock support
metze
2009-07-02 22:25:49 +02:00
Stefan Metzmacher
bc957dc4eb s3:smbd: add marshalling layer for SMB2 Find (QueryDirectory) support
metze
2009-07-02 22:25:49 +02:00
Stefan Metzmacher
74860465ac s3:smbd: add marshalling layer for SMB2 Break support (SMB 2.002 only)
metze
2009-07-02 22:25:49 +02:00
Stefan Metzmacher
d37709d38b s3:smbd: add marshalling layer for SMB2 SetInfo support
metze
2009-07-02 22:25:49 +02:00
Stefan Metzmacher
1df9cb6bc9 s3:smbd: add marshalling layer for SMB2 GetInfo support
metze
2009-07-02 22:25:48 +02:00
Stefan Metzmacher
d49a0e5f7d s3:smbd: add support for SMB2 Notify
metze
2009-07-02 09:13:56 +02:00
Stefan Metzmacher
3b25d868ee s3:smbd: add support for async interim SMB2 responses and prepare SMB2 cancel
metze
2009-06-24 21:04:57 +02:00
Stefan Metzmacher
754db207f6 s3:smbd: keep a list of outstanding SMB2 requests
metze
2009-06-24 21:04:57 +02:00
Stefan Metzmacher
bea384b277 s3:smbd: add smbd_smb2_send_oplock_break()
metze
2009-06-24 21:04:56 +02:00
Stefan Metzmacher
cf7c41b841 s3:smbd: the SMB2-COMPOUND test shows that the related vs. unrelated flags isn't checked first
metze
2009-06-24 21:04:56 +02:00
Stefan Metzmacher
a18341dab9 s3:smbd: only check the next_status for related requests
metze
2009-06-09 19:51:03 +02:00
Stefan Metzmacher
66acfbffeb s3:smbd: response with the same SMB2 flags as given by the client
...but also add the response flag.

metze
2009-06-09 19:51:03 +02:00
Stefan Metzmacher
4ae8bf09e6 s3:smbd: only pass the chained file handle for related compounded SMB2 requests
metze
2009-06-09 19:51:03 +02:00
Stefan Metzmacher
3d220f9fce s3:smbd: make sure we pad compounded SMB2 responses to 8 bytes
metze
2009-06-09 19:51:02 +02:00
Stefan Metzmacher
c0b64051d3 s3:smbd: more validation of the incoming SMB2 requests
metze
2009-06-09 19:51:02 +02:00
Stefan Metzmacher
915892e0da s3:smbd: for now ignore all non NBT Session Message requests for SMB2
metze
2009-06-09 19:51:01 +02:00
Stefan Metzmacher
6c44cc11b9 s3:smbd: don't include 1 byte padding for the dynamic buffer of SMB2 responses
It seems that Windows 2008 and Windows 7 doesn't do this anymore.

metze
2009-06-09 19:51:01 +02:00
Stefan Metzmacher
ee83d1aead s3:smbd: fix the logic for compounded requests
metze
2009-06-05 20:17:43 +02:00
Stefan Metzmacher
014ee5d0c2 s3:smbd: only setup the dyn iovec if a a dyn blob is given
Otherwise leave the default in there, which takes care of
padding for compounded requests.

metze
2009-06-05 20:17:42 +02:00
Stefan Metzmacher
fabdebdcf4 s3:smbd: add support for SMB2 Ioctl
We don't implement any level yet.

metze
2009-06-05 17:50:48 +02:00
Stefan Metzmacher
1b806d83b7 s3:smbd: make smbd_server_connection_terminate() a macro
metze
2009-06-05 11:31:15 +02:00
Stefan Metzmacher
160ead46dc s3:smbd: implement smbd_smb2_request_error/done() as macros on top of the _ex() function
metze
2009-06-05 11:31:03 +02:00
Jeremy Allison
73e3c85aba Change smbd_smb2_request_error() to add a __location__.
This allows quick identification of smb2 parsing errors.
Jeremy.
2009-06-04 12:47:17 -07:00
Jeremy Allison
e53ca4845e Add NTLMSSP SPNEGO to smb2 auth. Tested with Win7.
Jeremy.
2009-06-04 11:14:20 -07:00
Stefan Metzmacher
bfd1f5ddc6 s3:smbd: implement SMB2 Write
This only works on file shares.

metze
2009-06-03 17:54:40 +02:00
Stefan Metzmacher
4101f539bf s3:smbd: implement SMB2 Read
This only works works on file shares.

metze
2009-06-03 17:54:40 +02:00
Stefan Metzmacher
0ccef51cbe s3:smbd: implement SMB2 Flush
This works only on file shares yet.

metze
2009-06-03 17:54:40 +02:00
Stefan Metzmacher
ec0553bb6e s3:smbd: implement SMB2 Close
metze
2009-06-03 17:54:40 +02:00
Stefan Metzmacher
261c59e3a1 s3:smbd: implement a simple version of SMB2 Create
It only work on file shares and
just ignores any additional Create Context Values.

metze
2009-06-03 17:54:39 +02:00
Stefan Metzmacher
076aaf3f42 s3:smbd: create a user_struct for compat in SMB2 Session Setup
metze
2009-06-03 17:54:38 +02:00
Stefan Metzmacher
71fcd5bf64 s3:smbd: remove old comment, we support SMB2 signing now
metze
2009-06-03 11:18:54 +02:00
Stefan Metzmacher
ebc860ebeb s3:smbd: move SMB1 specific stuff into a substructure of smbd_server_connection
metze
2009-05-26 10:48:12 +02:00
Stefan Metzmacher
31c6679bf1 s3:smbd: add support for SMB2 signing
metze
2009-05-26 09:53:06 +02:00
Stefan Metzmacher
202509a347 s3:smbd: implement SMB2 Tree Disconnect
metze
2009-05-22 14:03:14 +02:00
Stefan Metzmacher
7dfbb2835f s3:smbd: implement SMB2 Tree Connect
For now this only checks if the share is present or not.

metze
2009-05-22 14:03:13 +02:00
Stefan Metzmacher
7749647740 s3:smbd: SMB2 session ids are 64bit...
We only grand ids up to 0x0000000000FFFFFF,
because that's what our idtree implementation can handle.
But also 16777215 sessions on one tcp connection should be enough:-)

metze
2009-05-22 14:03:13 +02:00
Stefan Metzmacher
1f59788516 s3:smbd: implement SMB2 Logoff
metze
2009-05-22 10:28:37 +02:00
Stefan Metzmacher
c3f6eff4f5 s3:smbd: we want to get the next command offset and not set it...
This should also fix the build on some hosts.

metze
2009-05-21 16:21:57 +02:00
Stefan Metzmacher
5d3d51e9ad s3:smbd: check the incoming session id for SMB2 requests
metze
2009-05-20 20:53:39 +02:00
Stefan Metzmacher
1ecdc8588d s3:smbd: implement SMB2 Session Setup with raw NTLMSSP
metze
2009-05-20 20:53:34 +02:00
Stefan Metzmacher
f9da4fb71a s3:smbd: move the callback functions of smbd_smb2_request_reply() closer itself
metze
2009-05-20 20:53:32 +02:00
Stefan Metzmacher
eac1235519 s3:smbd: add smbd_smb2_request_done_ex()
Some times we have to return a non-error response
with status != NT_STATUS_OK.

metze
2009-05-20 20:53:31 +02:00
Stefan Metzmacher
c4b41c5649 s3:smbd: fix initialized memory in SMB2 responses
MESSAGE_ID and SESSION_ID are both 64bit.

metze
2009-05-20 20:53:31 +02:00
Stefan Metzmacher
4abd5f34d9 s3:smbd: add support for SMB2 Keepalive (SMB2 Echo)
metze
2009-05-20 15:43:00 +02:00
Stefan Metzmacher
3ef6a5ae9e s3:smbd: add support for SMB2 Negotiate
This is not complete, but a start that makes the
samba4 smb2 client happy.

metze
2009-05-20 15:42:59 +02:00
Stefan Metzmacher
688945a994 s3:smbd: add infrastructure for SMB2 support
This is disabled by default and activated by
"max protocol = SMB2".

metze
2009-05-20 15:42:24 +02:00