Merge branch 'master' of ssh://git.samba.org/data/git/samba into regsrv
[ab/samba.git/.git] / source3 / printing / printfsp.c
index 1fde16b802d79040876246cd542b308dbc9c37f2..a247cd84276106e7a819bffdc0b9789b15fd0eb3 100644 (file)
 
 #include "includes.h"
 
-extern struct current_user current_user;
-
 /***************************************************************************
 open a print file and setup a fsp for it. This is a wrapper around
 print_job_start().
 ***************************************************************************/
 
-NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
-                       files_struct **result)
+NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
+                       const char *fname,
+                       uint16_t current_vuid, files_struct **result)
 {
        int jobid;
        SMB_STRUCT_STAT sbuf;
@@ -36,7 +35,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
        fstring name;
        NTSTATUS status;
 
-       status = file_new(conn, &fsp);
+       status = file_new(req, conn, &fsp);
        if(!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -51,10 +50,10 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
                fstrcat(name, p);
        }
 
-       jobid = print_job_start(&current_user, SNUM(conn), name, NULL);
+       jobid = print_job_start(conn->server_info, SNUM(conn), name, NULL);
        if (jobid == -1) {
                status = map_nt_error_from_unix(errno);
-               file_free(fsp);
+               file_free(req, fsp);
                return status;
        }
 
@@ -63,14 +62,14 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
        if (fsp->rap_print_jobid == 0) {
                /* We need to delete the entry in the tdb. */
                pjob_delete(lp_const_servicename(SNUM(conn)), jobid);
-               file_free(fsp);
+               file_free(req, fsp);
                return NT_STATUS_ACCESS_DENIED; /* No errno around here */
        }
 
        /* setup a full fsp */
        fsp->fh->fd = print_job_fd(lp_const_servicename(SNUM(conn)),jobid);
        GetTimeOfDay(&fsp->open_time);
-       fsp->vuid = current_user.vuid;
+       fsp->vuid = current_vuid;
        fsp->fh->pos = -1;
        fsp->can_lock = True;
        fsp->can_read = False;