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

1115 Commits

Author SHA1 Message Date
Volker Lendecke
75c6e0e5c7 s3: Lift smbd_server_conn from file_find_di_first 2010-09-28 07:36:17 +02:00
Volker Lendecke
9fc9ff9bfa s3: Remove smbd_server_conn from file_close_user 2010-09-28 07:36:16 +02:00
Volker Lendecke
25ca1cd1a8 s3: Remove smbd_server_conn from file_close_pid 2010-09-28 07:36:16 +02:00
Jeremy Allison
a738f5b846 Small tweak to bugfix for 7698 - Assert causes smbd to panic on invalid NetBIOS session request.
Don't just fail to reply on a bad NBT name, just don't do the
internal action.

Jeremy.
2010-09-27 18:24:53 -07:00
Jeremy Allison
03841f9e44 Fix bug #7698 - Assert causes smbd to panic on invalid NetBIOS session request.
Found by the CodeNomicon test suites at the SNIA plugfest.

http://www.codenomicon.com/

If an invalid NetBIOS session request is received the code in name_len() in
libsmb/nmblib.c can hit an assert.

Re-write name_len() and name_extract() to use "buf/len" pairs and
always limit reads.

Jeremy.
2010-09-26 03:01:03 -07:00
Jeremy Allison
7170b875c2 Thank goodness for code reviews. Volker caught - this should be lp_posix_pathnames()
not lp_unix_extensions().

Jeremy.
2010-09-22 18:34:19 -07:00
Jeremy Allison
314dc23ecf Fix bug #7693 - smbd changing mode of files on rename
When using "map archive", don't change the archive bit on
renames or writes with UNIX extensions turned on.

Jeremy.
2010-09-22 12:26:13 -07:00
Simo Sorce
8ec7aaef48 s3-rpc_server: Moved ncacn_np declarations in common header file.
Signed-off-by: Andreas Schneider <asn@samba.org>
2010-09-15 12:53:42 +02:00
Simo Sorce
5685914344 s3-rpc_server: Convert rpc_connect_spoolss_pipe into a generic interface.
This way we have one common way to open internal pipes whether they
are shortcircuited or piped to an external process.
2010-09-15 12:53:42 +02:00
Volker Lendecke
755ef5cf11 s3: Remove smbd_server_fd() from set_local_machine_name() 2010-08-28 14:06:10 +02:00
Günther Deschner
b5bdcdd65e s3-build: only include "fake_file.h" where needed.
Guenther
2010-08-26 00:20:28 +02:00
Volker Lendecke
1808dd0a85 s3: Make srv_send_smb take an sconn instead of a sock fd 2010-08-24 21:06:41 +02:00
Volker Lendecke
ac7b63384d s3: Lift smbd_server_fd from reload_services() 2010-08-18 11:18:21 +02:00
Volker Lendecke
f8ecec21e2 s3: Remove smbd_server_fd() from read_smb_length() 2010-08-17 22:44:04 +02:00
Volker Lendecke
840b0f523b s3: Move read_smb_length() to smbd/reply.c 2010-08-17 22:44:04 +02:00
Volker Lendecke
7d164498db s3: Lift smbd_server_fd() from read_data()
All callers have appropriate debug messages themselves
2010-08-17 22:44:03 +02:00
Volker Lendecke
40ae8b74b6 s3: Remove smbd_server_fd() from write_data()
This completely removes the DEBUG(0, ..) error message from write_data(). I've
gone through all callers of write_data() and made sure that they have their own
equivalent error message printing.
2010-08-17 12:46:53 +02:00
Volker Lendecke
910e3df7dd s3: Remove smbd_server_fd() from reply_echo 2010-08-16 22:39:23 +02:00
Volker Lendecke
495bb1efb3 s3: Remove smbd_server_fd() from reply_writebraw 2010-08-16 22:39:23 +02:00
Volker Lendecke
36cfc1d145 s3: Remove smbd_server_fd() from send_file_readX 2010-08-16 22:39:23 +02:00
Volker Lendecke
209b3aee1c s3: Remove smbd_server_fd() from send_file_readbraw 2010-08-16 22:39:23 +02:00
Volker Lendecke
cc5f838319 s3: Remove smbd_server_fd() from reply_readbraw_error 2010-08-16 22:39:23 +02:00
Volker Lendecke
59645506a0 s3: Remove smbd_server_fd() from sendfile_short_send 2010-08-16 22:39:23 +02:00
Volker Lendecke
6f85247494 s3: Remove smbd_server_fd() from fake_sendfile 2010-08-16 22:39:23 +02:00
Volker Lendecke
3e28c05e98 s3: Remove smbd_server_fd from netbios_session_retarget 2010-08-16 22:39:22 +02:00
Volker Lendecke
0e12c216dc s3: Remove smbd_server_fd from reply_special 2010-08-16 22:39:17 +02:00
Volker Lendecke
39da717fe1 s3: Lift the smbd_messaging_context from reload_services 2010-08-08 18:09:33 +02:00
Günther Deschner
813fbbd68c s3-build: avoid to globally include printing and spoolss headers.
This shrinks precompiled headers by 3MB and will slightly speed up any build.

