#include "includes.h"
#include "printing/pcap.h"
-
+#include "printing/load.h"
+#include "lib/param/loadparm.h"
/***************************************************************************
auto-load some homes and printer services
int pnum = lp_servicenumber(PRINTERS_NAME);
char *str;
char *saveptr;
+ char *auto_serv = NULL;
if (pnum < 0)
if (process_registry_service(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)) {
}
/***************************************************************************
-load automatic printer services
+load automatic printer services from pre-populated pcap cache
***************************************************************************/
void load_printers(struct tevent_context *ev,
struct messaging_context *msg_ctx)
{
- if (!pcap_cache_loaded()) {
- pcap_cache_reload(ev, msg_ctx);
- }
+ SMB_ASSERT(pcap_cache_loaded(NULL));
add_auto_printers();
/* load all printcap printers */
if (lp_load_printers() && lp_servicenumber(PRINTERS_NAME) >= 0)
- pcap_printer_fn(lp_add_one_printer, NULL);
+ pcap_printer_read_fn(lp_add_one_printer, NULL);
}