From 22974c5f323508b5dced97f4c54410172d1e3bdf Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 31 Jan 2018 22:36:51 -0500 Subject: [PATCH] The `cupsCopyDestInfo` function did not work with all print queues (Issue #5235) cups/dest.c: - Fix debug logging in _cupsGetDestResource. cups/dest-options.c: - Update CUPS server check in cupsCopyDestInfo. --- CHANGES.md | 2 ++ cups/dest-options.c | 21 ++++++++++++++++----- cups/dest.c | 9 +++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a0b60bfd5..5371d2eaf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ Changes in CUPS v2.3b3 - Additional changes for the scheduler to substitute default values for invalid job attributes when running in "relaxed conformance" mode (Issue #5229) - Localization changes (Issue #5232, rdar://37068158) +- The `cupsCopyDestInfo` function did not work with all print queues + (Issue #5235) Changes in CUPS v2.3b2 diff --git a/cups/dest-options.c b/cups/dest-options.c index 38317085e..4fba442dd 100644 --- a/cups/dest-options.c +++ b/cups/dest-options.c @@ -1,9 +1,10 @@ /* * Destination option/media support for CUPS. * - * Copyright 2012-2018 by Apple Inc. + * Copyright © 2012-2018 by Apple Inc. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -693,17 +694,27 @@ cupsCopyDestInfo( if (!http) { + DEBUG_puts("1cupsCopyDestInfo: Default server connection."); http = _cupsConnect(); dflags = CUPS_DEST_FLAGS_NONE; } #ifdef AF_LOCAL - else if (strcmp(http->hostname, cg->server) || (httpAddrFamily(http->hostaddr) != AF_LOCAL && cg->ipp_port != httpAddrPort(http->hostaddr))) -#else - else if (strcmp(http->hostname, cg->server) || cg->ipp_port != httpAddrPort(http->hostaddr)) + else if (httpAddrFamily(http->hostaddr) == AF_LOCAL) + { + DEBUG_puts("1cupsCopyDestInfo: Connection to server (domain socket)."); + dflags = CUPS_DEST_FLAGS_NONE; + } #endif /* AF_LOCAL */ + else if ((strcmp(http->hostname, cg->server) && cg->server[0] != '/') || cg->ipp_port != httpAddrPort(http->hostaddr)) + { + DEBUG_printf(("1cupsCopyDestInfo: Connection to device (%s).", http->hostname)); dflags = CUPS_DEST_FLAGS_DEVICE; + } else + { + DEBUG_printf(("1cupsCopyDestInfo: Connection to server (%s).", http->hostname)); dflags = CUPS_DEST_FLAGS_NONE; + } /* * Range check input... diff --git a/cups/dest.c b/cups/dest.c index 090970c79..bd5951756 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -1,10 +1,11 @@ /* * User-defined destination (and option) support for CUPS. * - * Copyright 2007-2018 by Apple Inc. - * Copyright 1997-2007 by Easy Software Products. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2007 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -1110,7 +1111,7 @@ _cupsGetDestResource( int port; /* Port number */ - DEBUG_printf(("_cupsGetDestResource(dest=%p(%s), resource=%p, resourcesize=%d)", (void *)dest, dest->name, (void *)resource, (int)resourcesize)); + DEBUG_printf(("_cupsGetDestResource(dest=%p(%s), flags=%u, resource=%p, resourcesize=%d)", (void *)dest, dest->name, flags, (void *)resource, (int)resourcesize)); /* * Range check input... -- 2.39.5