Use ippGet/ippSet (accessors) for IPP API.
[samba.git] / source3 / printing / load.c
index fc21f271bd9aa2aaba391edcbeaf31e76d27cbf1..136d055088fd260af73dddd9d6b2384c3355face 100644 (file)
@@ -18,7 +18,9 @@
 */
 
 #include "includes.h"
-
+#include "printing/pcap.h"
+#include "printing/load.h"
+#include "lib/param/loadparm.h"
 
 /***************************************************************************
 auto-load some homes and printer services
@@ -29,12 +31,21 @@ static void add_auto_printers(void)
        int pnum = lp_servicenumber(PRINTERS_NAME);
        char *str;
        char *saveptr;
+       char *auto_serv = NULL;
+
+       if (pnum < 0)
+               if (process_registry_service(PRINTERS_NAME))
+                       pnum = lp_servicenumber(PRINTERS_NAME);
 
        if (pnum < 0)
                return;
 
-       if ((str = SMB_STRDUP(lp_auto_services())) == NULL)
+       auto_serv = lp_auto_services(talloc_tos());
+       str = SMB_STRDUP(auto_serv);
+       TALLOC_FREE(auto_serv);
+       if (str == NULL) {
                return;
+       }
 
        for (p = strtok_r(str, LIST_SEP, &saveptr); p;
             p = strtok_r(NULL, LIST_SEP, &saveptr)) {
@@ -49,12 +60,12 @@ static void add_auto_printers(void)
 }
 
 /***************************************************************************
-load automatic printer services
+load automatic printer services from pre-populated pcap cache
 ***************************************************************************/
-void load_printers(void)
+void load_printers(struct tevent_context *ev,
+                  struct messaging_context *msg_ctx)
 {
-       if (!pcap_cache_loaded())
-               pcap_cache_reload();
+       SMB_ASSERT(pcap_cache_loaded());
 
        add_auto_printers();