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

7567 Commits

Author SHA1 Message Date
Michael Adam
63ac88d402 s3:smbd: remove code duplication in smb2_create_send()
Move the calls to smb2srv_open_recreate() from the parsing of
the create blobs (DHNC and DH2C) to a central place in the
open execution phase.
This is also where it should be called: in the durable reconnect
part, right before the call to SMB_VFS_DURABLE_RECONNECT()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-06-04 11:07:11 -07:00
Michael Adam
e6beae4471 s3:smbd: remove old comment about scavenger timer from vfs_default_durable_reconnect()
scavenger functionality belongs to the smb layer (and is meanwhile
implemented there).

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-06-04 11:07:11 -07:00
David Disseldorp
002d1a4467 Fix bug 9900: is_printer_published GUID retrieval
Samba currently always responds to GetPrinter(level = 7) requests with
DSPRINT_UNPUBLISH, regardless of the AD publish status tracked via the
PRINTER_ATTRIBUTE_PUBLISHED flag. This is due to erroneous "objectGUID"
unmarshalling in is_printer_published().

This change splits "objectGUID" retrieval into a separate function, and
adds a pull_reg_sz() call to correctly unmarshall the GUID.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2013-06-03 14:10:07 +02:00
Andrew Bartlett
cbb833d78e smbd: Fix build on platforms that will not support var = {} initialisation
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2013-05-27 11:57:00 +10:00
Richard Sharpe
bea2af9369 Revert my accidental commit.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>

Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Thu May 23 06:53:17 CEST 2013 on sn-devel-104
2013-05-23 06:53:17 +02:00
Richard Sharpe
27df444d0b Make sure that if an smbd is exiting because of an error we let the user know.
Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-21 23:16:59 -07:00
Volker Lendecke
7d8a1b1e04 smbd: Remove a pointless variable
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue May 14 13:19:44 CEST 2013 on sn-devel-104
2013-05-14 13:19:44 +02:00
Jeremy Allison
cbff488550 Remove the compound_related_in_progress state from the smb2 global state.
And also remove the restriction that we can't read a new
request whilst we're in this state.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@samba.org>
2013-05-07 17:58:45 +02:00
Jeremy Allison
10cbcfd167 The core of the fix to allow opens to go async inside a compound request.
This is only allowed for opens that cause an oplock break, otherwise it
is not allowed. See [MS-SMB2].pdf note <194> on Section 3.3.5.2.7.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-07 17:58:45 +02:00
Jeremy Allison
1102e73832 Move a variable into the area of code where it's used.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-07 17:58:45 +02:00
Jeremy Allison
a026fc6b69 Ensure we don't try and cancel anything that is in a compound-related request.
Too hard to deal with splitting off the replies.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-07 17:58:45 +02:00
Jeremy Allison
4111fcfd4f Only do the 1 second delay for sharing violations for SMB1, not SMB2.
Match Windows behavior.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2013-05-07 17:58:45 +02:00
Jeremy Allison
d25ba3f5a6 Allow "store dos attributes" to override the other "map XXX" parameters.
Makes us consistent with what is described in the man pages.

Signed-off-by: Jeremy Allison <jra@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-06 23:37:20 +02:00
Anand Avati
7e807934e6 check_parent_exists() can change errno. Ensure we preserve it across calls.
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 30 11:00:11 CEST 2013 on sn-devel-104
2013-04-30 11:00:11 +02:00
Jeremy Allison
251767cde9 Fix bug #9822 - Samba crashing during Win8 sync.
When refactoring the dptr desctructor in the
fix for bug:

9778 (Samba directory code uses dirfd() without vectoring through a VFS call)

I removed the code to NULL out the struct smb_Dir *
pointer inside the fsp struct by mistake.

Re-add the NULLing out of that pointer when
closing a directory pointer associated with
an open file.

