Hide streams from the EA API
authorVolker Lendecke <vl@samba.org>
Mon, 21 Jan 2008 19:24:23 +0000 (20:24 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 22 Jan 2008 11:29:02 +0000 (12:29 +0100)
(This used to be commit e9bb3d5067b74a29beb778f85687829778e42b5b)

source3/include/smb.h
source3/modules/vfs_streams_xattr.c
source3/smbd/trans2.c

index 25421115c8509151600b5cc9c0af469d276e0f8d..7de3568701fc8008265f796fa403e1613bc5bea2 100644 (file)
@@ -1904,6 +1904,8 @@ struct ea_list {
 #define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI"
 /* EA to use for DOS attributes */
 #define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB"
+/* Prefix for DosStreams in the vfs_streams_xattr module */
+#define SAMBA_XATTR_DOSSTREAM_PREFIX "user.DosStream."
 
 #define UUID_SIZE 16
 
index 965d57ff88d72c8906ea01caf75c88fb8170a39e..766e7d10ab15acf45d8ffdbaa2fa72098dcd7e04 100644 (file)
@@ -26,8 +26,6 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
 
-#define XATTR_DOSSTREAM_PREFIX "user.DosStream."
-
 struct stream_io {
        char *base;
        char *xattr_name;
@@ -140,7 +138,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname,
        }
 
        xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
-                                    XATTR_DOSSTREAM_PREFIX, sname);
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
        if (xattr_name == NULL) {
                errno = ENOMEM;
                goto fail;
@@ -187,7 +185,7 @@ static int streams_xattr_lstat(vfs_handle_struct *handle, const char *fname,
        }
 
        xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
-                                    XATTR_DOSSTREAM_PREFIX, sname);
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
        if (xattr_name == NULL) {
                errno = ENOMEM;
                goto fail;
@@ -239,7 +237,7 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
        }
 
        xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
-                                    XATTR_DOSSTREAM_PREFIX, sname);
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
        if (xattr_name == NULL) {
                errno = ENOMEM;
                goto fail;
@@ -373,7 +371,7 @@ static int streams_xattr_unlink(vfs_handle_struct *handle,  const char *fname)
        }
 
        xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
-                                    XATTR_DOSSTREAM_PREFIX, sname);
+                                    SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
        if (xattr_name == NULL) {
                errno = ENOMEM;
                goto fail;
@@ -403,7 +401,7 @@ static NTSTATUS walk_xattr_streams(connection_struct *conn, files_struct *fsp,
        NTSTATUS status;
        char **names;
        size_t i, num_names;
-       size_t prefix_len = strlen(XATTR_DOSSTREAM_PREFIX);
+       size_t prefix_len = strlen(SAMBA_XATTR_DOSSTREAM_PREFIX);
 
        status = get_ea_names_from_file(talloc_tos(), conn, fsp, fname,
                                        &names, &num_names);
@@ -414,7 +412,7 @@ static NTSTATUS walk_xattr_streams(connection_struct *conn, files_struct *fsp,
        for (i=0; i<num_names; i++) {
                struct ea_struct ea;
 
-               if (strncmp(names[i], XATTR_DOSSTREAM_PREFIX,
+               if (strncmp(names[i], SAMBA_XATTR_DOSSTREAM_PREFIX,
                            prefix_len) != 0) {
                        continue;
                }
index 896d2dee142244deb603956ff8db5334166e8d8d..b5b3ea751b5e8bed98f51f082282e0a0cfea91b8 100644 (file)
@@ -105,9 +105,13 @@ static bool samba_private_attr_name(const char *unix_ea_name)
 
        for (i = 0; prohibited_ea_names[i]; i++) {
                if (strequal( prohibited_ea_names[i], unix_ea_name))
-                       return True;
+                       return true;
        }
-       return False;
+       if (StrnCaseCmp(unix_ea_name, SAMBA_XATTR_DOSSTREAM_PREFIX,
+                       strlen(SAMBA_XATTR_DOSSTREAM_PREFIX)) == 0) {
+               return true;
+       }
+       return false;
 }
 
 /****************************************************************************