summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2010-09-14 13:24:04 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2010-09-14 13:24:04 +0200
commit97cffceb1d46e0e3cfb49f31e08033864230d4d3 (patch)
treedd73efea0906b4bf7e375d924993380d22948861
parenta957fc8910fb1739877e1e3d3dd850c20b776633 (diff)
win32-invalid-names.diff: Allow technically illegal pathname components
n#277603 Allow some technically illegal pathname components on Win32 (directories with trailing spaces or periods) because some SMB servers like Netware (and Samba, if mangled names = No) do serve such directories if they exist on the server's host system.
-rw-r--r--sal/osl/w32/file_url.cxx16
-rw-r--r--sal/osl/w32/file_url.h1
2 files changed, 12 insertions, 5 deletions
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index c1ccdf6f2..59cc37389 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -89,9 +89,10 @@ static BOOL IsValidFilePathComponent(
case '.':
if ( dwFlags & VALIDATEPATH_ALLOW_ELLIPSE )
{
- if ( 1 == lpCurrent - lpComponent )
+ if ( (dwFlags & VALIDATEPATH_ALLOW_INVALID_SPACE_AND_PERIOD) ||
+ 1 == lpCurrent - lpComponent )
{
- /* Current directory is O.K. */
+ /* Either do allow periods anywhere, or current directory */
lpComponentEnd = lpCurrent;
break;
}
@@ -104,8 +105,13 @@ static BOOL IsValidFilePathComponent(
}
case 0:
case ' ':
- lpComponentEnd = lpCurrent - 1;
- fValid = FALSE;
+ if ( dwFlags & VALIDATEPATH_ALLOW_INVALID_SPACE_AND_PERIOD )
+ lpComponentEnd = lpCurrent;
+ else
+ {
+ lpComponentEnd = lpCurrent - 1;
+ fValid = FALSE;
+ }
break;
default:
lpComponentEnd = lpCurrent;
@@ -375,7 +381,7 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
lpComponent = lpszPath + i;
}
- fValid = IsValidFilePathComponent( lpComponent, &lpComponent, dwFlags );
+ fValid = IsValidFilePathComponent( lpComponent, &lpComponent, dwFlags | VALIDATEPATH_ALLOW_INVALID_SPACE_AND_PERIOD);
if ( fValid && lpComponent )
{
diff --git a/sal/osl/w32/file_url.h b/sal/osl/w32/file_url.h
index 8af4b8a59..7806eab14 100644
--- a/sal/osl/w32/file_url.h
+++ b/sal/osl/w32/file_url.h
@@ -61,6 +61,7 @@ extern "C" {
#define VALIDATEPATH_ALLOW_ELLIPSE 0x0002
#define VALIDATEPATH_ALLOW_RELATIVE 0x0004
#define VALIDATEPATH_ALLOW_UNC 0x0008
+#define VALIDATEPATH_ALLOW_INVALID_SPACE_AND_PERIOD 0x0010
#define MAX_LONG_PATH 32767