[Pkg-owncloud-commits] [owncloud-client] 130/484: csync_exclude: Don't ignore invalid char client side (#3736)

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 91525a7d33c531c04772376e833ed0238a8ee510
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Oct 22 12:31:52 2015 +0200

    csync_exclude: Don't ignore invalid char client side (#3736)
    
    If the server does not support it, then the server will reply with an error
---
 csync/src/csync_exclude.c | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c
index 9e1c80b..3754251 100644
--- a/csync/src/csync_exclude.c
+++ b/csync/src/csync_exclude.c
@@ -171,7 +171,6 @@ bool csync_is_windows_reserved_word(const char* filename) {
 
 static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const char *path, int filetype, bool check_leading_dirs) {
     size_t i = 0;
-    const char *p = NULL;
     const char *bname = NULL;
     size_t blen = 0;
     char *conflict = NULL;
@@ -179,22 +178,6 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
     CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
     CSYNC_EXCLUDE_TYPE type  = CSYNC_NOT_EXCLUDED;
 
-      for (p = path; *p; p++) {
-        switch (*p) {
-          case '\\':
-          case ':':
-          case '?':
-          case '*':
-          case '"':
-          case '>':
-          case '<':
-          case '|':
-            return CSYNC_FILE_EXCLUDE_INVALID_CHAR;
-          default:
-            break;
-        }
-      }
-
     /* split up the path */
     bname = strrchr(path, '/');
     if (bname) {
@@ -217,7 +200,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
         goto out;
     }
 
-  #ifdef _WIN32
+#ifdef _WIN32
     // Windows cannot sync files ending in spaces (#2176). It also cannot
     // distinguish files ending in '.' from files without an ending,
     // as '.' is a separator that is not stored internally, so let's
@@ -231,7 +214,26 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
       match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
       goto out;
     }
-  #endif
+
+    // Filter out characters not allowed in a filename on windows
+    const char *p = NULL;
+    for (p = path; *p; p++) {
+        switch (*p) {
+        case '\\':
+        case ':':
+        case '?':
+        case '*':
+        case '"':
+        case '>':
+        case '<':
+        case '|':
+            match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
+            goto out;
+        default:
+            break;
+        }
+    }
+#endif
 
     rc = csync_fnmatch(".owncloudsync.log*", bname, 0);
     if (rc == 0) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list