Guenther
2010-07-31 00:50:31 +02:00
Simo Sorce
c18913a2c2 s3-smbd: Convert reply_printqueue to use spoolss.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:14 -04:00
Simo Sorce
21cd59e7a5 s3-smbd: Use the right check to test if we can print.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:14 -04:00
Simo Sorce
bdab6b10d2 s3-printing: Moved printing.c headers to include/printing.h.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:14 -04:00
Simo Sorce
849cc65654 s3-smbd: Migrated to new spoolss functions for printing.
Signed-off-by: Jim McDonough <jmcd@samba.org>
2010-07-27 10:27:13 -04:00
Volker Lendecke
b01a41d05b s3: Remove smbd_messaging_context() from smbd_do_locking() 2010-07-05 11:06:27 +02:00
Volker Lendecke
914b1c034f s3: Remove smbd_messaging_context() from rename_open_files() 2010-07-05 11:06:27 +02:00
Volker Lendecke
8da0575507 s3: Remove smbd_messaging_context() from reply_unlock() 2010-07-05 11:06:27 +02:00
Volker Lendecke
9a3f53075e s3: Remove smbd_messaging_context() from reply_lock() 2010-07-05 11:06:27 +02:00
Volker Lendecke
80cc726b4a s3: Remove smbd_messaging_context() from reply_writeunlock() 2010-07-05 11:06:26 +02:00
Volker Lendecke
298da9a0a4 s3: Remove smbd_messaging_context() from reply_lockread() 2010-07-05 11:06:26 +02:00
Volker Lendecke
c7f44801e3 s3: Remove fsp_belongs_conn
check_open_fsp does exactly the same
2010-06-13 15:20:58 +02:00
Volker Lendecke
b90eb7dd69 s3: Remove some leftovers from macros
check_fsp and check_fsp_open used to be macros
2010-06-13 15:04:25 +02:00
Volker Lendecke
dd192bb649 s3: Explicitly pass sconn to is_valid_writeX_buffer 2010-06-12 15:42:52 +02:00
Volker Lendecke
73955a2d92 s3: Explicitly pass sconn to reply_readbraw_error 2010-06-12 15:42:52 +02:00
Volker Lendecke
d5f20aea73 s3: Pass sconn explicitly to reply_special 2010-06-12 15:42:52 +02:00
Volker Lendecke
7223799b6e s3: Remove smbd_server_conn from smbd_do_locking 2010-06-12 15:42:52 +02:00
Volker Lendecke
5005ad2e78 s3: Remove smbd_server_conn from reply_rmdir 2010-06-12 15:42:52 +02:00
Volker Lendecke
0d6f3d64fa s3: Remove smbd_server_conn from reply_writebraw 2010-06-12 15:42:52 +02:00
Volker Lendecke
8f8aac9c2f s3: Remove smbd_server_conn from reply_read_and_X 2010-06-12 15:42:52 +02:00
Volker Lendecke
e16476ac48 s3: Remove smbd_server_conn from send_file_readX 2010-06-12 15:42:52 +02:00
Volker Lendecke
993738d368 s3: Remove smbd_server_conn from reply_read 2010-06-12 15:42:52 +02:00
Volker Lendecke
96acccf261 s3: Remove smbd_server_conn from reply_lockread 2010-06-12 15:42:51 +02:00
Volker Lendecke
fd1891829a s3: Remove smbd_server_conn from reply_readbraw 2010-06-12 15:42:51 +02:00
Volker Lendecke
2826471123 s3: Remove smbd_server_conn from reply_send_file_readbraw 2010-06-12 15:42:51 +02:00
Volker Lendecke
f26b738412 s3: Remove smbd_server_conn from reply_ulogoffX 2010-06-12 15:42:51 +02:00
Volker Lendecke
557aebc327 s3: Remove smbd_server_conn from reply_fclose 2010-06-12 15:42:51 +02:00
Volker Lendecke
96854ec994 s3: Remove smbd_server_conn from reply_search 2010-06-12 15:42:51 +02:00
Volker Lendecke
bf2f2f468c s3: Remove smbd_server_conn from reply_tcon_and_X 2010-06-12 15:42:51 +02:00
Volker Lendecke
0275502b9c s3: Remove smbd_server_conn from reply_tcon 2010-06-12 15:42:51 +02:00
Jeremy Allison
d28fa8faab Rename "allow_smb2" -> "using_smb2" and make the usage clearer. 2010-06-09 19:12:02 -07:00
Günther Deschner
b6a2cea74d s3-security: use shared "Standard access rights.".
Guenther
2010-06-03 11:00:26 +02:00
Volker Lendecke
3e0b2c8c9a s3: Fix some debug messages 2010-05-31 12:04:28 +02:00
Jeremy Allison
7e96db4f50 After talking with Microsoft engineers, the "lock spin time" is
no longer used in SMB2.

