diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-09-23 02:45:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:20:14 -0500 |
commit | d461f97a4acc36f9b98240cc6ce7e87a98fdd7cd (patch) | |
tree | 1bb33a66a00e6aad8475489658c6c39883692191 /source4 | |
parent | ed24e83d5b96ffa84656a46736078927bbeaa6c6 (diff) | |
download | samba-d461f97a4acc36f9b98240cc6ce7e87a98fdd7cd.tar.gz samba-d461f97a4acc36f9b98240cc6ce7e87a98fdd7cd.tar.bz2 samba-d461f97a4acc36f9b98240cc6ce7e87a98fdd7cd.zip |
r18839: align all directory search blobs on an 8 byte boundary to keep the
current vista release happy.
(This used to be commit d3f0114a9dc8458cccfda71087668b1ddf4d380c)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/smb_server/blob.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source4/smb_server/blob.c b/source4/smb_server/blob.c index 2fedc81678..0b38d3901d 100644 --- a/source4/smb_server/blob.c +++ b/source4/smb_server/blob.c @@ -38,6 +38,15 @@ } \ } while (0) + +/* align the end of the blob on an 8 byte boundary */ +#define BLOB_ALIGN(blob, alignment) do { \ + if ((blob)->length & ((alignment)-1)) { \ + uint8_t _pad = (alignment) - ((blob)->length & ((alignment)-1)); \ + BLOB_CHECK(smbsrv_blob_fill_data(blob, blob, (blob)->length+_pad)); \ + } \ +} while (0) + /* grow the data size of a trans2 reply */ NTSTATUS smbsrv_blob_grow_data(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, @@ -616,6 +625,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx, BLOB_CHECK(smbsrv_blob_append_string(mem_ctx, blob, file->directory_info.name.s, ofs + 60, default_str_flags, STR_TERMINATE_ASCII)); + BLOB_ALIGN(blob, 8); data = blob->data + ofs; SIVAL(data, 0, blob->length - ofs); return NT_STATUS_OK; @@ -635,6 +645,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx, BLOB_CHECK(smbsrv_blob_append_string(mem_ctx, blob, file->full_directory_info.name.s, ofs + 60, default_str_flags, STR_TERMINATE_ASCII)); + BLOB_ALIGN(blob, 8); data = blob->data + ofs; SIVAL(data, 0, blob->length - ofs); return NT_STATUS_OK; @@ -646,6 +657,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx, BLOB_CHECK(smbsrv_blob_append_string(mem_ctx, blob, file->name_info.name.s, ofs + 8, default_str_flags, STR_TERMINATE_ASCII)); + BLOB_ALIGN(blob, 8); data = blob->data + ofs; SIVAL(data, 0, blob->length - ofs); return NT_STATUS_OK; @@ -672,10 +684,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx, BLOB_CHECK(smbsrv_blob_append_string(mem_ctx, blob, file->both_directory_info.name.s, ofs + 60, default_str_flags, STR_TERMINATE_ASCII)); - /* align the end of the blob on an even boundary */ - if (blob->length & 1) { - BLOB_CHECK(smbsrv_blob_fill_data(blob, blob, blob->length+1)); - } + BLOB_ALIGN(blob, 8); data = blob->data + ofs; SIVAL(data, 0, blob->length - ofs); return NT_STATUS_OK; @@ -697,6 +706,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx, BLOB_CHECK(smbsrv_blob_append_string(mem_ctx, blob, file->id_full_directory_info.name.s, ofs + 60, default_str_flags, STR_TERMINATE_ASCII)); + BLOB_ALIGN(blob, 8); data = blob->data + ofs; SIVAL(data, 0, blob->length - ofs); return NT_STATUS_OK; @@ -724,6 +734,7 @@ NTSTATUS smbsrv_push_passthru_search(TALLOC_CTX *mem_ctx, BLOB_CHECK(smbsrv_blob_append_string(mem_ctx, blob, file->id_both_directory_info.name.s, ofs + 60, default_str_flags, STR_TERMINATE_ASCII)); + BLOB_ALIGN(blob, 8); data = blob->data + ofs; SIVAL(data, 0, blob->length - ofs); return NT_STATUS_OK; |