Fix an ancient uninitialized variable read
authorVolker Lendecke <vl@samba.org>
Tue, 30 Dec 2008 21:24:04 +0000 (22:24 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 31 Dec 2008 09:32:37 +0000 (10:32 +0100)
The callers of open_file_ntcreate expect *psbuf to be filled correctly

source/printing/printfsp.c
source/smbd/open.c
source/smbd/reply.c

index c66522492786cc5079d8453eed07ba3663cfbfaf..12399b882f7105db5245e5c3a9bca311ea8570b1 100644 (file)
@@ -28,10 +28,9 @@ print_job_start().
 ***************************************************************************/
 
 NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
-                       files_struct *fsp)
+                       files_struct *fsp, SMB_STRUCT_STAT *psbuf)
 {
        int jobid;
-       SMB_STRUCT_STAT sbuf;
        fstring name;
        NTSTATUS status;
 
@@ -75,9 +74,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 b732c5e3e9da446fc27d3462a5c3c344fe166ab9..b82c0362cc0afbaa372cba02cbad9666de81e1f3 100644 (file)
@@ -1222,7 +1222,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, fsp);
+               return print_fsp_open(conn, fname, fsp, psbuf);
        }
 
        if (!parent_dirname_talloc(talloc_tos(), fname, &parent_dir,
index 762fab1a03084ef2b20b317dbf8023f395364796..248596d2c8693c369e0bad67c8cab30541ecf0b2 100644 (file)
@@ -4633,6 +4633,7 @@ void reply_printopen(struct smb_request *req)
        connection_struct *conn = req->conn;
        files_struct *fsp;
        NTSTATUS status;
+       SMB_STRUCT_STAT sbuf;
 
        START_PROFILE(SMBsplopen);
 
@@ -4656,7 +4657,7 @@ void reply_printopen(struct smb_request *req)
        }
 
        /* Open for exclusive use, write only. */
-       status = print_fsp_open(conn, NULL, fsp);
+       status = print_fsp_open(conn, NULL, fsp, &sbuf);
 
        if (!NT_STATUS_IS_OK(status)) {
                file_free(fsp);