summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpc_client/cli_spoolss_notify.c52
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c38
2 files changed, 40 insertions, 50 deletions
diff --git a/source3/rpc_client/cli_spoolss_notify.c b/source3/rpc_client/cli_spoolss_notify.c
index a3e7acb1c1..320708736e 100644
--- a/source3/rpc_client/cli_spoolss_notify.c
+++ b/source3/rpc_client/cli_spoolss_notify.c
@@ -160,11 +160,11 @@ BOOL spoolss_connect_to_client( struct cli_state *cli, char *remote_machine)
do a reply open printer
****************************************************************************/
-NTSTATUS cli_spoolss_reply_open_printer(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+WERROR cli_spoolss_reply_open_printer(struct cli_state *cli, TALLOC_CTX *mem_ctx,
char *printer, uint32 localprinter, uint32 type,
POLICY_HND *handle)
{
- NTSTATUS result;
+ WERROR result = W_ERROR(ERRgeneral);
prs_struct rbuf;
prs_struct buf;
@@ -183,25 +183,21 @@ NTSTATUS cli_spoolss_reply_open_printer(struct cli_state *cli, TALLOC_CTX *mem_c
/* turn parameters into data stream */
if(!spoolss_io_q_replyopenprinter("", &q_s, &buf, 0)) {
DEBUG(0,("cli_spoolss_reply_open_printer: Error : failed to marshall SPOOL_Q_REPLYOPENPRINTER struct.\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
/* send the data on \PIPE\ */
- if (!rpc_api_pipe_req(cli, SPOOLSS_REPLYOPENPRINTER, &buf, &rbuf)) {
- result = NT_STATUS_UNSUCCESSFUL;
+ if (!rpc_api_pipe_req(cli, SPOOLSS_REPLYOPENPRINTER, &buf, &rbuf))
goto done;
- }
/* turn data stream into parameters*/
if(!spoolss_io_r_replyopenprinter("", &r_s, &rbuf, 0)) {
DEBUG(0,("cli_spoolss_reply_open_printer: Error : failed to unmarshall SPOOL_R_REPLYOPENPRINTER struct.\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
memcpy(handle, &r_s.handle, sizeof(r_s.handle));
- result = werror_to_ntstatus(r_s.status);
+ result = r_s.status;
done:
prs_mem_free(&buf);
@@ -214,10 +210,10 @@ done:
do a reply open printer
****************************************************************************/
-NTSTATUS cli_spoolss_reply_close_printer(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+WERROR cli_spoolss_reply_close_printer(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *handle)
{
- NTSTATUS result;
+ WERROR result = W_ERROR(ERRgeneral);
prs_struct rbuf;
prs_struct buf;
@@ -235,25 +231,21 @@ NTSTATUS cli_spoolss_reply_close_printer(struct cli_state *cli, TALLOC_CTX *mem_
/* turn parameters into data stream */
if(!spoolss_io_q_replycloseprinter("", &q_s, &buf, 0)) {
DEBUG(0,("cli_spoolss_reply_close_printer: Error : failed to marshall SPOOL_Q_REPLY_CLOSEPRINTER struct.\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
/* send the data on \PIPE\ */
- if (!rpc_api_pipe_req(cli, SPOOLSS_REPLYCLOSEPRINTER, &buf, &rbuf)) {
- result = NT_STATUS_UNSUCCESSFUL;
+ if (!rpc_api_pipe_req(cli, SPOOLSS_REPLYCLOSEPRINTER, &buf, &rbuf))
goto done;
- }
/* turn data stream into parameters*/
if(!spoolss_io_r_replycloseprinter("", &r_s, &rbuf, 0)) {
DEBUG(0,("cli_spoolss_reply_close_printer: Error : failed to marshall SPOOL_R_REPLY_CLOSEPRINTER struct.\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- result = werror_to_ntstatus(r_s.status);
+ result = r_s.status;
done:
prs_mem_free(&buf);
@@ -270,13 +262,13 @@ done:
Also see cli_spolss_reply_rrpcn()
*********************************************************************/
-NTSTATUS cli_spoolss_routerreplyprinter (struct cli_state *cli, TALLOC_CTX *mem_ctx,
+WERROR cli_spoolss_routerreplyprinter (struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *pol, uint32 condition, uint32 changd_id)
{
prs_struct qbuf, rbuf;
SPOOL_Q_ROUTERREPLYPRINTER q;
SPOOL_R_ROUTERREPLYPRINTER r;
- NTSTATUS result;
+ WERROR result = W_ERROR(ERRgeneral);
ZERO_STRUCT(q);
ZERO_STRUCT(r);
@@ -294,25 +286,21 @@ NTSTATUS cli_spoolss_routerreplyprinter (struct cli_state *cli, TALLOC_CTX *mem_
/* Marshall data and send request */
if (!spoolss_io_q_routerreplyprinter ("", &q, &qbuf, 0)) {
DEBUG(0,("cli_spoolss_routerreplyprinter: Unable to marshall SPOOL_Q_ROUTERREPLYPRINTER!\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- if (!rpc_api_pipe_req (cli, SPOOLSS_ROUTERREPLYPRINTER, &qbuf, &rbuf)) {
- result = NT_STATUS_UNSUCCESSFUL;
+ if (!rpc_api_pipe_req (cli, SPOOLSS_ROUTERREPLYPRINTER, &qbuf, &rbuf))
goto done;
- }
/* Unmarshall response */
if (!spoolss_io_r_routerreplyprinter ("", &r, &rbuf, 0)) {
DEBUG(0,("cli_spoolss_routerreplyprinter: Unable to unmarshall SPOOL_R_ROUTERREPLYPRINTER!\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
/* Return output parameters */
- result = werror_to_ntstatus(r.status);
+ result = r.status;
done:
prs_mem_free(&qbuf);
@@ -373,7 +361,7 @@ static int build_notify_data (TALLOC_CTX *ctx, NT_PRINTER_INFO_LEVEL *printer, u
Also see cli_spoolss_routereplyprinter()
*********************************************************************/
-NTSTATUS cli_spoolss_reply_rrpcn(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+WERROR cli_spoolss_reply_rrpcn(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *handle, PRINTER_MESSAGE_INFO *info,
NT_PRINTER_INFO_LEVEL *printer)
{
@@ -384,14 +372,14 @@ NTSTATUS cli_spoolss_reply_rrpcn(struct cli_state *cli, TALLOC_CTX *mem_ctx,
SPOOL_NOTIFY_INFO_DATA *notify_data = NULL;
uint32 data_len;
- NTSTATUS result;
+ WERROR result = W_ERROR(ERRgeneral);
SPOOL_Q_REPLY_RRPCN q_s;
SPOOL_R_REPLY_RRPCN r_s;
if (!info) {
DEBUG(5,("cli_spoolss_reply_rrpcn: NULL printer message info pointer!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ goto done;
}
prs_init(&buf, 1024, mem_ctx, MARSHALL);
@@ -409,7 +397,7 @@ NTSTATUS cli_spoolss_reply_rrpcn(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (info->flags && (data_len == -1)) {
DEBUG(0,("cli_spoolss_reply_rrpcn: Failed to build SPOOL_NOTIFY_INFO_DATA [flags == 0x%x] for printer [%s]\n",
info->flags, info->printer_name));
- result = NT_STATUS_NO_MEMORY;
+ result = WERR_NOMEM;
goto done;
}
notify_info.version = 0x2;
@@ -425,21 +413,17 @@ NTSTATUS cli_spoolss_reply_rrpcn(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* turn parameters into data stream */
if(!spoolss_io_q_reply_rrpcn("", &q_s, &buf, 0)) {
DEBUG(0,("cli_spoolss_reply_rrpcn: Error : failed to marshall SPOOL_Q_REPLY_RRPCN struct.\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
/* send the data on \PIPE\ */
- if (!rpc_api_pipe_req(cli, SPOOLSS_RRPCN, &buf, &rbuf)) {
- result = NT_STATUS_UNSUCCESSFUL;
+ if (!rpc_api_pipe_req(cli, SPOOLSS_RRPCN, &buf, &rbuf))
goto done;
- }
/* turn data stream into parameters*/
if(!spoolss_io_r_reply_rrpcn("", &r_s, &rbuf, 0)) {
DEBUG(0,("cli_spoolss_reply_rrpcn: Error : failed to unmarshall SPOOL_R_REPLY_RRPCN struct.\n"));
- result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
@@ -447,7 +431,7 @@ NTSTATUS cli_spoolss_reply_rrpcn(struct cli_state *cli, TALLOC_CTX *mem_ctx,
DEBUG(8,("cli_spoolss_reply_rrpcn: I think the spooler resonded that the notification was ignored.\n"));
}
- result = werror_to_ntstatus(r_s.status);
+ result = r_s.status;
done:
prs_mem_free(&buf);
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 3022b99afa..dff1186e1e 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -161,7 +161,7 @@ static void free_spool_notify_option(SPOOL_NOTIFY_OPTION **pp)
static void srv_spoolss_replycloseprinter(POLICY_HND *handle)
{
- NTSTATUS result;
+ WERROR result;
/* weird if the test succeds !!! */
if (smb_connections==0) {
@@ -171,8 +171,9 @@ static void srv_spoolss_replycloseprinter(POLICY_HND *handle)
result = cli_spoolss_reply_close_printer(&cli, cli.mem_ctx, handle);
- if (!NT_STATUS_IS_OK(result))
- DEBUG(0,("srv_spoolss_replycloseprinter: reply_close_printer failed.\n"));
+ if (!W_ERROR_IS_OK(result))
+ DEBUG(0,("srv_spoolss_replycloseprinter: reply_close_printer failed [%s].\n",
+ werror_str(result)));
/* if it's the last connection, deconnect the IPC$ share */
if (smb_connections==1) {
@@ -568,11 +569,11 @@ static BOOL is_client_monitoring_event(Printer_entry *p, uint32 flags)
--jerry
**************************************************************************/
-static NTSTATUS srv_spoolss_routerreplyprinter (struct cli_state *reply_cli, TALLOC_CTX *mem_ctx,
+static WERROR srv_spoolss_routerreplyprinter (struct cli_state *reply_cli, TALLOC_CTX *mem_ctx,
POLICY_HND *pol, PRINTER_MESSAGE_INFO *info,
NT_PRINTER_INFO_LEVEL *printer)
{
- NTSTATUS result;
+ WERROR result;
uint32 condition = 0x0;
if (info->flags & PRINTER_MESSAGE_DRIVER)
@@ -589,16 +590,17 @@ static NTSTATUS srv_spoolss_routerreplyprinter (struct cli_state *reply_cli, TAL
notification
**********************************************************************/
-static NTSTATUS srv_spoolss_send_event_to_client(Printer_entry* Printer,
+static WERROR srv_spoolss_send_event_to_client(Printer_entry* Printer,
struct cli_state *send_cli, PRINTER_MESSAGE_INFO *msg,
NT_PRINTER_INFO_LEVEL *info)
{
- NTSTATUS result;
+ WERROR result;
if (valid_notify_options(Printer)) {
/* This is a single call that can send information about multiple changes */
if (Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER)
msg->flags |= PRINTER_MESSAGE_ATTRIBUTES;
+
result = cli_spoolss_reply_rrpcn(send_cli, send_cli->mem_ctx, &Printer->notify.client_hnd,
msg, info);
}
@@ -620,8 +622,7 @@ static NTSTATUS srv_spoolss_send_event_to_client(Printer_entry* Printer,
static void send_spoolss_event_notification(PRINTER_MESSAGE_INFO *msg)
{
Printer_entry *find_printer;
- NTSTATUS result;
- WERROR wresult;
+ WERROR result;
NT_PRINTER_INFO_LEVEL *printer = NULL;
if (!msg) {
@@ -686,8 +687,8 @@ static void send_spoolss_event_notification(PRINTER_MESSAGE_INFO *msg)
printer = NULL;
}
- wresult = get_a_printer(&printer, 2, msg->printer_name);
- if (! W_ERROR_IS_OK(wresult))
+ result = get_a_printer(&printer, 2, msg->printer_name);
+ if (!W_ERROR_IS_OK(result))
continue;
}
@@ -695,9 +696,9 @@ static void send_spoolss_event_notification(PRINTER_MESSAGE_INFO *msg)
result = srv_spoolss_send_event_to_client(find_printer, &cli, msg, printer);
- if (!NT_STATUS_IS_OK(result)) {
- DEBUG(10,("send_spoolss_event_notification: Event notification failed [%s]\n",
- nt_errstr(result)));
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(5,("send_spoolss_event_notification: Event notification failed [%s]\n",
+ werror_str(result)));
}
}
}
@@ -1581,7 +1582,7 @@ WERROR _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPO
static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uint32 type, POLICY_HND *handle)
{
- NTSTATUS result;
+ WERROR result;
/*
* If it's the first connection, contact the client
@@ -1594,6 +1595,7 @@ static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uin
if(!spoolss_connect_to_client(&cli, unix_printer))
return False;
+
message_register(MSG_PRINTER_NOTIFY, srv_spoolss_receive_message);
}
@@ -1603,7 +1605,11 @@ static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uin
result = cli_spoolss_reply_open_printer(&cli, cli.mem_ctx, printer, localprinter,
type, handle);
- return (NT_STATUS_IS_OK(result));
+ if (!W_ERROR_IS_OK(result))
+ DEBUG(5,("srv_spoolss_reply_open_printer: Client RPC returned [%s]\n",
+ werror_str(result)));
+
+ return (W_ERROR_IS_OK(result));
}
/********************************************************************