Reporter confirms it fixes the crash.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Sat Apr 27 20:44:55 CEST 2013 on sn-devel-104
2013-04-27 20:44:55 +02:00
Jeremy Allison
5185460067 Check for WRITE_ACCESS on the file before overriding an EACCESS.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Apr 27 15:57:17 CEST 2013 on sn-devel-104
2013-04-27 15:57:17 +02:00
Jeremy Allison
77e3099483 Ensure we don't try the open_file_fchmod() if we can't write to the file.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-04-27 14:11:10 +02:00
Jeremy Allison
a91aac4a5f Remove indentation around code wrapped by unneeded CAN_WRITE.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-04-27 14:11:05 +02:00
Jeremy Allison
0d88b37fc6 Add early return in file_set_dosmode() on a read only share.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-04-27 14:10:52 +02:00
Volker Lendecke
8283fd0e00 smbd: Do not fetch the record in defer_open_done
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 27 02:06:10 CEST 2013 on sn-devel-104
2013-04-27 02:06:10 +02:00
Volker Lendecke
a7e803485d smbd: We don't use DEFERRED_OPEN_ENTRY anymore
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:22 -07:00
Volker Lendecke
8da5a0f1e3 smbd: Remove unused smb2_deferred_open_timer
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:22 -07:00
Volker Lendecke
78d4bdc0b8 smbd: Obsolete MSG_SMB_OPEN_RETRY
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:22 -07:00
Volker Lendecke
f52a3c3cd1 smbd: Remove the unused fsp->pending_break_messages array
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:22 -07:00
Volker Lendecke
3e7923d7af smbd: Remove unused reply_to_oplock_break_requests
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:22 -07:00
Volker Lendecke
234edb525d smbd: Obsolete MSG_SMB_BREAK_RESPONSE
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:21 -07:00
Volker Lendecke
4e4376164b smbd: Ignore OPEN_RETRY and BREAK_RESPONSE
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:21 -07:00
Volker Lendecke
afe9446985 smbd: Use dbwrap_record_watch_send for defer_open
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:21 -07:00
Jeremy Allison
5727bfa410 Fix bug in old create temp SMB request. Only use VFS functions.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Sat Apr 20 21:13:36 CEST 2013 on sn-devel-104
2013-04-20 21:13:36 +02:00
Jeremy Allison
95f7fc83b2 Ensure the RECVFILE path in vfs_pwrite_data() operates on a blocking socket.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 20 01:04:05 CEST 2013 on sn-devel-104
2013-04-20 01:04:05 +02:00
Jeremy Allison
1ed710c2ff Ensure the RECVFILE path in vfs_write_data() operates on a blocking socket.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:27 -07:00
Jeremy Allison
1a7cec37e7 Add the internals of is_smb2_recvfile_write.
This turns on the real receivefile detection, and completes
the receivefile code path changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:19 -07:00
Jeremy Allison
53b87f2fba The guts of the receivefile code changes.
If an incoming PDU might qualify, only read
SMBD_SMB2_SHORT_RECEIVEFILE_WRITE_LEN = (SMB2_HEADER + SMB2_WRITE_BODY_LEN)
bytes rather than the whole PDU.

Next time we're called, use is_smb2_recvfile_write() to decide if
this is an SMB2_WRITE that fit the receivefile criteria, otherwise
just read the rest of the PDU.

If we did do a short receivefile read, set up the smb2_req->smb1req->unread_bytes
value to show what bytes remain in the TCP buffers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:15 -07:00
Jeremy Allison
fdcaf0fa36 Add stub static function that will turn on/off receivefile code path.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:11 -07:00
Jeremy Allison
4b91097002 Add extra fields into struct smbd_smb2_request_read_state to support receivefile.
Initialize min_recv_size with the size that will trigger the
receivefile write path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:07 -07:00
Jeremy Allison
36d4b9d208 Add macro SMBD_SMB2_SHORT_RECEIVEFILE_WRITE_LEN.
This is the 'short' length we'll read in the SMB2_WRITE receivefile
code path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:03 -07:00
Jeremy Allison
61da7f00b3 Add utility function get_min_receive_file_size().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:11:00 -07:00
Jeremy Allison
63739440f1 Allow smbd_smb2_request_error_ex() to cope with unread bytes on error.
Drain the socket if a RECVFILE write failed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:10:55 -07:00
Jeremy Allison
a36d7633bd Add function smbd_smb2_unread_bytes().
Returns number of bytes left to read for recvfile. Will be
used in SMB_2_WRITE_FILE code path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:10:51 -07:00
Jeremy Allison
ec9fc986da If we already have an smb1req attached to the struct smbd_smb2_request, don't recreate it.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:10:47 -07:00
Jeremy Allison
9791c1a248 Ensure we don't do an SMB2 aio write if RECVFILE is active.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:10:14 -07:00
Matthieu Patou
aad5eeb9b4 fileserver: raise the debug level for share connection from non IPC to 2
So that logs of make test are not spamed, the code dates from 1999 maybe
at that moment we wanted to have some warning I think nodays it's pretty
stable.

Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-19 12:27:56 -07:00
Christian Ambach
165b7aa586 s3:smbd stop working on a dead client socket
when the client has already disconnected, exit server as done
in other paths in smbd_process

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-04-19 13:16:38 +02:00
Christian Ambach
58275be0eb s3:smbd increase a loglevel
do not complain too loudly if the socket has already gone

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-04-19 13:16:38 +02:00
Volker Lendecke
5aa9e552ec smbd: Fix signing when the async echo handler kicks in
This was introduced as a copy&paste error in 5e0258fc93

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
2013-04-19 13:16:38 +02:00
Michael Adam
31714c9784 s3:smbd:smb2:scavenger: fix format error for debugging open_persistent_id in scavenger_timer()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr 19 01:36:15 CEST 2013 on sn-devel-104
2013-04-19 01:36:15 +02:00
Gregor Beck
c2ef5182e3 s3:smbd: call scavenger_schedule_disconnected() from close normal file for durable handles
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-04-18 13:15:13 +02:00
Gregor Beck
1ed22ba4b7 s3:smbd: add a scavenger process for disconnected durable handles
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-04-18 13:15:13 +02:00
Gregor Beck
941e84dcfe s3:smbXsrv_open: add function smbXsrv_open_cleanup()
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-04-18 13:15:11 +02:00
Gregor Beck
9d47dc8958 s3:smbXsrv_open: factor out smbXsrv_open_global_parse_record
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-04-18 13:15:11 +02:00