From 96e8175dc81b32ba065ad393f8413373937d41cb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 17 Jul 2019 13:05:43 -0700 Subject: [PATCH] s3: smbd: Add dptr_fetch_fsp() for SMB1 code. We will use this to replace dptr_fetch(). Not yet used. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/dir.c | 16 ++++++++++++++++ source3/smbd/proto.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 25a7a2e165b..1cecef1997b 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -817,6 +817,22 @@ struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn, return(dptr); } +/**************************************************************************** + Return the associated fsp and seek the dir_hnd on it it given the 5 byte + server field. +****************************************************************************/ + +files_struct *dptr_fetch_fsp(struct smbd_server_connection *sconn, + char *buf, int *num) +{ + struct dptr_struct *dptr = dptr_fetch(sconn, buf, num); + + if (dptr == NULL) { + return NULL; + } + return dptr->dir_hnd->fsp; +} + /**************************************************************************** Fetch the dir ptr. ****************************************************************************/ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 2efabf3e41a..66b756a9c2e 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -209,6 +209,8 @@ bool dptr_fill(struct smbd_server_connection *sconn, char *buf1,unsigned int key); struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn, char *buf,int *num); +files_struct *dptr_fetch_fsp(struct smbd_server_connection *sconn, + char *buf,int *num); struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn, int dptr_num); bool get_dir_entry(TALLOC_CTX *ctx, -- 2.47.3