r65: added support for file streams in the simple NTVFS backend
[samba.git] / source / ntvfs / simple / svfs_util.c
index baa6f86d949e8e6af731e634ab379055190711cc..598b85f1ad757dd2713f9bcedc79b4f085ba0cf0 100644 (file)
@@ -52,9 +52,8 @@ char *svfs_unix_path(struct request_context *req, const char *name)
   returned names are separate unix and DOS names. The returned names
   are relative to the directory
 */
-struct svfs_dir *svfs_list(TALLOC_CTX *mem_ctx, struct request_context *req, const char *pattern)
+struct svfs_dir *svfs_list_unix(TALLOC_CTX *mem_ctx, struct request_context *req, const char *unix_path)
 {
-       char *unix_path;
        char *p, *mask;
        struct svfs_dir *dir;
        DIR *odir;
@@ -62,9 +61,6 @@ struct svfs_dir *svfs_list(TALLOC_CTX *mem_ctx, struct request_context *req, con
        uint_t allocated = 0;
        char *low_mask;
 
-       unix_path = svfs_unix_path(req, pattern);
-       if (!unix_path) { return NULL; }
-
        dir = talloc(mem_ctx, sizeof(struct svfs_dir));
        if (!dir) { return NULL; }
 
@@ -93,6 +89,11 @@ struct svfs_dir *svfs_list(TALLOC_CTX *mem_ctx, struct request_context *req, con
                char *full_name;
                char *low_name;
 
+               if (strchr(dent->d_name, ':') && !strchr(unix_path, ':')) {
+                       /* don't show streams in dir listing */
+                       continue;
+               }
+
                low_name = talloc_strdup(mem_ctx, dent->d_name);
                if (!low_name) { continue; }
                strlower(low_name);
@@ -129,6 +130,21 @@ struct svfs_dir *svfs_list(TALLOC_CTX *mem_ctx, struct request_context *req, con
        return dir;
 }
 
+/*
+  read a directory and find all matching file names and stat info
+  returned names are separate unix and DOS names. The returned names
+  are relative to the directory
+*/
+struct svfs_dir *svfs_list(TALLOC_CTX *mem_ctx, struct request_context *req, const char *pattern)
+{
+       char *unix_path;
+
+       unix_path = svfs_unix_path(req, pattern);
+       if (!unix_path) { return NULL; }
+
+       return svfs_list_unix(mem_ctx, req, unix_path);
+}
+
 
 /*******************************************************************
 set the time on a file via file descriptor