diff options
author | Jeremy Allison <jra@samba.org> | 2002-11-07 02:15:35 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-11-07 02:15:35 +0000 |
commit | 93042487882d8b2407541ad21d2e9bc2b59142e5 (patch) | |
tree | 9c71fc306cbf8088c23c04c3d0bf46182b32637d /source3/rpc_server | |
parent | 3955716f90c317684093b43065c73167382137d4 (diff) | |
download | samba-93042487882d8b2407541ad21d2e9bc2b59142e5.tar.gz samba-93042487882d8b2407541ad21d2e9bc2b59142e5.tar.bz2 samba-93042487882d8b2407541ad21d2e9bc2b59142e5.zip |
Merge of scalable printing code fix... Needs testing.
Jeremy.
(This used to be commit d030df76439c72825d68410211e62090438cef54)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index a5e464f73b..245df2003f 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -178,10 +178,18 @@ static void free_spool_notify_option(SPOOL_NOTIFY_OPTION **pp) Disconnect from the client ****************************************************************************/ -static void srv_spoolss_replycloseprinter(POLICY_HND *handle) +static void srv_spoolss_replycloseprinter(int snum, POLICY_HND *handle) { WERROR result; + /* + * Tell the specific printing tdb we no longer want messages for this printer + * by deregistering our PID. + */ + + if (!print_notify_deregister_pid(snum)) + DEBUG(0,("print_notify_register_pid: Failed to register our pid for printer %s\n", lp_const_servicename(snum) )); + /* weird if the test succeds !!! */ if (smb_connections==0) { DEBUG(0,("srv_spoolss_replycloseprinter:Trying to close non-existant notify backchannel !\n")); @@ -219,7 +227,8 @@ static void free_printer_entry(void *ptr) Printer_entry *Printer = (Printer_entry *)ptr; if (Printer->notify.client_connected==True) - srv_spoolss_replycloseprinter(&Printer->notify.client_hnd); + srv_spoolss_replycloseprinter(print_queue_snum(Printer->dev.handlename), + &Printer->notify.client_hnd); Printer->notify.flags=0; Printer->notify.options=0; @@ -2305,7 +2314,7 @@ done: Connect to the client machine. **********************************************************/ -static BOOL spoolss_connect_to_client(struct cli_state *the_cli, char *remote_machine) +static BOOL spoolss_connect_to_client(struct cli_state *the_cli, const char *remote_machine) { extern pstring global_myname; @@ -2396,7 +2405,7 @@ static BOOL spoolss_connect_to_client(struct cli_state *the_cli, char *remote_ma Connect to the client. ****************************************************************************/ -static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uint32 type, POLICY_HND *handle) +static BOOL srv_spoolss_replyopenprinter(int snum, const char *printer, uint32 localprinter, uint32 type, POLICY_HND *handle) { WERROR result; @@ -2418,6 +2427,14 @@ static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uin register_message_flags( True, FLAG_MSG_PRINTING ); } + /* + * Tell the specific printing tdb we want messages for this printer + * by registering our PID. + */ + + if (!print_notify_register_pid(snum)) + DEBUG(0,("print_notify_register_pid: Failed to register our pid for printer %s\n", printer )); + smb_connections++; result = cli_spoolss_reply_open_printer(¬ify_cli, notify_cli.mem_ctx, printer, localprinter, @@ -2448,6 +2465,7 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE uint32 options = q_u->options; UNISTR2 *localmachine = &q_u->localmachine; uint32 printerlocal = q_u->printerlocal; + int snum; SPOOL_NOTIFY_OPTION *option = q_u->option; /* store the notify value in the printer struct */ @@ -2459,6 +2477,9 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE return WERR_BADFID; } + if (!get_printer_snum(p, handle, &snum)) + return WERR_BADFID; + Printer->notify.flags=flags; Printer->notify.options=options; Printer->notify.printerlocal=printerlocal; @@ -2473,7 +2494,7 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE /* Connect to the client machine and send a ReplyOpenPrinter */ - if(!srv_spoolss_replyopenprinter(Printer->notify.localmachine, + if(!srv_spoolss_replyopenprinter(snum, Printer->notify.localmachine, Printer->notify.printerlocal, 1, &Printer->notify.client_hnd)) return WERR_SERVER_UNAVAILABLE; @@ -5832,7 +5853,7 @@ WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SET WERROR _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u) { POLICY_HND *handle = &q_u->handle; - + int snum; Printer_entry *Printer= find_printer_index_by_hnd(p, handle); if (!Printer) { @@ -5840,8 +5861,11 @@ WERROR _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u) return WERR_BADFID; } + if (!get_printer_snum(p, handle, &snum)) + return WERR_BADFID; + if (Printer->notify.client_connected==True) - srv_spoolss_replycloseprinter(&Printer->notify.client_hnd); + srv_spoolss_replycloseprinter(snum, &Printer->notify.client_hnd); Printer->notify.flags=0; Printer->notify.options=0; |