summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_spoolss_nt.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-10 22:24:10 +0000
committerJeremy Allison <jra@samba.org>2002-11-10 22:24:10 +0000
commit7f94064e4ae14b1bfdbb6553420c504a1e571103 (patch)
treed0785ad496b7f3cf3a647a98caafeaf56e861cae /source3/rpc_server/srv_spoolss_nt.c
parent9d7cd6643150704fab06982603b87df22bb3528e (diff)
downloadsamba-7f94064e4ae14b1bfdbb6553420c504a1e571103.tar.gz
samba-7f94064e4ae14b1bfdbb6553420c504a1e571103.tar.bz2
samba-7f94064e4ae14b1bfdbb6553420c504a1e571103.zip
First cut of fix for changenotify on a print server handle. Use the connections tdb
with an snum of -1 and a special printername. Jeremy. (This used to be commit 940b04ddfa87acc939911e3fe76496e3c4675632)
Diffstat (limited to 'source3/rpc_server/srv_spoolss_nt.c')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index f8262110ce..2227d39f44 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -226,9 +226,19 @@ static void free_printer_entry(void *ptr)
{
Printer_entry *Printer = (Printer_entry *)ptr;
- if (Printer->notify.client_connected==True)
- srv_spoolss_replycloseprinter(print_queue_snum(Printer->dev.handlename),
- &Printer->notify.client_hnd);
+ if (Printer->notify.client_connected==True) {
+ int snum = -1;
+
+ if ( Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER) {
+ snum = -1;
+ srv_spoolss_replycloseprinter(snum, &Printer->notify.client_hnd);
+ } else if (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) {
+ snum = print_queue_snum(Printer->dev.handlename);
+ if (snum != -1)
+ srv_spoolss_replycloseprinter(snum,
+ &Printer->notify.client_hnd);
+ }
+ }
Printer->notify.flags=0;
Printer->notify.options=0;
@@ -2471,7 +2481,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;
+ int snum = -1;
SPOOL_NOTIFY_OPTION *option = q_u->option;
/* store the notify value in the printer struct */
@@ -2483,9 +2493,6 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE
return WERR_BADFID;
}
- if ( (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) && !get_printer_snum(p, handle, &snum) )
- return WERR_BADFID;
-
Printer->notify.flags=flags;
Printer->notify.options=options;
Printer->notify.printerlocal=printerlocal;
@@ -2500,6 +2507,12 @@ WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE
/* Connect to the client machine and send a ReplyOpenPrinter */
+ if ( Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER)
+ snum = -1;
+ else if ( (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) &&
+ !get_printer_snum(p, handle, &snum) )
+ return WERR_BADFID;
+
if(!srv_spoolss_replyopenprinter(snum, Printer->notify.localmachine,
Printer->notify.printerlocal, 1,
&Printer->notify.client_hnd))
@@ -5859,7 +5872,6 @@ 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) {
@@ -5867,11 +5879,17 @@ 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) {
+ int snum = -1;
+
+ if ( Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER)
+ snum = -1;
+ else if ( (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) &&
+ !get_printer_snum(p, handle, &snum) )
+ return WERR_BADFID;
- if (Printer->notify.client_connected==True)
srv_spoolss_replycloseprinter(snum, &Printer->notify.client_hnd);
+ }
Printer->notify.flags=0;
Printer->notify.options=0;