summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_spoolss_nt.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-03-13 20:18:45 +0000
committerJeremy Allison <jra@samba.org>2001-03-13 20:18:45 +0000
commite532d96a26055d23450bfb3e9c28e0179ee9f2d2 (patch)
tree47bbf388d5dc561182df1c8c666d9e0d301fd67b /source3/rpc_server/srv_spoolss_nt.c
parent13a584b05acab8d0bb0257712664a3c6a90e3f97 (diff)
downloadsamba-e532d96a26055d23450bfb3e9c28e0179ee9f2d2.tar.gz
samba-e532d96a26055d23450bfb3e9c28e0179ee9f2d2.tar.bz2
samba-e532d96a26055d23450bfb3e9c28e0179ee9f2d2.zip
Move to a handle database per pipe name, not per pipe.
Jeremy. (This used to be commit a24b248a77ccac364832ff7d4df083d437caf9ed)
Diffstat (limited to 'source3/rpc_server/srv_spoolss_nt.c')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 9fcf9930bf..804fe8a523 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -569,7 +569,7 @@ static BOOL open_printer_hnd(pipes_struct *p, POLICY_HND *hnd, char *name)
return False;
}
- DEBUG(5, ("%d printer handles active\n", (int)p->pipe_handles.count ));
+ DEBUG(5, ("%d printer handles active\n", (int)p->pipe_handles->count ));
return True;
}
@@ -634,6 +634,8 @@ void srv_spoolss_receive_message(int msg_type, pid_t src, void *buf, size_t len)
fstring printer;
uint32 status;
struct pipes_struct *p;
+ struct policy *pol;
+ struct handle_list *hl;
*printer = '\0';
fstrcpy(printer,buf);
@@ -645,32 +647,43 @@ void srv_spoolss_receive_message(int msg_type, pid_t src, void *buf, size_t len)
DEBUG(10,("srv_spoolss_receive_message: Got message about printer %s\n", printer ));
- /* We need to enumerate all our pipes and all printers on them. */
+ /*
+ * We need to enumerate all printers. The handle list is shared
+ * across pipes of the same name, so just find the first open
+ * spoolss pipe.
+ */
+
+ hl = NULL;
for ( p = get_first_pipe(); p; get_next_pipe(p)) {
- struct policy *pol;
+ if (strequal(p->name, "spoolss")) {
+ hl = p->pipe_handles;
+ break;
+ }
+ }
- if (!strequal(p->name, "spoolss"))
- continue;
+ if (!hl) {
+ DEBUG(0,("srv_spoolss_receive_message: no handle list on spoolss pipe !\n"));
+ return;
+ }
- /* Iterate the printer list on this pipe. */
- for (pol = p->pipe_handles.Policy; pol; pol = pol->next ) {
- Printer_entry *find_printer = (Printer_entry *)pol->data_ptr;
+ /* Iterate the printer list on this pipe. */
+ for (pol = hl->Policy; pol; pol = pol->next ) {
+ Printer_entry *find_printer = (Printer_entry *)pol->data_ptr;
- if (!find_printer)
- continue;
+ if (!find_printer)
+ continue;
- /*
- * if the entry is the given printer or if it's a printerserver
- * we send the message
- */
+ /*
+ * if the entry is the given printer or if it's a printerserver
+ * we send the message
+ */
- if (find_printer->printer_type==PRINTER_HANDLE_IS_PRINTER)
- if (strcmp(find_printer->dev.handlename, printer))
- continue;
+ if (find_printer->printer_type==PRINTER_HANDLE_IS_PRINTER)
+ if (strcmp(find_printer->dev.handlename, printer))
+ continue;
- if (find_printer->notify.client_connected==True)
- cli_spoolss_reply_rrpcn(&cli, &find_printer->notify.client_hnd, PRINTER_CHANGE_ALL, 0x0, &status);
- }
+ if (find_printer->notify.client_connected==True)
+ cli_spoolss_reply_rrpcn(&cli, &find_printer->notify.client_hnd, PRINTER_CHANGE_ALL, 0x0, &status);
}
}