diff options
author | Jean-François Micouleau <jfm@samba.org> | 2000-09-26 10:15:12 +0000 |
---|---|---|
committer | Jean-François Micouleau <jfm@samba.org> | 2000-09-26 10:15:12 +0000 |
commit | 56917236a0414a03fb4ec193243c5de123bd3aa5 (patch) | |
tree | 9e988c2fa46bc96749ee5356a30e02d0b34b49f4 /source3/rpc_server/srv_spoolss_nt.c | |
parent | dda54bcd7d6f6d674f197abd323e102fdf7e8dc3 (diff) | |
download | samba-56917236a0414a03fb4ec193243c5de123bd3aa5.tar.gz samba-56917236a0414a03fb4ec193243c5de123bd3aa5.tar.bz2 samba-56917236a0414a03fb4ec193243c5de123bd3aa5.zip |
broadcast printer notify message to all clients. We now have printer
notification as on NT.
Andrew, your message passing code is cool :-)
J.F.
(This used to be commit 0374bc4b5f56d0fab3f7310e13cb71b5a71f9112)
Diffstat (limited to 'source3/rpc_server/srv_spoolss_nt.c')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 821cdf30e5..86fa0d108d 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -191,10 +191,13 @@ static BOOL srv_spoolss_replycloseprinter(POLICY_HND *handle) return False; /* if it's the last connection, deconnect the IPC$ share */ - if (smb_connections==1) + if (smb_connections==1) { if(!spoolss_disconnect_from_client(&cli)) return False; + message_deregister(MSG_PRINTER_NOTIFY); + } + smb_connections--; return True; @@ -579,11 +582,14 @@ static BOOL alloc_buffer_size(NEW_BUFFER *buffer, uint32 buffer_size) /*************************************************************************** receive the notify message ****************************************************************************/ -static BOOL srv_spoolss_receive_message(char *printer) +void srv_spoolss_receive_message(int msg_type, pid_t src, void *buf, size_t len) { + char printer[256]; uint32 status; Printer_entry *find_printer; + memcpy(printer, buf, len); + find_printer = (Printer_entry *)ubi_dlFirst(&Printer_list); /* Iterate the printer list. */ @@ -599,12 +605,9 @@ static BOOL srv_spoolss_receive_message(char *printer) continue; if (find_printer->notify.client_connected==True) - if( !cli_spoolss_reply_rrpcn(&cli, &find_printer->notify.client_hnd, PRINTER_CHANGE_ALL, 0x0, &status)) - return False; + cli_spoolss_reply_rrpcn(&cli, &find_printer->notify.client_hnd, PRINTER_CHANGE_ALL, 0x0, &status); } - - return True; } /*************************************************************************** @@ -626,7 +629,8 @@ static BOOL srv_spoolss_sendnotify(POLICY_HND *handle) else fstrcpy(printer, ""); - srv_spoolss_receive_message(printer); + /*srv_spoolss_receive_message(printer);*/ + message_send_all(MSG_PRINTER_NOTIFY, printer, strlen(printer)); return True; } @@ -1011,9 +1015,12 @@ static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uin * If it's the first connection, contact the client * and connect to the IPC$ share anonumously */ - if (smb_connections==0) + if (smb_connections==0) { if(!spoolss_connect_to_client(&cli, printer+2)) /* the +2 is to strip the leading 2 backslashs */ return False; + message_register(MSG_PRINTER_NOTIFY, srv_spoolss_receive_message); + + } smb_connections++; |