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

7180 Commits

Author SHA1 Message Date
Jeremy Allison
b70f23c2b5 Correctly check for errors in strlower_m() returns. 2012-08-09 12:08:18 -07:00
Jeremy Allison
c13887defc Check error returns on strnorm(). 2012-08-09 12:07:32 -07:00
Jeremy Allison
526e875cec Check error returns from strupper_m() (in all reasonable places). 2012-08-09 12:06:54 -07:00
Stefan Metzmacher
0d7b17f4db s3:smb2_sesssetup: setup global->[en|de]cryption_key
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Aug  9 09:59:02 CEST 2012 on sn-devel-104
2012-08-09 09:59:02 +02:00
Stefan Metzmacher
0cb11efa87 s3:smb2_read: don't try sendfile if encryption is used
metze
2012-08-09 08:21:35 +02:00
Stefan Metzmacher
a0cf42b709 s3:smb2_server: add smbd_smb2_request->do_encryption
For now it's always false...

metze
2012-08-09 08:21:35 +02:00
Stefan Metzmacher
95e4270813 s3:smb2_tcon: set global->encryption_required and enforce it
This the account or client doesn't support encryption we should
reject the tree connect.

metze
2012-08-09 08:21:35 +02:00
Stefan Metzmacher
64dce26533 s3:smb2_sesssetup: set global->encryption_required and enforce it
This the account or client doesn't support encryption we should
reject the session setup.

metze
2012-08-09 08:21:35 +02:00
Stefan Metzmacher
b5a72f4f35 s3:smb2_server: check the session before we could response with an error.
metze
2012-08-09 08:21:35 +02:00
Stefan Metzmacher
f15d9a6670 s3:smb2_server: do central file_id check if the operation requires it
Note that it's fine to call file_fsp_smb2() twice, the 2nd call
just returns smb2req->compat_chain_fsp without a 2nd lookup.

metze
2012-08-09 08:21:35 +02:00
Stefan Metzmacher
1c76e99ae4 s3:smb2_server: s/i/idx in smbd_smb2_request_pending_queue()
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Aug  8 17:32:26 CEST 2012 on sn-devel-104
2012-08-08 17:32:26 +02:00
Stefan Metzmacher
83d262088b s3:smb2_server: make use of SMBD_SMB2_OUT_HDR_PTR() in smbd_smb2_request_pending_queue()
metze
2012-08-08 12:52:52 +02:00
Stefan Metzmacher
0067de2074 s3:smb2_server: remove useless variable 'i'
metze
2012-08-08 12:52:51 +02:00
Stefan Metzmacher
63d92a192d s3:smb2_server: rewrite dup_smb2_vec3() using SMBD_SMB2_*_IOV_OFS and helper variables
metze
2012-08-08 12:52:51 +02:00
Stefan Metzmacher
fc8e3bd569 s3:smb2_server: make use of SMBD_SMB2_* macros in smbd_smb2_request_done_ex()
metze
2012-08-08 12:52:51 +02:00
Stefan Metzmacher
97b5aaa648 s3:smb2_server: make use of SMBD_SMB2_* macros in smbd_smb2_request_verify_sizes()
metze
2012-08-08 12:52:50 +02:00
Stefan Metzmacher
05ae95a0d5 s3:smb2_server: use the common buffer layout for smbd_smb2_request_pending*
metze
2012-08-08 12:52:50 +02:00
Stefan Metzmacher
644eab32af s3:smb2_read: use SMBD_SMB2_NUM_IOV_PER_REQ when checking for sendfile() support
metze
2012-08-08 12:52:50 +02:00
Stefan Metzmacher
2b9dd9049e s3:smb2_read: fix indentation in schedule_smb2_sendfile_read()
metze
2012-08-08 12:52:50 +02:00
Stefan Metzmacher
9f51d610d2 s3:smb2_server: don't try to update req->in.vector[0] in smbd_smb2_request_pending_queue()
req->in.vector[0] is reserved for the transport and might be removed in future.
This is currently always { NULL, 0 }, as it's not used, by our
transport layer code. The SMB2 layer should never touch this!

