Samba name mangling

Martin Vogt vogt at itwm.uni-kl.de
Fri Sep 3 11:52:31 GMT 1999




Hello,

here we use samba 2.0.3 on a 75 GB file server. I'm more or less a system
administrator for the server.

One of my users seems to found out that the name mangling algorithm
uses wrong parameters.
I don't understand much of this hashing algorithm but it seems
the user does.

I will give a translation of what the user wrote:

I think the Samba server has a problem with the creation
of 8.3 names. Or on the other side my NT has a problem
how the samba server does this:

I have created 100 files with the name : ABCDEFG_<n>.TST

Then I have counted the files:


     Nr. Name
      5 ABCDE~09.TST
      2 ABCDE~5L.TST
      2 ABCDE~61.TST
      4 ABCDE~6H.TST
      5 ABCDE~6X.TST
      4 ABCDE~7D.TST
      2 ABCDE~CP.TST
      5 ABCDE~DL.TST
      4 ABCDE~E1.TST
      5 ABCDE~EH.TST
      2 ABCDE~JT.TST
      2 ABCDE~K9.TST
      5 ABCDE~09.TST
      2 ABCDE~5L.TST
      2 ABCDE~61.TST
      4 ABCDE~6H.TST
      5 ABCDE~6X.TST
      4 ABCDE~7D.TST
      2 ABCDE~CP.TST
      5 ABCDE~DL.TST
      4 ABCDE~E1.TST
      5 ABCDE~EH.TST
      2 ABCDE~JT.TST
      2 ABCDE~K9.TST
      4 ABCDE~KP.TST
      5 ABCDE~L5.TST
      4 ABCDE~LL.TST
      5 ABCDE~RT.TST
      4 ABCDE~S9.TST
      5 ABCDE~SP.TST
      2 ABCDE~YH.TST
      4 ABCDE~YX.TST
      5 ABCDE~ZD.TST
      4 ABCDE~ZT.TST


A "del *" results in:

U:\t>del *
U:\t\*, Are you sure (Y/N)?
U:\t\ABCDEFG_85.tst
The system cannot find the file specified.
U:\t\ABCDEFG_86.tst
The system cannot find the file specified.
U:\t\ABCDEFG_87.tst
The system cannot find the file specified.
......


This was done with the normal del under NT, a rm *
on the server works.

Ok, lets look what "man smb.conf" says:


>This  algorithm  can  cause name collisions only if
>files in a directory  share  the  same  first  five
>alphanumeric  characters. The probability of such a
>clash is 1/1300.


Ok, there are really only (26+10)^2=1296 different
hashes. Then the chance to get a clash with n files
is: (1-p!/((p-n)!p^n)) with p = 1296.
This makes with 10 files 3.4 %
with 39 files it makes 44 %
and with 100 files it make 98%


Is this a bug?


regards,

Martin





More information about the samba-technical mailing list