diff options
author | Jeremy Allison <jra@samba.org> | 2014-01-11 15:04:38 -0800 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-01-15 09:45:10 +0100 |
commit | 42c80358c83dca65cdde78f442056ec0f55ecbb1 (patch) | |
tree | 2ea1f9b7a0945a276c9ddccbdc9d088dee8a9d14 /source3/smbd/dir.c | |
parent | 81df4123ca6fae6e9d901c59a12407f3f89dc335 (diff) | |
download | samba-42c80358c83dca65cdde78f442056ec0f55ecbb1.tar.gz |
s3:dir - Map wire offsets to native directory cookies.
Take care of the special offsets.
https://bugzilla.samba.org/show_bug.cgi?id=2662
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r-- | source3/smbd/dir.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 13e2090d14f..980ca5832ea 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -938,6 +938,22 @@ bool dptr_fill(struct smbd_server_connection *sconn, } /**************************************************************************** + Map a 32-bit wire cookie to a native directory offset. +****************************************************************************/ + +static long map_wire_to_dir_offset(struct dptr_struct *dptr, uint32_t wire_offset) +{ + if (wire_offset == WIRE_END_OF_DIRECTORY_OFFSET) { + return END_OF_DIRECTORY_OFFSET; + } else if(wire_offset == WIRE_START_OF_DIRECTORY_OFFSET) { + return START_OF_DIRECTORY_OFFSET; + } else if (wire_offset == WIRE_DOT_DOT_DIRECTORY_OFFSET) { + return DOT_DOT_DIRECTORY_OFFSET; + } + return (long)wire_offset; +} + +/**************************************************************************** Fetch the dir ptr and seek it given the 5 byte server field. ****************************************************************************/ @@ -955,11 +971,7 @@ struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn, } *num = key; wire_offset = IVAL(buf,1); - if (wire_offset == (uint32_t)-1) { - seekoff = END_OF_DIRECTORY_OFFSET; - } else { - seekoff = (long)wire_offset; - } + seekoff = map_wire_to_dir_offset(dptr, wire_offset); SeekDir(dptr->dir_hnd,seekoff); DEBUG(3,("fetching dirptr %d for path %s at offset %d\n", key, dptr->path, (int)seekoff)); |