Allowing veto files = /blah-blah-blah/ to contain \3 ...

Richard Sharpe realrichardsharpe at gmail.com
Fri Apr 30 19:02:22 MDT 2010


On Fri, Apr 30, 2010 at 5:21 PM, Jeremy Allison <jra at samba.org> wrote:
> On Fri, Apr 30, 2010 at 04:06:28PM -0700, Richard Sharpe wrote:
>> Hi,
>>
>> In mixed environments (Mac and Windows) you don't want to veto /Icon?/
>> because iTunes needs to create files like Icon1 Icon2 etc.
>>
>> However, if Mac users copy folders onto a Samba server that have
>> customized icons in them, they end up with a file called Icon\r.
>>
>> We wanted to veto just these files.
>>
>> The following patch allows you to do: veto files = /Icon\r/
>
> Hmmm. This is horrid, but I'm sure it works. Can't you
> use talloc_all_string_sub(ctx, buf, "\\r", "\r", 0);
> to do the same (look at the use in smbd/chgpasswd.c).

Don't have a talloc context laying around, so I did this:

--- ../rootfs-components/samba-3.4.4/source3/lib/util.c 2010-04-30
11:24:04.000000000 -0700
+++ samba-3.4.4/source3/lib/util.c      2010-04-30 17:40:25.000000000 -0700
@@ -1787,6 +1787,9 @@ void set_namearray(name_compare_entry **
                        return;
                }

+                /* DRI mod ... transform \r and \\ into 0x0D and \. RJS */
+                all_string_sub((*ppname_array)[i].name, "\\r", "\r", 0);
+
                /* next segment please */
                nameptr = name_end + 1;
                i++;

Works like a charm, a lucky charm.


-- 
Regards,
Richard Sharpe


More information about the samba-technical mailing list