ldap/admin/src/scripts/DSCreate.pm.in | 3 ++-
ldap/admin/src/scripts/Inf.pm | 8 ++++++--
ldap/admin/src/scripts/Setup.pm.in | 3 +++
ldap/admin/src/scripts/setup-ds.res.in | 1 +
4 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 5363898b122b1a7e7ad07fdc0ad074e91cd1510f
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Jul 13 12:24:19 2015 -0400
Ticket 48119 - Silent install needs to properly exit when INF file is missing
Bug Description: If the INF file is not present, we don't log the error to the
setup log file. We also don't properly check for the suitespot
user, which also does not properly exit if the calling user is
root.
Fix Description: Properly exit if the INF file is missing, or the suitespot user
is not set(and we are running the script as root).
https://fedorahosted.org/389/ticket/48119
Reviewed by: rmeggins(Thanks!)
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in
b/ldap/admin/src/scripts/DSCreate.pm.in
index f44afbb..e4a4ed0 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -797,8 +797,9 @@ sub setDefaults {
if (!$inf->{General}->{SuiteSpotUserID}) {
if ($> != 0) { # if not root, use the user's uid
$inf->{General}->{SuiteSpotUserID} = getLogin;
+ } else {
+ return('error_missing_userid');
}
- # otherwise, the uid must be specified
}
if (!$inf->{General}->{SuiteSpotGroup}) {
diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm
index ec433e2..d4c55f1 100644
--- a/ldap/admin/src/scripts/Inf.pm
+++ b/ldap/admin/src/scripts/Inf.pm
@@ -31,7 +31,9 @@ sub new {
$self = bless $self, $type;
if ($self->{filename}) {
- $self->read();
+ if($self->read() != 0){
+ undef $self;
+ }
}
return $self;
@@ -61,7 +63,7 @@ sub read {
} else {
if (!open(INF, $filename)) {
debug(0, "Error: could not open inf file $filename: $!\n");
- return;
+ return -1;
}
$inffh = \*INF;
}
@@ -118,6 +120,8 @@ sub read {
if ($inffh ne \*STDIN) {
close $inffh;
}
+
+ return 0;
}
sub section {
diff --git a/ldap/admin/src/scripts/Setup.pm.in b/ldap/admin/src/scripts/Setup.pm.in
index cd49d95..99025ab 100644
--- a/ldap/admin/src/scripts/Setup.pm.in
+++ b/ldap/admin/src/scripts/Setup.pm.in
@@ -117,6 +117,9 @@ sub init {
# if user supplied inf file, use that to initialize
if (defined($inffile)) {
$self->{inf} = new Inf($inffile);
+ if(!$self->{inf}){
+ $self->doExit(1);
+ }
} else {
$self->{inf} = new Inf;
}
diff --git a/ldap/admin/src/scripts/setup-ds.res.in
b/ldap/admin/src/scripts/setup-ds.res.in
index 011bf36..7134e25 100644
--- a/ldap/admin/src/scripts/setup-ds.res.in
+++ b/ldap/admin/src/scripts/setup-ds.res.in
@@ -118,6 +118,7 @@ error_enabling_feature = Could not enable the directory server feature
'%s'. Er
error_importing_ldif = Could not import LDIF file '%s'. Error: %s. Output:
%s\n
error_starting_server = Could not start the directory server using command '%s'.
The last line from the error log was '%s'. Error: %s\n
error_stopping_server = Could not stop the directory server '%s'. Error: %s\n
+error_missing_userid = The SuiteSpotUserID is missing. This must be set to valid user\n
error_missing_port_and_ldapi = Either ServerPort or ldapifilepath must be specified. The
server must listen to something.\n
error_missing_port = No ServerPort specified. The server must have a port number to
listen to (default 389).\n
error_server_already_exists = Error: the server already exists at '%s'\