diff options
author | Michael Sweet <michael.r.sweet@gmail.com> | 2017-10-12 08:31:03 -0400 |
---|---|---|
committer | Michael Sweet <michael.r.sweet@gmail.com> | 2017-10-12 08:31:03 -0400 |
commit | 6b33281c3ee2a3fee39324c27df3059a304f3dea (patch) | |
tree | f09aeba55005db6d6401d911fc412d458f32a16c /cups/dest.c | |
parent | 9554d4e748afc212ff68d56098f5c430c48325d3 (diff) | |
download | cups-6b33281c3ee2a3fee39324c27df3059a304f3dea.tar.gz |
One further fix for cupsGetDests2 - don't show network printers when the server
is remote.
Diffstat (limited to 'cups/dest.c')
-rw-r--r-- | cups/dest.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/cups/dest.c b/cups/dest.c index 45626884b..57a8dc95c 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -1657,13 +1657,44 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ } /* + * Connect to the server as needed... + */ + + if (!http) + { + if ((http = _cupsConnect()) == NULL) + { + *dests = NULL; + + return (0); + } + } + + /* * Grab the printers and classes... */ data.num_dests = 0; data.dests = NULL; - cups_enum_dests(http, 0, _CUPS_DNSSD_GET_DESTS, NULL, 0, 0, (cups_dest_cb_t)cups_get_cb, &data); + if (!httpAddrLocalhost(httpGetAddress(http))) + { + /* + * When talking to a remote cupsd, just enumerate printers on the remote + * cupsd. + */ + + cups_enum_dests(http, 0, _CUPS_DNSSD_GET_DESTS, NULL, 0, CUPS_PRINTER_DISCOVERED, (cups_dest_cb_t)cups_get_cb, &data); + } + else + { + /* + * When talking to a local cupsd, enumerate both local printers and ones we + * can find on the network... + */ + + cups_enum_dests(http, 0, _CUPS_DNSSD_GET_DESTS, NULL, 0, 0, (cups_dest_cb_t)cups_get_cb, &data); + } /* * Make a copy of the "real" queues for a later sanity check... |