summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-03-15 09:34:56 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-03-15 10:06:30 +0000
commit4f78696117ebe4f729880b5d9bfc2f5817b73543 (patch)
tree578074c4a2a010964011cc5ac95e5fef2f5a4cb7
parentecb7bfea45b2385ae7799ecfe7e77d695b57424a (diff)
fdo#42961 Don't let env vars interfere with internal bootstrap vars
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r--configmgr/source/components.cxx40
1 files changed, 31 insertions, 9 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 48d555e3236e..a341d8497913 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -54,6 +54,7 @@
#include "rtl/oustringostreaminserter.hxx"
#include "rtl/ref.hxx"
#include "rtl/string.h"
+#include "rtl/ustrbuf.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "rtl/instance.hxx"
@@ -838,17 +839,38 @@ void Components::parseXcsXcuLayer(int layer, rtl::OUString const & url) {
void Components::parseXcsXcuIniLayer(
int layer, rtl::OUString const & url, bool recordAdditions)
{
- //TODO: rtl::Bootstrap::getFrom "first trie[s] to retrieve the value via the
- // global function"
+ // Check if ini file exists (otherwise .override would still read global
+ // SCHEMA/DATA variables, which could interfere with unrelated environment
+ // variables):
rtl::Bootstrap ini(url);
- rtl::OUString urls;
- if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SCHEMA")), urls))
+ if (ini.getHandle() != 0)
{
- parseFileList(layer, &parseXcsFile, urls, ini, false);
- }
- if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA")), urls))
- {
- parseFileList(layer + 1, &parseXcuFile, urls, ini, recordAdditions);
+ rtl::OUStringBuffer prefix("${.override:");
+ for (sal_Int32 i = 0; i != url.getLength(); ++i) {
+ sal_Unicode c = url[i];
+ switch (c) {
+ case '$':
+ case ':':
+ case '\\':
+ prefix.append('\\');
+ // fall through
+ default:
+ prefix.append(c);
+ }
+ }
+ prefix.append(':');
+ rtl::OUString urls(prefix.toString() + rtl::OUString("SCHEMA}"));
+ rtl::Bootstrap::expandMacros(urls);
+ if (!urls.isEmpty())
+ {
+ parseFileList(layer, &parseXcsFile, urls, ini, false);
+ }
+ urls = prefix.makeStringAndClear() + rtl::OUString("DATA}");
+ rtl::Bootstrap::expandMacros(urls);
+ if (!urls.isEmpty())
+ {
+ parseFileList(layer + 1, &parseXcuFile, urls, ini, recordAdditions);
+ }
}
}