diff options
author | Mark Spruiell <mes@zeroc.com> | 2015-04-07 13:51:23 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2015-04-07 13:51:23 -0700 |
commit | eb9a2c3ae76b862254669b798b51b2b848616b6a (patch) | |
tree | 4572185953d41caff7c27485462c52ce8faf1234 /csharp/src | |
parent | Added back makedepend.py. (diff) | |
download | ice-eb9a2c3ae76b862254669b798b51b2b848616b6a.tar.bz2 ice-eb9a2c3ae76b862254669b798b51b2b848616b6a.tar.xz ice-eb9a2c3ae76b862254669b798b51b2b848616b6a.zip |
ICE-6402 - IceSSL.DefaultDir fixes
Diffstat (limited to 'csharp/src')
-rw-r--r-- | csharp/src/IceSSL/SSLEngine.cs | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/csharp/src/IceSSL/SSLEngine.cs b/csharp/src/IceSSL/SSLEngine.cs index deac22369a3..04b457bb7b3 100644 --- a/csharp/src/IceSSL/SSLEngine.cs +++ b/csharp/src/IceSSL/SSLEngine.cs @@ -734,6 +734,35 @@ namespace IceSSL } } + private static bool isAbsolutePath(string path) + { + // + // Skip whitespace + // + path = path.Trim(); + + // + // We need at least 3 non-whitespace characters to have an absolute path + // + if(path.Length < 3) + { + return false; + } + + // + // Check for X:\ path ('\' may have been converted to '/') + // + if((path[0] >= 'A' && path[0] <= 'Z') || (path[0] >= 'a' && path[0] <= 'z')) + { + return path[1] == ':' && (path[2] == '\\' || path[2] == '/'); + } + + // + // Check for UNC path + // + return (path[0] == '\\' && path[1] == '\\') || path[0] == '/'; + } + private bool checkPath(ref string path) { if(File.Exists(path)) @@ -741,7 +770,7 @@ namespace IceSSL return true; } - if(_defaultDir.Length > 0) + if(_defaultDir.Length > 0 && !isAbsolutePath(path)) { string s = _defaultDir + Path.DirectorySeparatorChar + path; if(File.Exists(s)) |