diff options
author | Marc Laukien <marc@zeroc.com> | 2002-09-01 21:21:05 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-09-01 21:21:05 +0000 |
commit | 31b064d4e4f55aadb9f03ab66ac59a94d82adfb6 (patch) | |
tree | c9e86b395f9c2c45e8205ae8ab99d3c5cbe6b838 /cpp/src/IcePatch/FileLocator.cpp | |
parent | cleaning up empty identity handling (diff) | |
download | ice-31b064d4e4f55aadb9f03ab66ac59a94d82adfb6.tar.bz2 ice-31b064d4e4f55aadb9f03ab66ac59a94d82adfb6.tar.xz ice-31b064d4e4f55aadb9f03ab66ac59a94d82adfb6.zip |
IcePatch work
Diffstat (limited to 'cpp/src/IcePatch/FileLocator.cpp')
-rw-r--r-- | cpp/src/IcePatch/FileLocator.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/cpp/src/IcePatch/FileLocator.cpp b/cpp/src/IcePatch/FileLocator.cpp index ee22b74f9c8..329cec2ce98 100644 --- a/cpp/src/IcePatch/FileLocator.cpp +++ b/cpp/src/IcePatch/FileLocator.cpp @@ -30,27 +30,37 @@ IcePatch::FileLocator::locate(const ObjectAdapterPtr& adapter, const Current& cu // string path = identityToPath(current.id); - if(path.empty()) // Empty paths are not permissible. + if(path.empty()) + { + return 0; + } + + if(path == ".") { return 0; } - if(path[0] == '/') // Path must not start with '/'. + if(path[0] == '/') // Example: /usr/mail/foo { return 0; } - if(path.find("..") != string::npos) // Path must not contain '..'. + // + // Note: We could make the following rule more selective, to allow + // names such as "...foo". But since such names are rather + // uncommon, we disallow ".." altogether, to be on the safe side. + // + if(path.find("..") != string::npos) // Example: foo/../.. { return 0; } - if(path.find(':') == 1) // Path cannot contain ':' as second character. + if(path.find(':') == 1) // Example: c:\blah { return 0; } - if(ignoreSuffix(path)) // Some suffixes are reserved. + if(ignoreSuffix(path)) // Example: foo.md5 { return 0; } |