metze
2012-08-08 12:50:22 +02:00
Stefan Metzmacher
6bfdca4786 s3:smb2_sesssetup: remove unused code in smbd_smb2_reauth_generic_return()
A reauth exchange is already signed, with the channel signing key.

metze
2012-08-08 05:37:49 +02:00
Stefan Metzmacher
5f7d786b08 s3:smb2_sesssetup: remove TALLOC_FREE(session) from smbd_smb2_[re]auth_generic_return
The caller does this via the smbd_smb2_session_setup_state_destructor()

metze
2012-08-08 05:37:49 +02:00
Stefan Metzmacher
c9ecfd6f3d s3:smb2_server: sign the last request at the start of smbd_smb2_request_reply()
This means we correctly sign all responses in a compound chain.

metze
2012-08-08 05:13:42 +02:00
Volker Lendecke
64c0367335 s3: Fix a crash in reply_lockingX_error
A timed brlock with 2 locks comes in and the second one blocks,
file is closed. smbd_cancel_pending_lock_requests_by_fid sets
blr->fsp to NULL. reply_lockingX_error (called via
MSG_SMB_BLOCKING_LOCK_CANCEL) deferences blr->fsp because
blr->lock_num==1 (the second one blocked).

This patch fixes the bug by only undoing the locks if fsp!=NULL.
fsp==NULL is the close case where everything is undone anyway.

Thanks to Peter Somogyi, somogyi@hu.ibm.com for this bug report.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug  8 04:12:04 CEST 2012 on sn-devel-104
2012-08-08 04:12:04 +02:00
Stefan Metzmacher
c3016915a1 s3:smb2_server: fix SMB2 signing of compound responses
We need to defer the signing until we know the response
doesn't change anymore before it goes over the wire.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Aug  7 20:29:30 CEST 2012 on sn-devel-104
2012-08-07 20:29:30 +02:00
Stefan Metzmacher
40f771e010 s3:smb2_server: there's no need to copy req->out.vector when we just keep the last request
metze
2012-08-07 18:32:47 +02:00
Stefan Metzmacher
8d63efe273 s3:smb2_server: use memmove instead of copying single vector elements
metze
2012-08-07 18:32:47 +02:00
Stefan Metzmacher
9b8973d3b5 s3:smb2_server: make use of SMBD_SMB2_OUT_HDR_PTR() smbd_smb2_request_pending_queue()
metze
2012-08-07 18:32:46 +02:00
Stefan Metzmacher
bfc87a4a76 s3:smb2_server: check for compound based on SMBD_SMB2_NUM_IOV_PER_REQ
metze
2012-08-07 18:32:46 +02:00
Stefan Metzmacher
5730272690 s3:smb2_server: make use of SMBD_SMB2_OUT_*_IOV smbd_smb2_request_reply()
metze
2012-08-07 18:32:46 +02:00
Stefan Metzmacher
727b1d1fa8 s3:smb2_server: check for compound based on SMBD_SMB2_NUM_IOV_PER_REQ
metze
2012-08-07 18:32:45 +02:00
Stefan Metzmacher
2da62179de s3:smb2_server: make use of SMBD_SMB2_*_IOV_OFS
metze
2012-08-07 18:32:45 +02:00
Stefan Metzmacher
d609bb9b42 s3:smb2_server: make use of helper macros in smb2_calculate_credits()
metze
2012-08-07 18:32:45 +02:00
Stefan Metzmacher
efaea8e0e1 s3:smb2_server: make use of helper macros in smbd_smb2_request_validate()
metze
2012-08-07 18:32:45 +02:00
Stefan Metzmacher
4e6e1ecb6e s3:smb2_server: make use of SMBD_SMB2_NUM_IOV_PER_REQ
metze
2012-08-07 18:32:44 +02:00
Stefan Metzmacher
337604a0cf s3:smb2_server: add some more SMBD_SMB2_* defines/macros
metze
2012-08-07 18:32:44 +02:00
Rusty Russell
3bb65aa159 source3/smbd/conn.c: wean off string_set/string_free
Use straight talloc strings.  This is the only user outside loadparm.c.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2012-08-07 23:20:05 +10:00
Stefan Metzmacher
e7bf8e7e23 s3:smb2_server: do one central as_root check if the operation requires it
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Aug  7 13:14:38 CEST 2012 on sn-devel-104
2012-08-07 13:14:38 +02:00
Stefan Metzmacher
eec941e411 s3:smb2_server: do one central tcon check if the operation requires it
metze
2012-08-07 11:16:37 +02:00
Stefan Metzmacher
59b9dfa0cb s3:smb2_server: do one central session check if the operation requires it
metze
2012-08-07 11:16:37 +02:00
Stefan Metzmacher
aba6df9f55 s3:smb2_server: add and use smbd_smb2_call()
metze
2012-08-07 11:16:37 +02:00
Stefan Metzmacher
e01333242f s3:smb2_server: add .as_root to smbd_smb2_dispatch_table
metze
2012-08-07 11:16:36 +02:00
Stefan Metzmacher
f69ed57d0f s3:smb2_server: add .need_tcon to smbd_smb2_dispatch_table
metze
2012-08-07 11:16:36 +02:00
Stefan Metzmacher
46f7a60e78 s3:smb2_server: add .need_session to smbd_smb2_dispatch_table
metze
2012-08-07 11:16:36 +02:00
Stefan Metzmacher
357110c10b s3:smb2_server: introduce a smbd_smb2_dispatch_table (for now just with names)
metze
2012-08-07 11:16:36 +02:00
Stefan Metzmacher
5ac4d3d274 s3:smb2_server: move 'conn' to main block of smbd_smb2_request_dispatch()
metze
2012-08-07 11:16:36 +02:00
Andrew Bartlett
f06c216d0b s3-pysmbd: Try opening as a file, then as a directory
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Aug  7 08:59:21 CEST 2012 on sn-devel-104
2012-08-07 08:59:21 +02:00
Andrew Bartlett
e571d5c03e s3-pysmbd: Use talloc_zero()
This avoids operating on uninitialised data

