Bug 579830

Summary: error sending hardware profile when non-xmlrpc-compliant chars are returned by dmidecode
Product: Red Hat Enterprise Linux 4 Reporter: Issue Tracker <tao>
Component: up2dateAssignee: Miroslav Suchý <msuchy>
Status: CLOSED ERRATA QA Contact: Pavel Novotny <pnovotny>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.8CC: ahumbe, cperry, jhutar, jwest, marcobillpeter, mosvald, mpoole, mzazrivec, plyons, pnovotny, psklenar, tao, vgaikwad, xdmoon
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously, the presence of the "\f" character in the Desktop Management Interface (DMI) information or any non-ASCII character in the hardware name rendered the system unable to register to both Red Hat Network (RHN) and Red Hat Network Satellite Server. This error has been fixed, and the system registration now works as expected.
Story Points: ---
Clone Of:
: 618250 618252 618267 619492 (view as bug list) Environment:
Last Closed: 2011-02-16 14:16:29 UTC Type: ---
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: 618267, 619702    
Bug Blocks: 619086, 619492, 624379, 638981, 638982    

Description Issue Tracker 2010-04-06 16:44:51 UTC
Escalated to Bugzilla from IssueTracker

Comment 1 Issue Tracker 2010-04-06 16:44:52 UTC
Event posted on 2010-04-06 14:23 BST by tpapaioa

Description of problem:
Registration of RHEL 4 system fails when the BIOS information returned by dmidecode contains characters like "form feed" (0x0c).

How reproducible:
100% for about a dozen of this customer's servers (Sun Fire X4150).

Steps to Reproduce:
Run rhnreg_ks or rhn_register to register system to Satellite server.

Actual results:
Registration fails with Internal Server Error, and the following in /var/log/up2date on the client system:

[Thu Mar 18 19:30:16 2010] up2date A protocol error occurred: Internal Server Error , attempt #1,
[Thu Mar 18 19:30:21 2010] up2date A protocol error occurred: Internal Server Error , attempt #2,
[Thu Mar 18 19:30:26 2010] up2date A protocol error occurred: Internal Server Error , attempt #3,
[Thu Mar 18 19:30:31 2010] up2date A protocol error occurred: Internal Server Error , attempt #4,
[Thu Mar 18 19:30:37 2010] up2date A protocol error occurred: Internal Server Error , attempt #5,
[Thu Mar 18 19:30:37 2010] up2date Internal Server Error
[Thu Mar 18 19:30:37 2010] up2date   File "/usr/sbin/rhnreg_ks", line 404, in ?
   main()
  File "/usr/sbin/rhnreg_ks", line 359, in main
   rhnreg.sendHardware(systemId, hardwareList)
  File "/usr/share/rhn/up2date_client/rhnreg.py", line 569, in sendHardware
   rpcServer.doCall(s.registration.add_hw_profile, systemId, hardwareList)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 309, in doCall
   raise up2dateErrors.CommunicationError(e.errmsg)

Expected results:
Successful registration.

Additional info:
This event sent from IssueTracker by mpoole  [Support Engineering Group]
 issue 726513

Comment 2 Martin Poole 2010-04-06 16:57:12 UTC
Using the following to get the data as seen by the registration code

PYTHONPATH=/usr/share/rhn python -c "from up2date_client import hardware; print hardware.Hardware()" > /tmp/hardware-info.txt

From a machine with no strange chars (after folding for clarity).

{
 'product': 'SUN FIRE X4150',
 'vendor': 'Sun Microsystems',
 'bios_vendor': 'American Megatrends Inc.',
 'system': 'SUN FIRE X4150 Rev 50',
 'bios_release': '11/05/2008',
 'board': 'Sun Microsystems',
 'bios_version': '1ADQW057',
 'class': 'DMI',
 'asset': '(chassis: 0000000000) (chassis: To Be Filled By O.E.M.) (board: 000000000000000000) (system: 0000000000) '},


on a machine with problems this looks like

