s3:smbd: add file_find_one_fsp_from_lease_key() helper function
authorVolker Lendecke <vl@samba.org>
Tue, 28 Oct 2014 22:31:46 +0000 (15:31 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 4 Dec 2014 04:45:10 +0000 (05:45 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/files.c
source3/smbd/proto.h

index d866d6337c648f010393b6754d60d11d737bb083..91eddb879b2a8aa7adf488570926bb8915c550c3 100644 (file)
@@ -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.
 ****************************************************************************/
index 67adbba6f25d7dd254bcb966b1a6f256bdd083f8..7a4b4c972c10a17d08295bde2060c2def2f21391 100644 (file)
@@ -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);