1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

smbd: use parent_pathref() in smb_unix_mknod()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2021-01-25 15:46:04 +01:00 committed by Jeremy Allison
parent 9b8b62a840
commit 65c90e6231

View File

@ -8142,7 +8142,6 @@ static NTSTATUS smb_unix_mknod(connection_struct *conn,
int ret;
struct smb_filename *parent_fname = NULL;
struct smb_filename *base_name = NULL;
bool ok;
if (total_data < 100) {
return NT_STATUS_INVALID_PARAMETER;
@ -8199,25 +8198,12 @@ static NTSTATUS smb_unix_mknod(connection_struct *conn,
"%.0f mode 0%o for file %s\n", (double)dev,
(unsigned int)unixmode, smb_fname_str_dbg(smb_fname)));
ok = parent_smb_fname(talloc_tos(),
smb_fname,
&parent_fname,
&base_name);
if (!ok) {
return NT_STATUS_NO_MEMORY;
}
ret = vfs_stat(conn, parent_fname);
if (ret == -1) {
TALLOC_FREE(parent_fname);
return map_nt_error_from_unix(errno);
}
status = openat_pathref_fsp(conn->cwd_fsp, parent_fname);
if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
status = parent_pathref(talloc_tos(),
conn->cwd_fsp,
smb_fname,
&parent_fname,
&base_name);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(parent_fname);
return status;
}