SYSTEM WARNING: 'file_get_contents(https://www.clearos.com/?rendertype=json&get=header): failed to open stream: Connection refused' in '/var/www/virtual/newwrapper/cf_topmenu.inc' line 5

ClearOS Bug Tracker


View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000520ClearOSapp-base - Base Systempublic2012-04-03 15:102012-04-18 19:37
Reporteruser2 
Assigned Todsokoloski 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionwon't fix 
PlatformOSOS Version
Product Version 
Target Version6.2.0Fixed in Version6.2.0 
Summary0000520: Yum plugins can pollute wc-yum output with non-JSON output
DescriptionThe addition of the yum-plugin-fastestmirror plugin created output in wc-yum that is not JSON. Sample output is below. Note: other yum plugins might be installed by an administrator, notably yum-plugin-protect-packages.

{"progress": 0, "code": 0, "overall": 0, "details": "Fetching repositories.", "errmsg": null}
{"progress": 35, "code": 0, "overall": 0, "details": "Updating repositories and preparing package dependencies... this may take a few minutes.", "errmsg": null}
Loading mirror speeds from cached hostfile
 * clearos: mirror2-houston.clearsdn.com
 * clearos-addons: mirror2-houston.clearsdn.com
 * clearos-extras: mirror2-houston.clearsdn.com
 * clearos-updates: mirror2-houston.clearsdn.com
 * private-clearcenter-ad: download4.clearsdn.com:80
 * private-clearcenter-content-filter: download4.clearsdn.com:80
 * private-clearcenter-dyndns: download4.clearsdn.com:80
 * private-clearcenter-google-apps: download1.clearsdn.com:80
 * private-clearcenter-ids: download1.clearsdn.com:80
{"progress": 100, "code": 0, "overall": 1, "details": "Updating repositories and preparing package dependencies... this may take a few minutes.", "errmsg": null}
{"progress": 100, "code": 0, "overall": 1, "details": "Updating repositories and preparing package dependencies... this may take a few minutes.", "errmsg": null}
TagsNo tags attached.
Attached Files? file icon wc-yum-json-decode.php [^] (1,294 bytes) 2012-04-03 15:52

- Relationships

-  Notes
(0000460)
dsokoloski (developer)
2012-04-03 15:52

It's not really possible to disable or pipe output from every possible YUM plug-in in wc-yum because we would have to know of every possible plug-in name in advance and specifically disable output for each unique name.

However, this is really a non-issue. I'm not sure how the output from wc-yum is being read by the marketplace code, but I suspect json_decode() is being called for each line of wc-yum output. If this is the case, then simply checking the return value of json_decode() is the proper solution. For example:

if (($data = json_decode($raw_line)) === NULL) continue;

I've attached an example script which feeds the example data in this bug report line-by-line in to json_decode(), testing the return value, and skipping malformed JSON.
(0000461)
bchambers (administrator)
2012-04-03 18:31

Actually, this check is being done in the (currently) one place where this function call is used.

Perhaps would be better doing the sanitization in the Yum class, so that anyone using it can guarantee that valid JSON is coming back?

If so, requires update to Yum.class.

If not, we don't need to do anything...can close.

- Issue History
Date Modified Username Field Change
2012-04-03 15:10 user2 New Issue
2012-04-03 15:10 user2 Status new => assigned
2012-04-03 15:10 user2 Assigned To => dsokoloski
2012-04-03 15:52 dsokoloski Note Added: 0000460
2012-04-03 15:52 dsokoloski File Added: wc-yum-json-decode.php
2012-04-03 18:31 bchambers Note Added: 0000461
2012-04-03 18:56 dsokoloski Status assigned => resolved
2012-04-03 18:56 dsokoloski Resolution open => won't fix
2012-04-13 09:09 user2 Project ClearCenter => ClearOS
2012-04-13 09:10 user2 Category app-clearcenter - ClearCenter Core => app-base - Base System
2012-04-13 09:11 user2 Fixed in Version => 6.2.0
2012-04-18 19:37 user2 Status resolved => closed

SYSTEM WARNING: 'file_get_contents(https://www.clearos.com/?rendertype=json&get=footer): failed to open stream: Connection refused' in '/var/www/virtual/newwrapper/cf_footer.inc' line 7