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
Volker Lendecke
2b40899bd3
s3: Slightly simplify smbd_smb2_request_next_vector
...
Metze, Jeremy, please check!
2011-05-12 11:48:29 +02:00
Jeremy Allison
02af307585
More simple const fixes.
2011-05-05 23:56:07 +02:00
Volker Lendecke
82b9fa3a19
s3: Fix dup_smb2_vec3
...
Metze, Jeremy, please check!
Thanks,
Volker
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu May 5 13:39:40 CEST 2011 on sn-devel-104
2011-05-05 13:39:40 +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
165521e20d
s3: only include smb profiling where needed.
...
Guenther
Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Thu Apr 14 01:31:39 CEST 2011 on sn-devel-104
2011-04-14 01:31:39 +02:00
Günther Deschner
8c24ebf371
s3: include smbd/smbd.h where needed.
...
Guenther
2011-03-30 01:13:08 +02:00
Jeremy Allison
eec50b21f6
Change "security=share" to downgrade to SMB1 from SMB2, rather than trying to fake it.
2011-01-27 15:26:47 -08:00
Volker Lendecke
d9204622e3
s3: Fix a C++ warning
2011-01-17 08:03:40 +01:00
Jeremy Allison
e8f7c60ec2
My algorithm for determining whan an incoming sequence number can be allowed is incorrect.
...
(I based it on the text in MS-SMB2, silly me :-). Fix it so incoming sequence numbers
can range over the entire allowable bitmap range. This fixes a repeatable
disconnect against Win7.
Jeremy.
2010-12-21 18:07:52 -08:00
Ken Harris
09aea03813
CREATE in a compound CREATE/NOTIFY sequence was being passed through set_operation_credits()
...
twice (ultimately perhaps because of bug 7331 involving this compound sequence and the need
to be ready for any incoming CANCEL of the NOTIFY). This had the server thinking it had
granted more credit than it actually had, which lead to zero-credits being granted in interim
NOTIFY responses.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Dec 20 20:59:55 CET 2010 on sn-devel-104
2010-12-20 20:59:55 +01:00
Jeremy Allison
a8eed184a0
Implement "use sendfile = yes" for SMB2. (cherry picked from commit 95cb7adcd03a1abbd0af395b6c96dd8e0eebd3d1)
...
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Dec 15 02:24:08 CET 2010 on sn-devel-104
2010-12-15 02:24:08 +01:00
Jeremy Allison
f974e68213
Change crediting so that the credits are returned on the interim async response.
...
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Dec 14 01:09:05 CET 2010 on sn-devel-104
2010-12-14 01:09:05 +01:00
Jeremy Allison
6ce365b238
We need to start off with smb2.credits_granted == 0. That way
...
when processing the faked up SMB2 NegProt from the SMB1 packet we
always allocate one credit on reply.
Jeremy.
2010-12-13 13:34:50 -08:00
Jeremy Allison
27a47eb9fc
Remove extra unused credit arg. to smbd_smb2_request_setup_out()
2010-12-13 13:20:05 -08:00
Jeremy Allison
2ac579ca76
Add a SMB2 crediting algorithm, by default the same as Windows. Defaults to 128 credits.
...
Jeremy.
2010-12-10 15:46:41 -08:00
Volker Lendecke
1d3bd5b1c0
s3: Fix some uninitialized variable warnings
2010-08-30 15:57:14 +02:00
Jeremy Allison
04f021e692
Fix bug #7653 - When SMB2 is on, Windows 7 clients can not connect as guest to a share.
...
Fix "security = share" with SMB2 by mapping internally
to "security = user" and "map to guest = Bad User".
Jeremy.
2010-08-27 15:25:04 -07:00
Volker Lendecke
50b3ee57e2
s3: Remove smbd_server_fd from smbd_initialize_smb2
2010-08-16 22:39:17 +02:00
Ira Cooper
c0aa55d550
s3: Cleanup of the initial SMB2 counters patch.
...
This reorganizes smbd_smb2_request_dispatch to have a central exit point,
and use the normal profiling macros.
Signed-off-by: Jeremy Allison <jra@samba.org>
2010-07-09 16:29:39 -07:00
Ira Cooper
90b1a1d296
s3: Add SMB2 performance counters.
...
A performance counter was added for every base type of SMB2 op.
2010-07-07 18:06:59 -07:00
Jeremy Allison
dd2fad01fd
SMB2 correctness fix. As we've already returned the credits in an interim
...
response, don't add more in the final return.
Jeremy.
2010-06-14 16:58:15 -07:00
Jeremy Allison
edd8940e18
Ensure we correctly setup req->subreq before testing for async. Stops crashes when
...
XX_send functions set async to stop interim replies being sent.
Jeremy.
2010-06-10 13:19:25 -07:00
Jeremy Allison
0c5d0e1c37
Second part of fix for 7501 - SMB2: CREATE request replies getting mangled.
...
Based on code from Ira Cooper <samba@ira.wakeful.net>, and also
advice on refactoring the patch into a function call. outbuf vectors
can be reallocated by smb2 processing code, so when returning interim
responses we must not make assumptions about vector size.
Jeremy
2010-06-08 17:44:05 -07:00
Ira Cooper
fd9e02d5f3
Fix for bug 7501 - SMB2: CREATE request replies getting mangled.
...
Code for dup_smb2_req() was duplicating the wrong vector (i, instead
of i+2) when returning a non-minimal SMB2 response.
2010-06-08 11:20:23 -07:00
Jeremy Allison
cb1590e410
Ensure we remove SMB2 cancel requests from the active queue
...
now we don't remove them in the talloc destructor.
Jeremy.
2010-06-02 16:57:08 -07:00
Jeremy Allison
53e4650622
Fix a crash bug found by Ira Cooper <samba@ira.wakeful.net>.
...
A create call comes in, goes async (on the oplock request).
At a later time (just before a cancel request is received)
it completes, and goes through smbd_smb2_request_reply() to
send the reply to the create call.
However, the output socket queue is full, so when
tstream_writev_queue_send() is called from smbd_smb2_request_reply(),
the smb2req stays on the "being processed" queue on
sconn->smb2.requests, as only when tstream_writev_queue_send() completes
is smbd_smb2_request_writev_done() get called, which will TALLOC_FREE
the smb2req (and thus take if off the queue).
The cancel comes in, gets processed and looks through the
requests on the queue, and BANG - hits the smb2req that
has already been processed and is outgoing....
Remove the request from the queue once
tstream_writev_queue_send() is called and not in the talloc
destructor function.
Jeremy.
2010-06-02 16:43:31 -07:00
Jeremy Allison
af44593555
(Finally) fix bug #7158 - SMB2 connection resets during IOZone tests from 64-bit Vista client
...
It turns out that the persistent handles are used by the Microsoft
redirector to index files on oplock break requests. So even if we
don't do durable handles (yet) we must set the persistent handle
on create. For now just use the same handle value as we use for
volatile.
Jeremy.
2010-05-19 19:28:26 -07:00
Jeremy Allison
c7982074a7
Keep track of credits we're giving out. Set initial credits to 1 (MS-SMB2 spec required).
...
Jeremy.
2010-05-18 17:11:54 -07:00
Jeremy Allison
4ad1943d29
Make us pass all SMB2 lock tests except MULTIPLE-UNLOCK and CONTEXT. Them next :-).
...
Jeremy.
2010-05-07 01:20:26 -07:00
Jeremy Allison
4e7195be36
Update (C) for 2010.
...
Jeremy.
2010-04-28 14:56:12 -07:00
Jeremy Allison
f11a5d196d
Don't return an intermediate reply on async on a pipe call (Windows doesn't).
...
Jeremy.
2010-04-27 16:07:12 -07:00
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