Jeremy.
2010-05-19 20:09:08 -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
Simo Sorce
dffeb12f3d smbd: move printfile_offset() within write_file() 2010-04-30 11:52:39 -07:00
Jeremy Allison
e90444319c Carefully label SMB1-specific locking calls.
Jeremy.
2010-04-29 17:08:12 -07:00
Simo Sorce
168b86c384 s3-smbd: group print relate data in own structure 2010-04-23 14:26:33 -07:00
Jeremy Allison
c75184b8a1 Fix issue with aio where r/w lock wasn't kept across aio read operations.
Change schedule_aio_read_and_X/schedule_aio_write_and_X to
return NTSTATUS. Move the grant and release of the lock into
the aio code.

Jeremy
2010-04-05 14:16:21 -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
eb60833a45 Fix bug 7310 - DOS attribute inconsistency with MS Office
On rename we need to set the archive bit on the renamed file.

Jeremy
2010-03-31 10:10:52 -07:00
Jeremy Allison
32c8feab5d Fix for bug #7233 - print fails with jobs >4GB from Win7 clients.
Contains for by Sebastian Kloska <oncaphillis@snafu.de>. Submitter
confirms this fixes the problem.

Jeremy.
2010-03-30 15:27:26 -07:00
Jeremy Allison
1fc5e7a3d6 Revert the part of bug fix #7233 - print fails with jobs >4GB from Win7 clients.
Submitter reports print file corruption after 2GB when SMBwrite etc.
always write at EOF. Still working on the fix.

Jeremy.
2010-03-26 09:32:40 -07:00
Jeremy Allison
66b7fcc8ef Fix bug #7233 - print fails with jobs >4GB from Win7 clients.
Ensure we always write at end-of-file for older write calls.

