summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-04 15:30:11 +0200
committerStefan Metzmacher <metze@samba.org>2012-09-08 03:39:06 +0200
commiteb1a05f783721247e9e01f4039f36c3d69b2dca7 (patch)
tree26e2426822afdcea197a27fe30767c5ee2e1c106 /source3
parent42afa596d5e58875944c5429fac4866a5614ebca (diff)
downloadsamba-eb1a05f783721247e9e01f4039f36c3d69b2dca7.tar.gz
samba-eb1a05f783721247e9e01f4039f36c3d69b2dca7.tar.bz2
samba-eb1a05f783721247e9e01f4039f36c3d69b2dca7.zip
s3:smbd: add disconnected checks to the open code.
(delay_for_batch_oplocks, open_mode_check, and delay_for_exclusive_oplocks) Pair-Programmed-With: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/open.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 9c4ba369cd..e919b1392e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -29,6 +29,7 @@
#include "../librpc/gen_ndr/ndr_security.h"
#include "../librpc/gen_ndr/open_files.h"
#include "auth.h"
+#include "serverid.h"
#include "messages.h"
extern const struct generic_mapping file_generic_mapping;
@@ -917,6 +918,14 @@ static bool share_conflict(struct share_mode_entry *entry,
(unsigned int)entry->share_access,
(unsigned int)entry->private_options));
+ if (server_id_is_disconnected(&entry->pid)) {
+ /*
+ * note: cleanup should have been done by
+ * delay_for_batch_oplocks()
+ */
+ return false;
+ }
+
DEBUG(10,("share_conflict: access_mask = 0x%x, share_access = 0x%x\n",
(unsigned int)access_mask, (unsigned int)share_access));
@@ -1298,6 +1307,19 @@ static bool delay_for_batch_oplocks(files_struct *fsp,
return false;
}
+ if (server_id_is_disconnected(&batch_entry->pid)) {
+ /*
+ * TODO: clean up.
+ * This could be achieved by sending a break message
+ * to ourselves. Special considerations for files
+ * with delete_on_close flag set!
+ *
+ * For now we keep it simple and do not
+ * allow delete on close for durable handles.
+ */
+ return false;
+ }
+
/* Found a batch oplock */
send_break_message(fsp, batch_entry, mid, oplock_request);
return true;
@@ -1317,6 +1339,15 @@ static bool delay_for_exclusive_oplocks(files_struct *fsp,
return false;
}
+ if (server_id_is_disconnected(&ex_entry->pid)) {
+ /*
+ * since only durable handles can get disconnected,
+ * and we can only get durable handles with batch oplocks,
+ * this should actually never be reached...
+ */
+ return false;
+ }
+
/* Found an exclusive or batch oplock */
delay_it = is_delete_request(fsp) ?