From 7cf412c3943d58b388dde6b89a8b58c4da66aa95 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 10 Jul 2007 16:03:42 +0000
Subject: [PATCH] Fix a set of problems with the configuration interface in which there were a number of cases in which insufficient validation was performed. In particular, if a new configuration object was added over protocol or an existing configuration object was changed from disabled to enabled, then the server would only perform generic validation for that component and would not have any way to perform more detailed validation that could detect larger numbers of problems.
---
opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java | 70 +++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 27 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
index 68ec379..7209bc8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
@@ -38,6 +38,7 @@
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.LoggerMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
+import org.opends.server.admin.std.server.ErrorLogPublisherCfg;
import org.opends.server.admin.std.server.FileBasedErrorLogPublisherCfg;
import org.opends.server.admin.std.meta.ErrorLogPublisherCfgDefn;
import org.opends.server.admin.server.ConfigurationChangeListener;
@@ -272,37 +273,17 @@
config.addFileBasedErrorChangeListener(this);
}
+
+
/**
* {@inheritDoc}
*/
- public boolean isConfigurationChangeAcceptable(
- FileBasedErrorLogPublisherCfg config, List<String> unacceptableReasons)
+ @Override()
+ public boolean isConfigurationAcceptable(ErrorLogPublisherCfg configuration,
+ List<String> unacceptableReasons)
{
- // Make sure the permission is valid.
- try
- {
- if(!currentConfig.getLogFileMode().equalsIgnoreCase(
- config.getLogFileMode()))
- {
- FilePermission.decodeUNIXMode(config.getLogFileMode());
- }
- if(!currentConfig.getLogFile().equalsIgnoreCase(config.getLogFile()))
- {
- File logFile = getFileForPath(config.getLogFile());
- if(logFile.createNewFile())
- {
- logFile.delete();
- }
- }
- }
- catch(Exception e)
- {
- int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
- String message = getMessage(msgID, config.dn().toString(),
- stackTraceToSingleLineString(e));
- unacceptableReasons.add(message);
- return false;
- }
+ FileBasedErrorLogPublisherCfg config =
+ (FileBasedErrorLogPublisherCfg) configuration;
// Validate retention and rotation policies.
for(DN dn : config.getRotationPolicyDN())
@@ -382,6 +363,41 @@
/**
* {@inheritDoc}
*/
+ public boolean isConfigurationChangeAcceptable(
+ FileBasedErrorLogPublisherCfg config, List<String> unacceptableReasons)
+ {
+ // Make sure the permission is valid.
+ try
+ {
+ if(!currentConfig.getLogFileMode().equalsIgnoreCase(
+ config.getLogFileMode()))
+ {
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+ }
+ if(!currentConfig.getLogFile().equalsIgnoreCase(config.getLogFile()))
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ if(logFile.createNewFile())
+ {
+ logFile.delete();
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+
+ return isConfigurationAcceptable(config, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public ConfigChangeResult applyConfigurationChange(
FileBasedErrorLogPublisherCfg config)
{
--
Gitblit v1.10.0