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

416 Commits

Author SHA1 Message Date
Volker Lendecke
f83e7d8f8c s3: Remove "server_fd" global variable 2010-09-28 07:36:15 +02:00
Andrew Bartlett
d1bb21b0d5 s3:auth Remove NT_USER_TOKEN
The all UPPER case typedef is no longer the preferred Samba style
and this makes it easier to see that this is the IDL-derivied structure

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:06 +10:00
Volker Lendecke
e466bb4af4 s3: Remove smbd_server_fd()
This breaks the perfcol_onefs() build.

Tim, Steve, this use of smbd_server_fd is replacable by calls into
substitute.c. I don't have a onefs environment around to build a fix, so I've
decided to insert an #error, making it not compile. The fix should be pretty
obvious, you can get the socket data via "%I" and "%i" substitutions.
2010-08-29 21:55:25 +02:00
Volker Lendecke
d3a0ff311e s3: Make char_flags and base_reverse const arrays
This moves those arrays from dynamic to static, shared memory, removing them
from globals.c.

I did it by dumping the result of init_tables() with dump_data(). Some massage
by an editor macro made it the initializer.
2010-08-24 22:45:41 +02:00
Volker Lendecke
2d81721a3f s3: Move "trans_num" to smbd_server_connection 2010-08-24 21:06:41 +02:00
Volker Lendecke
7b6835ec1d s3: Add smbd_server_connection->client_id 2010-08-18 11:18:22 +02:00
Volker Lendecke
2f53d1deb7 s3: Add "sock" to smbd_server_connection 2010-08-16 22:39:16 +02:00
Jeremy Allison
8cba4a0c96 Move the addition of the 16 byte guid out of spnego_gen_negTokenInit() and
into negprot_spnego() where it belongs (it's not an SPNEGO operation).
Add a TALLOC_CTX for callers of negprot_spnego(). Closer to unifying all
the gen_negTokenXXX calls.

Jeremy.
2010-07-19 16:45:16 -07:00
Jeremy Allison
5bdb8b472c Revert "Remove the global char *LastDir."
Volker pointed out I'd missed the "last directory" cache
part of this code. Return us to caching the directory we're
in (reduces sys call load).

Mea maxima culpa.

Jeremy.

This reverts commit 2f30aea332.
2010-07-13 09:30:35 -07:00
Volker Lendecke
23790c9a8f s3: Add sconn_server_id() 2010-07-05 11:06:24 +02:00
Volker Lendecke
58b9595bab s3: Add missing prototype for smb2_opcode_name 2010-07-05 11:06:24 +02:00
Volker Lendecke
9cc52e8411 s3: Add msg_ctx to smbd_server_connection
It would be obvious to initialize this in smbd_init_globals(), but there the
messaging_context can't be initialized yet because we don't have smb.conf
loaded yet.
2010-07-05 11:06:23 +02:00
Volker Lendecke
5dc2fe5fdc s3: Explicitly pass sconn to process_blocking_lock_queue_smb2 2010-06-12 15:42:57 +02:00
Volker Lendecke
375ce3c96a s3: Explicitly pass sconn to [remove|schedule]_deferred_open_message_smb2 2010-06-12 15:42:57 +02:00
Volker Lendecke
9747eb45d6 s3: Explicitly pass sconn to open_was_deferred_smb2 2010-06-12 15:42:57 +02:00
Volker Lendecke
a45ea200c6 s3: Explicitly pass sconn to negprot_spnego() 2010-06-12 15:42:50 +02:00
Volker Lendecke
3087986e76 s3: Remove sconn arg from smbd_notify_cancel_by_smbreq 2010-06-12 15:42:50 +02:00
Jeremy Allison
321d7a6303 Implement AIO in SMB2. Doesn't allow cancel calls yet (to be added).
Jeremy.
2010-06-10 13:20:37 -07:00
Jeremy Allison
d28fa8faab Rename "allow_smb2" -> "using_smb2" and make the usage clearer. 2010-06-09 19:12:02 -07:00
Jeremy Allison
34a8324409 Fix a valgrind error found by SMB2-COMPOUND test.
If a file is closed we must also NULL out all chained_fsp
pointers when the fsp is freed to prevent invalid pointer
access.

Jeremy.
2010-06-08 21:20:07 -07:00
Andreas Schneider
fad86ddf55 s3-smbd: Remove unneeded dependency of map_username to globals.c.
Reviewed-by: Simo Sorce <idra@samba.org>
2010-06-04 12:12:08 -04:00
Simo Sorce
b32b59d47f s3:smbd make yp cache local.
The my_yp_domain variable is just a static cache needed to avoid
making over and over expensive and potentially blocking calls to
yp_get_default_domain().
Instead of keeping this onto the smbd_server_connection struct, just
keep it local to the only function ever using this variable.

This disentagle this function (and a number of calling functions)
from having to pass around smbd_server_connection and thus having
to link against smbd. It also removes a few ifdefs.

Nothing changes from a global/local pov, as the smbd_server_connection
variable passed around is also a global one.

Signed-off-by: Andreas Schneider <asn@samba.org>
2010-05-31 18:21:29 +02:00
Andrew Bartlett
723ea68d3b s3:auth Remove AUTH_NTLMSSP_STATE typedef.
typedefs are no longer preferred Samba style.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-31 15:10:44 +02: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
895b99fd6b Be more forgiving on client oplock break failure (as Windows does). Remove a global.
Jeremy.
2010-05-13 11:33:02 -07:00
Jeremy Allison
ae9fe3cc8e SMB2 always have level2 oplock capability. Correct mapping from break messages to SMB2 oplock levels.
Jeremy.
2010-05-10 14:23:44 -07:00
Jeremy Allison
adf4833792 This patch looks bigger than it is. It does 2 things. 1). Renames smbpid -> smblctx in our locking code. 2). Widens smblctx to 64-bits internally. Preparing to use the SMB2 handle as the locking context.
Jeremy.
2010-05-07 06:20:50 -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
a77a8a5e35 Fix more SMB2 locking. We still crash but this won't last :-).
Jeremy.
2010-05-06 08:22:13 -07:00
Jeremy Allison
f4092ecec7 Plumb the SMB2 front end into the blocking lock backend.
Metze, you'll probably be happier with this work as it
doesn't abuse tevent in the way you dislike. This is a
first cut at the code, which will need lots of testing
but I'm hoping this will give people an idea of where I'm
going with this.

