summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-02-13 18:06:45 +0100
committerGünther Deschner <gd@samba.org>2009-02-14 01:42:00 +0100
commitcba40f65212814ddf7ccdcfdf92f799785a6ad4e (patch)
tree1479a761591e362b1eb080951ee38494fa6fb223
parent886c028e44a31c52f6595343f55236e27a8d0b40 (diff)
downloadsamba-cba40f65212814ddf7ccdcfdf92f799785a6ad4e.tar.gz
samba-cba40f65212814ddf7ccdcfdf92f799785a6ad4e.tar.bz2
samba-cba40f65212814ddf7ccdcfdf92f799785a6ad4e.zip
s3-rpcclient: use rpccli_spoolss_AddPrinterEx.
Guenther
-rw-r--r--source3/rpcclient/cmd_spoolss.c58
1 files changed, 42 insertions, 16 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index b4dcad5187..b6e8f7dd97 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1380,9 +1380,14 @@ static WERROR cmd_spoolss_addprinterex(struct rpc_pipe_client *cli,
int argc, const char **argv)
{
WERROR result;
- uint32 level = 2;
- PRINTER_INFO_CTR ctr;
- PRINTER_INFO_2 info2;
+ NTSTATUS status;
+ struct spoolss_SetPrinterInfoCtr info_ctr;
+ struct spoolss_SetPrinterInfo2 info2;
+ struct policy_handle handle;
+ struct spoolss_DevmodeContainer devmode_ctr;
+ struct sec_desc_buf sd;
+ struct spoolss_UserLevelCtr userlevel_ctr;
+ struct spoolss_UserLevel1 level1;
/* parse the command arguments */
if (argc != 5)
@@ -1392,17 +1397,19 @@ static WERROR cmd_spoolss_addprinterex(struct rpc_pipe_client *cli,
}
/* Fill in the DRIVER_INFO_2 struct */
+ ZERO_STRUCT(devmode_ctr);
ZERO_STRUCT(info2);
-
- init_unistr( &info2.printername, argv[1]);
- init_unistr( &info2.sharename, argv[2]);
- init_unistr( &info2.drivername, argv[3]);
- init_unistr( &info2.portname, argv[4]);
- init_unistr( &info2.comment, "Created by rpcclient");
- init_unistr( &info2.printprocessor, "winprint");
- init_unistr( &info2.datatype, "RAW");
- info2.devmode = NULL;
- info2.secdesc = NULL;
+ ZERO_STRUCT(sd);
+
+ info2.printername = argv[1];
+ info2.drivername = argv[3];
+ info2.sharename = argv[2];
+ info2.portname = argv[4];
+ info2.comment = "Created by rpcclient";
+ info2.printprocessor = "winprint";
+ info2.datatype = "RAW";
+ info2.devmode = NULL;
+ info2.secdesc = NULL;
info2.attributes = PRINTER_ATTRIBUTE_SHARED;
info2.priority = 0;
info2.defaultpriority = 0;
@@ -1417,9 +1424,28 @@ static WERROR cmd_spoolss_addprinterex(struct rpc_pipe_client *cli,
info2.averageppm = 0;
*/
- ctr.printers_2 = &info2;
- result = rpccli_spoolss_addprinterex (cli, mem_ctx, level, &ctr);
-
+ info_ctr.level = 2;
+ info_ctr.info.info2 = &info2;
+
+ level1.size = 28; /* wild guess */
+ level1.build = 1381;
+ level1.major = 2;
+ level1.minor = 0;
+ level1.processor = 0;
+ level1.client = global_myname();
+ level1.user = cli->auth->user_name;
+
+ userlevel_ctr.level = 1;
+ userlevel_ctr.user_info.level1 = &level1;
+
+ status = rpccli_spoolss_AddPrinterEx(cli, mem_ctx,
+ cli->srv_name_slash,
+ &info_ctr,
+ &devmode_ctr,
+ &sd,
+ &userlevel_ctr,
+ &handle,
+ &result);
if (W_ERROR_IS_OK(result))
printf ("Printer %s successfully installed.\n", argv[1]);