summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-04-16 11:26:32 -0500
committerRich Megginson <rmeggins@redhat.com>2010-04-26 17:41:45 -0600
commita7b2cdc8c3ee5fcc23155d791cafc48f554008f2 (patch)
tree31f9b663124078f39865278c74cfdeee80ba2fdf
parent78c50664d6421cc5d0836bb03820680dc2cb7acf (diff)
downloadds-a7b2cdc8c3ee5fcc23155d791cafc48f554008f2.tar.gz
ds-a7b2cdc8c3ee5fcc23155d791cafc48f554008f2.tar.xz
ds-a7b2cdc8c3ee5fcc23155d791cafc48f554008f2.zip
Bug 542570 - Directory Server port number is not validated in the beginning.
https://bugzilla.redhat.com/show_bug.cgi?id=542570 Resolves: bug 542570 Bug Description: Directory Server port number is not validated in the beginning. Fix Description: The code has been modified to validate the port value from the beginning of the string to the end to ensure that it only contains digits and to generate the appropriate error message. Reviewed by: rmeggins (and pushed)
-rw-r--r--ldap/admin/src/scripts/DSCreate.pm.in3
-rw-r--r--ldap/admin/src/scripts/DSDialogs.pm4
-rw-r--r--ldap/admin/src/scripts/setup-ds.res.in2
3 files changed, 7 insertions, 2 deletions
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index dcd55afb..a156f108 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -82,6 +82,9 @@ sub checkPort {
}
}
+ if ($inf->{slapd}->{ServerPort} !~ /^\d+$/) {
+ return ('error_port_invalid', $inf->{slapd}->{ServerPort});
+ }
if (!portAvailable($inf->{slapd}->{ServerPort})) {
return ('error_port_available', $inf->{slapd}->{ServerPort}, $!);
}
diff --git a/ldap/admin/src/scripts/DSDialogs.pm b/ldap/admin/src/scripts/DSDialogs.pm
index 6583ff9e..60bc1155 100644
--- a/ldap/admin/src/scripts/DSDialogs.pm
+++ b/ldap/admin/src/scripts/DSDialogs.pm
@@ -64,8 +64,8 @@ my $dsport = new Dialog (
my $self = shift;
my $ans = shift;
my $res = $DialogManager::SAME;
- if ($ans !~ /\d+/) {
- $self->{manager}->alert("dialog_dsport_error", $ans);
+ if ($ans !~ /^\d+$/) {
+ $self->{manager}->alert("dialog_dsport_invalid", $ans);
} elsif (!portAvailable($ans)) {
$self->{manager}->alert("dialog_dsport_error", $ans);
} else {
diff --git a/ldap/admin/src/scripts/setup-ds.res.in b/ldap/admin/src/scripts/setup-ds.res.in
index af9080d4..ca7b6e7e 100644
--- a/ldap/admin/src/scripts/setup-ds.res.in
+++ b/ldap/admin/src/scripts/setup-ds.res.in
@@ -55,6 +55,7 @@ dialog_ssgroup_no_user = The system user '%s' does not belong to the group '%s'.
dialog_dsport_text = The standard directory server network port number is 389. However, if\nyou are not logged as the superuser, or port 389 is in use, the\ndefault value will be a random unused port number greater than 1024.\nIf you want to use port 389, make sure that you are logged in as the\nsuperuser, that port 389 is not in use.\n\n
dialog_dsport_prompt = Directory server network port
dialog_dsport_error = The port %s is in use or not available. Please choose another port.\n\n
+dialog_dsport_invalid = The port %s is not a valid port. Please choose a valid port.\n\n
# ----------- DS server ID Dialog Resource ----------------
dialog_dsserverid_text = Each instance of a directory server requires a unique identifier.\nThis identifier is used to name the various\ninstance specific files and directories in the file system,\nas well as for other uses as a server instance identifier.\n\n
@@ -103,6 +104,7 @@ error_adding_entry = Error adding entry '%s'. Error: %s\n
error_updating_entry = Error updating entry '%s'. Error: %s\n
error_invalid_param = The parameter '%s' has an invalid value '%s'.\n
+error_port_invalid = The port %s is not a valid port. Please choose a valid port.\n
error_port_available = The port number '%s' is not available for use. This may be due to an\
invalid port number, or the port already being in use by another\
program, or low port restriction. Please choose another value for\