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

222 Commits

Author SHA1 Message Date
Michael Adam
bdb80aeb11 s3:smbd:smb2: fix segfault (access after free) in durable disconnect code
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Feb 19 11:12:01 CET 2013 on sn-devel-104
2013-02-19 11:12:01 +01:00
Michael Adam
cfebce3c56 s3:smbd: add debugging to close code (regarding disconnect of a durable)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Feb 18 17:42:45 CET 2013 on sn-devel-104
2013-02-18 17:42:45 +01:00
Stefan Metzmacher
f0e6a9be00 s3:smbd: use smbXsrv_open_close() instead of smbXsrv_open_update()
This makes sure we store the correct disconnect_time for disconnected
durable handles.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-18 15:53:36 +01:00
Björn Baumbach
7a76762c68 s3: make recursive_rmdir function non-static 2012-10-01 17:06:06 +02:00
Michael Adam
f935ebdf7a s3:smbd: initial durable handle support: special treatment of durable handles in close
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
2012-09-08 03:39:06 +02:00
Volker Lendecke
4abccf0b65 s3: Fix a panic when shutting down
When a client disconnects while we have aio open, there is no close
request that cleans up. We can't send out the replies anymore, so
just drop the aio requests that are pending.

Found using the new python lib writing multiple files simultaneously

TODO: check tdis and logoff

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Sep  8 01:27:34 CEST 2012 on sn-devel-104
2012-09-08 01:27:34 +02:00
Jeremy Allison
61cec270c2 Fix unused variable. 2012-07-24 00:09:46 +02:00
Volker Lendecke
8ef968a23d s3-aio: Panic if we try to close a fsp with outstanding aio requests
The core smbd must have taken care of this. If we don't do this properly,
we have a race of the close(2) against a pwrite(2). We might end up
writing to the wrong file.

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 19 03:40:17 CEST 2012 on sn-devel-104
2012-07-19 03:40:17 +02:00
Volker Lendecke
f5dc8837d9 s3: Properly handle shutdown with the _send/_recv based aio
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:37:28 -07:00
Rusty Russell
fe72740e82 loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.
They use talloc_tos() internally: hoist that up to the callers, some
of whom don't want to us talloc_tos().

A simple patch, but hits a lot of files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-07-18 15:07:23 +09:30
Michael Adam
73b200064f s3:util: rename procid_equal() to serverid_equal()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-21 08:27:32 +02:00
Stefan Metzmacher
abcd095847 s3:smbd/close: call del_share_mode() directly before TALLOC_FREE(lck)
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sun Jun  3 21:08:19 CEST 2012 on sn-devel-104
2012-06-03 21:08:19 +02:00
Stefan Metzmacher
f66d88d10a s3:smbd/close: remove unused goto out from close_directory()
metze
2012-06-03 17:23:28 +02:00
Stefan Metzmacher
8751c3f2ef s3:smbd/close: do an early return in close_directory()
metze
2012-06-03 17:23:28 +02:00
Stefan Metzmacher
d792f59aeb s3: Fix an assert to trigger in close_remove_share_mode
In case we have a left-over entry in the share mode entry array,
the SMB_ASSERT(got_tokens) is likely to kick in. It happens when
we are about to delete a file with initial delete on close. We don't
have a delete on close token set in the locking.tdb record. We see
the fsp->initial_delete_on_close set, add the delete_on_close token
to lck. Then "delete_file" is being set to true. Then later on we
do the notify_deferred_opens. This walks the list, also checking
for share_mode_stale_pid. We have already deleted our own share
mode entry, share_mode_stale_pid() sees the left-over entry. It not
also deletes that one but also the delete on close token. This leads
to a different view of "delete_file" a.k.a. "got_tokens" further
down in close_remove_share_mode, leading the SMB_ASSERT to fire.

This patch attempts to fix the issue by keeping around our own share
mode entry for almost the whole routine, preventing share_mode_stale_pid()
from removing the delete tokens.

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
2012-06-03 17:23:28 +02:00
Volker Lendecke
b9e11bd63e s3: Do an early return in close_remove_share_mode
Without "lck" we don't have much to clean up

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-03 17:23:28 +02:00
Volker Lendecke
2e95b77c99 s3: Make close_remove_share_mode a bit more readable
by introducing a variable simplifying a boolean expression

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-03 17:23:28 +02:00
Volker Lendecke
8541829a9a s3: Slightly simplify close_remove_share_mode
Remove a level of indentation by more use of "continue;"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-03 17:23:28 +02:00
Stefan Metzmacher
8486d514f5 s3:smbd/close: avoid procid_is_me()
metze
2012-06-03 17:23:28 +02:00
Volker Lendecke
89cf7ea944 s3: Check for serverid_exists in close_directory
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-25 09:19:38 -07:00
Volker Lendecke
bdc4404ef9 s3: Check for serverid_exists in close_remove_share_mode
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-25 09:19:38 -07:00
Volker Lendecke
19b6671c07 s3: Check for serverid_exists in notify_deferred_opens
We will remove the check in parse_share_modes soon

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-05-25 09:19:37 -07:00
Stefan Metzmacher
3a66ee1ae5 s3:smbd: pass smbd_server_connection to should_notify_deferred_opens()
metze
2012-05-25 09:05:34 +02:00
Jeremy Allison
32cbf20e65 Move the set_write_time() call to after get_existing_share_mode_lock() returns with a share mode.
get_existing_share_mode_lock() isn't really the right
call here, as we're being called after
close_remove_share_mode() inside close_normal_file()
so it's quite normal to not have an existing share
mode here. However, get_share_mode_lock() doesn't
work because that will create a new share mode if
one doesn't exist - so stick with this call (just
ignore any error we get if the share mode doesn't
exist.

