summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-10-28 15:31:46 -0700
committerJeremy Allison <jra@samba.org>2014-12-04 05:45:10 +0100
commiteb9fc01d207ce29e68027f8958d4e8534f89a9e5 (patch)
treee1b27e7e4ac23aafd4848396b16a7266defb4e14
parentd78b18dd8c510591452ebd17810261cf89868d5c (diff)
downloadsamba-eb9fc01d207ce29e68027f8958d4e8534f89a9e5.tar.gz
samba-eb9fc01d207ce29e68027f8958d4e8534f89a9e5.tar.xz
samba-eb9fc01d207ce29e68027f8958d4e8534f89a9e5.zip
s3:smbd: add file_find_one_fsp_from_lease_key() helper function
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/smbd/files.c18
-rw-r--r--source3/smbd/proto.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index d866d6337c..91eddb879b 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -387,6 +387,24 @@ files_struct *file_find_di_next(files_struct *start_fsp)
return NULL;
}
+struct files_struct *file_find_one_fsp_from_lease_key(
+ struct smbd_server_connection *sconn,
+ const struct smb2_lease_key *lease_key)
+{
+ struct files_struct *fsp;
+
+ for (fsp = sconn->files; fsp; fsp=fsp->next) {
+ if ((fsp->lease != NULL) &&
+ (fsp->lease->lease.lease_key.data[0] ==
+ lease_key->data[0]) &&
+ (fsp->lease->lease.lease_key.data[1] ==
+ lease_key->data[1])) {
+ return fsp;
+ }
+ }
+ return NULL;
+}
+
/****************************************************************************
Find any fsp open with a pathname below that of an already open path.
****************************************************************************/
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 67adbba6f2..7a4b4c972c 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -369,6 +369,9 @@ files_struct *file_find_dif(struct smbd_server_connection *sconn,
files_struct *file_find_di_first(struct smbd_server_connection *sconn,
struct file_id id);
files_struct *file_find_di_next(files_struct *start_fsp);
+struct files_struct *file_find_one_fsp_from_lease_key(
+ struct smbd_server_connection *sconn,
+ const struct smb2_lease_key *lease_key);
bool file_find_subpath(files_struct *dir_fsp);
void file_sync_all(connection_struct *conn);
void fsp_free(files_struct *fsp);