summaryrefslogtreecommitdiff
path: root/source4/rpc_server/spoolss
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-10 12:15:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:38 -0500
commit577218b2aded7adb367f3f33bcc5560f3d4c0ec2 (patch)
tree353a1cad1840485225b0d25d08eae5ae4aa27e5c /source4/rpc_server/spoolss
parent3136462ea9d2b97e5385386e2c37b1ac403db6ca (diff)
downloadsamba-577218b2aded7adb367f3f33bcc5560f3d4c0ec2.tar.gz
samba-577218b2aded7adb367f3f33bcc5560f3d4c0ec2.tar.bz2
samba-577218b2aded7adb367f3f33bcc5560f3d4c0ec2.zip
r4640: first stage in the server side support for multiple context_ids on one pipe
this stage does the following: - simplifies the dcerpc_handle handling, and all the callers of it - split out the context_id depenent state into a linked list of established contexts - fixed some talloc handling in several rpc servers that i noticed while doing the above (This used to be commit fde042b3fc609c94e2c7eedcdd72ecdf489cf63b)
Diffstat (limited to 'source4/rpc_server/spoolss')
-rw-r--r--source4/rpc_server/spoolss/dcesrv_spoolss.c43
-rw-r--r--source4/rpc_server/spoolss/dcesrv_spoolss.h2
2 files changed, 5 insertions, 40 deletions
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index 25210913fe..ff0a5641b7 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
@@ -186,26 +186,6 @@ static WERROR spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CT
}
-/*
- 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)
-{
- struct spoolss_openprinter_state *c_state = h->data;
- spoolss_OpenPrinter_close(c_state);
-}
-
/*
spoolss_OpenPrinter
*/
@@ -498,10 +478,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 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);
+ talloc_free(h);
ZERO_STRUCTP(r->out.handle);
@@ -905,34 +882,24 @@ static WERROR spoolss_OpenPrinterEx_server(struct dcesrv_call_state *dce_call,
{
struct spoolss_openprinter_state *state;
struct dcesrv_handle *handle;
- TALLOC_CTX *op_mem_ctx;
/* Check printername is our name */
if (!strequal(r->in.printername + 2, lp_netbios_name()))
return WERR_INVALID_PRINTER_NAME;
- op_mem_ctx = talloc_init("spoolss_OpenPrinter");
- if (!op_mem_ctx) {
- return WERR_OK;
+ handle = dcesrv_handle_new(dce_call->context, SPOOLSS_HANDLE_SERVER);
+ if (!handle) {
+ return WERR_NOMEM;
}
- state = talloc_p(op_mem_ctx, struct spoolss_openprinter_state);
+ state = talloc_p(handle, struct spoolss_openprinter_state);
if (!state) {
return WERR_OK;
}
- state->mem_ctx = op_mem_ctx;
-
- handle = dcesrv_handle_new(dce_call->conn, SPOOLSS_HANDLE_SERVER);
- if (!handle) {
- talloc_destroy(state->mem_ctx);
- return WERR_NOMEM;
- }
handle->data = state;
- handle->destroy = spoolss_OpenPrinter_destroy;
- state->reference_count = 1;
state->access_mask = r->in.access_mask;
*r->out.handle = handle->wire_handle;
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.h b/source4/rpc_server/spoolss/dcesrv_spoolss.h
index 950c765a72..aef13dd6d6 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.h
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.h
@@ -32,8 +32,6 @@ enum spoolss_handle {
state asscoiated with a spoolss_OpenPrinter{,Ex}() operation
*/
struct spoolss_openprinter_state {
- int reference_count;
void *openprinter_ctx;
- TALLOC_CTX *mem_ctx;
uint32_t access_mask;
};