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;
/* 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);
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;
/* 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);
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);
/* 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);
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)
{
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);
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;
/* 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;
}
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);
static void srv_spoolss_replycloseprinter(POLICY_HND *handle)
{
- NTSTATUS result;
+ WERROR result;
/* weird if the test succeds !!! */
if (smb_connections==0) {
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) {
--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)
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);
}
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) {
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;
}
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)));
}
}
}
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
if(!spoolss_connect_to_client(&cli, unix_printer))
return False;
+
message_register(MSG_PRINTER_NOTIFY, srv_spoolss_receive_message);
}
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));
}
/********************************************************************