summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-09-03 00:26:19 +0000
committerTim Potter <tpot@samba.org>2002-09-03 00:26:19 +0000
commit882ff84daad4052d87cbf3d83de6cb281b09251a (patch)
tree526aae0376e214bf73d7840d38d767ce6ed065c3
parente0a8b7e0d0705c8f1597cc24cf62d830a5dea2ca (diff)
downloadsamba-882ff84daad4052d87cbf3d83de6cb281b09251a.tar.gz
samba-882ff84daad4052d87cbf3d83de6cb281b09251a.tar.bz2
samba-882ff84daad4052d87cbf3d83de6cb281b09251a.zip
Return data from enumprinterdataex by deep copying on passed in tdb context.
(This used to be commit 1f629aa54ea3733c356c21f9f707b7f6075f6429)
-rw-r--r--source3/rpc_client/cli_spoolss.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index cff1f1d0a9..d2492dc53b 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -2171,6 +2171,7 @@ WERROR cli_spoolss_enumprinterdataex(struct cli_state *cli, TALLOC_CTX *mem_ctx,
SPOOL_Q_ENUMPRINTERDATAEX q;
SPOOL_R_ENUMPRINTERDATAEX r;
WERROR result = W_ERROR(ERRgeneral);
+ int i;
ZERO_STRUCT(q);
ZERO_STRUCT(r);
@@ -2207,7 +2208,22 @@ WERROR cli_spoolss_enumprinterdataex(struct cli_state *cli, TALLOC_CTX *mem_ctx,
*returned = r.returned;
- /* TODO: figure out a nice way to return data */
+ /* Again, we have to deep copy the results on the passed in
+ tdb context as they will disappear after the prs_free at
+ the end of this function. */
+
+ *values = talloc(mem_ctx, sizeof(PRINTER_ENUM_VALUES) * r.returned);
+
+ for (i = 0; i < r.returned; i++) {
+ PRINTER_ENUM_VALUES *v = &r.ctr.values[i];
+
+ (*values)[i].valuename.buffer = talloc(mem_ctx, v->value_len * 2);
+ unistrcpy((*values)[i].valuename.buffer, v->valuename.buffer);
+ (*values)[i].type = v->type;
+ (*values)[i].data = talloc(mem_ctx, v->data_len);
+ memcpy((*values)[i].data, v->data, v->data_len);
+ (*values)[i].data_len = v->data_len;
+ }
done:
prs_mem_free(&qbuf);