From 9a4110d3d13effc260940b012b8af4ba057462de Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 3 Sep 2002 04:56:39 +0000 Subject: Fix setprinterdata rpcclient command to use new cli_spoolss_setprinterdata function. Also fixed crash bug - I don't think anyone uses this command anymore... (This used to be commit 82c9bf2a6f03c801e701636aff726090483cea25) --- source3/rpcclient/cmd_spoolss.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index bd399196eb..15648e4d1b 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1620,7 +1620,8 @@ static NTSTATUS cmd_spoolss_setprinterdata(struct cli_state *cli, POLICY_HND pol; BOOL opened_hnd = False; PRINTER_INFO_CTR ctr; - PRINTER_INFO_0 *info = NULL; + PRINTER_INFO_0 info; + REGISTRY_VALUE value; /* parse the command arguements */ if (argc != 4) { @@ -1642,6 +1643,8 @@ static NTSTATUS cmd_spoolss_setprinterdata(struct cli_state *cli, opened_hnd = True; + ctr.printers_0 = &info; + result = cli_spoolss_getprinter(cli, mem_ctx, 0, &needed, &pol, 0, &ctr); @@ -1652,13 +1655,16 @@ static NTSTATUS cmd_spoolss_setprinterdata(struct cli_state *cli, goto done; printf("%s\n", timestring(True)); - printf("\tchange_id (before set)\t:[0x%x]\n", info->change_id); + printf("\tchange_id (before set)\t:[0x%x]\n", info.change_id); /* Set the printer data */ - result = cli_spoolss_setprinterdata( - cli, mem_ctx, &pol, argv[2], REG_SZ, argv[3], - strlen(argv[3]) + 1); + fstrcpy(value.valuename, argv[2]); + value.type = REG_SZ; + value.size = strlen(argv[3]) + 1; + value.data_p = talloc_memdup(mem_ctx, argv[3], value.size); + + result = cli_spoolss_setprinterdata(cli, mem_ctx, &pol, &value); if (!W_ERROR_IS_OK(result)) { printf ("Unable to set [%s=%s]!\n", argv[2], argv[3]); @@ -1675,7 +1681,7 @@ static NTSTATUS cmd_spoolss_setprinterdata(struct cli_state *cli, goto done; printf("%s\n", timestring(True)); - printf("\tchange_id (after set)\t:[0x%x]\n", info->change_id); + printf("\tchange_id (after set)\t:[0x%x]\n", info.change_id); done: /* cleanup */ -- cgit