summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-09-03 04:56:39 +0000
committerTim Potter <tpot@samba.org>2002-09-03 04:56:39 +0000
commit9a4110d3d13effc260940b012b8af4ba057462de (patch)
treec8064630db8a38913f23b81a825017581bd251a9 /source3
parent629ad6941e95fef465059c248ea0d99a32be2a98 (diff)
downloadsamba-9a4110d3d13effc260940b012b8af4ba057462de.tar.gz
samba-9a4110d3d13effc260940b012b8af4ba057462de.tar.bz2
samba-9a4110d3d13effc260940b012b8af4ba057462de.zip
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)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpcclient/cmd_spoolss.c18
1 files changed, 12 insertions, 6 deletions
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 */