From d2a2e48e53b1960438bfd6cc563b3d44a8d271e3 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 16 Feb 2021 14:19:51 +0100 Subject: [PATCH 1/3] printing: use correct error out in file_version_is_newer() when openat_pathref_fsp() fails Fixes a regression introduced by cbe25e1777d0c43c21e8acc2cea79fd03fdaf2ea: if there's no existing file, openat_pathref_fsp() will fail with NT_STATUS_OBJECT_NAME_NOT_FOUND which must be handled the same way it is done by the SMB_VFS_CREATE_FILE() call below. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14635 Signed-off-by: Ralph Boehme --- source3/printing/nt_printing.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 9b7904f6778..0788134bf87 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -833,7 +833,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr status = openat_pathref_fsp(conn->cwd_fsp, smb_fname); if (!NT_STATUS_IS_OK(status)) { - return false; + ret = 1; + goto done; } status = SMB_VFS_CREATE_FILE( -- 2.29.2 From afba301b7e3a8490df0409a37bb239e395ae2056 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 16 Feb 2021 14:23:02 +0100 Subject: [PATCH 2/3] printing: use correct error out in file_version_is_newer() when openat_pathref_fsp() fails Fixes a regression introduced by ef5e913bca584f0232d5bfff14df4ccba2dda35c: if there's no existing file, openat_pathref_fsp() will fail with NT_STATUS_OBJECT_NAME_NOT_FOUND which must be handled the same way it is done by the SMB_VFS_CREATE_FILE() call below. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14635 Signed-off-by: Ralph Boehme --- source3/printing/nt_printing.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 0788134bf87..e3cd8102851 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -893,7 +893,9 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr status = openat_pathref_fsp(conn->cwd_fsp, smb_fname); if (!NT_STATUS_IS_OK(status)) { - return false; + DBG_NOTICE("Can't open new file [%s], errno = %d\n", + smb_fname_str_dbg(smb_fname), errno); + goto error_exit; } status = SMB_VFS_CREATE_FILE( -- 2.29.2 From b3cd2bcd4826aa1b87e3038162cfbb9de1dd7cca Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 16 Feb 2021 14:24:05 +0100 Subject: [PATCH 3/3] printing: use correct error out in get_correct_cversion() when openat_pathref_fsp() fails Fixes a regression introduced by a74f0af1a91fe0bbc68e4d41d65f43ec383ae8bf: if there's no existing file, openat_pathref_fsp() will fail with NT_STATUS_OBJECT_NAME_NOT_FOUND which must be handled the same way it is done by the SMB_VFS_CREATE_FILE() call below. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14635 Signed-off-by: Ralph Boehme --- source3/printing/nt_printing.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index e3cd8102851..e9253093ae2 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1104,7 +1104,10 @@ static uint32_t get_correct_cversion(const struct auth_session_info *session_inf nt_status = openat_pathref_fsp(conn->cwd_fsp, smb_fname); if (!NT_STATUS_IS_OK(nt_status)) { - return false; + DBG_NOTICE("Can't open file [%s], errno =%d\n", + smb_fname_str_dbg(smb_fname), errno); + *perr = WERR_ACCESS_DENIED; + goto error_exit; } nt_status = SMB_VFS_CREATE_FILE( -- 2.29.2