Bug 466137

Summary: htmladmin gives 500 error
Product: Red Hat Directory Server Reporter: Ulf Weltman <ulf.weltman>
Component: UI - Admin ExpressAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: Chandrasekar Kannan <ckannan>
Severity: low Docs Contact:
Priority: medium    
Version: 8.0CC: benl, jgalipea, nkinder
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Other   
Whiteboard:
Fixed In Version: 8.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-29 23:07:01 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:    
Bug Blocks: 249650, 493682    
Attachments:
Description Flags
diffs
none
cvs commit log none

Description Ulf Weltman 2008-10-08 16:56:09 UTC
Point a browser to the admin server URL, click "Red Hat Administration Express" and authenticate, I end up at http://hptem080.cup.hp.com:9830/admin-serv/tasks/configuration/HTMLAdmin?op=index which gives a 500 error and this AS error log output:
"Premature end of script headers: htmladmin, referer: http://hptem080.cup.hp.com:9830/dist/download"

This happens on at least HP-UX 11.23 IA and PA with both RHDS 8.0.0 and 8.0.4.

Comment 1 Ulf Weltman 2008-10-09 00:21:02 UTC
A-ha, I got it running in a debugger and found it was having trouble getting a resource bundle from ICU.  Turns out the htmladmin uses adminsdk's res_getstring() with the acceptLanguage set to the raw string from the browser, which I still had set to "en-US,en,en-CA,en-us,EN-US,EN,es-ES,es,no-NO,no,en-gb,ro-RO,ro,utf-8,utf,de-DE" after testing the SP7 security stuff.  ICU chokes on that locale and returns U_ILLEGAL_ARGUMENT_ERROR.  Returning my intl.accept_languages to the default fixes it.

There is no crash when it fails to resolve the locale, htmladmin just prints nothing at all since all the resource string lookups return empty strings.

Comment 2 Rich Megginson 2008-12-03 23:28:11 UTC
It is the double quotes which is throwing it off.  That is, en-US,en,en-CA,en-us,EN-US,EN,es-ES,es,no-NO,no,en-gb,ro-RO,ro,utf-8,utf,de-DE will work, but not "en-US,en,en-CA,en-us,EN-US,EN,es-ES,es,no-NO,no,en-gb,ro-RO,ro,utf-8,utf,de-DE"

You cannot set the language string to something containing quotes with the regular Preferences->Languages Choose... dialog, you have to go to
about:config
and set intl.accept_languages to the above value.

Furthermore, the browser (or perhaps Apache) will parse and append the string before it gets to htmladmin, and the value will be
 "en-US,en;q=0.9,en-CA;q=0.9,en-us;q=0.8,EN-US;q=0.8,EN;q=0.7,es-ES;q=0.6,es;q=0.6,no-NO;q=0.5,no;q=0.4,en-gb;q=0.4,ro-RO;q=0.3,ro;q=0.3,utf-8;q=0.2,utf;q=0.1,de-DE";q=0.1

This is what I've found in my testing.  At any rate, it looks as though the fix is to handle U_ILLEGAL_ARGUMENT_ERROR, and just use the default language in that case.

Comment 3 Rich Megginson 2008-12-04 01:01:39 UTC
Created attachment 325619 [details]
diffs

Comment 4 Rich Megginson 2008-12-04 15:58:08 UTC
Created attachment 325699 [details]
cvs commit log

Reviewed by: nkinder (Thanks!)
Fix Description: If the locale string passed in to res_getstring is bogus, the CGI will just exit (no crash, no security problems) which causes the 500 error.  ures_open returns U_ILLEGAL_ARGUMENT_ERROR if the locale string is bogus.  In this case, just use NULL for the locale which will cause it to use the default one.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no

Comment 5 Jenny Severance 2009-03-13 18:53:50 UTC
fix verified - RHEL 5 - DS 8.1  Red Hat Administration Express available, able to view log and stop servers

Comment 6 Chandrasekar Kannan 2009-04-29 23:07:01 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/RHEA-2009-0455.html