]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_streams_xattr: stream names may contain colons
authorRalph Boehme <slow@samba.org>
Sat, 9 May 2015 13:02:03 +0000 (15:02 +0200)
committerRalph Böhme <slow@samba.org>
Fri, 7 Aug 2015 07:52:12 +0000 (09:52 +0200)
With vfs_fruit option "fruit:encoding = native" we're already converting
stream names that contain illegal NTFS characters from their on-the-wire
Unicode Private Range encoding to their native ASCII representation.

As as result the name of xattrs storing the streams (via
vfs_streams_xattr) may contain a colon, so we have to use strrchr_m()
instead of strchr_m() for matching the stream type suffix.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11278

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/modules/vfs_streams_xattr.c

index d149fc83a7a351f0a46dc2304cf0971e76e8b2ba..92bd1c9bce75979dc2715cde21da1533a1f3fd56 100644 (file)
@@ -112,7 +112,21 @@ static NTSTATUS streams_xattr_get_name(vfs_handle_struct *handle,
        SMB_VFS_HANDLE_GET_DATA(handle, config, struct streams_xattr_config,
                                return NT_STATUS_UNSUCCESSFUL);
 
-       stype = strchr_m(stream_name + 1, ':');
+       /*
+        * With vfs_fruit option "fruit:encoding = native" we're
+        * already converting stream names that contain illegal NTFS
+        * characters from their on-the-wire Unicode Private Range
+        * encoding to their native ASCII representation.
+        *
+        * As as result the name of xattrs storing the streams (via
+        * vfs_streams_xattr) may contain a colon, so we have to use
+        * strrchr_m() instead of strchr_m() for matching the stream
+        * type suffix.
+        *
+        * In check_path_syntax() we've already ensured the streamname
+        * we got from the client is valid.
+        */
+       stype = strrchr_m(stream_name + 1, ':');
 
        if (stype) {
                if (strcasecmp_m(stype, ":$DATA") != 0) {