admserv/cgi-src40/security.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
New commits: commit ec879b64efc6f2956dffa8ba0e004e4865364f17 Author: Nathan Kinder nkinder@redhat.com Date: Tue Aug 13 19:51:49 2013 -0700
Ticket 47468 - Change security password validation error is out of order
When changing the NSS security database password from Console, the input validation errors that are returned by Admin Server are out of order from teh UI elements in the Console. The way we were calling the function to fetch parameters were causing the calling order to process the input fields from the bottom up as viewed in the UI. This makes the error message that is returned to the user look a bit odd.
This patch simply forces the parameters to be fetched in the same order as they are displayed in the UI in Console.
diff --git a/admserv/cgi-src40/security.c b/admserv/cgi-src40/security.c index 31da45d..fef3bea 100644 --- a/admserv/cgi-src40/security.c +++ b/admserv/cgi-src40/security.c @@ -2184,8 +2184,15 @@ int main(int argc, char *argv[])
} else if (!PORT_Strcmp(operation, "INIT_PIN")) { /* initialize internal token pin */ - initPin(getParameter("newpwd",getResourceString(DBT_PASSWORD)), - getParameter("confirmpwd",getResourceString(DBT_PASSWORD))); + + /* We fetch the paramters here for the benefit of the Console. If we call + * getParameter() as an argument to initPin, the calling order causes the + * error message that is returned to be out of order with the display in + * the UI. */ + char *newpwd = getParameter("newpwd",getResourceString(DBT_PASSWORD)); + char *confirmpwd = getParameter("confirmpwd",getResourceString(DBT_PASSWORD)); + + initPin(newpwd, confirmpwd);
} else if (!PORT_Strcmp(operation, "DELETE_CACERT")) { /* remove a ca certificate */ @@ -2218,9 +2225,16 @@ int main(int argc, char *argv[]) /* currently change password only apply to key3.db, and we do not deal with change password for external token. User can do that via the software that comes with the hardware */ - changePassword(getParameter("oldpwd", getResourceString(DBT_OLD_PWD)), - getParameter("newpwd", getResourceString(DBT_NEW_PWD)), - getParameter("confirmpwd", getResourceString(DBT_CONFIRM_PWD))); + + /* We fetch the paramters here for the benefit of the Console. If we call + * getParameter() as an argument to initPin, the calling order causes the + * error message that is returned to be out of order with the display in + * the UI. */ + char *oldpwd = getParameter("oldpwd", getResourceString(DBT_OLD_PWD)); + char *newpwd = getParameter("newpwd", getResourceString(DBT_NEW_PWD)); + char *confirmpwd = getParameter("confirmpwd", getResourceString(DBT_CONFIRM_PWD)); + + changePassword(oldpwd, newpwd, confirmpwd);
} else if (!PORT_Strcmp(operation, "INSTALL_CRL_CKL")) { /* install a crl/ckl certificate */