files_struct **_fsp)
{
struct share_mode_lock *sharemode_lock;
+ struct share_mode_entry *e;
files_struct *fsp = NULL;
NTSTATUS status;
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
- if (serverid_exists(&sharemode_lock->data->share_modes[0].pid)) {
+ e = &sharemode_lock->data->share_modes[0];
+
+ if (e->pid.pid != UINT64_MAX && serverid_exists(&e->pid)) {
/*
* server still exists
* TODO: check whether session exists
sharemode_lock->data->share_modes[0].pid =
messaging_server_id(op->connection->sconn->msg_ctx);
+ sharemode_lock->data->modified = true;
/*
* circumstances seems ok, do the open
DEBUG(0, ("OBNOX - durable_reconnect: new fsp created (%s:%s)\n", __location__, __FUNCTION__));
- fsp->fh->fd = SMB_VFS_OPEN(conn,
- smb_fname,
- fsp,
- sharemode_lock->data->share_modes[0].flags,
- 0 /* mode */);
- if (fsp->fh->fd == -1) {
-DEBUG(0, ("OBNOX - durable_reconnect: failed to open file: %s (%s:%s)\n", nt_errstr(status), __location__, __FUNCTION__));
- status = map_nt_error_from_unix(errno);
- return status;
- }
-
-DEBUG(0, ("OBNOX - durable_reconnect: opened file (%s:%s)\n", __location__, __FUNCTION__));
-
- /* - release the sharemode lock: this writes the changes */
- talloc_free(sharemode_lock);
-
fsp->file_id = op->global->backend_file_id;
fsp->initial_allocation_size = 0;//TODO
- fsp->file_pid = 0;//smb1req->pid;
+ fsp->file_pid = smb1req->smbpid;
fsp->vuid = smb1req->vuid;//
//fsp->open_time = 0;//from->open_time;
- fsp->access_mask = sharemode_lock->data->share_modes[0].access_mask;
- fsp->share_access = sharemode_lock->data->share_modes[0].share_access;
- //fsp->oplock_type = sharemode_lock->data->share_modes[0].oplock_type;
+ fsp->access_mask = e->access_mask;
+ fsp->share_access = e->share_access;
+ fsp->oplock_type = e->op_type;
fsp->can_lock = true;//from->can_lock;
fsp->can_read = (fsp->access_mask & (FILE_READ_DATA)) ? True : False;
if (!CAN_WRITE(conn)) {
fsp->is_directory = false;//from->is_directory;
fsp->aio_write_behind = false;//from->aio_write_behind;
+DEBUG(0, ("OBNOX - durable_reconnect: before open file (%s:%s)\n", __location__, __FUNCTION__));
+
+ fsp->fh->fd = SMB_VFS_OPEN(conn,
+ smb_fname,
+ fsp,
+ e->flags,
+ 0 /* mode */);
+ if (fsp->fh->fd == -1) {
+ status = map_nt_error_from_unix(errno);
+DEBUG(0, ("OBNOX - durable_reconnect: failed to open file: %s (%s:%s)\n", nt_errstr(status), __location__, __FUNCTION__));
+ return status;
+ }
+
+DEBUG(0, ("OBNOX - durable_reconnect: opened file (%s:%s)\n", __location__, __FUNCTION__));
+
+ /* - release the sharemode lock: this writes the changes */
+ talloc_free(sharemode_lock);
+
+
/* Q: do this in fsp creation? */
op->fsp = fsp;
fsp->smbXsrv = op;