{
 'product': '              ',
 'vendor': '\x0c               ',
 'bios_vendor': 'American Megatrends Inc.',
 'system': '\x0c             \x0c    ',
 'bios_release': '11/05/2008',
 'board': '\x0c              ',
 'bios_version': '1ADQW057',
 'class': 'DMI', 'asset': '(board:  ) '},

Comment 3 Martin Poole 2010-04-06 17:01:18 UTC
The problem is caused by the presence of the formfeed (and other xml-suspect characters) in the python  string.printable set which is used as the filter for the dmidecode contents.

In /usr/share/rhn/up2date_client/hardware.py towards the end of the read_dmi function it calls

  toascii = makefilter(string.printable)

to create a filter to be applied to the contents. The set of characters passed to create this filter probably needs to be a slightly more restricted set than string.printable, possible the union of string.digits, string.letters, string.punctuation and the member of string.whitespace that are not problematic.

Comment 15 Miroslav Suchý 2010-07-26 08:05:30 UTC
I do confirm this behaviour on RHEL5 as well.

Comment 20 Jaromir Hradilek 2010-07-29 12:39:47 UTC
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

New Contents:
Previously, the presence of the "\f" character in the Desktop Management Interface (DMI) information or any non-ASCII character in the hardware name rendered the system unable to register to both Red Hat Network (RHN) and Red Hat Network Satellite Server. This error has been fixed, and the system registration now works as expected.

Comment 22 Miroslav Suchý 2010-08-13 09:25:46 UTC
We find problem in https://bugzilla.redhat.com/show_bug.cgi?id=618267#c3
commit 16fddd9063c5a5dabce2b849416c5e0dddf3438e cherrypicked as rev 195242

Comment 43 Pavel Novotny 2010-11-23 13:17:20 UTC
Verified.

# rpm -q up2date rhnlib
up2date-4.9.1-29.el4
rhnlib-2.1.4-14.el4_8.3

Hardware profile info containing special characters like (c) or (r) is handled correctly and registration to satellite / hosted ends up successfully.
Note: control characters like form-feed etc. are handled by rhnlib package, not up2date.

# PYTHONPATH=/usr/share/rhn python -c "from up2date_client import hardware; from pprint import pprint; pprint(hardware.Hardware())"

[{'bus': 'PCI',
  'class': 'OTHER',
  'desc': '"Dell Remote Access Card 4 Daughter Card SMIC interface\x02\x0f\x0e\xc2\xa1\xc3\xbf\x04\x05\x06\xc2\xa9\x0c\xc2\xae\x01\x12\x10"',
  'detached': '0',
  'deviceId': '0014',
  'driver': 'unknown',
  'pciType': '1',
  'pcibus': '4',
  'pcidev': '4',
  'pcidom': '0',
  'pcifn': '2',
  'subDeviceId': '0014',
  'subVendorId': '1028',
  'vendorId': '1028'},
 {'bus': 'PCI',
  'class': 'OTHER',
  'desc': '"Dell Remote Access Card 4 Daughter Card Virtual UART\x02\x0f\x0e\xc2\xa1\xc3\xbf\x04\x05\x06\xc2\xa9\x0c\xc2\xae\x01\x12\x10"',
  'detached': '0',
  'deviceId': '0012',
  'driver': 'unknown',
  'pciType': '1',
  'pcibus': '4',
  'pcidev': '4',
  'pcidom': '0',
  'pcifn': '1',
  'subDeviceId': '0012',
  'subVendorId': '1028',
  'vendorId': '1028'},
...
...
...

# rhnreg_ks --serverUrl=... --username=... --password=...
(No errors.)

On server - Systems -> (system) -> Details -> Hardware:
"Dell Remote Access Card 4 Daughter Card SMIC interface¡ÿ©®"
"Dell Remote Access Card 4 Daughter Card Virtual UART¡ÿ©®"
...
...
...

Comment 45 errata-xmlrpc 2011-02-16 14:16:29 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0240.html