Name mangling bug: was samba bug?

MCCALL,DON (HP-USA,ex1) don_mccall at hp.com
Fri Sep 28 12:06:26 GMT 2001


Hi James,
My comments below...
I've cc'ed the samba-technical list, so the developers can decide whether 
it makes sense to take the case of "trailing ....'s" and incorporate a 
test in the name mangling code, so it doesn't return these in the
'longfilename'
portion of the smb return, but instead returns a mangled name only, as it
does with
other illegal characters...

Don
-----Original Message-----
From: James Nord [mailto:teilo at cdt.luth.se]
Sent: Thursday, September 27, 2001 3:56 AM
To: samba at samba.org
Cc: MCCALL,DON (HP-USA,ex1)
Subject: Re: Name mangling bug: was samba bug?


Don,

I read around and found this is one of those "exceptionally well 
documented" microsft API things ;-)
ie windows will ignore all trailing dots on a file..

Samba also mangles the name "hello\ooo"
*but* something happens that *only* the magled name is shown

(samba realises it is an illegal name?)

^^^^^^^^yes. the "\" cannot be used in a windows/msdos name, as it is the
directory separator,
and samba has a list of characters that it recognizes as having to mangle.
Since the 'real' file name is illegal to windows, samba only returns the
mangled name, AS the 
real name.  This is different than an 8.3 (short) filename; in this case
windows is expecting
the 'longfilename' in one place in the smb return, and the 'shortfilename'
in another field in 
the smbreturn.

H:\temp\samba>dir /x
 Volume in drive H is homes_inh
 Volume Serial Number is 1205-4BBA

 Directory of H:\temp\samba

2001/09/27  09:38       <DIR>                          .

2001/09/26  17:21       <DIR>                          ..

2001/09/26  15:29       <DIR>                          HELLO~O0

2001/09/27  09:37       <DIR>          FOO~0R          foo...

2001/09/27  09:38       <DIR>          THISN~RC        this needs mangling

               0 File(s)              0 bytes
               5 Dir(s)   5 557 452 800 bytes free

teilo at fury.cdt.luth.se samba > ls
foo.../               hello\ooo/            this needs mangling/

using smbclient
smb: \temp\samba\> ls

  .                                   D       0  Thu Sep 27 09:38:51 2001

  ..                                  D       0  Wed Sep 26 17:21:15 2001

  HELLO~O0                            D       0  Wed Sep 26 15:29:22 2001

  foo...                              D       0  Thu Sep 27 09:37:52 2001

  this needs mangling                 D       0  Thu Sep 27 09:38:51 2001

                33273 blocks of size 4194304. 1325 blocks available

Would it be possible for samba - in the case where it is talking to a MS 
windows SMB/CIFS implemtation return only the mangled name of a file if 
it ends in one or more dots (and its not . or ..)?

^^^^^^^^^Anything's possible... (no pun intended);
Jeremy, Andrew, et all - what do you think?  I could code it up, if you 
think it's something we should include in the 2.2.x branch????
vvvvvvvvvvvvvv

/James

MCCALL,DON (HP-USA,ex1) wrote:

>Hi James;
>
>Well, "should" is such a relative concept... ;->
>But looking at a log level 10, we can see that samba is indeed mangling
>foo...
>  
>[2001/09/26 11:23:58, 5] smbd/trans2.c:(447)
>  get_lanman2_dir_entry found ./foo... fname=foo...
>[2001/09/26 11:23:58, 5] smbd/mangle.c:(989)
>  name_map_mangle( foo..., need83 = FALSE, cache83 = TRUE, 1 )
>[2001/09/26 11:23:58, 5] smbd/mangle.c:(1024)
>  name_map_mangle() ==> [foo...]
>[2001/09/26 11:23:58, 5] smbd/mangle.c:(338)
>  Checking foo... for 8.3
>[2001/09/26 11:23:58, 5] smbd/mangle.c:(989)
>  name_map_mangle( foo..., need83 = TRUE, cache83 = TRUE, 1 )
>[2001/09/26 11:23:58, 5] smbd/mangle.c:(338)
>  Checking foo... for 8.3
>[2001/09/26 11:23:58, 5] smbd/mangle.c:(871)
>  Mangling name FOO... to FOO~0R
>[2001/09/26 11:23:58, 5] smbd/mangle.c:(1024)
>  name_map_mangle() ==> [FOO~0R]
>
>
>And in fact, if you go into a command prompt window, and type 
>
>dir k: /x  (where k: is mapped to the share that contains the directory
>foo..)
>you will see the mapped name along with the 'real' name.
>you can then type 
>dir k:\FOO~0R
>
>and you will get the directory listing you would expect.
>
>The issue isn't with samba, but with the windows explorer not showing you
>the 'mangled' 8.3 names, or using them when they do the request across the
>wire.
>
>IMHO, anyway...
>
>Hope this helps,
>Don
>
>-----Original Message-----
>From: James Nord [mailto:teilo at cdt.luth.se]
>Sent: Wednesday, September 26, 2001 10:53 AM
>To: samba at samba.org
>Cc: MCCALL,DON (HP-USA,ex1)
>Subject: Re: Name mangling bug: was samba bug?
>
>
>So then samba *should* mangle the unix file "foo..."?
>
>/James
>
>MCCALL,DON (HP-USA,ex1) wrote:
>
>>Hi James,
>>this sounds familiar - I believe I looked at a wire trace,
>>and windows is dropping the trailing dots BEFORE it sends the 
>>request over the wire. so samba never sees the name foo..., thus
>>does not create it.
>>Don
>>-----Original Message-----
>>From: James Nord [mailto:teilo at cdt.luth.se]
>>Sent: Wednesday, September 26, 2001 9:34 AM
>>To: James Nord
>>Cc: samba at samba.org
>>Subject: Name mangling bug: was samba bug?
>>
>>
>>James Nord wrote:
>>
>>>Hi,
>>>
>>>I stumbled accross the following just now (samba 2.2.2-pre)
>>>
>>>anyone else seen this? is it known?
>>>
>>>windows explorer make a new folder "foo..." -> gets renamed to "foo" 
>>>i.e. looses the trailing three dots..
>>>
>>>from unix make a dir "foo..." you see it listed in windows explrer.
>>
>>>user at sambaserver# echo hello > foo.../hello.txt
>>>
>>>windows explorer  "foo..." dir is empty..
>>>
>>>/James
>>>
>>Okay the name choping is a windows (at least 2000) thing - tried 
>>creating documents from cmd.exe and cygwin tools, all loose the trailing 
>>"..."'s
>>Haven't tested on 9x/Dos/NT4
>>
>>But samba normally mangles illegal names? why does it not do so here?
>>
>>user at sambaserv > mkdir samba\hello\\ooo
>>
>>user at win2000> dir foo
>>H:\temp\samba>dir
>>Volume in drive H is homes_inh
>>Volume Serial Number is 1205-4BBA
>>
>>Directory of H:\temp\samba
>>
>>2001/09/26  15:29       <DIR>          .
>>2001/09/26  15:29       <DIR>          ..
>>2001/09/26  15:29       <DIR>          HELLO~O0
>>              0 File(s)              0 bytes
>>              3 Dir(s)   5 637 144 576 bytes free
>>
>>/James
>>


-- 
Technology is a word that describes something that doesn't work yet.
	Douglas Adams







More information about the samba mailing list