Jeremy.
2010-03-24 12:47:01 -07:00
Stefan Metzmacher
d663b4c6c0 s3:smbd: disallow readbraw and writebraw if the echo handler is active
metze
2010-03-22 17:15:13 +01:00
Stefan Metzmacher
fbf112bd16 s3:smbd: disable sendfile if the echo handler is active
metze
2010-03-22 17:15:13 +01:00
Stefan Metzmacher
1e7086e5ce s3:smbd: let reply_readbraw_error use the locked socket
metze
2010-03-22 17:15:11 +01:00
Jeremy Allison
367ddc3d1b Fix bug #7234 - Symlink delete fails but incorrectly reports success to client.
Typo called LSTAT instead of STAT in the unlink by pathname path.

Jeremy.
2010-03-10 14:08:30 -08:00
Jeremy Allison
c61c9c3a4c Fix for bug #7189 - Open txt files with notepad on samba shares creates problem.
Ensure we don't use any of the create_options for Samba private
use. Add a new parameter to the VFS_CREATE call (private_flags)
which is only used internally. Renumber NTCREATEX_OPTIONS_PRIVATE_DENY_DOS
and NTCREATEX_OPTIONS_PRIVATE_DENY_FCB to match the S4 code).
Rev. the VFS interface to version 28.

Jeremy.
2010-03-05 15:13:37 -08:00
Steven Danneman
cb0ea27369 s3/smbd: change locking behavior when "lock spin time = 0".
The "lock spin time" parameter mimics the following Windows
setting which by default is 250ms in Windows and 200ms in Samba.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\LockViolationDelay

When a client sends repeated, non-blocking, contending BRL requests
to a Windows server, after the first Windows starts treating these
requests as timed blocking locks with the above timeout.

As an efficiency, I've changed the behavior when this setting is 0,
to skip this logic and treat all requests as non-blocking locks.

This gives the smbd server behavior similar to the 3.0 release with
the do_spin_lock() implementation.

I've also changed the blocking lock parameter in the call from
push_blocking_lock_request() to true as all requests made in this
path are blocking by definition.
2010-02-12 21:29:00 -08:00
Jeremy Allison
ce8dcbe91b Fix bug #7033 - SMBrmdir call always returns true, even on failure to delete a directory.
There is a codepath missing to propagate back error returns from the rmdir
POSIX call inside close_directory when delete on close is set. This means doing
an rmdir on a Windows command line will always report success, even when the
directory was not deleted. This fix adds that codepath back into Samba.

Jeremy.
2010-01-12 16:50:40 -08:00
Jeremy Allison
74deee3cc9 Rename reply_doserror() -> reply_force_doserror().
Rewrite all calls to reply_nterror(NT_STATUS_DOS()) to
reply_force_doserror() and update the comment in smbd/error.c

Jeremy.
2009-12-21 11:16:38 -08:00
Jeremy Allison
642101ac23 Remove all calls to reply_doserror - turn them into
correct reply_nterror calls. Next rename reply_doserror ->
reply_force_doserror and plumb in when NT_STATUS_DOS is
used.
Jeremy.
2009-12-21 11:05:25 -08:00
Jeremy Allison
0dd8c8a6ff reply_doserror() doesn't force DOS errors on the wire.
Start migrating uses of reply_doserror() to reply_nterror() with the
correct mapping. Eventually we'll get to the point where we can
change reply_doserror() to force a DOS error code on the wire,
and can change calls to reply_nterror(req, NT_STATUS_DOS()) - which *does*
force DOS errors on the wire - to reply_doserror(). Which might
actually make the server code look like it's making sense.

Jeremy.
2009-12-18 14:25:39 -08:00
Jeremy Allison
32915ceefc Make Samba3 pass the RAW-LOCK test as Windows.
Implement the win7 NT_STATUS_INVALID_LOCK_RANGE.
Make smbd behave as Windows does in canceling locks.

