Bug 1430882

Summary: The -h option is overridden by _cupsSetDefaults settings when the IPP port is not given
Product: Red Hat Enterprise Linux 7 Reporter: Bryan Mason <bmason>
Component: cupsAssignee: Zdenek Dohnal <zdohnal>
Status: CLOSED ERRATA QA Contact: Petr Sklenar <psklenar>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: bmason, psklenar, thozza
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: cups-1.6.3-31.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 13:41:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1420851, 1465887, 1465928    
Attachments:
Description Flags
Possible patch adapted from upstream
none
Proposed patch none

Description Bryan Mason 2017-03-09 18:52:23 UTC
Created attachment 1261676 [details]
Possible patch adapted from upstream

Description of problem:

  The "-h" option to "lp*" commands (like lpstat) is ignored if
  ServerName is set in client.conf and the port isn't specified in the
  argument to the "-h" option.


Version-Release number of selected component (if applicable):

  cups-1.6.3-26

How reproducible:

  100%

Steps to Reproduce:

  1. Set "ServerName <some-host>" in /etc/cups/client.conf
  2. run "lpstat -h <another-host> -p"

Actual results:

  The printer list from <another-host>.

Expected results:

  The printer list from <some-host>.

Additional info:

  # cat /etc/cups/client.conf 
  # Empty

  # lpstat -a
  lpstat: No destinations added.

  # lpstat -h rhel73-test -p
  printer pass is idle.  enabled since Thu 09 Mar 2017 10:30:04 AM PST

  # lpstat -h rhel68-test -p
  printer fail is idle.  enabled since Thu 09 Mar 2017 10:31:18 AM PST

  # echo "ServerName rhel68-test" > /etc/cups/client.conf 
  # cat /etc/cups/client.conf
  ServerName rhel68-test

  # lpstat -h rhel73-test -p
  printer fail is idle.  enabled since Thu 09 Mar 2017 10:31:18 AM PST

  # lpstat -h rhel73-test:631 -p
  printer pass is idle.  enabled since Thu 09 Mar 2017 10:30:04 AM PST

  This is the same as cups.org STR #4675 which was resolved with
  https://github.com/apple/cups/commit/4b9daaf451a59d1eb1c99aac32d4e3cb19416397

  I've adapted that patch for RHEL 7.3 and attached.
  The patch fixes the issue in my testing:

  [root@sf01799390 cupsrpms]# yum update *.rpm
  ...
  Updated:
    cups.x86_64 1:1.6.3-26.el7_3.sf01799390.1
    cups-client.x86_64 1:1.6.3-26.el7_3.sf01799390.1
    cups-filesystem.noarch 1:1.6.3-26.el7_3.sf01799390.1
    cups-libs.x86_64 1:1.6.3-26.el7_3.sf01799390.1
      
  Complete!

  # lpstat -h rhel73-test -p
  printer pass is idle.  enabled since Thu 09 Mar 2017 10:30:04 AM PST

Comment 6 Zdenek Dohnal 2017-09-22 12:42:13 UTC
Created attachment 1329577 [details]
Proposed patch

Comment 16 errata-xmlrpc 2018-04-10 13:41:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0782