diff options
author | James Peach <jpeach@samba.org> | 2007-03-23 19:24:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:49:39 -0500 |
commit | c61db93c7e2d46ac0fd1a0f98199c111fd416a9b (patch) | |
tree | cd8576cd34c969a6ed63afc69ca2349e8626bb47 /source4/libcli | |
parent | 40c2da7e896d7e3a37b96fad961c965c0ff5f999 (diff) | |
download | samba-c61db93c7e2d46ac0fd1a0f98199c111fd416a9b.tar.gz samba-c61db93c7e2d46ac0fd1a0f98199c111fd416a9b.tar.bz2 samba-c61db93c7e2d46ac0fd1a0f98199c111fd416a9b.zip |
r21949: After discussion with the Apple and Linux client maintainers,
changing the FindFirst response for the UNIX_INFO2 level to include
a length field before the name. The name is not required to be null
terminated. the lenght field does not count any null.
(This used to be commit eef672bfff6b112ceceec2a58c78042352e83276)
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/raw/interfaces.h | 2 | ||||
-rw-r--r-- | source4/libcli/raw/rawsearch.c | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index e4efab3375..4620baed78 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -2576,7 +2576,7 @@ union smb_search_data { NTTIME create_time; uint32_t file_flags; uint32_t flags_mask; - const char *name; + struct smb_wire_string name; } unix_info2; }; diff --git a/source4/libcli/raw/rawsearch.c b/source4/libcli/raw/rawsearch.c index 5abe19d50c..3c7ca5788e 100644 --- a/source4/libcli/raw/rawsearch.c +++ b/source4/libcli/raw/rawsearch.c @@ -607,7 +607,12 @@ static int parse_trans2_search(struct smbcli_tree *tree, return ofs; case RAW_SEARCH_DATA_UNIX_INFO2: - if (blob->length < (116 + 8 + 1)) { + /* 8 - size of ofs + file_index + * 116 - size of unix_info2 + * 4 - size of name length + * 2 - "." is the shortest name + */ + if (blob->length < (116 + 8 + 4 + 2)) { return -1; } @@ -630,11 +635,16 @@ static int parse_trans2_search(struct smbcli_tree *tree, data->unix_info2.file_flags = IVAL(blob->data, 116); data->unix_info2.flags_mask = IVAL(blob->data, 120); - /* There is no length field for this name but we know it's null terminated. */ - len = smbcli_blob_pull_unix_string(tree->session, mem_ctx, blob, - &data->unix_info2.name, 116 + 8, 0); + /* There is a 4 byte length field for this name. The length + * does not include the NULL terminator. + */ + len = smbcli_blob_pull_string(tree->session, mem_ctx, blob, + &data->unix_info2.name, + 8 + 116, /* offset to length */ + 8 + 116 + 4, /* offset to string */ + 0); - if (ofs != 0 && ofs < (116 + 8 + len)) { + if (ofs != 0 && ofs < (8 + 116 + 4 + len)) { return -1; } |