From af451af22f745d56bb92f0dbdd270f7fd024ef0d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 14 May 2002 07:21:57 +0000 Subject: Added deleteprinterdata client rpc. (This used to be commit 217ae50acd8cf088e268e7d2a6a7c192aca9e2f1) --- source3/libsmb/cli_spoolss.c | 45 +++++++++++++++++++++++++++++++++++++++ source3/rpc_parse/parse_spoolss.c | 14 +++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/source3/libsmb/cli_spoolss.c b/source3/libsmb/cli_spoolss.c index 575817fb37..754b7b20a5 100644 --- a/source3/libsmb/cli_spoolss.c +++ b/source3/libsmb/cli_spoolss.c @@ -2122,4 +2122,49 @@ WERROR cli_spoolss_writeprinter(struct cli_state *cli, TALLOC_CTX *mem_ctx, return result; } +/* Delete printer data */ + +WERROR cli_spoolss_deleteprinterdata(struct cli_state *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, char *valuename) +{ + prs_struct qbuf, rbuf; + SPOOL_Q_DELETEPRINTERDATA q; + SPOOL_R_DELETEPRINTERDATA r; + WERROR result = W_ERROR(ERRgeneral); + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Initialise parse structures */ + + prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL); + prs_init(&rbuf, 0, mem_ctx, UNMARSHALL); + + /* Initialise input parameters */ + + make_spoolss_q_deleteprinterdata(&q, hnd, valuename); + + /* Marshall data and send request */ + + if (!spoolss_io_q_deleteprinterdata("", &q, &qbuf, 0) || + !rpc_api_pipe_req(cli, SPOOLSS_DELETEPRINTERDATA, &qbuf, &rbuf)) + goto done; + + /* Unmarshall response */ + + if (!spoolss_io_r_deleteprinterdata("", &r, &rbuf, 0)) + goto done; + + result = r.status; + + if (!W_ERROR_IS_OK(r.status)) + goto done; + + done: + prs_mem_free(&qbuf); + prs_mem_free(&rbuf); + + return result; +} + /** @} **/ diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 10522248f4..47ddbb7aa1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -1112,7 +1112,6 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, q_u->handle = *handle; init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); q_u->size = size; - return True; } @@ -7229,3 +7228,16 @@ BOOL make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, q_u->buffer = data; return True; } + +/******************************************************************* + * init a structure. + ********************************************************************/ + +BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, + POLICY_HND *handle, char *valuename) +{ + memcpy(&q_u->handle, handle, sizeof(POLICY_HND)); + init_unistr2(&q_u->valuename, valuename, strlen(valuename) + 1); + + return True; +} -- cgit