From 076e0b01f99f147a3b30233bf50986157b84c979 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 30 Dec 2008 22:24:04 +0100 Subject: [PATCH] Fix an ancient uninitialized variable read The callers of open_file_ntcreate expect *psbuf to be filled correctly (cherry picked from commit b0f293addb93e34107fcfd52170261885104dbb0) --- source/include/proto.h | 3 ++- source/printing/printfsp.c | 10 +++++----- source/smbd/open.c | 2 +- source/smbd/reply.c | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/include/proto.h b/source/include/proto.h index 76e0d7629ce..95de3f9bc90 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -6625,7 +6625,8 @@ bool sysv_cache_reload(void); /* The following definitions come from printing/printfsp.c */ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname, - uint16_t current_vuid, files_struct *fsp); + uint16_t current_vuid, files_struct *fsp, + SMB_STRUCT_STAT *psbuf); void print_fsp_end(files_struct *fsp, enum file_close_type close_type); /* The following definitions come from printing/printing.c */ diff --git a/source/printing/printfsp.c b/source/printing/printfsp.c index 324af18af05..96d47a48c97 100644 --- a/source/printing/printfsp.c +++ b/source/printing/printfsp.c @@ -26,10 +26,10 @@ print_job_start(). ***************************************************************************/ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname, - uint16_t current_vuid, files_struct *fsp) + uint16_t current_vuid, files_struct *fsp, + SMB_STRUCT_STAT *psbuf) { int jobid; - SMB_STRUCT_STAT sbuf; fstring name; NTSTATUS status; @@ -73,9 +73,9 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname, fsp->is_directory = False; string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid)); fsp->wcp = NULL; - SMB_VFS_FSTAT(fsp, &sbuf); - fsp->mode = sbuf.st_mode; - fsp->file_id = vfs_file_id_from_sbuf(conn, &sbuf); + SMB_VFS_FSTAT(fsp, psbuf); + fsp->mode = psbuf->st_mode; + fsp->file_id = vfs_file_id_from_sbuf(conn, psbuf); return NT_STATUS_OK; } diff --git a/source/smbd/open.c b/source/smbd/open.c index a465695c1cb..3c07dba60bf 100644 --- a/source/smbd/open.c +++ b/source/smbd/open.c @@ -1342,7 +1342,7 @@ static NTSTATUS open_file_ntcreate_internal(connection_struct *conn, DEBUG(10, ("open_file_ntcreate: printer open fname=%s\n", fname)); - return print_fsp_open(conn, fname, req->vuid, fsp); + return print_fsp_open(conn, fname, req->vuid, fsp, psbuf); } if (!parent_dirname_talloc(talloc_tos(), fname, &parent_dir, diff --git a/source/smbd/reply.c b/source/smbd/reply.c index c0359bccaf4..c23aa4f025c 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -4658,6 +4658,7 @@ void reply_printopen(struct smb_request *req) { connection_struct *conn = req->conn; files_struct *fsp; + SMB_STRUCT_STAT sbuf; NTSTATUS status; START_PROFILE(SMBsplopen); @@ -4682,7 +4683,7 @@ void reply_printopen(struct smb_request *req) } /* Open for exclusive use, write only. */ - status = print_fsp_open(conn, NULL, req->vuid, fsp); + status = print_fsp_open(conn, NULL, req->vuid, fsp, &sbuf); if (!NT_STATUS_IS_OK(status)) { file_free(fsp); -- 2.11.4.GIT