Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
vikrantmalik051 committed Mar 15, 2020
1 parent b9d6a23 commit 4b35a28
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions utils/cups-browsed.c
Original file line number Diff line number Diff line change
Expand Up @@ -10354,6 +10354,8 @@ found_cups_printer (const char *remote_host, const char *uri,
char *c;
int hl;
remote_printer_t *printer;
http_t *http;
ipp_t *request = NULL;

memset(scheme, 0, sizeof(scheme));
memset(username, 0, sizeof(username));
Expand Down Expand Up @@ -10423,6 +10425,31 @@ found_cups_printer (const char *remote_host, const char *uri,
debug_printf("starting BrowseTimeout timer for %s (%ds)\n",
printer->queue_name, BrowseTimeout);
}
if (NewBrowsePollQueuesShared) {
request = ippNewRequest(CUPS_ADD_MODIFY_PRINTER);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, printer->uri);

ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser ());

printer->num_options = cupsAddOption("printer-is-shared", "true",
printer->num_options, &(printer->options));
debug_printf("Setting printer-is-shared bit\n");

cupsEncodeOptions2(request, printer->num_options, printer->options, IPP_TAG_OPERATION);
cupsEncodeOptions2(request, printer->num_options, printer->options, IPP_TAG_PRINTER);

http = http_connect_local ();
if (printer->netprinter != 0 || !HAVE_CUPS_2_2)
ippDelete(cupsDoRequest(http, request, "/admin/"));
else {
ippDelete(request);
}
if (cupsLastError() > IPP_STATUS_OK_EVENTS_COMPLETE)
debug_printf("Unable to modify the printer-is-shared bit (%s)!\n",
cupsLastErrorString());
}
}
}

Expand Down Expand Up @@ -10717,34 +10744,6 @@ browse_poll_get_printers (browsepoll_t *context, http_t *conn)
found_cups_printer (context->server, uri, location, info);
printer = new_browsepoll_printer (uri, location, info);
printers = g_list_insert (printers, printer, 0);

if (NewBrowsePollQueuesShared) {
num_options = 0;
options = NULL;
request = ippNewRequest(CUPS_ADD_MODIFY_PRINTER);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);

ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());

num_options = cupsAddOption("printer-is-shared", "true",
num_options, &options);
debug_printf("Setting printer-is-shared bit\n");

cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
cupsEncodeOptions2(request, num_options, options, IPP_TAG_PRINTER);

if ((http = http_connect_local ()) == NULL)
debug_printf("Unable to connect to CUPS!\n");
else {
ippDelete(cupsDoRequest(http, request, "/admin/"));
cupsFreeOptions(num_options, options);
if (cupsLastError() > IPP_STATUS_OK_EVENTS_COMPLETE)
debug_printf("Unable to modify the printer-is-shared bit (%s)!\n",
cupsLastErrorString());
}
}
}

if (!attr)
Expand Down

0 comments on commit 4b35a28

Please sign in to comment.