Bug 968397

Summary: CIM clients are sometimes getting HTTP/1.1 501 Not Implemented
Product: [Fedora] Fedora Reporter: Tomáš Bžatek <tbzatek>
Component: sblim-sfcbAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: praveen_paladugu, srinivas_g_gowda, tsmetana, vcrhonek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sblim-sfcb-1.3.16-7.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-06 00:12:10 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: 1102477    
Attachments:
Description Flags
sblim-sfcb-1.3.16-http-header-cmd-check.patch none

Description Tomáš Bžatek 2013-05-29 16:10:14 UTC
Description of problem:
So I was wondering why simple wbemcli instance enumeration doesn't work on sfcbd but works on Pegasus with the same query. The wbemcli client was getting HTTP/1.1 501 Not Implemented from the server.

So I started debugging sfcbd and grabbed a query from YAWN (basically the same operation on the same class). First I thought the query was malformed but putting the working query in curl I got 501 again. Funny that moving from https to http made it work.

So I started looking in sfcbd sources, added some prints to see what's in the buffer. Eventually it came up that buffer handling in httpAdapter.c:getHdrs() is wrong since for some reason the incoming message was fragmented at the beginning, within the "POST" string that was also being checked to match the expected http command/method.

Version-Release number of selected component (if applicable):
sblim-sfcb-1.3.16-3.fc19.x86_64

How reproducible:
always

Steps to Reproduce:
$ wbemcli ei -noverify -dx 'https://user:pass@localhost:59890/root/cimv2:LMI_LANEndpoint'

- or -

$ curl -vvv --insecure 'https://user:pass@localhost:59890/root/cimv2:LMI_LANEndpoint' -H 'Content-type: application/xml; charset="utf-8"' -H 'CIMOperation: MethodCall' -H 'CIMMethod: EnumerateInstances' -H 'CIMObject: root/cimv2' -H 'Accept-Encoding: identity' -d '<?xml version="1.0" encoding="utf-8" ?>
<CIM CIMVERSION="2.0" DTDVERSION="2.0"><MESSAGE ID="1001" PROTOCOLVERSION="1.0"><SIMPLEREQ><IMETHODCALL NAME="EnumerateInstances"><LOCALNAMESPACEPATH><NAMESPACE NAME="root"/><NAMESPACE NAME="cimv2"/></LOCALNAMESPACEPATH><IPARAMVALUE NAME="ClassName"><CLASSNAME NAME="LMI_LANEndpoint"/></IPARAMVALUE><IPARAMVALUE NAME="LocalOnly"><VALUE>FALSE</VALUE></IPARAMVALUE></IMETHODCALL></SIMPLEREQ></MESSAGE></CIM>'

Actual results:
* About to connect() to localhost port 59890 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 59890 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
* 	subject: E=root,CN=localhost.localdomain
* 	start date: May 16 14:38:45 2013 GMT
* 	expire date: May 16 14:38:45 2014 GMT
* 	common name: localhost.localdomain
* 	issuer: E=root,CN=localhost.localdomain
* Server auth using Basic with user 'root'
> POST /root/cimv2:LMI_LANEndpoint HTTP/1.1
> Authorization: Basic cm9vdDpoZXNsbw==
> User-Agent: curl/7.29.0
> Host: localhost:59890
> Accept: */*
> Content-type: application/xml; charset="utf-8"
> CIMOperation: MethodCall
> CIMMethod: EnumerateInstances
> CIMObject: root/cimv2
> Accept-Encoding: identity
> Content-Length: 445
> 
* upload completely sent off: 445 out of 445 bytes
< HTTP/1.1 501 Not Implemented
< Server: sfcHttpd
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

Comment 1 Tomáš Bžatek 2013-05-29 16:18:06 UTC
Created attachment 754458 [details]
sblim-sfcb-1.3.16-http-header-cmd-check.patch

httpAdapter: Check for cmd in whole buffer

The commRead() call may return data not always aligned to newlines,
in fact data are typically fragmented for https connection. The test
for "cmd" presence in headers may actually end up checking shorter
buffer than the string itself, resulting in immediate error return
instead of waiting for next chunk.

Comment 2 Fedora Update System 2013-07-23 14:25:03 UTC
sblim-sfcb-1.3.16-7.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/sblim-sfcb-1.3.16-7.fc19

Comment 3 Fedora Update System 2013-07-24 03:46:46 UTC
Package sblim-sfcb-1.3.16-7.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing sblim-sfcb-1.3.16-7.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-13537/sblim-sfcb-1.3.16-7.fc19
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-08-06 00:12:10 UTC
sblim-sfcb-1.3.16-7.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.