From 1c60a4e76a37b2dabffccf24add5e8916dbc65b9 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 Reviewed-by: Guenther Deschner (cherry picked from commit 8c1fd86db873f0326faf1cefa731a03709f8ac7f) --- 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 ffee1d51e5f..c61af088981 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 05138a4eeb31c6fc106e5797c38ea6a6ca434c38 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 Reviewed-by: Guenther Deschner (cherry picked from commit 70063c523bff5e471eac2b011b243c5aa0c4bee1) --- 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 c61af088981..6fbe6780370 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 5704b5a76f17e9b1c73fd1d51cfe224f9f935f82 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 RN: Printerdriver upload 4.14rc1 not working Signed-off-by: Ralph Boehme Reviewed-by: Guenther Deschner Autobuild-User(master): Günther Deschner Autobuild-Date(master): Wed Feb 17 19:53:00 UTC 2021 on sn-devel-184 (cherry picked from commit 718f7b1a84f1c6eb35d52232a8573370f45add56) --- 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 6fbe6780370..64033043675 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