Bug 8218 - File server: Error opening file from non-owner user.
File server: Error opening file from non-owner user.
Product: Samba 4.0
Classification: Unclassified
Component: File services
x64 FreeBSD
: P5 major
: ---
Assigned To: Andrew Tridgell
Depends on:
  Show dependency treegraph
Reported: 2011-06-10 12:17 UTC by Yuri
Modified: 2012-10-24 21:41 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Yuri 2011-06-10 12:17:27 UTC
it seems that there is some bug in ntvfs subsystem. when i'm trying to perform some modify operation on file, from user with no owner rights for this file, i've got error:

../source4/ntvfs/posix/pvfs_open.c:1557 mapped errno NT_STATUS_ACCESS_DENIED for /usr/share/tstshare/some_text_file.txt (was 13)

i've try to trace error, it happens somewhere between ntvfs_open() and ntvfs_next_open():

Obtained 10 stack frames.
0x281e526d <pvfs_open+4189> at /usr/local/samba/lib/samba/libntvfs.so
0x281d43e4 <ntvfs_next_open+84> at /usr/local/samba/lib/samba/libntvfs.so
0x281cd000 <rap_netserverenum2+4128> at /usr/local/samba/lib/samba/libntvfs.so
0x281d365c <ntvfs_open+76> at /usr/local/samba/lib/samba/libntvfs.so
0x2909d341 <smbsrv_reply_ntcreate_and_X+929> at /usr/local/samba/modules/service/smb.so
0x2908ae1b <smbsrv_recv_smb_request+2859> at /usr/local/samba/modules/service/smb.so
0x2908a8aa <smbsrv_recv_smb_request+1466> at /usr/local/samba/modules/service/smb.so
0x28c0d8b2 <packet_recv+1826> at /usr/local/samba/lib/samba/libauthkrb5.so
0x290ae2d6 <smbsrv_terminate_connection+198> at /usr/local/samba/modules/service/smb.so
0x28131928 <stream_terminate_connection+392> at /usr/local/samba/lib/samba/libservice.so

i've try to find out, where from ntvfs_open() happens call to rap_netserverenum2(), but there is direct call to pvfs_open()

if SOMEONE knows SOMETHING, what can help me, it will be GREAT!))
Comment 1 Matthias Dieter Wallnöfer 2011-06-10 19:21:42 UTC
Tridge, Metze, do you have a clue?
Comment 2 Yuri 2011-06-17 08:14:46 UTC
i've traceced stack another time with gdb and result differs from libexecinfo:

#0  pvfs_open (ntvfs=0x2b1a47c0, req=0x2b139a30, io=0x28fe82f0)
    at ../source4/ntvfs/posix/pvfs_open.c:1193
#1  0x281d3db3 in ntvfs_next_open (ntvfs=0x2b1a4770, req=0x2b139a30,
    oi=0x28fe82f0) at ../source4/ntvfs/ntvfs_interface.c:481
#2  0x281cc700 in unixuid_open (ntvfs=0x2b1a4770, req=0x2b139a30,
    io=0x28fe82f0) at ../source4/ntvfs/unixuid/vfs_unixuid.c:442
#3  0x281d2edb in ntvfs_open (req=0x2b139a30, oi=0x28fe82f0)
    at ../source4/ntvfs/ntvfs_interface.c:118
#4  0x290a4341 in smbsrv_reply_ntcreate_and_X ()
   from /usr/local/samba/modules/service/smb.so
#5  0x29091e1b in switch_message ()
   from /usr/local/samba/modules/service/smb.so
#6  0x290918aa in smbsrv_recv_smb_request ()
   from /usr/local/samba/modules/service/smb.so
#7  0x28c0e8e2 in packet_recv ()
   from /usr/home/lula/samba-master/bin/shared/private/libauthkrb5.so
#8  0x290b52d6 in smbsrv_recv () from /usr/local/samba/modules/service/smb.so
#9  0x281319f8 in stream_io_handler (conn=0x2b1331b0, flags=1)
    at ../source4/smbd/service_stream.c:92
#10 0x28131a74 in stream_io_handler_fde (ev=0x28f2e270, fde=0x2b13c0e0,
    flags=1, private_data=0x2b1331b0) at ../source4/smbd/service_stream.c:106
#11 0x2819abdc in std_event_loop_select ()
   from /usr/home/lula/samba-master/bin/shared/private/libtevent.so.0
#12 0x2819acbc in std_event_loop_once ()
   from /usr/home/lula/samba-master/bin/shared/private/libtevent.so.0
#13 0x28196f2f in _tevent_loop_once ()
   from /usr/home/lula/samba-master/bin/shared/private/libtevent.so.0
#14 0x28197156 in tevent_common_loop_wait ()
   from /usr/home/lula/samba-master/bin/shared/private/libtevent.so.0
#15 0x2819721d in _tevent_loop_wait ()
   from /usr/home/lula/samba-master/bin/shared/private/libtevent.so.0
#16 0x08052877 in binary_smbd_main (binary_name=0x805642b "samba", argc=4,
    argv=0xbfbfeb28) at ../source4/smbd/server.c:480
#17 0x080528e8 in main (argc=1474660693, argv=0xec815356)
    at ../source4/smbd/server.c:491

including some debug output to unixuid_open() instead of rap_netserverenum2() gave result.

ok, so, inclusion of next code:

        int fd1;
        fd1 = open("/usr/share/tstshare/123/qwe.txt", 6, 0);
        DEBUG(0,("Call to open() from ntvfs_next_open(). Result: %d\n", fd1));

to all stack functions gave >0 result, till ntvfs_next_open(). in ntvfs_next_open() fd is -1. from all of this stuff, i can suggest, that bug is somewhere between unixuid_open() and ntvfs_next_open(). someone have any guess???
Comment 3 Stefan Metzmacher 2012-10-24 21:41:45 UTC
The s3fs (default) file server in 4.0.0 will support this