From: Volker Lendecke Date: Tue, 28 Oct 2014 22:31:46 +0000 (-0700) Subject: s3:smbd: add file_find_one_fsp_from_lease_key() helper function X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=eb9fc01d207ce29e68027f8958d4e8534f89a9e5;p=obnox%2Fsamba%2Fsamba-obnox.git s3:smbd: add file_find_one_fsp_from_lease_key() helper function Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Reviewed-by: Stefan Metzmacher --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index d866d6337c6..91eddb879b2 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 67adbba6f25..7a4b4c972c1 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);