}
}
+NTSTATUS smb2_create_durable_reconnect(struct smbXsrv_open_global *open,
+ TALLOC_CTX *mem_ctx,
+ files_struct **fsp)
+{
+ struct share_mode_lock *sharemode_lock;
+
+ /* 1. check entry in locking.tdb */
+
+ /*
+ * TODO: need to use different fetch function
+ * parse_share_modes currently checks for serverid_exists
+ * possibilites:
+ * - adapt fetch_share_mode / parse_share_modes to honour durable
+ * (i.e. not make share mode invalid if server does not exist for
+ * durable)
+ */
+ sharemode_lock = fetch_share_mode_unlocked(mem_ctx, open->backend_file_id);
+ if (sharemode_lock == NULL) {
+ /* TODO: use/create other fetch func with better error code */
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ if (sharemode_lock->data->num_share_modes == 0) {
+ /* should not happen? internal error? */
+ return NT_STATUS_INTERNAL_DB_ERROR;
+ }
+
+ if (sharemode_lock->data->num_share_modes > 1) {
+ /* can't be durable if there is more than one handle on the file */
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ if (serverid_exists(sharemode_lock->data->share_modes[0].pid)) {
+ /*
+ * server still exists
+ * TOD: check whether session exists?...
+ */
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ /* 2. proceed with opening file */
+}
+
struct smbd_smb2_create_state {
struct smbd_smb2_request *smb2req;
struct smb_request *smb1req;