printing: use correct error out in file_version_is_newer() when openat_pathref_fsp...
authorRalph Boehme <slow@samba.org>
Tue, 16 Feb 2021 13:23:02 +0000 (14:23 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 17 Feb 2021 18:48:36 +0000 (18:48 +0000)
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 <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/printing/nt_printing.c

index 0788134bf8723c4b3f27f7af4e1d3cdd736b5238..e3cd8102851e430d7feb6f1b9ebcd9e3fdf8571f 100644 (file)
@@ -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(