patch for modules/vfs_recycle.c (fwd)

Tobias Oetiker oetiker+r at ee.ethz.ch
Mon Jun 28 11:14:22 GMT 2004


Stefan told me to send this patch here ....

cheers
tobi


-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker @ ISG.EE, ETZ J97, ETH, CH-8092 Zurich
 / // _ \/ _ \/ /  System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/   http://people.ee.ethz.ch/~oetiker   +41(0)44-632-5286

---------- Forwarded message ----------
From: Tobias Oetiker <oetiker+r at ee.ethz.ch>
To: metze at samba.org
Date: Fri, 18 Jun 2004 08:53:21 +0200 (MEST)
Subject: patch for modules/vfs_recycle.c

Hi Stefan,

in order to be able to exclude not only single directories but
branches I have written the following patch ... it seems odd to
exclude /tmp and then see evererything from /tmp/dir/... go to the
recyclebin all the same ... what do you think ?

cheers
tobi

--- vfs_recycle.c.orig  2004-06-18 07:51:11.717382000 +0200
+++ vfs_recycle.c       2004-06-18 08:27:07.003966000 +0200
@@ -250,7 +250,9 @@
 /**
  * Check if needle is contained exactly in haystack
  * @param haystack list of parameters separated by delimimiter character
- * @param needle string to be matched exactly to haystack
+ * @param needle string to be matched to haystack by looking for
+ *        directories to match /aaa will match /aaa/b but not /aaaa/b
+ *
  * @return True if found
  **/
 static BOOL checkparam(const char **haystack_list, const char *needle)
@@ -263,7 +265,11 @@
        }

        for(i=0; haystack_list[i] ; i++) {
-               if(strequal(haystack_list[i], needle)) {
+               int haystack_len = strlen(haystack_list[i]);
+               if( strequal(haystack_list[i], needle ) ||
+                  ( strlen(needle) > haystack_len
+                    && needle[haystack_len] == '/'
+                    && strnequal(haystack_list[i], needle,haystack_len) )) {
                        return True;
                }
        }




-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker @ ISG.EE, ETZ J97, ETH, CH-8092 Zurich
 / // _ \/ _ \/ /  System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/   http://people.ee.ethz.ch/~oetiker   +41(0)44-632-5286


More information about the samba-technical mailing list