summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-03-30 08:44:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:22 -0500
commit11963877ab9efe55c65ef8798a86166d62822d7a (patch)
tree1313fd66a7f33076ba94d5b2853a112dfeef5fd8 /source4
parent7eb440f2f735128c9e40f5ec868809cfa3be6948 (diff)
downloadsamba-11963877ab9efe55c65ef8798a86166d62822d7a.tar.gz
samba-11963877ab9efe55c65ef8798a86166d62822d7a.tar.bz2
samba-11963877ab9efe55c65ef8798a86166d62822d7a.zip
r14807: fixed the format of notify responses (forgot to commit this earlier)
(This used to be commit fb91a37e926963acfc90fe276a33c7a329a023e8)
Diffstat (limited to 'source4')
-rw-r--r--source4/smb_server/smb/nttrans.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/source4/smb_server/smb/nttrans.c b/source4/smb_server/smb/nttrans.c
index 1bc828b0f0..e2fc962196 100644
--- a/source4/smb_server/smb/nttrans.c
+++ b/source4/smb_server/smb/nttrans.c
@@ -346,7 +346,6 @@ static NTSTATUS nttrans_notify_change_send(struct nttrans_op *op)
size_t size = 0;
int i;
NTSTATUS status;
- uint32_t ofs=0;
uint8_t *p;
#define MAX_BYTES_PER_CHAR 3
@@ -362,14 +361,16 @@ static NTSTATUS nttrans_notify_change_send(struct nttrans_op *op)
/* construct the changes buffer */
for (i=0;i<info->out.num_changes;i++) {
+ uint32_t ofs;
ssize_t len;
SIVAL(p, 4, info->out.changes[i].action);
len = push_string(p + 12, info->out.changes[i].name.s,
- op->trans->out.params.length - (ofs+12), STR_UNICODE);
+ op->trans->out.params.length -
+ (p+12 - op->trans->out.params.data), STR_UNICODE);
SIVAL(p, 8, len);
- ofs += len + 12;
+ ofs = len + 12;
if (ofs & 3) {
int pad = 4 - (ofs & 3);
@@ -377,12 +378,16 @@ static NTSTATUS nttrans_notify_change_send(struct nttrans_op *op)
ofs += pad;
}
- SIVAL(p, 0, ofs);
+ if (i == info->out.num_changes-1) {
+ SIVAL(p, 0, 0);
+ } else {
+ SIVAL(p, 0, ofs);
+ }
- p = op->trans->out.params.data + ofs;
+ p += ofs;
}
- op->trans->out.params.length = ofs;
+ op->trans->out.params.length = p - op->trans->out.params.data;
return NT_STATUS_OK;
}