Mangle again.
Jeremy Allison
jallison at whistle.com
Tue Mar 31 22:04:48 GMT 1998
Christopher R. Hertel wrote:
>
> This is probably for Jeremy and Andrew,
>
> I want to know if illegal_name() should go away...
>
> There is an internal function called illegal_name() in mangle.c.
> Basically, it checks an input string to determine whether it contains any
> of the following illegal characters:
>
> "*\\/?<>|\":"
>
No I don't think it should. It's designed to
prevent legal UNIX filenames being created
or sent back to the client that DOS programs
would find illegal.
> There is also a macro called isdoschar() which tests a character to see if
> it is a legal DOS character. This macro appears to return True for
> alphanumeric characters (isalnum()) and for characters in
>
> "._^$~!#%&-{}()@'`"
>
> illegal_name() is only used once:
>
> BOOL name_map_mangle( char *OutName, BOOL need83, int snum )
> {
> #ifdef MANGLE_LONG_FILENAMES
> if( !need83 && illegal_name(OutName) )
> need83 = True;
> #endif
> :
> :
>
> So... my question:
>
> Is this a left-over from before the code-page stuff? If so should it,
> perhaps, be written as:
>
> static BOOL illegal_name( char *name )
> {
> while( *name )
> {
> if( !isdoschar( *name ) )
> return( True );
> }
> return( False );
> } /* illegal_name */
>
Nope - I think it's correct as is. The decision
to mangle can be made if the filename would be
impossible to see under DOS/Windows - in this case
the mangling is to change these filenames into
something Windows can use. Remember, these
'illegal' characters can be valid in a
pathname sent *from* the client (wildcards
etc), just not in a pathname sent back.
The isdoschar has a different use, within the
is_8_3 function, to determine if a name is
a valid 8.3 to send back to the client.
The multibyte codepage stuff is not affected
by this code (check out the skip_multibyte_char)
call in mangle_name_83().
Jeremy.
--
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------
More information about the samba-technical
mailing list