From 85504ae6ff72204894ea7a856f0f36b44ad77fe2 Mon Sep 17 00:00:00 2001 From: Steven Danneman Date: Mon, 28 Jun 2010 16:06:33 -0700 Subject: s4:libcli: Modify S4 client library to check for proper CN alignment MS-CIFS 2.2.7.4.2 states that FILE_NOTIFY_INFORMATION structures in change notify replies must be aligned to 4-byte boundaries. This updates s4 client to check for this restriction and also adds a torture test which should tickle a server into giving unaligned structures if it doesn't follow the spec. --- source4/libcli/raw/rawnotify.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/libcli/raw/rawnotify.c') diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c index 2155076dd7..40256aa405 100644 --- a/source4/libcli/raw/rawnotify.c +++ b/source4/libcli/raw/rawnotify.c @@ -71,10 +71,12 @@ _PUBLIC_ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, parms->nttrans.out.changes = NULL; parms->nttrans.out.num_changes = 0; - + /* count them */ for (ofs=0; nt.out.params.length - ofs > 12; ) { uint32_t next = IVAL(nt.out.params.data, ofs); + if (next % 4 != 0) + return NT_STATUS_INVALID_NETWORK_RESPONSE; parms->nttrans.out.num_changes++; if (next == 0 || ofs + next >= nt.out.params.length) break; -- cgit