[ooo-build-commit] .: sal/osl

Fridrich Strba fridrich at kemper.freedesktop.org
Tue Sep 14 04:31:40 PDT 2010


 sal/osl/w32/file_url.cxx |   16 +++++++++++-----
 sal/osl/w32/file_url.h   |    1 +
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 97cffceb1d46e0e3cfb49f31e08033864230d4d3
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Tue Sep 14 13:24:04 2010 +0200

    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.

diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index c1ccdf6..59cc373 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 8af4b8a..7806eab 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
 


More information about the ooo-build-commit mailing list