]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix an ancient uninitialized variable read
authorVolker Lendecke <vl@samba.org>
Tue, 30 Dec 2008 21:24:04 +0000 (22:24 +0100)
committerKarolin Seeger <kseeger@samba.org>
Fri, 2 Jan 2009 11:44:28 +0000 (12:44 +0100)
The callers of open_file_ntcreate expect *psbuf to be filled correctly
(cherry picked from commit b0f293addb93e34107fcfd52170261885104dbb0)

source/include/proto.h
source/printing/printfsp.c
source/smbd/open.c
source/smbd/reply.c

index 76e0d7629cee4c9817b069e0d0c5433000435131..95de3f9bc90c85bb3c5aba530f323bae7528b431 100644 (file)
@@ -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  */
index 324af18af05812e7ebe09e896c43c9e766429221..96d47a48c9795a3b7efaeab534bbf73c729647a6 100644 (file)
@@ -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;
 }
index a465695c1cb8f876be96b6834d433373f4164aed..3c07dba60bf877ccd32aedeb827bed6209778051 100644 (file)
@@ -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,
index c0359bccaf43c9802ff683aabe0e31d4d0cee4be..c23aa4f025c4466bd1485898911499ed5036a258 100644 (file)
@@ -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);