Andrew Bartlett
2012-08-07 14:57:33 +10:00
Andrew Bartlett
227d490477 s3-pysmbd: Add talloc_stackframe() to smbd_set_simple_acl wrapper 2012-08-07 14:57:07 +10:00
Stefan Metzmacher
721096b1ad s3:smb2_server: make use of smbd_smb2_inbuf_parse_compound() in smbd_smb2_request_read*()
This changes the way we read SMB2 traffic from the socket,
now as create just one large buffer for the whole NBT payload
and then split it into iovec elements in smbd_smb2_inbuf_parse_compound()

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Aug  6 21:54:35 CEST 2012 on sn-devel-104
2012-08-06 21:54:35 +02:00
Stefan Metzmacher
fbd663c143 s3:smb2_server: make use of smbd_smb2_inbuf_parse_compound() in smbd_smb2_request_create()
metze
2012-08-06 20:02:32 +02:00
Stefan Metzmacher
9e9d784def s3:smb2_server: remove const from smbd_smb2_first_negprot()
metze
2012-08-06 20:02:32 +02:00
Stefan Metzmacher
c1b3454259 s3:smb2_server: add smbd_smb2_inbuf_parse_compound()
metze
2012-08-06 20:02:32 +02:00
Stefan Metzmacher
1c7bd2b71c s3:smbd: remove unused variable in sesssetup.c
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Aug  5 23:09:06 CEST 2012 on sn-devel-104
2012-08-05 23:09:06 +02:00
Stefan Metzmacher
4384b1e73b s3:smb2_server: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:41 +02:00
Stefan Metzmacher
47c67f2eac s3:smb2_ioctl: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:40 +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
e67d07f639 s3:smb2_setinfo: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:40 +02:00
Stefan Metzmacher
9c58a0a870 s3:smb2_getinfo: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:40 +02:00
Stefan Metzmacher
e9a21e5c8b s3:smb2_negprot: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:39 +02:00
Stefan Metzmacher
f28b2ac65a s3:smb2_write: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:38 +02:00
Stefan Metzmacher
f08e478d2f s3:smb2_tcon: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:37 +02:00
Stefan Metzmacher
6e9a65ded3 s3:smb2_create: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:37 +02:00
Stefan Metzmacher
926379ae79 s3:smb2_find: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:36 +02:00
Stefan Metzmacher
559742f45f s3:smb2_sesssetup: make use of SMBD_SMB2_* macros
metze
2012-08-05 20:55:36 +02:00
Stefan Metzmacher
048c8d3db4 s3:smb2_glue: make use of SMBD_SMB2_IN_HDR_PTR()
metze
2012-08-05 20:55:36 +02:00
Stefan Metzmacher
8cf817d7fd s3:smb2_read: make use of SMBD_SMB2_IN_BODY_PTR()
metze
2012-08-05 20:55:35 +02:00
Stefan Metzmacher
121dbd6210 s3:smb2_notify: make use of SMBD_SMB2_IN_*_PTR()
metze
2012-08-05 20:55:35 +02:00
Stefan Metzmacher
88a34026f5 s3:smb2_flush: make use of SMBD_SMB2_IN_BODY_PTR()
metze
2012-08-05 20:55:35 +02:00
Stefan Metzmacher
52805c4169 s3:smb2_close: make use of SMBD_SMB2_IN_BODY_PTR()
metze
2012-08-05 20:55:34 +02:00
Stefan Metzmacher
21742c3693 s3:smb2_break: make use of SMBD_SMB2_IN_BODY_PTR()
metze
2012-08-05 20:55:34 +02:00
Stefan Metzmacher
7ee54cd9c4 s3:smbd: add helper macros to access smb2req->{in,out}.vector[]
For SMB3 encryption we need to change the vector layout
and we better hide this behind some central macros.

