Apply Craig Barratt's fixes to allow multiple exlusion files and patterns.
authorRichard Sharpe <sharpe@samba.org>
Thu, 18 Mar 2004 22:29:54 +0000 (22:29 +0000)
committerRichard Sharpe <sharpe@samba.org>
Thu, 18 Mar 2004 22:29:54 +0000 (22:29 +0000)
Much of this was applied by hand because of the changes in the code. However,
it builds and smbclient seems to work still. The Amanda folks are testing
and it seems to work there as well.
(This used to be commit 10d05b57c5c66718fb1ca476f7214087ddae29ee)

source3/client/clitar.c
source3/lib/util.c

index f38d6fe91a5a728f2e28c99c6a9c8e799597025b..e43b3e4cc50bee204166c43d70e5d2e6b014f265 100644 (file)
@@ -800,7 +800,7 @@ static void do_tar(file_info *finfo)
 #ifdef HAVE_REGEX_H
                                (tar_re_search && !regexec(preg, exclaim, 0, NULL, 0))) {
 #else
-                               (tar_re_search && mask_match(exclaim, cliplist[0], True))) {
+                               (tar_re_search && mask_match_list(exclaim, cliplist, clipn, True))) {
 #endif
                        DEBUG(3,("Skipping file %s\n", exclaim));
                        return;
@@ -1153,7 +1153,7 @@ static void do_tarput(void)
 #ifdef HAVE_REGEX_H
                                        (tar_re_search && !regexec(preg, finfo.name, 0, NULL, 0)));
 #else
-                                       (tar_re_search && mask_match(finfo.name, cliplist[0], True)));
+                                       (tar_re_search && mask_match_list(finfo.name, cliplist, clipn, True)));
 #endif
 
                DEBUG(5, ("Skip = %i, cliplist=%s, file=%s\n", skip, (cliplist?cliplist[0]:NULL), finfo.name));
index 3a8d627ee9e59931b85eebfb69569af7c36824e0..10d224baabfb73a9b5d1cfa4430b330642b7437d 100644 (file)
@@ -2320,6 +2320,20 @@ BOOL mask_match(const char *string, char *pattern, BOOL is_case_sensitive)
        return ms_fnmatch(pattern, string, Protocol, is_case_sensitive) == 0;
 }
 
+/*******************************************************************
+ A wrapper that handles a list of patters and calls mask_match()
+ on each.  Returns True if any of the patterns match.
+*******************************************************************/
+
+BOOL mask_match_list(const char *string, char **list, int listLen, BOOL is_case_sensitive)
+{
+       while (listLen-- > 0) {
+               if (mask_match(string, *list++, is_case_sensitive))
+                       return True;
+       }
+       return False;
+}
+
 /*********************************************************
  Recursive routine that is called by unix_wild_match.
 *********************************************************/