diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-15 19:12:57 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-15 19:12:57 +0000 |
commit | 5f30d7093499c65b10a8458cf68cf9a585262236 (patch) | |
tree | b6ae5af4b1ac7ba89c383bdfd3cb8486fd44e737 /cpp/src/IcePatch/FileLocator.cpp | |
parent | Added PrivateKeyException to the addKeyCert methods to ensure that the (diff) | |
download | ice-5f30d7093499c65b10a8458cf68cf9a585262236.tar.bz2 ice-5f30d7093499c65b10a8458cf68cf9a585262236.tar.xz ice-5f30d7093499c65b10a8458cf68cf9a585262236.zip |
added pw check to glacier
Diffstat (limited to 'cpp/src/IcePatch/FileLocator.cpp')
-rw-r--r-- | cpp/src/IcePatch/FileLocator.cpp | 198 |
1 files changed, 99 insertions, 99 deletions
diff --git a/cpp/src/IcePatch/FileLocator.cpp b/cpp/src/IcePatch/FileLocator.cpp index 182db254f85..cdd001cd84d 100644 --- a/cpp/src/IcePatch/FileLocator.cpp +++ b/cpp/src/IcePatch/FileLocator.cpp @@ -1,99 +1,99 @@ -// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#include <IcePatch/FileLocator.h>
-#include <IcePatch/Util.h>
-#include <IcePatch/IcePatchI.h>
-
-using namespace std;
-using namespace Ice;
-using namespace IcePatch;
-
-IcePatch::FileLocator::FileLocator(const Ice::ObjectAdapterPtr& adapter) :
- _directory(new DirectoryI(adapter)),
- _regular(new RegularI(adapter))
-{
-}
-
-ObjectPtr
-IcePatch::FileLocator::locate(const ObjectAdapterPtr& adapter, const Current& current, LocalObjectPtr&)
-{
- //
- // Check whether the path is valid.
- //
- string path = identityToPath(current.identity);
-
- if (path.empty())
- {
- return 0;
- }
-
- if (path[0] == '/') // Path must not start with '/'.
- {
- return 0;
- }
-
- if (path.find("..") != string::npos) // Path must not contain '..'.
- {
- return 0;
- }
-
- if (path.find(':') == 1) // Path cannot contain ':' as second character.
- {
- return 0;
- }
-
- FileInfo info;
- try
- {
- info = getFileInfo(path, true);
- }
- catch (const FileAccessException& ex)
- {
- Warning out(adapter->getCommunicator()->getLogger());
- out << ex << ":\n" << ex.reason;
- return 0;
- }
-
- switch (info.type)
- {
- case FileTypeDirectory:
- {
- return _directory;
- }
-
- case FileTypeRegular:
- {
- return _regular;
- }
-
- default:
- {
- return 0;
- }
- }
-}
-
-void
-IcePatch::FileLocator::finished(const ObjectAdapterPtr&, const Current& current, const ObjectPtr&,
- const LocalObjectPtr&)
-{
- // Nothing to do.
-}
-
-void
-IcePatch::FileLocator::deactivate()
-{
- //
- // Break cyclic dependencies.
- //
- _directory = 0;
- _regular = 0;
-}
+// ********************************************************************** +// +// Copyright (c) 2002 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <IcePatch/FileLocator.h> +#include <IcePatch/Util.h> +#include <IcePatch/IcePatchI.h> + +using namespace std; +using namespace Ice; +using namespace IcePatch; + +IcePatch::FileLocator::FileLocator(const Ice::ObjectAdapterPtr& adapter) : + _directory(new DirectoryI(adapter)), + _regular(new RegularI(adapter)) +{ +} + +ObjectPtr +IcePatch::FileLocator::locate(const ObjectAdapterPtr& adapter, const Current& current, LocalObjectPtr&) +{ + // + // Check whether the path is valid. + // + string path = identityToPath(current.identity); + + if (path.empty()) + { + return 0; + } + + if (path[0] == '/') // Path must not start with '/'. + { + return 0; + } + + if (path.find("..") != string::npos) // Path must not contain '..'. + { + return 0; + } + + if (path.find(':') == 1) // Path cannot contain ':' as second character. + { + return 0; + } + + FileInfo info; + try + { + info = getFileInfo(path, true); + } + catch (const FileAccessException& ex) + { + Warning out(adapter->getCommunicator()->getLogger()); + out << ex << ":\n" << ex.reason; + return 0; + } + + switch (info.type) + { + case FileTypeDirectory: + { + return _directory; + } + + case FileTypeRegular: + { + return _regular; + } + + default: + { + return 0; + } + } +} + +void +IcePatch::FileLocator::finished(const ObjectAdapterPtr&, const Current& current, const ObjectPtr&, + const LocalObjectPtr&) +{ + // Nothing to do. +} + +void +IcePatch::FileLocator::deactivate() +{ + // + // Break cyclic dependencies. + // + _directory = 0; + _regular = 0; +} |