summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-11-07 11:29:35 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-11-07 11:29:35 -0330
commit5129377a9d7ea4fcb9809be9022d4cff3cef896e (patch)
tree072a249461de5d7e1428c53f51aa08f03e8fae16 /cpp
parentBug 3415 (diff)
downloadice-5129377a9d7ea4fcb9809be9022d4cff3cef896e.tar.bz2
ice-5129377a9d7ea4fcb9809be9022d4cff3cef896e.tar.xz
ice-5129377a9d7ea4fcb9809be9022d4cff3cef896e.zip
Bug 3529
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/IceGrid/Internal.ice3
-rw-r--r--cpp/src/IceGrid/NodeCache.cpp30
-rw-r--r--cpp/src/IceGrid/ServerI.cpp11
-rw-r--r--cpp/src/IceGrid/Util.cpp11
4 files changed, 36 insertions, 19 deletions
diff --git a/cpp/src/IceGrid/Internal.ice b/cpp/src/IceGrid/Internal.ice
index ef3d4ab8725..48419c3f531 100644
--- a/cpp/src/IceGrid/Internal.ice
+++ b/cpp/src/IceGrid/Internal.ice
@@ -69,9 +69,6 @@ class InternalServerDescriptor
/** The application revision. */
int revision;
- /** The Ice version. */
- int iceVersion;
-
/** The id of the session which allocated the server. */
string sessionId;
diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp
index 01e308fed58..b3c3f1e4365 100644
--- a/cpp/src/IceGrid/NodeCache.cpp
+++ b/cpp/src/IceGrid/NodeCache.cpp
@@ -898,14 +898,14 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const
//
// For newer versions of Ice, we generate Ice.Admin properties:
//
- server->iceVersion = 0;
+ int iceVersion = 0;
if(info.descriptor->iceVersion != "")
{
- server->iceVersion = getMMVersion(info.descriptor->iceVersion);
+ iceVersion = getMMVersion(info.descriptor->iceVersion);
}
server->processRegistered = false;
- if(server->iceVersion == 0 || server->iceVersion >= 30300)
+ if(iceVersion == 0 || iceVersion >= 30300)
{
props.push_back(createProperty("Ice.Admin.ServerId", info.descriptor->id));
if(hasProperty(info.descriptor->propertySet.properties, "Ice.Admin.Endpoints"))
@@ -949,7 +949,7 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const
}
props.push_back(createProperty("IceBox.LoadOrder", servicesStr));
- if(server->iceVersion != 0 && server->iceVersion < 30300)
+ if(iceVersion != 0 && iceVersion < 30300)
{
if(hasProperty(iceBox->propertySet.properties, "IceBox.ServiceManager.RegisterProcess"))
{
@@ -975,7 +975,27 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const
// logs, adapters, db envs and properties to the internal server
// descriptor.
//
- forEachCommunicator(ToInternalServerDescriptor(server, _session->getInfo(), server->iceVersion))(info.descriptor);
+ forEachCommunicator(ToInternalServerDescriptor(server, _session->getInfo(), iceVersion))(info.descriptor);
+
+ //
+ // For Ice servers > 3.3.0 escape the properties.
+ //
+ if(iceVersion == 0 || iceVersion >= 30300)
+ {
+ PropertyDescriptorSeq newProps;
+ for(PropertyDescriptorSeq::const_iterator p = props.begin(); p != props.end(); ++p)
+ {
+ if(p->value.empty() && p->name.find('#') == 0)
+ {
+ newProps.push_back(createProperty(p->name));
+ }
+ else
+ {
+ newProps.push_back(createProperty(escapeProperty(p->name), escapeProperty(p->value)));
+ }
+ }
+ server->properties["config"] = newProps;
+ }
return server;
}
diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp
index 1ebd9e84ba3..0d26abdfbb8 100644
--- a/cpp/src/IceGrid/ServerI.cpp
+++ b/cpp/src/IceGrid/ServerI.cpp
@@ -2131,8 +2131,6 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
// We do not want to esapce the properties if the Ice version is
// previous to Ice 3.3.
//
- bool escapeProperties = (_desc->iceVersion == 0 || _desc->iceVersion > 30300);
-
Ice::StringSeq knownFiles;
for(PropertyDescriptorSeqDict::const_iterator p = properties.begin(); p != properties.end(); ++p)
{
@@ -2153,14 +2151,7 @@ ServerI::updateImpl(const InternalServerDescriptorPtr& descriptor)
}
else
{
- if(escapeProperties)
- {
- configfile << escapeProperty(r->name) << "=" << escapeProperty(r->value) << endl;
- }
- else
- {
- configfile << r->name << "=" << r->value << endl;
- }
+ configfile << r->name << "=" << r->value << endl;
}
}
configfile.close();
diff --git a/cpp/src/IceGrid/Util.cpp b/cpp/src/IceGrid/Util.cpp
index d3b6b998738..704f093f24a 100644
--- a/cpp/src/IceGrid/Util.cpp
+++ b/cpp/src/IceGrid/Util.cpp
@@ -100,14 +100,23 @@ IceGrid::createProperty(const string& name, const string& value)
string
IceGrid::escapeProperty(const string& s)
{
+ size_t firstChar = s.find_first_not_of(' ');
+ size_t lastChar = s.find_last_not_of(' ');
string result;
for(unsigned int i = 0; i < s.size(); ++i)
{
char c = s[i];
switch(c)
{
- case '\\':
case ' ':
+ if(i < firstChar || i > lastChar)
+ {
+ result.push_back('\\');
+ }
+ result.push_back(c);
+ break;
+
+ case '\\':
case '#':
case '=':
result.push_back('\\');