is_mangled()

Andrew Tridgell tridge at samba.anu.edu.au
Tue Mar 31 00:00:24 GMT 1998


> Okay... The ones I question are "voo~.~zz.zen" and "~zz.barf".  I don't 
> think that either of these are valid mangled names, but is_mangled() 
> accepts them as such.
> 
> Comments?

you are right. The idea of the is_mangled() function is to be an
approximate filter on filenames to see if they came from the mangling
process. The main requirement is that it never gives a false
negative, ie. it never says that a filename is not mangled when it
is. So the following is_mangled() would be OK:

int is_mangled(char *s)
{
	return strchr(s,'~') != NULL;
}

the only problem is efficiency. If is_mangled() returns false
positives then the mangling code will get called on those names to try
to find the base name. It will fail but it will slow the server down. 
 
> If I get agreement, I'll rewrite this function.

yep, rewriting it is fine and will make things marginally more
efficient. Just remember that you must be absolutely sure not to
introduce any false negatives. False positives are OK, but not false
negatives. 

Cheers, Andrew


More information about the samba-technical mailing list