s3-printing: avoid using pipes_struct when only session_info is needed.
authorGünther Deschner <gd@samba.org>
Fri, 29 Apr 2011 22:09:09 +0000 (00:09 +0200)
committerGünther Deschner <gd@samba.org>
Mon, 16 May 2011 14:54:21 +0000 (16:54 +0200)
Guenther
(cherry picked from commit cd5b2b242b39437081592d41d297bce0668b40ab)

source3/include/nt_printing.h
source3/printing/nt_printing.c
source3/rpc_server/spoolss/srv_spoolss_nt.c

index 02a72b32f19b4a9d7a09aa5c75c62d4a8c420131..ad6262ecff0a34ae67527f49175c56b1a85a0f3e 100644 (file)
@@ -23,7 +23,7 @@
 #define NT_PRINTING_H_
 
 #include "client.h"
-#include "../librpc/gen_ndr/srv_spoolss.h"
+#include "../librpc/gen_ndr/spoolss.h"
 
 #ifndef SAMBA_PRINTER_PORT_NAME
 #define SAMBA_PRINTER_PORT_NAME "Samba Printer Port"
@@ -169,11 +169,11 @@ bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
 bool delete_driver_files(const struct auth_serversupplied_info *server_info,
                         const struct spoolss_DriverInfo8 *r);
 
-WERROR move_driver_to_download_area(struct pipes_struct *p,
+WERROR move_driver_to_download_area(struct auth_serversupplied_info *session_info,
                                    struct spoolss_AddDriverInfoCtr *r);
 
 WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
-                             struct pipes_struct *rpc_pipe,
+                             struct auth_serversupplied_info *session_info,
                              struct spoolss_AddDriverInfoCtr *r);
 
 void map_printer_permissions(struct security_descriptor *sd);
index d74003a7084c13924368271412b96ac20b0af776..552e1ba076351fedc1df10588f844b536f6872d0 100644 (file)
@@ -36,7 +36,6 @@
 #include "smbd/smbd.h"
 #include "auth.h"
 #include "messages.h"
-#include "ntdomain.h"
 #include "rpc_server/spoolss/srv_spoolss_nt.h"
 
 /* Map generic permissions to printer object specific permissions */
@@ -579,7 +578,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
 /****************************************************************************
 Determine the correct cVersion associated with an architecture and driver
 ****************************************************************************/
-static uint32 get_correct_cversion(struct pipes_struct *p,
+static uint32 get_correct_cversion(struct auth_serversupplied_info *session_info,
                                   const char *architecture,
                                   const char *driverpath_in,
                                   WERROR *perr)
@@ -622,7 +621,7 @@ static uint32 get_correct_cversion(struct pipes_struct *p,
 
        nt_status = create_conn_struct(talloc_tos(), &conn, printdollar_snum,
                                       lp_pathname(printdollar_snum),
-                                      p->session_info, &oldcwd);
+                                      session_info, &oldcwd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("get_correct_cversion: create_conn_struct "
                         "returned %s\n", nt_errstr(nt_status)));
@@ -637,7 +636,7 @@ static uint32 get_correct_cversion(struct pipes_struct *p,
                goto error_free_conn;
        }
 
-       if (!become_user_by_session(conn, p->session_info)) {
+       if (!become_user_by_session(conn, session_info)) {
                DEBUG(0, ("failed to become user\n"));
                *perr = WERR_ACCESS_DENIED;
                goto error_free_conn;
@@ -767,7 +766,7 @@ static uint32 get_correct_cversion(struct pipes_struct *p,
 } while (0);
 
 static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
-                                          struct pipes_struct *rpc_pipe,
+                                          struct auth_serversupplied_info *session_info,
                                           const char *architecture,
                                           const char **driver_path,
                                           const char **data_file,
@@ -827,7 +826,7 @@ static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
         *      NT2K: cversion=3
         */
 
-       *version = get_correct_cversion(rpc_pipe, short_architecture,
+       *version = get_correct_cversion(session_info, short_architecture,
                                        *driver_path, &err);
        if (*version == -1) {
                return err;
@@ -840,12 +839,12 @@ static WERROR clean_up_driver_struct_level(TALLOC_CTX *mem_ctx,
 ****************************************************************************/
 
 WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
-                             struct pipes_struct *rpc_pipe,
+                             struct auth_serversupplied_info *session_info,
                              struct spoolss_AddDriverInfoCtr *r)
 {
        switch (r->level) {
        case 3:
-               return clean_up_driver_struct_level(mem_ctx, rpc_pipe,
+               return clean_up_driver_struct_level(mem_ctx, session_info,
                                                    r->info.info3->architecture,
                                                    &r->info.info3->driver_path,
                                                    &r->info.info3->data_file,
@@ -854,7 +853,7 @@ WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
                                                    r->info.info3->dependent_files,
                                                    &r->info.info3->version);
        case 6:
-               return clean_up_driver_struct_level(mem_ctx, rpc_pipe,
+               return clean_up_driver_struct_level(mem_ctx, session_info,
                                                    r->info.info6->architecture,
                                                    &r->info.info6->driver_path,
                                                    &r->info.info6->data_file,
@@ -959,7 +958,7 @@ static WERROR move_driver_file_to_download_area(TALLOC_CTX *mem_ctx,
        return ret;
 }
 
-WERROR move_driver_to_download_area(struct pipes_struct *p,
+WERROR move_driver_to_download_area(struct auth_serversupplied_info *session_info,
                                    struct spoolss_AddDriverInfoCtr *r)
 {
        struct spoolss_AddDriverInfo3 *driver;
@@ -1005,7 +1004,7 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 
        nt_status = create_conn_struct(talloc_tos(), &conn, printdollar_snum,
                                       lp_pathname(printdollar_snum),
-                                      p->session_info, &oldcwd);
+                                      session_info, &oldcwd);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("move_driver_to_download_area: create_conn_struct "
                         "returned %s\n", nt_errstr(nt_status)));
@@ -1020,7 +1019,7 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
                goto err_free_conn;
        }
 
-       if (!become_user_by_session(conn, p->session_info)) {
+       if (!become_user_by_session(conn, session_info)) {
                DEBUG(0, ("failed to become user\n"));
                err = WERR_ACCESS_DENIED;
                goto err_free_conn;
index a44c047a9b6c38d51a51b79804127db4fcdf8634..6f667cdd61425f02764bde933c701a5196ea2908 100644 (file)
@@ -8011,12 +8011,12 @@ WERROR _spoolss_AddPrinterDriverEx(struct pipes_struct *p,
        }
 
        DEBUG(5,("Cleaning driver's information\n"));
-       err = clean_up_driver_struct(p->mem_ctx, p, r->in.info_ctr);
+       err = clean_up_driver_struct(p->mem_ctx, p->session_info, r->in.info_ctr);
        if (!W_ERROR_IS_OK(err))
                goto done;
 
        DEBUG(5,("Moving driver to final destination\n"));
-       err = move_driver_to_download_area(p, r->in.info_ctr);
+       err = move_driver_to_download_area(p->session_info, r->in.info_ctr);
        if (!W_ERROR_IS_OK(err)) {
                goto done;
        }