Ignore:
Timestamp:
May 12, 2014, 8:58:38 PM (11 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.6: updated vendor to latest version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/printing/printing.c

    r746 r860  
    16571657}
    16581658
     1659/****************************************************************************
     1660 Notify smbds of new printcap data
     1661**************************************************************************/
     1662static void reload_pcap_change_notify(struct tevent_context *ev,
     1663                                      struct messaging_context *msg_ctx)
     1664{
     1665        /*
     1666         * Reload the printers first in the background process so that
     1667         * newly added printers get default values created in the registry.
     1668         *
     1669         * This will block the process for some time (~1 sec per printer), but
     1670         * it doesn't block smbd's servering clients.
     1671         */
     1672        reload_printers_full(ev, msg_ctx);
     1673
     1674        message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL);
     1675}
     1676
    16591677static bool printer_housekeeping_fn(const struct timeval *now,
    16601678                                    void *private_data)
     
    16791697}
    16801698
     1699static void printing_sig_term_handler(struct tevent_context *ev,
     1700                                      struct tevent_signal *se,
     1701                                      int signum,
     1702                                      int count,
     1703                                      void *siginfo,
     1704                                      void *private_data)
     1705{
     1706        exit_server_cleanly("termination signal");
     1707}
     1708
     1709static void printing_sig_hup_handler(struct tevent_context *ev,
     1710                                  struct tevent_signal *se,
     1711                                  int signum,
     1712                                  int count,
     1713                                  void *siginfo,
     1714                                  void *private_data)
     1715{
     1716        struct messaging_context *msg_ctx = talloc_get_type_abort(
     1717                private_data, struct messaging_context);
     1718
     1719        DEBUG(1,("Reloading printers after SIGHUP\n"));
     1720        pcap_cache_reload(ev, msg_ctx,
     1721                          &reload_pcap_change_notify);
     1722}
     1723
     1724static void printing_conf_updated(struct messaging_context *msg,
     1725                                  void *private_data,
     1726                                  uint32_t msg_type,
     1727                                  struct server_id server_id,
     1728                                  DATA_BLOB *data)
     1729{
     1730        DEBUG(5,("Reloading printers after conf change\n"));
     1731        pcap_cache_reload(messaging_event_context(msg), msg,
     1732                          &reload_pcap_change_notify);
     1733}
     1734
     1735
    16811736static pid_t background_lpq_updater_pid = -1;
    16821737
     
    17141769                int ret;
    17151770                NTSTATUS status;
     1771                struct tevent_signal *se;
    17161772
    17171773                /* Child. */
     
    17281784                }
    17291785
    1730                 smbd_setup_sig_term_handler();
    1731                 smbd_setup_sig_hup_handler(ev, msg_ctx);
     1786                se = tevent_add_signal(ev, ev, SIGTERM, 0,
     1787                                       printing_sig_term_handler,
     1788                                       NULL);
     1789                if (se == NULL) {
     1790                        smb_panic("failed to setup SIGTERM handler");
     1791                }
     1792                se = tevent_add_signal(ev, ev, SIGHUP, 0,
     1793                                       printing_sig_hup_handler,
     1794                                       msg_ctx);
     1795                if (se == NULL) {
     1796                        smb_panic("failed to setup SIGHUP handler");
     1797                }
    17321798
    17331799                if (!serverid_register(procid_self(),
     
    17431809                messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE,
    17441810                                   print_queue_receive);
     1811                messaging_register(msg_ctx, NULL, MSG_SMB_CONF_UPDATED,
     1812                                   printing_conf_updated);
    17451813
    17461814                fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ,
     
    17511819                        smb_panic("tevent_add_fd() failed for pause_pipe");
    17521820                }
     1821
     1822                /* reload on startup to ensure parent smbd is refreshed */
     1823                pcap_cache_reload(server_event_context(),
     1824                                  smbd_messaging_context(),
     1825                                  &reload_pcap_change_notify);
    17531826
    17541827                if (!(event_add_idle(ev, NULL,
Note: See TracChangeset for help on using the changeset viewer.