Jeremy.
2009-12-04 14:04:08 -08:00
Jeremy Allison
91e0bdd86c Refactor reply_rmdir to use handle based code. All
calls are now handle based. Put rmdir into close.c
and make it private.
Jeremy.
2009-12-03 13:01:10 -08:00
Jeremy Allison
dfcc4115dd Remove unneeded argument from can_set_delete_on_close(). Ensure
can_set_delete_on_close() is correctly called before any setting
of the disposition bit (clean up the do_unlink() call).
Jeremy.
2009-12-02 18:06:40 -08:00
Volker Lendecke
a1a81ef785 Revert "s3: Make the implicit reference to Protocol in mask_match() explicit"
This reverts commit e23d8a3d1f.
2009-11-23 16:35:00 +01:00
Volker Lendecke
5c4885a26b Revert "s3: Make the implicit reference to Protocol in is_in_path() explicit"
This reverts commit f7b4151a64.
2009-11-23 16:35:00 +01:00
Volker Lendecke
7930206f5c Revert "s3: Make the implicit reference to get_Protocol in lp_use_sendfile() explicit"
This reverts commit 6a14902297.
2009-11-23 16:34:59 +01: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
Volker Lendecke
6a14902297 s3: Make the implicit reference to get_Protocol in lp_use_sendfile() explicit 2009-11-21 20:49:17 +01:00
Volker Lendecke
f7b4151a64 s3: Make the implicit reference to Protocol in is_in_path() explicit 2009-11-21 20:49:17 +01:00
Volker Lendecke
e23d8a3d1f s3: Make the implicit reference to Protocol in mask_match() explicit 2009-11-21 20:49:16 +01:00
Volker Lendecke
5a1606269a s3: Tune if-conditions in a very hot codepath
This looks innocent, but it is visible in a netbench run.  Due to boolean
short-circuiting we don't have to execute the conditions on the right-hand side
of the &&. So putting the less likely condition left gains a bit.
2009-11-21 12:15:39 +01:00
Volker Lendecke
f6650f5d19 s3: Do not talloc in readdir
This is a hot codepath (called from the stat cache)
2009-11-18 23:16:13 +01:00
Jeremy Allison
7407b526e3 Start removing SMB_STRUCT_STAT variables except for
the directory enumeration code (which needs it).
Jeremy.
2009-11-17 16:06:08 -08:00
Jeremy Allison
a770caed0f Remove "store create time" code, cause create time to be stored
in the "user.DOSATTRIB" EA. From the docs:
In Samba 3.5.0 and above the "user.DOSATTRIB" extended attribute has been extended to store
the create time for a file as well as the DOS attributes. This is done in a backwards compatible
way so files created by Samba 3.5.0 and above can still have the DOS attribute read from this
extended attribute by earlier versions of Samba, but they will not be able to read the create
time stored there. Storing the create time separately from the normal filesystem meta-data
allows Samba to faithfully reproduce NTFS semantics on top of a POSIX filesystem.
Passes make test but will need more testing.
Jeremy.
2009-11-17 14:55:02 -08:00
Jeremy Allison
a2a8dc515c Don't overwrite a dynamic pointer with the address of a stack
variable.
Jeremy.
2009-11-16 14:55:21 -08:00
Jeremy Allison
c99dd5c23e Got the logic simplification worked out so we still pass
BASE-DELAYWRITE and also RAW-CLOSE.
Jeremy.
2009-11-05 22:58:12 -08:00
Jeremy Allison
977fa4e377 Revert commit "0551284dc08eb93ef7b2b2227a45e5ec21d482fb" - simplify
the logic. This was incorrect (I'll revisit this tomorrow).
Jeremy.
2009-11-05 21:27:25 -08:00
Jeremy Allison
0551284dc0 Simplify the logic - remove extraneous argument and calls to set_close_write_time().
We were treating a file time set on close as a sticky write time set, and I don't
think it is. I will add a torture test later to RAW-CLOSE to confirm this.
Jeremy.
2009-11-05 17:40:01 -08:00