/* print notify back-channel pipe handle*/
struct rpc_pipe_client *cli_pipe;
- struct dcerpc_binding_handle *binding_handle;
uint32_t active_connections;
};
/* weird if the test succeeds !!! */
if (prn_hnd->notify.cli_chan == NULL ||
+ prn_hnd->notify.cli_chan->cli_pipe == NULL ||
+ prn_hnd->notify.cli_chan->cli_pipe->binding_handle == NULL ||
prn_hnd->notify.cli_chan->active_connections == 0) {
DEBUG(0, ("Trying to close unexisting backchannel!\n"));
DLIST_REMOVE(back_channels, prn_hnd->notify.cli_chan);
}
status = dcerpc_spoolss_ReplyClosePrinter(
- prn_hnd->notify.cli_chan->binding_handle,
+ prn_hnd->notify.cli_chan->cli_pipe->binding_handle,
talloc_tos(),
&prn_hnd->notify.cli_hnd,
&result);
/* if it's the last connection, deconnect the IPC$ share */
if (prn_hnd->notify.cli_chan->active_connections == 1) {
- prn_hnd->notify.cli_chan->binding_handle = NULL;
cli_shutdown(rpc_pipe_np_smb_conn(prn_hnd->notify.cli_chan->cli_pipe));
DLIST_REMOVE(back_channels, prn_hnd->notify.cli_chan);
TALLOC_FREE(prn_hnd->notify.cli_chan);
if (prn_hnd->notify.msg_ctx != NULL) {
messaging_deregister(prn_hnd->notify.msg_ctx,
MSG_PRINTER_NOTIFY2, NULL);
-
- /*
- * Tell the serverid.tdb we're no longer
- * interested in printer notify messages.
- */
-
- serverid_register_msg_flags(
- messaging_server_id(prn_hnd->notify.msg_ctx),
- false, FLAG_MSG_PRINT_NOTIFY);
}
}
if (prn_hnd->notify.cli_chan) {
prn_hnd->notify.cli_chan->active_connections--;
+ prn_hnd->notify.cli_chan = NULL;
}
}
if (ret != 0)
return WERR_BADFID; /* What to return here? */
- /* go ahead and re-read the services immediately */
- become_root();
- reload_services(msg_ctx, -1, false);
- unbecome_root();
-
- if ( lp_servicenumber( sharename ) >= 0 )
- return WERR_ACCESS_DENIED;
-
return WERR_OK;
}
/* Is there notification on this handle? */
if (prn_hnd->notify.cli_chan == NULL ||
+ prn_hnd->notify.cli_chan->cli_pipe == NULL ||
+ prn_hnd->notify.cli_chan->cli_pipe->binding_handle == NULL ||
prn_hnd->notify.cli_chan->active_connections == 0) {
return 0;
}
info.info0 = &info0;
status = dcerpc_spoolss_RouterReplyPrinterEx(
- prn_hnd->notify.cli_chan->binding_handle,
+ prn_hnd->notify.cli_chan->cli_pipe->binding_handle,
mem_ctx,
&prn_hnd->notify.cli_hnd,
prn_hnd->notify.change, /* color */
if (delete_files &&
(r->in.delete_flags & DPD_DELETE_ALL_FILES) &&
printer_driver_files_in_use(tmp_ctx,
- get_session_info_system(),
- p->msg_ctx,
+ b,
info)) {
/* no idea of the correct error here */
status = WERR_ACCESS_DENIED;
if (delete_files &&
(r->in.delete_flags & DPD_DELETE_ALL_FILES) &&
printer_driver_files_in_use(info,
- get_session_info_system(),
- p->msg_ctx,
+ b,
info_win2k)) {
/* no idea of the correct error here */
talloc_free(info_win2k);
return false;
}
- if ( the_cli->protocol != PROTOCOL_NT1 ) {
+ if ( cli_state_protocol(the_cli) != PROTOCOL_NT1 ) {
DEBUG(0,("spoolss_connect_to_client: machine %s didn't negotiate NT protocol.\n", remote_machine));
cli_shutdown(the_cli);
return false;
/* the +2 is to strip the leading 2 backslashs */
fstrcpy(unix_printer, printer + 2);
- chan = talloc_zero(back_channels, struct notify_back_channel);
+ chan = talloc_zero(NULL, struct notify_back_channel);
if (!chan) {
return false;
}
TALLOC_FREE(chan);
return false;
}
- chan->binding_handle = chan->cli_pipe->binding_handle;
DLIST_ADD(back_channels, chan);
messaging_register(msg_ctx, NULL, MSG_PRINTER_NOTIFY2,
receive_notify2_message_list);
- /* Tell the connections db we're now interested in printer
- * notify messages. */
- serverid_register_msg_flags(messaging_server_id(msg_ctx),
- true, FLAG_MSG_PRINT_NOTIFY);
+ }
+
+ if (chan->cli_pipe == NULL ||
+ chan->cli_pipe->binding_handle == NULL) {
+ DEBUG(0, ("srv_spoolss_replyopenprinter: error - "
+ "NULL %s for printer %s\n",
+ chan->cli_pipe == NULL ?
+ "chan->cli_pipe" : "chan->cli_pipe->binding_handle",
+ printer));
+ return false;
}
/*
printer));
}
- status = dcerpc_spoolss_ReplyOpenPrinter(chan->binding_handle,
+ status = dcerpc_spoolss_ReplyOpenPrinter(chan->cli_pipe->binding_handle,
talloc_tos(),
printer,
localprinter,
return WERR_BADFID;
}
+ /*
+ * When sending a PRINTER_NOTIFY_FIELD_SERVER_NAME we should send the
+ * correct servername.
+ */
+ pinfo2->servername = talloc_strdup(pinfo2, Printer->servername);
+ if (pinfo2->servername == NULL) {
+ return WERR_NOMEM;
+ }
+
for (i=0; i<option->count; i++) {
option_type = option->types[i];