Jeremy.
2010-04-30 21:03:20 -07:00
Jeremy Allison
e90444319c Carefully label SMB1-specific locking calls.
Jeremy.
2010-04-29 17:08:12 -07:00
Jeremy Allison
ebf6340bb5 Move the global blocking lock records into the smb1 state.
Jeremy
2010-04-29 16:50:15 -07:00
Jeremy Allison
4e7195be36 Update (C) for 2010.
Jeremy.
2010-04-28 14:56:12 -07:00
Stefan Metzmacher
b764145ac8 s3:smbd: keep local and remote tsocket_address per connection
metze
2010-04-27 17:22:31 +02: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
2bbb8c917e Allow smb2 create requests to be cancelled.
Jeremy.
2010-04-23 13:10:15 -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
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
7984243768 Move to using 64-bit mid values in our internal open file database.
This will allow us to share logic much easier between SMB1 and SMB2
servers.

Jeremy
2010-04-12 21:40:28 -07:00
Jeremy Allison
e15939b456 Plumb SMB2 stubs into all the places we defer SMB1 operations.
Rename functions to be internally consistent. Next step is
to cope queueing single (non-compounded) SMB2 requests to
put some code inside the stubs.

Jeremy.
2010-04-09 19:26:34 -07:00
Jeremy Allison
08b24e923d Stop smb2 from calling into smb1 blocking lock request code.
Allocate a uint16_t internal SMB1 mid for an SMB2 request.
Add a back pointer from the faked up smb_request struct
to the smb2 request.

Getting ready to add restart code for blocking locks,
share mode violations and oplocks in SMB2.

