[Pkg-samba-maint] Bug#440451: dfs_redirect causes NT_STATUS_OBJECT_NAME_NOT_FOUND

Marcin Owsiany porridge at debian.org
Sat Sep 1 15:44:05 UTC 2007


Package: samba
Version: 3.0.24-6etch4
Severity: important

With the following share in the config:

| [pub]
|    comment = public stuff
|    writable = yes
|    locking = no
|    path = /usr/local/mnt
|    public = yes
|    follow symlinks = yes
|    wide links = yes
|    directory mask = 02775
|    force directory mode = 02775
|    create mask = 0664
|    force create mode = 0664
|    force user = nobody
|    force group = pub

I get the following symptoms when trying to delete
/usr/local/mnt/data/pub/another_file:

| smb: \data\pub\> ls another_file
|   another_file                                 0  Sat Sep  1 14:39:02 2007
| 
|                 33764 blocks of size 1048576. 6360 blocks available
| smb: \data\pub\> rm another_file
| NT_STATUS_OBJECT_NAME_NOT_FOUND deleting remote file \data\pub\another_file

As you can see, the file is shown in directory listings, but cannot be deleted.
I also saw reports on the internet of people not being able to open such files
either, but did not try that myself.

To make things more interesting, doing the same with
/usr/local/mnt/data/foo/another_file (note "foo" instead of "pub") works just
fine.

I turned on debug level 3 and compared both cases. Here's the successful one:

| [2007/09/01 15:26:26, 3] smbd/msdfs.c:dfs_redirect(435)
|   dfs_redirect: Not redirecting melina/pub/data/foo/another_file.
| [2007/09/01 15:26:26, 3] smbd/msdfs.c:dfs_redirect(439)
|   dfs_redirect: Path converted to non-dfs path data/foo/another_file
| [2007/09/01 15:26:26, 3] smbd/dir.c:dptr_create(512)
|   creating new dirptr 256 for path data/foo, expect_close = 1
| [2007/09/01 15:26:26, 3] smbd/process.c:process_smb(1110)
|   Transaction 456 of length 88
| [2007/09/01 15:26:26, 3] smbd/process.c:switch_message(914)
|   switch message SMBunlink (pid 13098) conn 0x841a2b0
| [2007/09/01 15:26:26, 3] smbd/reply.c:reply_unlink(2105)
|   reply_unlink : data/foo/another_file
| [2007/09/01 15:26:26, 3] smbd/dosmode.c:unix_mode(147)
|   unix_mode(data/foo/another_file) returning 0664
| [2007/09/01 15:26:26, 2] smbd/open.c:open_file(352)
|   nobody opened file data/foo/another_file read=No write=No (numopen=1)
| [2007/09/01 15:26:26, 3] smbd/sec_ctx.c:push_sec_ctx(208)
|   push_sec_ctx(65534, 1001) : sec_ctx_stack_ndx = 1
| [2007/09/01 15:26:26, 3] smbd/uid.c:push_conn_ctx(353)
|   push_conn_ctx(101) : conn_ctx_stack_ndx = 0
| [2007/09/01 15:26:26, 3] smbd/sec_ctx.c:set_sec_ctx(241)
|   setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
| [2007/09/01 15:26:26, 3] smbd/sec_ctx.c:pop_sec_ctx(339)
|   pop_sec_ctx (65534, 1001) - sec_ctx_stack_ndx = 0
| [2007/09/01 15:26:26, 2] smbd/close.c:close_normal_file(344)
|   nobody closed file data/foo/another_file (numopen=0)

And here the failure:

| [2007/09/01 14:57:48, 3] smbd/msdfs.c:dfs_redirect(435)
|   dfs_redirect: Not redirecting melina/pub/data/pub/another_file.
| [2007/09/01 14:57:48, 3] smbd/msdfs.c:dfs_redirect(439)
|   dfs_redirect: Path converted to non-dfs path data/pub/another_file
| [2007/09/01 14:57:48, 3] smbd/dir.c:dptr_create(512)
|   creating new dirptr 256 for path data/pub, expect_close = 1
| [2007/09/01 14:57:48, 3] smbd/process.c:process_smb(1110)
|   Transaction 98 of length 88
| [2007/09/01 14:57:48, 3] smbd/process.c:switch_message(914)
|   switch message SMBunlink (pid 13098) conn 0x841a2b0
| [2007/09/01 14:57:48, 3] smbd/msdfs.c:dfs_redirect(435)
|   dfs_redirect: Not redirecting data/pub/another_file.
| [2007/09/01 14:57:48, 3] smbd/msdfs.c:dfs_redirect(439)
|   dfs_redirect: Path converted to non-dfs path another_file
| [2007/09/01 14:57:48, 3] smbd/reply.c:reply_unlink(2105)
|   reply_unlink : another_file
| [2007/09/01 14:57:48, 3] smbd/error.c:error_packet(146)
|   error packet at smbd/reply.c(2113) cmd=6 (SMBunlink) NT_STATUS_OBJECT_NAME_NOT_FOUND

The beginnings of the two fragments are identical, other than the differing
paths and timestamps. However, there is the bit which is only present in the
failing case, just before the error is reported:

| [2007/09/01 14:57:48, 3] smbd/msdfs.c:dfs_redirect(435)
|   dfs_redirect: Not redirecting data/pub/another_file.
| [2007/09/01 14:57:48, 3] smbd/msdfs.c:dfs_redirect(439)
|   dfs_redirect: Path converted to non-dfs path another_file
| [2007/09/01 14:57:48, 3] smbd/reply.c:reply_unlink(2105)
|   reply_unlink : another_file
| [2007/09/01 14:57:48, 3] smbd/error.c:error_packet(146)
|   error packet at smbd/reply.c(2113) cmd=6 (SMBunlink) NT_STATUS_OBJECT_NAME_NOT_FOUND

See how the path is stripped to just the base name. It seems to me that the
presence of "pub" in the path (which is also the share name) triggers the
error. There are no symlinks anywhere in neither file paths.

Here is the full config file:

| [global]
|    null passwords = yes
|    unix extensions = no
|    workgroup = DOMEK
|    server string = %h server (Samba %v)
|    dns proxy = no
|    log file = /var/log/samba/log.%m
|    log level = 3
|    max log size = 1000
|    syslog = 0
|    panic action = /usr/share/samba/panic-action %d
|    encrypt passwords = true
|    passdb backend = tdbsam
|    obey pam restrictions = yes
|    invalid users = root
|    passwd program = /usr/bin/passwd %u
|    passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
|    load printers = yes
|    printing = bsd
|    printcap name = /etc/printcap
|    socket options = TCP_NODELAY
| [homes]
|    comment = Home Directories
|    browseable = no
|    writable = no
|    create mask = 0700
|    directory mask = 0700
| [printers]
|    comment = All Printers
|    browseable = no
|    path = /tmp
|    printable = yes
|    public = no
|    writable = no
|    create mode = 0700
| [print$]
|    comment = Printer Drivers
|    path = /var/lib/samba/printers
|    browseable = yes
|    read only = yes
|    guest ok = no
| [cdrom]
|    comment = Samba server's CD-ROM
|    writable = no
|    locking = no
|    path = /cdrom
|    public = yes
| [pub]
|    comment = public stuff
|    writable = yes
|    locking = no
|    path = /usr/local/mnt
|    public = yes
|    follow symlinks = yes
|    wide links = yes
|    directory mask = 02775
|    force directory mode = 02775
|    create mask = 0664
|    force create mode = 0664
|    force user = nobody
|    force group = pub

Adding "host msdfs = no" to the global section makes the problem go away.

Googling revealed reports of related problems, however left without an
explanation (there may be duplicates):
http://lists.samba.org/archive/samba/2007-March/130278.html
http://readlist.com/lists/lists.samba.org/samba/2/13627.html
http://nopaste.debianforum.de/6243
http://www.mail-archive.com/samba@lists.samba.org/msg83906.html
http://lists.samba.org/archive/samba/2007-April/130921.html
http://forums.fedoraforum.org/showthread.php?t=150853

-- 
Marcin Owsiany <porridge at debian.org>             http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216




More information about the Pkg-samba-maint mailing list