admserv/cgi-src40/config.c | 4 ++--
admserv/cgi-src40/security.c | 11 ++++++++---
admserv/cgi-src40/security.properties | 2 +-
admserv/newinst/src/AdminServer.pm.in | 34 ++++++++++++++++++----------------
4 files changed, 29 insertions(+), 22 deletions(-)
New commits:
commit 1bece0e524811a0da8aae5a27c3c130a7e452a4e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Apr 30 17:52:47 2015 -0700
Ticket #47467 - Improve Add CRL/CKL dialog and errors
Description: Additional modifications to the error messages.
When an input for CRL/CKL is missing, the generated error message
is not broken and does not give much help.
DBT_MISSING_THIS + DBT_MISSING_FILE
You should enter a No file specified. Enter the full path of a file.'
If the object of the "enter" is DBT_MISSING_FILE, change to just print
it. And modified the sentense as follows:
Enter a file name in the configuration directory or the full path of
a file.
https://fedorahosted.org/389/ticket/47467
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/admserv/cgi-src40/security.c b/admserv/cgi-src40/security.c
index d604f88..34bf3a7 100644
--- a/admserv/cgi-src40/security.c
+++ b/admserv/cgi-src40/security.c
@@ -223,9 +223,14 @@ getResourceString(char *key) {
}
}
-static char * getParameter(char *key, char *keyName) {
-
- PR_snprintf(line, sizeof(line), getResourceString(DBT_MISSING_THIS), keyName);
+static char * getParameter(char *key, char *keyName)
+{
+ if (strcmp(keyName, getResourceString(DBT_MISSING_FILE))) {
+ /* not a missing file */
+ PR_snprintf(line, sizeof(line), getResourceString(DBT_MISSING_THIS), keyName);
+ } else {
+ PR_snprintf(line, sizeof(line), getResourceString(DBT_MISSING_FILE));
+ }
return get_cgi_var(key, getResourceString(DBT_PARAMETERMISSING), line);
}
diff --git a/admserv/cgi-src40/security.properties
b/admserv/cgi-src40/security.properties
index 289eef5..7a67f5d 100644
--- a/admserv/cgi-src40/security.properties
+++ b/admserv/cgi-src40/security.properties
@@ -61,7 +61,7 @@ security45 { "Unable to find the CRL or CKL specified." }
security50 { "Could not open file %s. File does not exist or filename is invalid.
A filename that exists in the server security directory must be specified. Absolute or
relative paths should not be specified." }
security51 { "Could not add module found in file %s." }
security52 { "The module has been successfully added. Please restart the console for
changes to take effect." }
-security53 { "No file specified. Enter the full path of a file." }
+security53 { "No file specified. Enter a file name in the configuration directory or
the full path of a file." }
security54 { "No file format specified." }
security55 { "Invalid file format." }
security56 { "No module name or incorrect module name specified. Please enter a
valid module name." }
commit d1de836de72a9633fa8fd1743b35b9a7a54333ea
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Apr 29 22:39:49 2015 -0700
Ticket #48171 - remove-ds-admin.pl removes files in the rpm
Description: remove-ds-admin.pl expects /etc/dirsrv/admin-serv/bakup
contains the original config files from rpm to replace with. If
setup-ds-admin.pl fails for some reason, it quits without backing up
the files. In the case, remove-ds-admin.pl just removes the config
files since there is no way to restore them.
This patch moves the backup code before the operation that has a
possibility to fail. This allows setup-ds-admin.pl to create the
backups even if the setup fails.
Also, read_conf and update_conf in cgi-src40/config.c uses given path
and file name instead of the generated full path which is set up an
empty string if the file is not accessible or not a plain file.
https://fedorahosted.org/389/ticket/48171
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/admserv/cgi-src40/config.c b/admserv/cgi-src40/config.c
index ddb4af3..8b16737 100644
--- a/admserv/cgi-src40/config.c
+++ b/admserv/cgi-src40/config.c
@@ -714,7 +714,7 @@ static char * read_conf(char *file, char *name) {
f = fopen(filename, "r");
if (f==NULL) {
char msg[BIG_LINE];
- PR_snprintf(msg, BIG_LINE, "Cannot open file %s for reading", filename);
+ PR_snprintf(msg, BIG_LINE, "Cannot open file %s/%s for reading", configdir,
file);
rpt_err(SYSTEM_ERROR, msg, NULL, NULL);
}
@@ -752,7 +752,7 @@ static int update_conf(char *file, char *name, char *val) {
f = fopen(filename, "r");
if (f==NULL) {
char msg[BIG_LINE];
- PR_snprintf(msg, BIG_LINE, "Cannot open file %s for reading", filename);
+ PR_snprintf(msg, BIG_LINE, "Cannot open file %s/%s for reading", configdir,
file);
rpt_err(SYSTEM_ERROR, msg, NULL, NULL);
}
diff --git a/admserv/newinst/src/AdminServer.pm.in
b/admserv/newinst/src/AdminServer.pm.in
index 0c98a6e..a141596 100644
--- a/admserv/newinst/src/AdminServer.pm.in
+++ b/admserv/newinst/src/AdminServer.pm.in
@@ -384,6 +384,23 @@ sub updateHttpConfFiles {
libpath_add("@LIBPATH@");
libpath_add("$savepath");
$ENV{SHLIB_PATH} = $ENV{LD_LIBRARY_PATH};
+
+ if (! -d "$admConf->{configdir}/bakup") {
+ if (system ("mkdir -p $admConf->{configdir}/bakup")) {
+ debug(0, "Error backing up $admConf->{configdir}/console.conf failed:
$!");
+ }
+ }
+ # backup the savefiles for "remove-ds-admin.pl -a"
+ foreach my $savefile (@saveconffiles, @savesecfiles) {
+ if (! -f "$admConf->{configdir}/bakup/$savefile") {
+ if (-e "$admConf->{configdir}/$savefile"){
+ if(system ("cp -p $admConf->{configdir}/$savefile
$admConf->{configdir}/bakup")) {
+ debug(0, "Error backing up $admConf->{configdir}/$savefile
failed: $!\n");
+ }
+ }
+ }
+ }
+
my $cmd = "@cgibindir@/config op=set
configuration.nsSuiteSpotUser=\"$user\"";
if (!defined($origport) or ($port != $origport)) { # need to change the port number
$cmd .= " configuration.nsServerPort=\"$port\"";
@@ -391,7 +408,7 @@ sub updateHttpConfFiles {
if ($serverAddress) {
$cmd .= " configuration.nsServerAddress=\"$serverAddress\"";
}
-
+ debug(1, "Running $cmd ...");
$? = 0; # clear error
my $output = `$cmd 2>&1`;
# Check the output of the config CGI to see if something bad happened.
@@ -423,21 +440,6 @@ sub updateHttpConfFiles {
print CONSOLECONF @contents;
close (CONSOLECONF);
}
- if (! -d "$admConf->{configdir}/bakup") {
- if (system ("mkdir -p $admConf->{configdir}/bakup")) {
- debug(0, "Error backing up $admConf->{configdir}/console.conf failed:
$!");
- }
- }
- # backup the savefiles for "remove-ds-admin.pl -a"
- foreach my $savefile (@saveconffiles, @savesecfiles) {
- if (! -f "$admConf->{configdir}/bakup/$savefile") {
- if (-e "$admConf->{configdir}/$savefile"){
- if(system ("cp -p $admConf->{configdir}/$savefile
$admConf->{configdir}/bakup")) {
- debug(0, "Error backing up $admConf->{configdir}/$savefile
failed: $!\n");
- }
- }
- }
- }
return 1;
}