Jeremy.
2010-04-08 22:15:55 -07:00
Jeremy Allison
3491f6d119 Simplify call_trans2qfilepathinfo() and smbd_do_qfilepathinfo()
Remove the bool ms_dfs_link parameter from smbd_do_qfilepathinfo.
It is not possible for this to be a DFS link. Remove the check_msdfs_link()
call from call_trans2qfilepathinfo() - the call to filename_convert()
above with a ucf_flags of zero *MUST* catch a DFS link and return
NT_STATUS_PATH_NOT_COVERED in this case, so the code below checking
for msdfs links is redundent. Don't add this to 3.5.x, as it's an
optimization but not needed to fix bug #7339 - MSDFS is non-functional in 3.5.x.

Jeremy.
2010-04-08 21:24:23 -07:00
Jeremy Allison
3413cf7a6b Start to plumb smb2 into the oplock system. Calls dummy functions for now.
Jeremy.
2010-04-07 19:00:44 -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
Stefan Metzmacher
44d655b33f s3:smbd: add echo handler information to struct smbd_server_connection
metze
2010-03-22 17:15:12 +01:00
Stefan Metzmacher
8de8554628 s3:smbd: add smbd_[un]lock_socket() dummies
metze
2010-03-22 17:15:11 +01:00
Volker Lendecke
d6a6872506 s3: Abstract access to sessionid.tdb, similar to conn_tdb.c 2010-03-01 17:53:22 +01:00
Jeremy Allison
2f30aea332 Remove the global char *LastDir.
This is no longer used for anything.
2010-01-12 14:48:23 -08:00
Volker Lendecke
0f8e2a6ebb Revert "s3: Move the global variable Protocol to struct smbd_server_connection"
This reverts commit c85a4c9ba4.
2009-11-23 16:34:59 +01:00
Volker Lendecke
c85a4c9ba4 s3: Move the global variable Protocol to struct smbd_server_connection 2009-11-21 20:49:17 +01:00
Stefan Metzmacher
e621b7a52e s3:smbd: add a generic smbd_dirptr_lanman2_entry() function
This can we used by SMB2, the key difference between
SMB1 and SMB2 is that with SMB2 entries are aligned
to 8 bytes and there's no padding at the end of the last entry.

metze
2009-08-19 22:12:42 +02:00
Stefan Metzmacher
b70ae644ed s3:smbd: make smbd_check_open_rights() function non-static for use in SMB2
metze
2009-08-19 19:28:24 +02:00
Stefan Metzmacher
47452b8cec s3:smbd: add smbd_notify_cancel_by_smbreq()
This function will be used by the SMB2 notify code.