The previous commit raised the error message debug
level inside get_share_mode_lock_internal() so
we don't always get a level 1 error message if
get_existing_share_mode_lock() fails.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat May 19 06:26:33 CEST 2012 on sn-devel-104
2012-05-19 06:26:33 +02:00
Volker Lendecke
f5ca3f11e4 s3: Revert the serverid changes, they need more work
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri May 18 13:12:14 CEST 2012 on sn-devel-104
2012-05-18 13:12:14 +02:00
Volker Lendecke
182faceab2 s3: Check for serverid_exists in close_directory
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-17 13:17:22 -07:00
Volker Lendecke
2db3ecbc95 s3: Check for serverid_exists in close_remove_share_mode
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-17 13:17:22 -07:00
Volker Lendecke
689a04bc6c s3: Check for serverid_exists in notify_deferred_opens
We will remove the check in parse_share_modes soon

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-17 13:17:21 -07:00
Jeremy Allison
d399af30c1 Remove cancel_aio_by_fsp(). It can never work and could lead to memory corruption
as outstanding IO's complete. Also we never have any aio's on a call to close_normal_file()
with close_type ERROR_CLOSE.
2012-04-12 15:06:59 -07:00
Andrew Bartlett
6aa12fcb30 build: Remove SMB_OFF_T, replace with off_t
Now that we always require a 64 bit off_t, we no longer need SMB_OFF_T.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri Apr  6 01:47:43 CEST 2012 on sn-devel-104
2012-04-06 01:47:43 +02:00
Jeremy Allison
704ea4729b Third part of fix for bug #8837 - smbd crashes when deleting directory and veto files are enabled.
Use correct check to see if veto files has been enabled. Even if not
set lp_veto_files() returns a valid string address (to a '\0' character).

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Apr  5 01:36:04 CEST 2012 on sn-devel-104
2012-04-05 01:36:04 +02:00
Jeremy Allison
c10ed730d4 Second part of bugfix for bug #8837 - smbd crashes when deleting directory and veto files are enabled.
Store the 'struct security_token' as well as the 'struct security_unix_token'
inside the locking db when setting a delete on close.
2012-04-04 14:58:42 -07:00
Jeremy Allison
c9ef087722 Fix const warnings.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Feb 24 23:10:56 CET 2012 on sn-devel-104
2012-02-24 23:10:56 +01:00
Volker Lendecke
e5c8484073 s3: get_share_mode_lock->get_existing_share_mode_lock 2012-02-19 17:44:26 +01:00
Volker Lendecke
92b96ac84b s3: Delete streams on directories 2012-01-31 23:30:09 +01:00
Volker Lendecke
cfebba96bd s3: Put an indirection layer into share_mode_lock
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-01-12 23:59:22 +01:00
Volker Lendecke
9cf6d735d4 s3: Introduce get_share_mode_lock_fresh()
This slightly simplifies the code path for all callers which assume
that a share mode exists already. Only the callers in open_file_ntcreate
and open_directory will ever create new share modes.

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-01-12 23:59:22 +01:00
Volker Lendecke
1bea57a6c3 s3: Fix raw.mux after UNUSED_SHARE_MODE_ENTRY was removed
See the large comment in notify_deferred_opens for an explanation

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Dec 14 19:08:30 CET 2011 on sn-devel-104
2011-12-14 19:08:30 +01:00
Stefan Metzmacher
95384d11a3 s3:smbd/close: use talloc_get_type_abort() as private_data can't be NULL
metze
2011-12-14 12:00:07 +01:00
Stefan Metzmacher
77dc976b53 s3:smbd/close: pass smbd_server_connection to notify_deferred_opens()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Mon Dec 12 21:49:11 CET 2011 on sn-devel-104
2011-12-12 21:49:11 +01:00
Stefan Metzmacher
4d44f879e1 s3:smbd/clode: pass smbd_server_connection as private_data to msg_close_file()
metze
2011-12-12 20:14:41 +01:00
Stefan Metzmacher
61d8674727 s3:smbd/close: avoid usage of server_event_context()
metze
2011-12-12 14:35:42 +01:00
Volker Lendecke
1c46fb5c3e s3: Use autogenerated open_files.idl 2011-12-02 22:43:05 +01:00
Jeremy Allison
865bc0c0ac Remove the check for FILE_WRITE_ATTRIBUTES from smb_set_file_time(). It
is called from places like fileio.c that need to update the write time
on a file handle only open for write, without neccessarily having
FILE_WRITE_ATTRIBUTES permission. Move all checks to before the
smb_set_file_time() callers.
2011-11-15 17:41:48 -08:00
Frank Lahm
c3bdcab516 First part of fix for bug #8419 - Make VFS op "streaminfo" stackable.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Oct 17 21:39:32 CEST 2011 on sn-devel-104
2011-10-17 21:39:32 +02:00
Frank Lahm
7a0b5d6fc5 Add support for VFS op streaminfo chaining in all relevant VFS modules.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Oct 14 03:26:06 CEST 2011 on sn-devel-104
2011-10-14 03:26:06 +02:00
Volker Lendecke
502fdae7f1 s3: Pass sconn explicitly to schedule_deferred_open_message_smb 2011-08-02 19:18:08 +02:00
Volker Lendecke
77f5246f09 s3: Fix some nonempty blank lines 2011-08-02 19:18:08 +02:00
Andrew Bartlett
9289537993 s3-auth Use struct auth_user_info_unix for unix_name and sanitized_username
This is closer to the layout of struct auth_session_info in auth.idl

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
e5dd03d199 s3-globals Remove smbd_event_context() (use server_event_context())
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
2011-05-31 00:32:07 +02:00