Author: rmeggins
Update of /cvs/dirsec/console/src/com/netscape/management/client/ug In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9267/console/src/com/netscape/management/client/ug
Modified Files: PickerEditorResource.properties ResEditorPosixUser.java Log Message: Resolves: bug 458488 Bug Description: Console doesn't type-check input for schema-defined INTEGER attributes Reviewed by: nhosoi (Thanks!) Fix Description: Fixed for posix uidNumber and gidNumber. Non numeric or negative values will be rejected. If the user specifies an explicit value of 0, a warning dialog will ask if the user really wants to do this. Platforms tested: RHEL5 Flag Day: no Doc impact: yes
Index: PickerEditorResource.properties =================================================================== RCS file: /cvs/dirsec/console/src/com/netscape/management/client/ug/PickerEditorResource.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PickerEditorResource.properties 13 Jun 2007 20:33:11 -0000 1.2 +++ PickerEditorResource.properties 10 Dec 2008 02:53:19 -0000 1.3 @@ -373,7 +373,20 @@ resourceEditor-IncompleteTitle=Incomplete Information resourceEditor-UnableToSaveRDNEntryText=Changes cannot be saved for entries with multi-valued RDNs resourceEditor-navigator_tt=List of views for navigation of this dialog - +resourceEditor-UidNotANumberTitle=uidNumber Must Be A Number +resourceEditor-UidNotANumberText=The uidNumber field must have a numeric value. +resourceEditor-GidNotANumberTitle=gidNumber Must Be A Number +resourceEditor-GidNotANumberText=The gidNumber field must have a numeric value. +resourceEditor-UidNotValidTitle=uidNumber Value Not Valid +resourceEditor-UidNotValidText=The uidNumber field does not have a valid value. +resourceEditor-GidNotValidTitle=gidNumber Value Not Valid +resourceEditor-GidNotValidText=The gidNumber field does not have a valid value. +resourceEditor-yesButton=Yes +resourceEditor-noButton=No +resourceEditor-errorText1=The value 0 is for privileged users only. +resourceEditor-errorText2=Assigning this value to a user will give this user privileged access. +resourceEditor-errorText3=Do you really want to use this value? +resourceEditor-errorTitle=Value Warning CALPage-displayName=Licenses CALPage-ID=Licenses CALPage-Title=To facilitate tracking of all Client Access Licenses (CAL), please indicate whether
Index: ResEditorPosixUser.java =================================================================== RCS file: /cvs/dirsec/console/src/com/netscape/management/client/ug/ResEditorPosixUser.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ResEditorPosixUser.java 18 Jul 2005 00:34:23 -0000 1.1.1.1 +++ ResEditorPosixUser.java 10 Dec 2008 02:53:19 -0000 1.2 @@ -490,14 +490,84 @@ * @return true if all required information has been provided; false otherwise */ public boolean isComplete() { - if (_cbEnable.isSelected() && - ((_tfUIDNumber.getText().trim().length() == 0)||(_tfGIDNumber.getText().trim().length()==0))) { - SuiOptionPane.showMessageDialog(null, - _resource.getString("resourceEditor", "IncompleteText"), - _resource.getString("resourceEditor", - "IncompleteTitle"), SuiOptionPane.ERROR_MESSAGE); - ModalDialogUtil.sleep(); - return false; + if (_cbEnable.isSelected()) { + if ((_tfUIDNumber.getText().trim().length() == 0)||(_tfGIDNumber.getText().trim().length()==0)) { + SuiOptionPane.showMessageDialog(null, + _resource.getString("resourceEditor", "IncompleteText"), + _resource.getString("resourceEditor", + "IncompleteTitle"), SuiOptionPane.ERROR_MESSAGE); + ModalDialogUtil.sleep(); + return false; + } + int testval; + try { + testval = Integer.parseInt(_tfUIDNumber.getText().trim()); + } catch (NumberFormatException nfe) { + SuiOptionPane.showMessageDialog(null, + _resource.getString("resourceEditor", "UidNotANumberText"), + _resource.getString("resourceEditor", + "UidNotANumberTitle"), SuiOptionPane.ERROR_MESSAGE); + ModalDialogUtil.sleep(); + return false; + } + if (testval < 0) { + SuiOptionPane.showMessageDialog(null, + _resource.getString("resourceEditor", "UidNotValidText"), + _resource.getString("resourceEditor", + "UidNotValidTitle"), SuiOptionPane.ERROR_MESSAGE); + ModalDialogUtil.sleep(); + return false; + } + if (testval == 0) { + Object[] val1 = {_resource.getString("resourceEditor", "yesButton"), + _resource.getString("resourceEditor", "noButton")}; + Object[] msg1 = {_resource.getString("resourceEditor", "errorText1"), + _resource.getString("resourceEditor", "errorText2"), + _resource.getString("resourceEditor", "errorText3")}; + int selection = SuiOptionPane.showOptionDialog(null, msg1, + _resource.getString("resourceEditor", "errorTitle"), + SuiOptionPane.DEFAULT_OPTION, + SuiOptionPane.WARNING_MESSAGE, null, val1, val1[0]); + + if (selection == 1) { + ModalDialogUtil.sleep(); + return false; + } + } + try { + testval = Integer.parseInt(_tfGIDNumber.getText().trim()); + } catch (NumberFormatException nfe) { + SuiOptionPane.showMessageDialog(null, + _resource.getString("resourceEditor", "GidNotANumberText"), + _resource.getString("resourceEditor", + "GidNotANumberTitle"), SuiOptionPane.ERROR_MESSAGE); + ModalDialogUtil.sleep(); + return false; + } + if (testval < 0) { + SuiOptionPane.showMessageDialog(null, + _resource.getString("resourceEditor", "GidNotValidText"), + _resource.getString("resourceEditor", + "GidNotValidTitle"), SuiOptionPane.ERROR_MESSAGE); + ModalDialogUtil.sleep(); + return false; + } + if (testval == 0) { + Object[] val1 = {_resource.getString("resourceEditor", "yesButton"), + _resource.getString("resourceEditor", "noButton")}; + Object[] msg1 = {_resource.getString("resourceEditor", "errorText1"), + _resource.getString("resourceEditor", "errorText2"), + _resource.getString("resourceEditor", "errorText3")}; + int selection = SuiOptionPane.showOptionDialog(null, msg1, + _resource.getString("resourceEditor", "errorTitle"), + SuiOptionPane.DEFAULT_OPTION, + SuiOptionPane.WARNING_MESSAGE, null, val1, val1[0]); + + if (selection == 1) { + ModalDialogUtil.sleep(); + return false; + } + } } return true; }
389-commits@lists.fedoraproject.org