summaryrefslogtreecommitdiff
path: root/source3/smbd/nttrans.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-12-31 17:52:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:50 -0500
commit200bd10b32107b4ce8fc72cc2abbf5a247708ba6 (patch)
tree5c3d7cfef6259d693633218936724acb1b9824ac /source3/smbd/nttrans.c
parent421ffdbb2439fbf44cb61e0d1549071b85a3507c (diff)
downloadsamba-200bd10b32107b4ce8fc72cc2abbf5a247708ba6.tar.gz
samba-200bd10b32107b4ce8fc72cc2abbf5a247708ba6.tar.bz2
samba-200bd10b32107b4ce8fc72cc2abbf5a247708ba6.zip
r20442: Slight rewrite of the change notify infrastructure. This now survives the
first of the raw-notify subtests, the one-level test_notify_dir without any flags around yet. The tricky part was getting the data structures right, I hope the next tests don't let that fall over. fsp->notify is now by default NULL, meaning that nobody has issued a changenotify call. This means nobody is interested in changes for this directory. If that has happened, notify_change_buf collects the changes if no current request is outstanding, and it collects the requests if no change has happened since the last request. Happy New Year, somewhere on this planet it's already 2007 :-) Volker P.S: Jeremy, there's a question for you in smbd/files.c line 367. (This used to be commit ce0ad24988075465addcac0b9afc872e909135af)
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r--source3/smbd/nttrans.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index f51d01fb9c..0ef962ca0f 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1826,6 +1826,7 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf,
uint16 *setup = *ppsetup;
files_struct *fsp;
uint32 flags;
+ NTSTATUS status;
if(setup_count < 6) {
return ERROR_DOS(ERRDOS,ERRbadfunc);
@@ -1847,9 +1848,27 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf,
return ERROR_DOS(ERRDOS,ERRbadfid);
}
+ if (fsp->notify == NULL) {
+ if (!(fsp->notify = TALLOC_ZERO_P(
+ NULL, struct notify_change_buf))) {
+ return ERROR_NT(NT_STATUS_NO_MEMORY);
+ }
+ }
+
if (fsp->notify->num_changes > 0) {
- change_notify_reply(inbuf, max_param_count, fsp);
+ /*
+ * We've got changes pending, respond immediately
+ */
+
+ SMB_ASSERT(fsp->notify->requests == NULL);
+
+ change_notify_reply(inbuf, max_param_count,
+ fsp->notify->num_changes,
+ fsp->notify->changes);
+
+ TALLOC_FREE(fsp->notify->changes);
+ fsp->notify->num_changes = 0;
/*
* change_notify_reply() above has independently sent its
@@ -1858,8 +1877,13 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf,
return -1;
}
- if (!change_notify_set(inbuf, fsp, conn, flags, max_param_count)) {
- return(UNIXERROR(ERRDOS,ERRbadfid));
+ /*
+ * No changes pending, queue the request
+ */
+
+ status = change_notify_add_request(inbuf, max_param_count, fsp);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ERROR_NT(status);
}
return -1;