summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpcclient/cmd_spoolss.c23
-rw-r--r--source3/utils/net_rpc_printer.c13
2 files changed, 17 insertions, 19 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index e24fb99e6f..5393ba75a9 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -864,10 +864,9 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
NTSTATUS status;
fstring printername;
const char *valuename, *keyname;
- struct regval_blob value;
enum winreg_Type type;
- uint8_t *buffer = NULL;
+ union spoolss_PrinterData data;
uint32_t offered = 0;
uint32_t needed;
@@ -903,21 +902,20 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
&pol,
keyname,
valuename,
- &type,
- buffer,
offered,
+ &type,
+ &data,
&needed,
&result);
if (W_ERROR_EQUAL(result, WERR_MORE_DATA)) {
offered = needed;
- buffer = talloc_array(mem_ctx, uint8_t, needed);
status = rpccli_spoolss_GetPrinterDataEx(cli, mem_ctx,
&pol,
keyname,
valuename,
- &type,
- buffer,
offered,
+ &type,
+ &data,
&needed,
&result);
}
@@ -926,22 +924,13 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli,
goto done;
}
- if (!W_ERROR_IS_OK(result)) {
- goto done;
- }
-
-
if (!W_ERROR_IS_OK(result))
goto done;
/* Display printer data */
- fstrcpy(value.valuename, valuename);
- value.type = type;
- value.size = needed;
- value.data_p = buffer;
+ display_printer_data(valuename, type, &data);
- display_reg_value(value);
done:
if (is_valid_policy_hnd(&pol))
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 6ad8224c86..d1d38e8e00 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -910,6 +910,15 @@ static bool net_spoolss_setprinterdataex(struct rpc_pipe_client *pipe_hnd,
{
WERROR result;
NTSTATUS status;
+ union spoolss_PrinterData data;
+ DATA_BLOB blob;
+
+ blob = data_blob_const(value->data_p, value->size);
+
+ result = pull_spoolss_PrinterData(mem_ctx, &blob, &data, value->type);
+ if (!W_ERROR_IS_OK(result)) {
+ return false;
+ }
/* setprinterdataex call */
status = rpccli_spoolss_SetPrinterDataEx(pipe_hnd, mem_ctx,
@@ -917,8 +926,8 @@ static bool net_spoolss_setprinterdataex(struct rpc_pipe_client *pipe_hnd,
keyname,
value->valuename,
value->type,
- value->data_p,
- value->size,
+ data,
+ 0,
&result);
if (!W_ERROR_IS_OK(result)) {