metze
2012-08-05 20:55:34 +02:00
Stefan Metzmacher
7327310754 s3:smb2_server: use 'i' instead of '1' as vector index in smbd_smb2_request_pending_timer()
If we reach this code i is currently always 1, but it's easier to unstand this
way.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Aug  5 20:00:26 CEST 2012 on sn-devel-104
2012-08-05 20:00:26 +02:00
Stefan Metzmacher
1a0c40f537 s3:smb2_lock: remove unused in_smbpid
metze
2012-08-05 16:39:31 +02:00
Stefan Metzmacher
96fa47f56e s3:smb2_write: remove unused in_smbpid
metze
2012-08-05 16:39:31 +02:00
Stefan Metzmacher
056070f395 s3:smb2_read: remove unused in_smbpid
metze
2012-08-05 16:39:30 +02:00
Stefan Metzmacher
401860cab6 s3:smbd: add support for SMB_EXTENDED_SIGNATURES in SMBtconX
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Aug  4 14:28:04 CEST 2012 on sn-devel-104
2012-08-04 14:28:04 +02:00
Stefan Metzmacher
ff75fd9eda s3:smbd: setup the application session key with the first tcon on a session
Look for Server.Session.SessionKeyState in [MS-SMB].
The first SMBtconX sets the state to available, which makes it possible
to protect the session key at that stage, if client and server
support TREE_CONNECT_ANDX_EXTENDED_SIGNATURE.

