summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2014-01-11 15:04:38 -0800
committerKarolin Seeger <kseeger@samba.org>2014-01-17 09:18:40 +0100
commitd8bed98383eebf98fd0912fe2bfcfb4dae94478b (patch)
tree32fbbab97d751ea49cdc6afaacff798d790773a3 /source3/smbd
parent45e65e125cc701fdf193c9954fe8dbfd87b75bfb (diff)
downloadsamba-d8bed98383eebf98fd0912fe2bfcfb4dae94478b.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> (cherry picked from commit 42c80358c83dca65cdde78f442056ec0f55ecbb1)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/dir.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 13e2090d14..980ca5832e 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));