summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/acl/AclPlugin.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-12-05 20:34:21 +0000
committerAlan Conway <aconway@apache.org>2013-12-05 20:34:21 +0000
commitad246c1d855b619604233f579ca6515899eacc02 (patch)
treeb7cac804983230c4eaa2689832d985f138557eff /cpp/src/qpid/acl/AclPlugin.cpp
parent8e9390e1d25393553fa8fc3cdc397e7fd37a01f9 (diff)
downloadqpid-python-ad246c1d855b619604233f579ca6515899eacc02.tar.gz
QPID-5398: qpidd --acl-file does not work with a drive-prefixed path on windows.
On windows, acl-file was not recognizing drive-prefixed paths (e.g. c:\foo) as absolute and was trying to interpret them relative to the brokers data-dir. This commit fixes the problem and adds a general-purpose Path class that can be a collection point for any other path-related portability problems that come up. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1548279 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/acl/AclPlugin.cpp')
-rw-r--r--cpp/src/qpid/acl/AclPlugin.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/cpp/src/qpid/acl/AclPlugin.cpp b/cpp/src/qpid/acl/AclPlugin.cpp
index c666eb5420..2e254f7a9a 100644
--- a/cpp/src/qpid/acl/AclPlugin.cpp
+++ b/cpp/src/qpid/acl/AclPlugin.cpp
@@ -21,6 +21,7 @@
#include "qpid/broker/Broker.h"
#include "qpid/Plugin.h"
#include "qpid/Options.h"
+#include "qpid/sys/Path.h"
#include "qpid/log/Statement.h"
#include <boost/shared_ptr.hpp>
@@ -68,11 +69,11 @@ struct AclPlugin : public Plugin {
if (acl) throw Exception("ACL plugin cannot be initialized twice in one process.");
- if (values.aclFile.at(0) != '/' && !b.getDataDir().getPath().empty()) {
- std::ostringstream oss;
- oss << b.getDataDir().getPath() << "/" << values.aclFile;
- values.aclFile = oss.str();
- }
+ sys::Path aclFile(values.aclFile);
+ sys::Path dataDir(b.getDataDir().getPath());
+ if (!aclFile.isAbsolute() && !dataDir.empty())
+ values.aclFile = (dataDir + aclFile).str();
+
acl = new Acl(values, b);
b.setAcl(acl.get());
b.addFinalizer(boost::bind(&AclPlugin::shutdown, this));