Bug 771393 - Sosreport fails for default values when rhn user name contains character '/' in it.
Summary: Sosreport fails for default values when rhn user name contains character '/' ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sos
Version: 6.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Bryn M. Reeves
QA Contact: David Kutálek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-03 15:44 UTC by Yogesh
Modified: 2018-11-26 18:01 UTC (History)
7 users (show)

Fixed In Version: sos-2.2-18.el6
Doc Type: Bug Fix
Doc Text:
* Previous releases of sos used inconsistent input sanitization rules depending on whether user name and case information was supplied interactively or read from system configuration files * This caused sos to fail to properly sanitize certain invalid strings when read from configuration files and to apply different sanitization to the same strings when input interactively * All name and number sanitization is now carried out in a single location and all input routines have been modified to use these routines * Name and number sanitization rules are now applied consistently regardless of the source of the data
Clone Of:
Environment:
Last Closed: 2012-06-20 07:25:15 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0958 0 normal SHIPPED_LIVE Low: sos security, bug fix, and enhancement update 2012-06-19 19:28:28 UTC

Description Yogesh 2012-01-03 15:44:51 UTC
Description of problem:
when rhn user name contains character '/' in it, Sosreport is giving following error
/bin/sh: /tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz: No such file or directory
/bin/tar: -: Cannot write: Broken pipe
/bin/tar: Error is not recoverable: exiting now
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    sosreport(sys.argv[1:])
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 843, in sosreport
    GlobalVars.policy.displayResults()
  File "/usr/lib/python2.6/site-packages/sos/policyredhat.py", line 329, in displayResults
    fp = open(self.report_file, "r")
IOError: [Errno 2] No such file or directory: '/tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz'


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


How reproducible:
Always

Steps to Reproduce:
1. Open /etc/sysconfig/rhn/systemid
2. Edit value of field 'username'. Add '/' character in username. e.g.
<name>username</name>
<value><string>abc/xyz</string></value>
3. Run command
# sosreport

  
Actual results:
Sosreport is giving following error
/bin/sh: /tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz: No such file or directory
/bin/tar: -: Cannot write: Broken pipe
/bin/tar: Error is not recoverable: exiting now
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    sosreport(sys.argv[1:])
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 843, in sosreport
    GlobalVars.policy.displayResults()
  File "/usr/lib/python2.6/site-packages/sos/policyredhat.py", line 329, in displayResults
    fp = open(self.report_file, "r")
IOError: [Errno 2] No such file or directory: '/tmp/sosreport-ABCD/XYZ-20111230154705.tar.xz'

Expected results:
Sosreport should trim down character '/' from rhn username and continue..

Additional info:
Trivial patch to file - /usr/lib/python2.6/site-packages/sos/policyredhat.py
--- policyredhat.py.bkup	2012-01-03 21:18:23.223920912 +0530
+++ policyredhat.py	2012-01-03 21:06:52.627932715 +0530
@@ -246,6 +246,7 @@
         else:
             self.reportName = self.reportName
 
+	self.reportName = self.reportName.replace('/','')
         curwd = os.getcwd()
         os.chdir(os.path.dirname(self.cInfo['dstroot']))
         oldmask = os.umask(077)

Comment 21 Bryn M. Reeves 2012-05-01 13:18:05 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:
* Previous releases of sos used inconsistent input sanitization rules depending on whether user name and case information was supplied interactively or read from system configuration files
* This caused sos to fail to properly sanitize certain invalid strings when read from configuration files and to apply different sanitization to the same strings when input interactively
* All name and number sanitization is now carried out in a single location and all input routines have been modified to use these routines
* Name and number sanitization rules are now applied consistently regardless of the source of the data

Comment 23 errata-xmlrpc 2012-06-20 07:25:15 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.

http://rhn.redhat.com/errata/RHSA-2012-0958.html


Note You need to log in before you can comment on or make changes to this bug.