static unsigned int BrowseTimeout = 300;
static uint16_t BrowsePort = 631;
static browsepoll_t **BrowsePoll = NULL;
+static unsigned int NewBrowsePollQueuesShared = 0;
+static unsigned int AllowResharingRemoteCUPSPrinters = 0;
static size_t NumBrowsePoll = 0;
static guint update_netifs_sourceid = 0;
static char local_server_str[1024];
* only if we have CUPS older than 2.2.
* When you have remote queue, clean up and break from the loop.
*/
- if (p->netprinter != 0 || !HAVE_CUPS_2_2)
+ if (p->netprinter != 0 || !HAVE_CUPS_2_2 || AllowResharingRemoteCUPSPrinters)
ippDelete(cupsDoRequest(http, request, "/admin/"));
else {
ippDelete(request);
if (p->netprinter == 0 &&
strncmp(line, "*%", 2) &&
strncmp(line, "*PPD-Adobe:", 11) &&
- ap_remote_queue_id_line_inserted == 0) {
+ ap_remote_queue_id_line_inserted == 0 &&
+ !AllowResharingRemoteCUPSPrinters) {
ap_remote_queue_id_line_inserted = 1;
cupsFilePrintf(out, "*APRemoteQueueID: \"\"\n");
}
num_options = cupsAddOption("printer-is-shared", "true",
num_options, &options);
debug_printf("Setting printer-is-shared bit.\n");
+ } else if (NewBrowsePollQueuesShared &&
+ (val = cupsGetOption("printer-to-be-shared", p->num_options,
+ p->options)) != NULL) {
+ num_options = cupsAddOption("printer-is-shared", "true",
+ num_options, &options);
+ debug_printf("Setting printer-is-shared bit.\n");
} else {
num_options = cupsAddOption("printer-is-shared", "false",
num_options, &options);
* network printer or if we have remote CUPS queue, do IPP request
* only if we have CUPS older than 2.2.
*/
- if (p->netprinter != 0 || !HAVE_CUPS_2_2)
+ if (p->netprinter != 0 || !HAVE_CUPS_2_2 || AllowResharingRemoteCUPSPrinters)
ippDelete(cupsDoRequest(http, request, "/admin/"));
else
ippDelete(request);
(printer->domain == NULL || printer->domain[0] == '\0' ||
printer->type == NULL || printer->type[0] == '\0')) {
printer->is_legacy = 1;
+
if (printer->status != STATUS_TO_BE_CREATED) {
printer->timeout = time(NULL) + BrowseTimeout;
debug_printf("starting BrowseTimeout timer for %s (%ds)\n",
printer->queue_name, BrowseTimeout);
}
}
+
+ if (printer && NewBrowsePollQueuesShared &&
+ (HAVE_CUPS_1_6 || (!HAVE_CUPS_1_6 && !printer->is_legacy)))
+ printer->num_options = cupsAddOption("printer-to-be-shared", "true", printer->num_options, &(printer->options));
+
}
gboolean
else if (!strcasecmp(value, "no") || !strcasecmp(value, "false") ||
!strcasecmp(value, "off") || !strcasecmp(value, "0"))
NewIPPPrinterQueuesShared = 0;
+ } else if (!strcasecmp(line, "AllowResharingRemoteCUPSPrinters") && value) {
+ if (!strcasecmp(value, "yes") || !strcasecmp(value, "true") ||
+ !strcasecmp(value, "on") || !strcasecmp(value, "1"))
+ AllowResharingRemoteCUPSPrinters = 1;
+ else if (!strcasecmp(value, "no") || !strcasecmp(value, "false") ||
+ !strcasecmp(value, "off") || !strcasecmp(value, "0"))
+ AllowResharingRemoteCUPSPrinters = 0;
+ } else if (!strcasecmp(line, "NewBrowsePollQueuesShared") && value) {
+ if (!strcasecmp(value, "yes") || !strcasecmp(value, "true") ||
+ !strcasecmp(value, "on") || !strcasecmp(value, "1"))
+ NewBrowsePollQueuesShared = 1;
+ else if (!strcasecmp(value, "no") || !strcasecmp(value, "false") ||
+ !strcasecmp(value, "off") || !strcasecmp(value, "0"))
+ NewBrowsePollQueuesShared = 0;
} else if (!strcasecmp(line, "AutoClustering") && value) {
if (!strcasecmp(value, "yes") || !strcasecmp(value, "true") ||
!strcasecmp(value, "on") || !strcasecmp(value, "1"))
# BrowseTimeout 300
-
# Filtering of remote printers by other properties than IP addresses
# of their servers
# IPBasedDeviceURIs IPv4
# IPBasedDeviceURIs IPv6
+# The AllowResharingRemoteCUPSPrinters directive determines whether a
+# print queue pointing to a remote CUPS queue will be re-shared to the
+# local network or not. Since the queues generated using the BrowsePoll
+# directive are also pointing to remote queues, they are also shared
+# automatically if the following option is set. Default is not to share
+# remote printers.
+
+# AllowResharingRemoteCUPSPrinters Yes
+
+# The NewBrowsePollQueuesShared directive determines whether a print
+# queue for a newly discovered printer (discovered by the BrowsePoll directive)
+# will be shared to the local network or not. This directive will only work
+# if AllowResharingRemoteCUPSPrinters is set to yes. Default is
+# not to share printers discovered using BrowsePoll.
+
+# NewBrowsePollQueuesShared Yes
# Set CreateRemoteRawPrinterQueues to "Yes" to let cups-browsed also
# create local queues pointing to remote raw CUPS queues. Normally,