mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3-spoolss: add and use spoolss_printerinfo2_to_setprinterinfo2().
This fixes some invalid typecasts. Guenther
This commit is contained in:
parent
12d1a3b0a5
commit
30a9ddccff
@ -90,3 +90,32 @@ WERROR push_spoolss_PrinterData(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
|
||||
}
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
void spoolss_printerinfo2_to_setprinterinfo2(const struct spoolss_PrinterInfo2 *i,
|
||||
struct spoolss_SetPrinterInfo2 *s)
|
||||
{
|
||||
s->servername = i->servername;
|
||||
s->printername = i->printername;
|
||||
s->sharename = i->sharename;
|
||||
s->portname = i->portname;
|
||||
s->drivername = i->drivername;
|
||||
s->comment = i->comment;
|
||||
s->location = i->location;
|
||||
s->devmode_ptr = 0;
|
||||
s->sepfile = i->sepfile;
|
||||
s->printprocessor = i->printprocessor;
|
||||
s->datatype = i->datatype;
|
||||
s->parameters = i->parameters;
|
||||
s->secdesc_ptr = 0;
|
||||
s->attributes = i->attributes;
|
||||
s->priority = i->priority;
|
||||
s->defaultpriority = i->defaultpriority;
|
||||
s->starttime = i->starttime;
|
||||
s->untiltime = i->untiltime;
|
||||
s->status = i->status;
|
||||
s->cjobs = i->cjobs;
|
||||
s->averageppm = i->averageppm;
|
||||
}
|
||||
|
@ -11,4 +11,6 @@ WERROR pull_spoolss_PrinterData(TALLOC_CTX *mem_ctx,
|
||||
WERROR push_spoolss_PrinterData(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
|
||||
enum winreg_Type type,
|
||||
union spoolss_PrinterData *data);
|
||||
void spoolss_printerinfo2_to_setprinterinfo2(const struct spoolss_PrinterInfo2 *i,
|
||||
struct spoolss_SetPrinterInfo2 *s);
|
||||
|
||||
|
@ -506,27 +506,8 @@ static WERROR cmd_spoolss_setprinter(struct rpc_pipe_client *cli,
|
||||
|
||||
|
||||
/* Modify the comment. */
|
||||
info2.servername = info.info2.servername;
|
||||
info2.printername = info.info2.printername;
|
||||
info2.sharename = info.info2.sharename;
|
||||
info2.portname = info.info2.portname;
|
||||
info2.drivername = info.info2.drivername;
|
||||
info2.comment = comment;
|
||||
info2.location = info.info2.location;
|
||||
info2.devmode_ptr = 0;
|
||||
info2.sepfile = info.info2.sepfile;
|
||||
info2.printprocessor = info.info2.printprocessor;
|
||||
info2.datatype = info.info2.datatype;
|
||||
info2.parameters = info.info2.parameters;
|
||||
info2.secdesc_ptr = 0;
|
||||
info2.attributes = info.info2.attributes;
|
||||
info2.priority = info.info2.priority;
|
||||
info2.defaultpriority = info.info2.defaultpriority;
|
||||
info2.starttime = info.info2.starttime;
|
||||
info2.untiltime = info.info2.untiltime;
|
||||
info2.status = info.info2.status;
|
||||
info2.cjobs = info.info2.cjobs;
|
||||
info2.averageppm = info.info2.averageppm;
|
||||
spoolss_printerinfo2_to_setprinterinfo2(&info.info2, &info2);
|
||||
info2.comment = comment;
|
||||
|
||||
info_ctr.level = 2;
|
||||
info_ctr.info.info2 = &info2;
|
||||
@ -601,27 +582,8 @@ static WERROR cmd_spoolss_setprintername(struct rpc_pipe_client *cli,
|
||||
goto done;
|
||||
|
||||
/* Modify the printername. */
|
||||
info2.servername = info.info2.servername;
|
||||
info2.printername = new_printername;
|
||||
info2.sharename = info.info2.sharename;
|
||||
info2.portname = info.info2.portname;
|
||||
info2.drivername = info.info2.drivername;
|
||||
info2.comment = info.info2.comment;
|
||||
info2.location = info.info2.location;
|
||||
info2.devmode_ptr = 0;
|
||||
info2.sepfile = info.info2.sepfile;
|
||||
info2.printprocessor = info.info2.printprocessor;
|
||||
info2.datatype = info.info2.datatype;
|
||||
info2.parameters = info.info2.parameters;
|
||||
info2.secdesc_ptr = 0;
|
||||
info2.attributes = info.info2.attributes;
|
||||
info2.priority = info.info2.priority;
|
||||
info2.defaultpriority = info.info2.defaultpriority;
|
||||
info2.starttime = info.info2.starttime;
|
||||
info2.untiltime = info.info2.untiltime;
|
||||
info2.status = info.info2.status;
|
||||
info2.cjobs = info.info2.cjobs;
|
||||
info2.averageppm = info.info2.averageppm;
|
||||
spoolss_printerinfo2_to_setprinterinfo2(&info.info2, &info2);
|
||||
info2.printername = new_printername;
|
||||
|
||||
info_ctr.level = 2;
|
||||
info_ctr.info.info2 = &info2;
|
||||
@ -1818,27 +1780,8 @@ static WERROR cmd_spoolss_setdriver(struct rpc_pipe_client *cli,
|
||||
|
||||
/* Set the printer driver */
|
||||
|
||||
info2.servername = info.info2.servername;
|
||||
info2.printername = info.info2.printername;
|
||||
info2.sharename = info.info2.sharename;
|
||||
info2.portname = info.info2.portname;
|
||||
info2.drivername = argv[2];
|
||||
info2.comment = info.info2.comment;
|
||||
info2.location = info.info2.location;
|
||||
info2.devmode_ptr = 0;
|
||||
info2.sepfile = info.info2.sepfile;
|
||||
info2.printprocessor = info.info2.printprocessor;
|
||||
info2.datatype = info.info2.datatype;
|
||||
info2.parameters = info.info2.parameters;
|
||||
info2.secdesc_ptr = 0;
|
||||
info2.attributes = info.info2.attributes;
|
||||
info2.priority = info.info2.priority;
|
||||
info2.defaultpriority = info.info2.defaultpriority;
|
||||
info2.starttime = info.info2.starttime;
|
||||
info2.untiltime = info.info2.untiltime;
|
||||
info2.status = info.info2.status;
|
||||
info2.cjobs = info.info2.cjobs;
|
||||
info2.averageppm = info.info2.averageppm;
|
||||
spoolss_printerinfo2_to_setprinterinfo2(&info.info2, &info2);
|
||||
info2.drivername = argv[2];
|
||||
|
||||
info_ctr.level = 2;
|
||||
info_ctr.info.info2 = &info2;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "utils/net.h"
|
||||
#include "../librpc/gen_ndr/cli_spoolss.h"
|
||||
#include "rpc_client/cli_spoolss.h"
|
||||
#include "rpc_client/init_spoolss.h"
|
||||
#include "registry.h"
|
||||
#include "registry/reg_objects.h"
|
||||
|
||||
@ -757,6 +758,7 @@ static bool net_spoolss_setprinter(struct rpc_pipe_client *pipe_hnd,
|
||||
WERROR result;
|
||||
NTSTATUS status;
|
||||
struct spoolss_SetPrinterInfoCtr info_ctr;
|
||||
struct spoolss_SetPrinterInfo2 info2;
|
||||
struct spoolss_DevmodeContainer devmode_ctr;
|
||||
struct sec_desc_buf secdesc_ctr;
|
||||
|
||||
@ -776,8 +778,8 @@ static bool net_spoolss_setprinter(struct rpc_pipe_client *pipe_hnd,
|
||||
(void *)&info->info1;
|
||||
break;
|
||||
case 2:
|
||||
info_ctr.info.info2 = (struct spoolss_SetPrinterInfo2 *)
|
||||
(void *)&info->info2;
|
||||
spoolss_printerinfo2_to_setprinterinfo2(&info->info2, &info2);
|
||||
info_ctr.info.info2 = &info2;
|
||||
break;
|
||||
case 3:
|
||||
info_ctr.info.info3 = (struct spoolss_SetPrinterInfo3 *)
|
||||
@ -2047,6 +2049,8 @@ NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
|
||||
/* do something for all printers */
|
||||
for (i = 0; i < num_printers; i++) {
|
||||
|
||||
struct spoolss_SetPrinterInfo2 info2;
|
||||
|
||||
/* do some initialization */
|
||||
printername = info_enum[i].info2.printername;
|
||||
sharename = info_enum[i].info2.sharename;
|
||||
@ -2098,8 +2102,8 @@ NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
|
||||
d_printf(_("creating printer: %s\n"), printername);
|
||||
|
||||
info_ctr.level = level;
|
||||
info_ctr.info.info2 = (struct spoolss_SetPrinterInfo2 *)
|
||||
(void *)&info_src.info2;
|
||||
spoolss_printerinfo2_to_setprinterinfo2(&info_src.info2, &info2);
|
||||
info_ctr.info.info2 = &info2;
|
||||
|
||||
result = rpccli_spoolss_addprinterex(pipe_hnd_dst,
|
||||
mem_ctx,
|
||||
|
Loading…
x
Reference in New Issue
Block a user