ldap/admin/src/scripts/DSCreate.pm.in | 3 +++
ldap/admin/src/scripts/DSDialogs.pm | 4 ++--
ldap/admin/src/scripts/setup-ds.res.in | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit 6fa876657c99509d770876b7c7c25dbebc8ebe53
Author: Endi S. Dewata <edewata(a)redhat.com>
Date: Fri Apr 16 11:26:32 2010 -0500
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)
(cherry picked from commit a7b2cdc8c3ee5fcc23155d791cafc48f554008f2)
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in
b/ldap/admin/src/scripts/DSCreate.pm.in
index e04f1cd..86a8b0f 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 6583ff9..60bc115 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 b18a2ae..b0d88c2 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\