metze
2009-08-17 09:25:45 +02:00
Stefan Metzmacher
d60f049eaf s3:smbd: implement SMB2 Cancel correctly.
metze
2009-08-17 09:25:45 +02:00
Jeremy Allison
6a0c2946be Fix BASE-DELAYWRITE test by removing const from struct smb_filename
in smbd_do_qfilepathinfo(). update_stat_ex_mtime() modifies the
stat struct inside the smb_fname so don't make a copy of that
stat struct, use it directly - it's meant to be updated and
represent the state of the file we're returning.
Jeremy.
2009-08-12 15:08:23 -07: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
Stefan Metzmacher
59c3f5e3ca s3:smbd: move dptr globals into struct smbd_server_connection
metze
2009-08-07 14:18:17 +02:00
Stefan Metzmacher
daa71c4236 s3:smbd: add generic smbd_dirptr_get_entry()
metze
2009-08-07 14:18:15 +02:00
Tim Prouty
4b42927ec3 s3: Convert some callers of vfs_stat_smb_fname to SMB_VFS_STAT() 2009-07-22 09:51:17 -07:00
Stefan Metzmacher
ed99bf7317 s3:smbd: make smbd_do_qfsinfo() non static for use in SMB2 GetInfo
metze
2009-07-13 14:13:06 +02:00
Stefan Metzmacher
7d735519d7 s3:smbd: make smbd_do_setfilepathinfo() non static for use in SMB2 SetInfo
metze
2009-07-13 11:18:59 +02:00
Stefan Metzmacher
0ba532e1b2 s3:smbd: make smbd_do_qfilepathinfo() non static for use in SMB2
metze
2009-07-12 16:55:22 +02:00
Stefan Metzmacher
8d534d45a5 s3:smbd: make smbd_do_locking() non static
metze
2009-07-10 12:24:24 +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
f62a331045 s3:smbd: move global notify_changes_by_mid to smbd_server_connection
metze
2009-07-02 09:10:58 +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
c0b64051d3 s3:smbd: more validation of the incoming SMB2 requests
metze
2009-06-09 19:51:02 +02:00
Stefan Metzmacher
76acd7bfad s3:smbd: keep the chain_fsp for SMB2 requests
metze
2009-06-05 20:17:43 +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
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
cfc8d4a1f4 s3:smbd: add smbd_smb2_fake_smb_request()
metze
2009-06-03 17:54:39 +02:00
Stefan Metzmacher
0099f4758e s3:smbd: create a connection_struct in SMB2 Tree Connect
metze
2009-06-03 17:54:38 +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
c862018008 s3:smbd: move tcon specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:38 +02:00
Stefan Metzmacher
75d03970b7 s3:smbd: move more session specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
356f0336e5 s3:smbd: move some session specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
f554af1871 s3:smbd: move already_got_session to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
d9843b3db4 s3:smbd: move max_recv to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
e16e7146b3 s3:smbd: move negprot related globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Stefan Metzmacher
f20ded603b s3:smbd: move pending_auth_data list to struct smbd_server_connection
metze
2009-06-03 17:54:36 +02:00
Stefan Metzmacher
52f2f9449f s3:smbd: remove unused global 'orig_inbuf'
metze
2009-05-26 16:36:25 +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
1f59788516 s3:smbd: implement SMB2 Logoff
metze
2009-05-22 10:28:37 +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
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
4abd5f34d9 s3:smbd: add support for SMB2 Keepalive (SMB2 Echo)
metze
2009-05-20 15:43:00 +02:00
Stefan Metzmacher
d7d73b08e9 s3:smbd: allow SMB 2.002 dialect in SMB1 negprot
We create a dummy SMB2 Negotiate inbuf and pass the
connection to the SMB2 engine.

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
c14dd15c6a s3:smbd: make negprot_spnego() non static
metze
2009-05-20 15:42:58 +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
Stefan Metzmacher
c16c90a1cb s3:smbd: use new simplified snb_signing code in the server
We keep the seqnum/mid mapping in the smb_request structure.

This also moves one global variable into the
smbd_server_connection struct.

metze
2009-03-23 12:21:13 +01:00
Stefan Metzmacher
52f6a4436f s3:smbd: make kernel oplocks event driven
And use signal events for Linux oplocks.

metze
2009-01-27 15:28:10 +01:00
Stefan Metzmacher
b8c416fe2a s3:smbd: convert aio to use tevent_signal
metze
2009-01-27 15:28:09 +01:00
Stefan Metzmacher
ac61f650ae s3:smbd: use signal events for SIGTERM, SIGHUP and SIGCHLD
metze
2009-01-27 15:28:07 +01:00
Stefan Metzmacher
196028ab7b s3:smbd: restructure kernel oplocks code
This converts the irix oplocks code to use a fd event
and removes the last special case for file descriptors
for the main sys_select().

metze
2009-01-22 12:37:29 +01:00
Stefan Metzmacher
aeb798c325 s3:smbd: handle incoming smb requests via event handlers
We use a fd event and receive incoming smb requests
when the fd becomes readable. It's not completely
nonblocking yet, but it should behave like the old code.

We use timed events to trigger retries for deferred open calls.

metze
2009-01-09 08:45:40 +01:00
Stefan Metzmacher
3dde0cbb76 s3:smbd: move all globals and static variables in globals.[ch]
The goal is to move all this variables into a big context structure.

metze
2009-01-08 12:22:21 +01:00