1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

pysmbd: handle file not found error

Avoid PANIC: internal error

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Björn Baumbach 2018-09-19 16:52:54 +02:00
parent ab558fa14c
commit bc8d0d5160

View File

@ -150,7 +150,11 @@ static NTSTATUS init_files_struct(TALLOC_CTX *mem_ctx,
fsp->fsp_name = smb_fname;
fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, flags, 00644);
if (fsp->fh->fd == -1) {
int err = errno;
umask(saved_umask);
if (err == ENOENT) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
return NT_STATUS_INVALID_PARAMETER;
}
@ -204,8 +208,11 @@ static NTSTATUS set_nt_acl_conn(const char *fname,
}
if (!NT_STATUS_IS_OK(status)) {
printf("open: error=%d (%s)\n", errno, strerror(errno));
SMB_VFS_CLOSE(fsp);
DBG_ERR("init_files_struct failed: %s\n",
nt_errstr(status));
if (fsp != NULL) {
SMB_VFS_CLOSE(fsp);
}
TALLOC_FREE(frame);
return status;
}