From 3d0ee9bbef948df9c472ba0b534d9829dd2c466a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 30 Apr 2011 00:09:09 +0200 Subject: s3-printing: avoid using pipes_struct when only session_info is needed. Guenther (cherry picked from commit cd5b2b242b39437081592d41d297bce0668b40ab) (cherry picked from commit 44c6ed73b6f27484014cde771715c94475cac53f) --- source3/include/nt_printing.h | 6 +++--- source3/printing/nt_printing.c | 23 +++++++++++------------ source3/rpc_server/spoolss/srv_spoolss_nt.c | 4 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h index 02a72b32f19..ad6262ecff0 100644 --- a/source3/include/nt_printing.h +++ b/source3/include/nt_printing.h @@ -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); diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index d74003a7084..552e1ba0763 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -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; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index a44c047a9b6..6f667cdd614 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -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; } -- cgit