Bug 878090

Summary: cupsGetFile does not work with WebInterface=no
Product: [Fedora] Fedora Reporter: Jiri Popelka <jpopelka>
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 19CC: jpopelka, twaugh
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: cups-1.6.1-10.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-25 10:04:09 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:

Description Jiri Popelka 2012-11-19 16:19:12 UTC
This problem is a result of disabling the cups web interface via "cupsctl WebInterface=no" as suggested in bug #864522, comment #3.
I'm filling a separate bug as I'm not sure whether it's bug or designed so.

Steps to reproduce:
1) cupsctl WebInterface=no
2) systemctl restart  cups.service
3) 
 a) Python
  import cups;
  file ("cupsd.copy", "w");
  cups.Connection().getFile("/admin/conf/cupsd.conf", "cupsd.conf")'

 b) C
  FILE * file = fopen (filename, "w");
  http_t *http = httpConnectEncrypt (cupsServer(), ippPort(), cupsEncryption());
  cupsGetFile (http, "/admin/conf/cupsd.conf", "cupsd.conf");
  fclose (file);

Actual results:
cupsGetFile [1] fetches the "Web Interface is Disabled" html page instead of the requested file.
[1] http://www.cups.org/documentation.php/api-httpipp.html#cupsGetFile

This makes cupsd.conf editing in for example system-config-printer impossible, one will end up with the "Web Interface is Disabled" html page instead of original cupsd.conf after making some server setting with s-c-printer.

Comment 1 Jiri Popelka 2012-11-19 16:20:46 UTC
(In reply to comment #0)
>  a) Python
>   import cups;
>   file ("cupsd.copy", "w");

s/cupsd.copy/cupsd.conf

Comment 2 Jiri Popelka 2012-11-19 16:30:24 UTC
(In reply to comment #0)
> I'm filling a separate bug as I'm not sure whether it's bug or designed so.

cupsGetFile is a HTTP GET request so there's probably not much we can fix here.
I just didn't want to pollute bug #864522 until we are sure.

Comment 3 Tim Waugh 2012-11-19 17:09:47 UTC
Oh, *that's* how I ended up with that message in cupsd.conf that time.

Yes, I think that's intentional behaviour, and I hadn't thought about the fact that server setting adjustment is done over HTTP not IPP.

Looks like we'll have to add the web interface back in then.

Comment 4 Tim Waugh 2012-11-19 17:12:56 UTC
Separately: I wonder if 'cupsctl' is careful to avoid that problem or not?

Comment 5 Jiri Popelka 2012-11-21 13:10:23 UTC
cupsctl uses cupsAdminGetServerSettings and cupsAdminSetServerSettings which were added in cups-1.3 and cupsctl doesn't seem to have problems with WebInterface=no.

Doesn't it sound like something we want to have bindings for in pycups ?

Comment 7 Tim Waugh 2012-11-21 15:16:36 UTC
Hmm, we *do* have such bindings, and in fact that's what system-config-printer uses.  I wonder how come they work fine whereas our tool doesn't.

Comment 8 Jiri Popelka 2012-11-21 15:25:22 UTC
Seems that it's used only for getting of basic server settings (_fillBasic()), the advanced server settings (_fillAdvanced()) use getFile().

Comment 9 Tim Waugh 2012-11-21 17:01:06 UTC
Try this as a non-root user:

cupsctl -U root WebInterface=Yes

... it fails in the same way. When it is run as root it just reads the file directly!

Comment 10 Fedora End Of Life 2013-04-03 19:46:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 11 Tim Waugh 2014-06-25 10:04:09 UTC
Not clear there's anything we can do to fix this.