Ignore:
Timestamp:
May 13, 2014, 11:39:04 AM (11 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update trunk to 3.6.23

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/printing/printing.c

    r751 r862  
    16611661}
    16621662
     1663/****************************************************************************
     1664 Notify smbds of new printcap data
     1665**************************************************************************/
     1666static void reload_pcap_change_notify(struct tevent_context *ev,
     1667                                      struct messaging_context *msg_ctx)
     1668{
     1669        /*
     1670         * Reload the printers first in the background process so that
     1671         * newly added printers get default values created in the registry.
     1672         *
     1673         * This will block the process for some time (~1 sec per printer), but
     1674         * it doesn't block smbd's servering clients.
     1675         */
     1676        reload_printers_full(ev, msg_ctx);
     1677
     1678        message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL);
     1679}
     1680
    16631681static bool printer_housekeeping_fn(const struct timeval *now,
    16641682                                    void *private_data)
     
    16831701}
    16841702
     1703static void printing_sig_term_handler(struct tevent_context *ev,
     1704                                      struct tevent_signal *se,
     1705                                      int signum,
     1706                                      int count,
     1707                                      void *siginfo,
     1708                                      void *private_data)
     1709{
     1710        exit_server_cleanly("termination signal");
     1711}
     1712
     1713static void printing_sig_hup_handler(struct tevent_context *ev,
     1714                                  struct tevent_signal *se,
     1715                                  int signum,
     1716                                  int count,
     1717                                  void *siginfo,
     1718                                  void *private_data)
     1719{
     1720        struct messaging_context *msg_ctx = talloc_get_type_abort(
     1721                private_data, struct messaging_context);
     1722
     1723        DEBUG(1,("Reloading printers after SIGHUP\n"));
     1724        pcap_cache_reload(ev, msg_ctx,
     1725                          &reload_pcap_change_notify);
     1726}
     1727
     1728static void printing_conf_updated(struct messaging_context *msg,
     1729                                  void *private_data,
     1730                                  uint32_t msg_type,
     1731                                  struct server_id server_id,
     1732                                  DATA_BLOB *data)
     1733{
     1734        DEBUG(5,("Reloading printers after conf change\n"));
     1735        pcap_cache_reload(messaging_event_context(msg), msg,
     1736                          &reload_pcap_change_notify);
     1737}
     1738
     1739
    16851740static pid_t background_lpq_updater_pid = -1;
    16861741
     
    17181773                int ret;
    17191774                NTSTATUS status;
     1775                struct tevent_signal *se;
    17201776
    17211777                /* Child. */
     
    17321788                }
    17331789
    1734                 smbd_setup_sig_term_handler();
    1735                 smbd_setup_sig_hup_handler(ev, msg_ctx);
     1790                se = tevent_add_signal(ev, ev, SIGTERM, 0,
     1791                                       printing_sig_term_handler,
     1792                                       NULL);
     1793                if (se == NULL) {
     1794                        smb_panic("failed to setup SIGTERM handler");
     1795                }
     1796                se = tevent_add_signal(ev, ev, SIGHUP, 0,
     1797                                       printing_sig_hup_handler,
     1798                                       msg_ctx);
     1799                if (se == NULL) {
     1800                        smb_panic("failed to setup SIGHUP handler");
     1801                }
    17361802
    17371803                if (!serverid_register(procid_self(),
     
    17471813                messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE,
    17481814                                   print_queue_receive);
     1815                messaging_register(msg_ctx, NULL, MSG_SMB_CONF_UPDATED,
     1816                                   printing_conf_updated);
    17491817
    17501818                fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ,
     
    17551823                        smb_panic("tevent_add_fd() failed for pause_pipe");
    17561824                }
     1825
     1826                /* reload on startup to ensure parent smbd is refreshed */
     1827                pcap_cache_reload(server_event_context(),
     1828                                  smbd_messaging_context(),
     1829                                  &reload_pcap_change_notify);
    17571830
    17581831                if (!(event_add_idle(ev, NULL,
Note: See TracChangeset for help on using the changeset viewer.