metze
2012-08-04 12:33:06 +02:00
Stefan Metzmacher
49d0432efd s3:smbd: setup session->global->signing_/application_key during SPNEGO SMB1 session setups
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Aug  4 11:09:42 CEST 2012 on sn-devel-104
2012-08-04 11:09:42 +02:00
Stefan Metzmacher
2265e4633a s3:smbd: setup session->global->signing_/application_key during old SMB1 session setups
metze
2012-08-04 09:10:23 +02:00
Stefan Metzmacher
3d63e4da17 s3:smbd: keep the "application session key" during SMB1 reauth
metze
2012-08-04 09:10:22 +02:00
Stefan Metzmacher
b1a0fda73d libcli/smb: pass hdr/len to smb_signing_check/sign_pdu() and skip the nbt header
metze
2012-08-04 09:10:21 +02:00
Stefan Metzmacher
b1c5efbfea s3:smbd: skip nbt header in srv_check_sign_mac()
metze
2012-08-04 09:10:20 +02:00
Andrew Bartlett
1e5098d5e1 s3-pysmbd: Add hook for get_nt_acl()
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug  2 13:27:55 CEST 2012 on sn-devel-104
2012-08-02 13:27:54 +02:00
Andrew Bartlett
64f494de5e s3-pysmbd: fix DEBUG 2012-08-02 11:35:19 +02:00
Andrew Bartlett
e5686a4cf0 s3-pysmbd: Add my copyright 2012-08-02 11:35:19 +02:00
Andrew Bartlett
55a0d6606c s3-pysmbd: Add set_nt_acl() function based on parts of vfstest
This will allow us to set the full NT ACL on a file, using the VFS
layer, during provision of the AD DC.

Andrew Bartlett
2012-08-02 11:35:19 +02:00
Stefan Metzmacher
b93e6ef5e7 s3:smbd: add a optional_support helper variable to reply_tcon_and_X()
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Aug  1 18:25:26 CEST 2012 on sn-devel-104
2012-08-01 18:25:26 +02:00
Stefan Metzmacher
3fb6549db0 s3:smbd: make use of TCONX_FLAG_DISCONNECT_TID define
metze
2012-08-01 14:17:16 +02:00
Volker Lendecke
d1dccfbda6 s3: Fix Coverity ID 710818 Resource leak
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-07-31 11:40:23 +02:00
Volker Lendecke
2ddc3a280e s3: Fix Coverity ID 710827 Resource leak
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-07-31 11:40:22 +02:00
Volker Lendecke
d2eb26cfbd s3: Make request_timed_out() static
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-07-31 11:40:22 +02:00
Stefan Metzmacher
35c0f164bc s3:smbd: do a clean shutdown during release_ip() after CTDB_SRVID_RELEASE_IP
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul 31 11:33:27 CEST 2012 on sn-devel-104
2012-07-31 11:33:27 +02:00
Stefan Metzmacher
d73b7938bb s3:smbd: use print_sockaddr() instead of client_socket_addr()
We already have a server address in sockaddr_storage format.

Also the name "client_socket" was very miss leading,
as it returns the local address of the socket.

metze
2012-07-31 09:34:21 +02:00
Stefan Metzmacher
13de233fc6 s3:smbd: move smbd_register_ips() next to release_ip()
metze
2012-07-31 09:34:21 +02:00
Andrew Bartlett
b181a0b96b lib/param: Remove use of lp{cfg,}_socket_address outside the NBT client and server
In these other cases, control of the sockets to bind to can be obtained using
"bind interfaces only = yes" and "interfaces = ".

Andrew Bartlett
2012-07-27 17:59:51 +10:00
Stefan Metzmacher
a67daa3aa6 s3:smb2_negprot: return the current system time in the SMB2 NEGPROT response
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul 26 11:56:02 CEST 2012 on sn-devel-104
2012-07-26 11:56:02 +02:00
Stefan Metzmacher
f6592c427d s3:smbd: fix compiler warnings in notify_internal.c
metze
2012-07-26 10:02:07 +02:00
Stefan Metzmacher
df08929d28 s3:smb2_sesssetup: reject SMB2_SESSION_FLAG_BINDING requests
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul 26 02:08:56 CEST 2012 on sn-devel-104
2012-07-26 02:08:56 +02:00
Stefan Metzmacher
859e5be070 s3:smb2_ioctl: fix GUID_compare() check in FSCTL_VALIDATE_NEGOTIATE_INFO
metze
2012-07-25 23:32:18 +02:00