summaryrefslogtreecommitdiffstats
path: root/source/modules
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules')
-rw-r--r--source/modules/vfs_default.c6
-rw-r--r--source/modules/vfs_recycle.c53
2 files changed, 42 insertions, 17 deletions
diff --git a/source/modules/vfs_default.c b/source/modules/vfs_default.c
index 4febc064d94..98e9aaa2631 100644
--- a/source/modules/vfs_default.c
+++ b/source/modules/vfs_default.c
@@ -632,7 +632,7 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const str
}
#elif defined(HAVE_UTIME)
{
- struct utimebuf times;
+ struct utimbuf times;
times.actime = convert_timespec_to_time_t(ts[0]);
times.modtime = convert_timespec_to_time_t(ts[1]);
result = utime(path, times);
@@ -905,8 +905,12 @@ static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
static int vfswrap_chflags(vfs_handle_struct *handle, const char *path, int flags)
{
+#ifdef HAVE_CHFLAGS
+ return chflags(path, flags);
+#else
errno = ENOSYS;
return -1;
+#endif
}
static size_t vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc)
diff --git a/source/modules/vfs_recycle.c b/source/modules/vfs_recycle.c
index 579cc94cf94..a20e09f0108 100644
--- a/source/modules/vfs_recycle.c
+++ b/source/modules/vfs_recycle.c
@@ -311,23 +311,48 @@ done:
}
/**
- * 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
- * @return True if found
+ * Check if any of the components of "exclude_list" are contained in path.
+ * Return True if found
**/
-static BOOL checkparam(const char **haystack_list, const char *needle)
+
+static BOOL matchdirparam(const char **dir_exclude_list, char *path)
{
- int i;
+ char *startp = NULL, *endp = NULL;
- if (haystack_list == NULL || haystack_list[0] == NULL ||
- *haystack_list[0] == '\0' || needle == NULL || *needle == '\0') {
+ if (dir_exclude_list == NULL || dir_exclude_list[0] == NULL ||
+ *dir_exclude_list[0] == '\0' || path == NULL || *path == '\0') {
return False;
}
- for(i=0; haystack_list[i] ; i++) {
- if(strequal(haystack_list[i], needle)) {
- return True;
+ /*
+ * Walk the components of path, looking for matches with the
+ * exclude list on each component.
+ */
+
+ for (startp = path; startp; startp = endp) {
+ int i;
+
+ while (*startp == '/') {
+ startp++;
+ }
+ endp = strchr(startp, '/');
+ if (endp) {
+ *endp = '\0';
+ }
+
+ for(i=0; dir_exclude_list[i] ; i++) {
+ if(unix_wild_match(dir_exclude_list[i], startp)) {
+ /* Repair path. */
+ if (endp) {
+ *endp = '/';
+ }
+ return True;
+ }
+ }
+
+ /* Repair path. */
+ if (endp) {
+ *endp = '/';
}
}
@@ -485,11 +510,7 @@ static int recycle_unlink(vfs_handle_struct *handle, const char *file_name)
goto done;
}
- /* FIXME: this check will fail if we have more than one level of directories,
- * we shoud check for every level 1, 1/2, 1/2/3, 1/2/3/4 ....
- * ---simo
- */
- if (checkparam(recycle_exclude_dir(handle), path_name)) {
+ if (matchdirparam(recycle_exclude_dir(handle), path_name)) {
DEBUG(3, ("recycle: directory %s is excluded \n", path_name));
rc = SMB_VFS_NEXT_UNLINK(handle, file_name);
goto done;