diff options
author | Tim Potter <tpot@samba.org> | 2004-06-20 11:34:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:45 -0500 |
commit | 77c571986414afd070ba629f41317e011e52349b (patch) | |
tree | d07b4b58e22af89a7b427a01ee87a834b9f4b6b6 /source4 | |
parent | 7936b76e6a7d3c3436afe16ed3b8aa2be13fbcb5 (diff) | |
download | samba-77c571986414afd070ba629f41317e011e52349b.tar.gz samba-77c571986414afd070ba629f41317e011e52349b.tar.bz2 samba-77c571986414afd070ba629f41317e011e52349b.zip |
r1208: Return some dummy printer information for the EnumPrinters RPC.
rpcclient enumprinters prints this information OK.
Some minor cut&paste cleanups.
(This used to be commit 1c749a3a348a2df477808d4fcc5377832bffa5e9)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/spoolss/dcesrv_spoolss.c | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index cb001c168a..dbf3d4cb89 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -31,19 +31,64 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrinters *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + struct ndr_push *buf; + struct spoolss_PrinterInfo1 info; + WERROR result; + + info.flags = 0; + info.name = "p"; + info.description = "a printer"; + info.comment = "a comment"; + + buf = ndr_push_init(); + + ndr_push_spoolss_PrinterInfo1(buf, NDR_SCALARS|NDR_BUFFERS, &info); + + if (*r->in.buf_size < buf->offset) { + *r->out.buf_size = buf->offset; + result = WERR_INSUFFICIENT_BUFFER; + goto done; + } + + r->out.buffer = (DATA_BLOB *)talloc(mem_ctx, sizeof(DATA_BLOB)); + + if (!r->out.buffer) { + result = WERR_NOMEM; + goto done; + } + + *r->out.buffer = data_blob_talloc(mem_ctx, buf->data, buf->offset); + + r->out.count = 1; + *r->out.buf_size = buf->offset; + + result = WERR_OK; + + done: + ndr_push_free(buf); + + return result; } /* + destroy connection state +*/ +static void spoolss_OpenPrinter_close(struct spoolss_openprinter_state *c_state) +{ + c_state->reference_count--; + if (c_state->reference_count == 0) { + talloc_destroy(c_state->mem_ctx); + } +} + +/* destroy an open connection. This closes the database connection */ static void spoolss_OpenPrinter_destroy(struct dcesrv_connection *conn, struct dcesrv_handle *h) { -#if 0 - struct samr_connect_state *c_state = h->data; - samr_Connect_close(c_state); -#endif + struct spoolss_openprinter_state *c_state = h->data; + spoolss_OpenPrinter_close(c_state); } /* @@ -338,7 +383,7 @@ static WERROR spoolss_ClosePrinter(struct dcesrv_call_state *dce_call, TALLOC_CT DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY); - /* this causes the callback spoolss_XXX_destroy() to be called by + /* this causes the callback s_XXX_destroy() to be called by the handle destroy code which destroys the state associated with the handle */ dcesrv_handle_destroy(dce_call->conn, h); |