[Samba] confusing name mangling results
gk at proliberty.com
gk at proliberty.com
Fri Aug 30 08:59:21 GMT 2002
I hope someone can help me understand why I see inconsistent name
mangling between Samba and Windows 2000.
I am running:
LINUX: smbd Version 2.2.1a on linux kernel 2.4.18
MAC: Mac OS 9.1; DAVE version 2.5.2
WINDOWS 2000 PROFESSION (ServicePack 2)
According to the O'Reilly book, 'Using Samba', given a file named:
According to 'Using Samba', it should mangle to:
This is what smbd 2.2.1a showed me (viewing the file name on the Mac
with DAVE ):
This is what Windows 2000 showed me (viewing the file name on the Mac
with DAVE ):
I have not changed the default name mangling in smb.conf.
I looked at the latest samba sources in cvs and it appears that there
are a couple of different mangling/hash options so I am suspecting
that Samba is NOT conforming to a standard algorithm to be compatible
My purpose is the following:
I create mp3 playlists on Windows or linux (where long file names are
I want to be able to play the same lists from Mac OS 9 (where long
file names are not supported), after mangling the path names
appropriately to be equal to what the files would look like from the
Apparently there is a different name mangling algorithm used by
Windows 2000 than by Samba. I would like to support both algorithms
but cannot find any utility to do this and no clear documentation of
how either system performs name mangling.
I don't know for sure who is doing the mangling here.
Is it Samba or DAVE?
Macintosh supports up to 32 char file names and I only observe
mangling for names which exceed 32 chars so I assume that DAVE is the
one doing the mangling, not Samba. Does that make sense?
The DAVE manual just says that 'Short File Names' are used but
doesn't go into detail about the algorithm, so I assumed that the
mangling algorithm must be a standard and that the Samba algorithm
Apparently there is no standard since I get different results when
the same filename is viewed from the Windows 2000 share, which
implies that the host OS is doing the name mangling and not DAVE.
Can anyone point me to a better explanation of name mangling?
Greg Keraunen <gk at proliberty.com>
I was basing my testing on the following description in:
Robert Eckstein, David Collier-Brown, Peter Kelly
1st Edition November 1999
5.4.1 The Samba Mangling Operation
Here is how Samba mangles a long filename into an 8.3 filename:
If the original filename does not begin with a dot, up to
the first five alphanumeric characters that occur before the last dot
(if there is one) are converted to
uppercase. These characters are used as the first five
characters of the 8.3 mangled filename.
If the original filename begins with a dot, the dot is
removed and up to the first five alphanumeric characters that occur
before the last dot (if there is one) are
converted to uppercase. These characters are used as the
first five characters of the 8.3 mangled filename.
These characters are immediately followed a special
mangling character: by default, a tilde (~), although Samba allows
you to change this character.
The base of the long filename before the last period is
hashed into a two-character code; parts of the name after the last
dot may be used if necessary. This two
character code is appended to the 8.3 filename after the
The first three characters after the last dot (if there
is one) of the original filename are converted to uppercase and
appended onto the mangled name as the
extension. If the original filename began with a dot,
three underscores ( _ _ _ ) are used as the extension instead.
Here are some examples:
.htaccess HTACC~U0._ _ _
More information about the samba