Authentification loop in cupsDoFileRequest fails because of EPIPE #611

Closed
michaelrsweet opened this Issue Mar 5, 2004 · 4 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Mar 5, 2004

Version: 1.1-current
CUPS.org User: michael.goffioul

Current CVS (just tried cvs up). I got the problem when trying to install a printer with KDEPrint and giving a wrong root password. cupsDoFileRequest seems to enter an end-less loop due to the failed authentication and the fact that httpUpdate returns -1 instead of the HTTP_UNAUTHORIZED status. Enabling debug in CUPS shows that httpUpdate fails with EPIPE error and returns this, forgetting about the received 401 status code. See below the debug output:

cupsDoFileRequest: setup...
cupsDoFileRequest: authstring="Basic xxxxxxxxxxxxxxxx"
cupsDoFileRequest: post...
httpGetLength(http=0x8c6fe08), state=7
httpGetLength: content_length=356
http_send(http=0x8c6fe08, request=HTTP_POST, uri="/admin/")
httpReconnect(http=0x8c6fe08)
httpPrintf(http=0x8c6fe08, format="%s %s HTTP/1.1
", ...)
httpPrintf: POST /admin/ HTTP/1.1
Authorization: Basic xxxxxxxxxxxxxxx
httpPrintf(http=0x8c6fe08, format="%s: %s
", ...)
httpPrintf: Authorization: Basic xxxxxxxxxxxxxxxx
Content-Length: 356
httpPrintf(http=0x8c6fe08, format="%s: %s
", ...)
httpPrintf: Content-Length: 356
Content-Type: application/ipp
httpPrintf(http=0x8c6fe08, format="%s: %s
", ...)
httpPrintf: Content-Type: application/ipp
Host: localhost
httpPrintf(http=0x8c6fe08, format="%s: %s
", ...)
httpPrintf: Host: localhost
httpPrintf(http=0x8c6fe08, format="
", ...)
httpPrintf:
cupsDoFileRequest: ipp write...
httpWrite: wrote 8 bytes:
01 01 40 03 00 00 00 01 ..@.....
httpWrite: wrote 29 bytes:
01 47 00 12 61 74 74 72 69 62 75 74 65 73 2D 63 .G..attributes-c
68 61 72 73 65 74 00 05 75 74 66 2D 38 harset..utf-8
httpWrite: wrote 37 bytes:
48 00 1B 61 74 74 72 69 62 75 74 65 73 2D 6E 61 H..attributes-na
74 75 72 61 6C 2D 6C 61 6E 67 75 61 67 65 00 05 tural-language..
65 6E 2D 75 73 en-us
httpWrite: wrote 58 bytes:
45 00 0B 70 72 69 6E 74 65 72 2D 75 72 69 00 2A E..printer-uri.*
69 70 70 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 3A ipp://localhost:
36 33 31 2F 70 72 69 6E 74 65 72 73 2F 74 6F 5F 631/printers/to_
62 65 5F 72 65 6D 6F 76 65 64 be_removed
httpWrite: wrote 33 bytes:
04 45 00 0A 64 65 76 69 63 65 2D 75 72 69 00 11 .E..device-uri..
70 61 72 61 6C 6C 65 6C 3A 2F 64 65 76 2F 6C 70 parallel:/dev/lp
30 0
httpWrite: wrote 36 bytes:
42 00 12 6A 6F 62 2D 73 68 65 65 74 73 2D 64 65 B..job-sheets-de
66 61 75 6C 74 00 04 6E 6F 6E 65 42 00 00 00 04 fault..noneB....
6E 6F 6E 65 none
httpWrite: wrote 25 bytes:
21 00 10 6A 6F 62 2D 71 75 6F 74 61 2D 70 65 72 !..job-quota-per
69 6F 64 00 04 00 00 00 00 iod......
httpWrite: wrote 20 bytes:
21 00 0B 6A 6F 62 2D 6B 2D 6C 69 6D 69 74 00 04 !..job-k-limit..
00 00 00 00 ....
httpWrite: wrote 23 bytes:
21 00 0E 6A 6F 62 2D 70 61 67 65 2D 6C 69 6D 69 !..job-page-limi
74 00 04 00 00 00 00 t......
httpWrite: wrote 36 bytes:
42 00 1B 72 65 71 75 65 73 74 69 6E 67 2D 75 73 B..requesting-us
65 72 2D 6E 61 6D 65 2D 64 65 6E 69 65 64 00 04 er-name-denied..
6E 6F 6E 65 none
httpWrite: wrote 29 bytes:
41 00 0C 70 72 69 6E 74 65 72 2D 69 6E 66 6F 00 A..printer-info.
0C 41 4C 50 53 20 4D 44 2D 31 30 30 30 .ALPS MD-1000
httpWrite: wrote 21 bytes:
41 00 10 70 72 69 6E 74 65 72 2D 6C 6F 63 61 74 A..printer-locat
69 6F 6E 00 00 ion..
httpWrite: changing states...
httpWrite: wrote 1 bytes:
03 .
cupsDoFileRequest: update...
httpUpdate(http=0x8c6fe08), state=7
httpGets(line=0xbfff6ad0, length=1024, http=0x8c6fe08)
httpGets: read 64 bytes...
httpGets: Returning "HTTP/1.1 401 Unauthorized"
httpUpdate: Got "HTTP/1.1 401 Unauthorized"
httpGets(line=0xbfff6ad0, length=1024, http=0x8c6fe08)
httpGets: Returning "Date: Fri, 05 Mar 2004 16:19:26 GMT"
httpUpdate: Got "Date: Fri, 05 Mar 2004 16:19:26 GMT"
httpGets(line=0xbfff6ad0, length=1024, http=0x8c6fe08)
httpGets: read -1 bytes...
httpGets: recv() error 104!
httpGets: read 0 bytes...
httpUpdate: socket error 32 - Broken pipe
cupsDoFileRequest: status = -1
cupsDoFileRequest: HTTP_ERROR, errno = 32

Collaborator

michaelrsweet commented Mar 9, 2004

CUPS.org User: mike

Thanks, will fix ASAP and get back to you...

Collaborator

michaelrsweet commented Mar 19, 2004

CUPS.org User: mike

Sorry for the delay; try the attached patch (or CVS tomorrow morning) to confirm that the problem is now fixed on your end...

Collaborator

michaelrsweet commented Mar 19, 2004

CUPS.org User: mike

Fixed in CVS - the anonymous CVS repository will be updated at midnight EST.

Collaborator

michaelrsweet commented Apr 2, 2004

"str611.patch":

Index: http.c

RCS file: /development/cvs/cups/cups/http.c,v
retrieving revision 1.132
diff -u -r1.132 http.c
--- http.c 25 Feb 2004 20:14:51 -0000 1.132
+++ http.c 19 Mar 2004 11:40:55 -0000
@@ -1678,6 +1678,9 @@

  • See if there was an error...
    */
  • if (http->error == EPIPE && http->status > HTTP_CONTINUE)
  • return (http->status);

if (http->error)
{
DEBUG_printf(("httpUpdate: socket error %d - %s\n", http->error,

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment