}
}
- if (!del_share_mode(lck, fsp)) {
- DEBUG(0, ("close_remove_share_mode: Could not delete share "
- "entry for file %s\n",
- fsp_str_dbg(fsp)));
- }
-
if (fsp->initial_delete_on_close &&
!is_delete_on_close_set(lck, fsp->name_hash)) {
bool became_user = False;
POSIX delete now. */
for (i=0; i<lck->data->num_share_modes; i++) {
struct share_mode_entry *e = &lck->data->share_modes[i];
+
+ //TODO: continue if our own entry...
+
if (is_valid_share_mode_entry(e) &&
e->name_hash == fsp->name_hash) {
if (fsp->posix_open && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) {
if (!(close_type == NORMAL_CLOSE || close_type == SHUTDOWN_CLOSE) ||
!delete_file) {
+ if (!del_share_mode(lck, fsp)) {
+ DEBUG(0, ("close_remove_share_mode: Could not delete share "
+ "entry for file %s\n",
+ fsp_str_dbg(fsp)));
+ }
+
TALLOC_FREE(lck);
return NT_STATUS_OK;
}
pop_sec_ctx();
}
+ if (delete_file) {
+ if (!del_share_mode(lck, fsp)) {
+ DEBUG(0, ("close_remove_share_mode: Could not delete share "
+ "entry for file %s\n",
+ fsp_str_dbg(fsp)));
+ }
+ }
+
TALLOC_FREE(lck);
if (delete_file) {
NTSTATUS status = NT_STATUS_OK;
NTSTATUS tmp;
connection_struct *conn = fsp->conn;
- struct smbd_server_connection *sconn = conn->sconn;
int ret;
/*
status, map_nt_error_from_unix(ret));
}
- if (close_type == SHUTDOWN_CLOSE && fsp->smbXsrv->global->durable) {
- struct share_mode_lock *lck;
-
- lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
- if (lck != NULL && lck->data->num_share_modes == 1) {
- lck->data->share_modes[0].pid.pid = UINT64_MAX;
- lck->data->share_modes[0].pid.task_id = UINT32_MAX;
- lck->data->share_modes[0].pid.vnn = UINT32_MAX;
- lck->data->share_modes[0].pid.unique_id = UINT64_MAX; //todo place NTTIME expire timer here
- lck->data->modified = true;
-#if 0
- } else if (lck != NULL) {
- uint32_t i;
-
- for (i=0; i < lck->data->num_share_modes; i++) {
- struct share_mode_entry *e = &lck->data->share_modes[i];
- char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
-
- if (procid_is_me(&e->pid)) {
- continue;
- }
-
- share_mode_entry_to_message(msg, e);
-
- messaging_send_buf(fsp->conn->sconn->msg_ctx,
- e->pid,
- MSG_SMB_BREAK_RESPONSE,
- (uint8 *)msg,
- MSG_SMB_SHARE_MODE_ENTRY_SIZE);
- }
- }
-#endif
-
- tmp = close_filestruct(fsp);
- status = ntstatus_keeperror(status, tmp);
-
- if (fsp->oplock_type == LEVEL_II_OPLOCK) {
- sconn->oplocks.level_II_open--;
- } else if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
- sconn->oplocks.exclusive_open--;
- }
-
- SMB_ASSERT(sconn->oplocks.exclusive_open>=0);
- SMB_ASSERT(sconn->oplocks.level_II_open>=0);
-
- TALLOC_FREE(lck);
-
- tmp = fd_close(fsp);
- status = ntstatus_keeperror(status, tmp);
- file_free(req, fsp);
- return status;
- }
-
- TALLOC_FREE(lck);
-
-#if 0
- TALLOC_FREE(lck);
-
- tmp = fd_close(fsp);
- status = ntstatus_keeperror(status, tmp);
- file_free(req, fsp);
- return status;
-#endif
- }
-
/*
* If we're flushing on a close we can get a write
* error here, we must remember this.