summaryrefslogtreecommitdiffstats
path: root/source3/smbd/smb2_server.c
Commit message (Collapse)AuthorAgeFilesLines
* s3:smb2_server: make sure we grant credits on async read/write operations ↵Stefan Metzmacher2011-08-071-6/+15
| | | | | | | | | | | | | (bug #8357) Currently we skip, the "gone async" interim response on read and write, this caused the aio code path to grant 0 credits to the client in the read/write responses. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Sun Aug 7 22:23:57 CEST 2011 on sn-devel-104
* Secod part of bugfix for bug #8335 - file copy aborts with ↵Jeremy Allison2011-07-291-3/+24
| | | | | | | | | | | | | | | | | smb2_validate_message_id: bad message_id Modify the credit granting algorithm to closer to what I believe Windows does. Split up max_credits into 1/16ths, and then scale the requested credits by how many 16ths have been currently granted. Less than 1/16th == grant all requested (100%), scale down as more have been granted. Never ask for less than 1 if the client asked for at least 1. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Jul 29 20:37:42 CEST 2011 on sn-devel-104
* s3-auth use auth_user_info not netr_SamInfo3 in auth3_session_infoAndrew Bartlett2011-07-201-1/+1
| | | | | | | | | | | | This makes auth3_session_info identical to auth_session_info The logic to convert the info3 to a struct auth_user_info is essentially moved up the stack from the named pipe proxy in source3/rpc_server to create_local_token(). Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* s3-auth Use struct auth_user_info_unix for unix_name and sanitized_usernameAndrew Bartlett2011-07-201-2/+2
| | | | | | | | This is closer to the layout of struct auth_session_info in auth.idl Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* Move smbd_smb2_request_check_tcon() smbd_smb2_request_check_session() next ↵Jeremy Allison2011-07-081-0/+130
| | | | | | | to their only user and make them static. Add comments. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Jul 8 21:01:40 CEST 2011 on sn-devel-104
* s3:smb2_server: add some comments about change_to_user() and ↵Stefan Metzmacher2011-07-081-2/+98
| | | | | | | | | change_to_root_user() metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Fri Jul 8 13:45:46 CEST 2011 on sn-devel-104
* lib/util Move bitmap.c to lib/utilAndrew Bartlett2011-07-081-0/+1
|
* Fix bug #8293 - SMB2 doesn't rotate the log files often enough.Jeremy Allison2011-07-081-0/+17
| | | | | | | | | | Move the num_requests field out of the smb1 struct into the generic struct smbd_server_connection struct. Use it to count SMB2 requests as well as SMB1 and ensure that check_log_size() is called every 50 SMB2 requests. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Jul 8 01:14:53 CEST 2011 on sn-devel-104
* s3:smb2_server: call change_to_root_user() or smbd_smb2_request_check_tcon()Stefan Metzmacher2011-07-071-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | For all requests which don't operate on a tcon, we should call change_to_root_user(), to match the SMB1 behavior. For SMB1 we do the following operations without AS_USER: /* 0x70 */ { "SMBtcon",reply_tcon,0}, /* 0x71 */ { "SMBtdis",reply_tdis,DO_CHDIR}, /* 0x72 */ { "SMBnegprot",reply_negprot,0}, /* 0x73 */ { "SMBsesssetupX",reply_sesssetup_and_X,0}, /* 0x74 */ { "SMBulogoffX",reply_ulogoffX, 0}, /* ulogoff doesn't give a valid TID */ /* 0x75 */ { "SMBtconX",reply_tcon_and_X,0}, ... /* 0x2b */ { "SMBecho",reply_echo,0}, ... /* 0xa4 */ { "SMBntcancel",reply_ntcancel, 0 }, For SMB2tdis we still call smbd_smb2_request_check_tcon() as close_cnum() calls change_to_root_user() when needed. metze Signed-off-by: Jeremy Allison <jra@samba.org>
* s3:smb2_server: there's no reason to check the session id twice on a ↵Stefan Metzmacher2011-07-041-5/+0
| | | | | | | | | smb2_tcon request metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Mon Jul 4 17:34:13 CEST 2011 on sn-devel-104
* Second part of fix for bug #8219 - SMB Panic from Windows 7 Client.Jeremy Allison2011-06-291-1/+1
| | | | | | | | | | | | Pass in the correct vector to the signing algorithm in an async response - we must start with vector[1] which has the SMB2_HDR_BODY length, not vector[0] which is the 4 byte packet length. Also note we're passing in 2 vectors not 3. Metze please review. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Jun 29 20:09:21 CEST 2011 on sn-devel-104
* Fix bug #8219 - SMB Panic from Windows 7 ClientJeremy Allison2011-06-291-0/+8
| | | | | | | | | Caused by referencing an uninitialized variable in the duplicated struct smbd_smb2_request when sending a signed intermediate reply. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Jun 29 04:37:28 CEST 2011 on sn-devel-104
* s3-globals Remove smbd_event_context() (use server_event_context())Andrew Bartlett2011-05-311-1/+1
| | | | | | | | 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
* s3: Slightly simplify smbd_smb2_request_next_vectorVolker Lendecke2011-05-121-3/+5
| | | | Metze, Jeremy, please check!
* More simple const fixes.Jeremy Allison2011-05-051-4/+4
|
* s3: Fix dup_smb2_vec3Volker Lendecke2011-05-051-1/+1
| | | | | | | | | | | 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
* s3-tevent: only include ../lib/util/tevent wrappers where needed.Günther Deschner2011-04-291-0/+1
| | | | | | | Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Fri Apr 29 14:00:30 CEST 2011 on sn-devel-104
* s3: only include smb profiling where needed.Günther Deschner2011-04-141-0/+1
| | | | | | | Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Thu Apr 14 01:31:39 CEST 2011 on sn-devel-104
* s3: include smbd/smbd.h where needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* Change "security=share" to downgrade to SMB1 from SMB2, rather than trying ↵Jeremy Allison2011-01-271-8/+0
| | | | to fake it.
* s3: Fix a C++ warningVolker Lendecke2011-01-171-1/+1
|
* My algorithm for determining whan an incoming sequence number can be allowed ↵Jeremy Allison2010-12-211-6/+7
| | | | | | | | | | 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.
* CREATE in a compound CREATE/NOTIFY sequence was being passed through ↵Ken Harris2010-12-201-17/+17
| | | | | | | | | | | | 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
* Implement "use sendfile = yes" for SMB2. (cherry picked from commit ↵Jeremy Allison2010-12-151-0/+9
| | | | | | | 95cb7adcd03a1abbd0af395b6c96dd8e0eebd3d1) Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Dec 15 02:24:08 CET 2010 on sn-devel-104
* Change crediting so that the credits are returned on the interim async response.Jeremy Allison2010-12-141-4/+7
| | | | | Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Dec 14 01:09:05 CET 2010 on sn-devel-104
* We need to start off with smb2.credits_granted == 0. That wayJeremy Allison2010-12-131-2/+3
| | | | | | | when processing the faked up SMB2 NegProt from the SMB1 packet we always allocate one credit on reply. Jeremy.
* Remove extra unused credit arg. to smbd_smb2_request_setup_out()Jeremy Allison2010-12-131-3/+3
|
* Add a SMB2 crediting algorithm, by default the same as Windows. Defaults to ↵Jeremy Allison2010-12-101-23/+132
| | | | | | 128 credits. Jeremy.
* s3: Fix some uninitialized variable warningsVolker Lendecke2010-08-301-1/+1
|
* Fix bug #7653 - When SMB2 is on, Windows 7 clients can not connect as guest ↵Jeremy Allison2010-08-271-0/+8
| | | | | | | | | to a share. Fix "security = share" with SMB2 by mapping internally to "security = user" and "map to guest = Bad User". Jeremy.
* s3: Remove smbd_server_fd from smbd_initialize_smb2Volker Lendecke2010-08-161-2/+2
|
* s3: Cleanup of the initial SMB2 counters patch.Ira Cooper2010-07-091-89/+191
| | | | | | | 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>
* s3: Add SMB2 performance counters.Ira Cooper2010-07-071-19/+58
| | | | A performance counter was added for every base type of SMB2 op.
* SMB2 correctness fix. As we've already returned the credits in an interimJeremy Allison2010-06-141-0/+2
| | | | | | response, don't add more in the final return. Jeremy.
* Ensure we correctly setup req->subreq before testing for async. Stops ↵Jeremy Allison2010-06-101-4/+4
| | | | | | | | crashes when XX_send functions set async to stop interim replies being sent. Jeremy.
* Second part of fix for 7501 - SMB2: CREATE request replies getting mangled.Jeremy Allison2010-06-081-67/+67
| | | | | | | | | 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
* Fix for bug 7501 - SMB2: CREATE request replies getting mangled.Ira Cooper2010-06-081-3/+1
| | | | | Code for dup_smb2_req() was duplicating the wrong vector (i, instead of i+2) when returning a non-minimal SMB2 response.
* Ensure we remove SMB2 cancel requests from the active queueJeremy Allison2010-06-021-0/+1
| | | | | | now we don't remove them in the talloc destructor. Jeremy.
* Fix a crash bug found by Ira Cooper <samba@ira.wakeful.net>.Jeremy Allison2010-06-021-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* (Finally) fix bug #7158 - SMB2 connection resets during IOZone tests from ↵Jeremy Allison2010-05-191-1/+2
| | | | | | | | | | | | 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.
* Keep track of credits we're giving out. Set initial credits to 1 (MS-SMB2 ↵Jeremy Allison2010-05-181-1/+8
| | | | | | spec required). Jeremy.
* Make us pass all SMB2 lock tests except MULTIPLE-UNLOCK and CONTEXT. Them ↵Jeremy Allison2010-05-071-0/+8
| | | | | | next :-). Jeremy.
* Update (C) for 2010.Jeremy Allison2010-04-281-0/+1
| | | | Jeremy.
* Don't return an intermediate reply on async on a pipe call (Windows doesn't).Jeremy Allison2010-04-271-0/+5
| | | | Jeremy.
* Implement oplocks within SMB2. Plumb into the existing SMB1 oplock system.Jeremy Allison2010-04-241-3/+2
| | | | | | Seems to work but needs more tests (to be added). Jeremy.
* When sending the initial async response, this is never part of a chain.Jeremy Allison2010-04-231-1/+1
| | | | | | Get the reply flags correct. Jeremy.
* Make deferred opens (NT_STATUS_SHARING_VIOLATION) work over SMB2.Jeremy Allison2010-04-221-8/+9
| | | | | | | | Makes SMB2Create call re-entrant internally. Now this infrastructure is in place, oplocks will follow shortly. Tested with Win7 client and with W2K8R2. Jeremy.
* Now SMB2 error messages are correctly being returned with the 1 byte data ↵Jeremy Allison2010-04-191-51/+49
| | | | | | area, smbd_smb2_request_error_ex() must call smbd_smb2_request_done_ex() in order to do the padding correctly on compound replies. Jeremy.
* Ensure vectors are always allocated with consistent size. Removes one byte ↵Jeremy Allison2010-04-191-20/+60
| | | | | | alloc on SMB2 error packet. Always use talloc_zero_array on out vectors - fixes valgrind errors in tevent writes. Jeremy.
* Remove an unused auto variable.Jeremy Allison2010-04-191-3/+0
| | | | Jeremy.