Bug 6616 - [SMBD] Problem with share link to directory (with bad account access), and obscure error message
[SMBD] Problem with share link to directory (with bad account access), and ob...
Status: RESOLVED DUPLICATE of bug 7126
Product: Samba 3.3
Classification: Unclassified
Component: File services
3.3.7
x64 Linux
: P3 normal
: ---
Assigned To: Volker Lendecke
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-06 11:23 UTC by bepi
Modified: 2010-02-14 06:58 UTC (History)
0 users

See Also:


Attachments
Patch for fix lost access denied (1.78 KB, patch)
2009-08-12 07:46 UTC, bepi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description bepi 2009-08-06 11:23:22 UTC
Hi.

In

file
smbd/service.c

function
static connection_struct *make_connection_snum(int snum, user_struct *vuser,
					       DATA_BLOB password, 
					       const char *pdev,
					       NTSTATUS *pstatus)

section
	/* win2000 does not check the permissions on the directory
	   during the tree connect, instead relying on permission
	   check during individual operations. To match this behaviour
	   I have disabled this chdir check (tridge) */
	/* the alternative is just to check the directory exists */
	if ((ret = SMB_VFS_STAT(conn, conn->connectpath, &st)) != 0 ||
	    !S_ISDIR(st.st_mode)) {
		if (ret == 0 && !S_ISDIR(st.st_mode)) {
			DEBUG(0,("'%s' is not a directory, when connecting to "
				 "[%s]\n", conn->connectpath,
				 lp_servicename(snum)));
		} else {
			DEBUG(0,("'%s' does not exist or permission denied "
				 "when connecting to [%s] Error was %s\n",
				 conn->connectpath, lp_servicename(snum),
				 strerror(errno) ));
		}
		*pstatus = NT_STATUS_BAD_NETWORK_NAME;
		goto err_root_exit;
	}

	string_set(&conn->origpath,conn->connectpath);


- the SMB_VFS_STAT(...) not work with the link to directory, 
- the NT_STATUS_BAD_NETWORK_NAME error is one obscure error message, is more good NT_STATUS_OBJECT_PATH_NOT_FOUND, NO_SUCH_FILE, or other?


Example of the problem with share link to directory (with bad account access):
exnet= host with smbd
audio= share directory 'audio' with user access
gdbdesktop= share link to directory 'Desktop -> Scrivania' with user access


Ok with a share directory:
smbclient //exnet/audio
Enter gdb's password:
Anonymous login successful
Domain=[GDB.IT] OS=[Unix] Server=[Samba 3.3.7]
tree connect failed: NT_STATUS_ACCESS_DENIED

Ko with share link to directory
smbclient //exnet/gdbdesktop
Enter gdb's password:
Anonymous login successful
Domain=[GDB.IT] OS=[Unix] Server=[Samba 3.3.7]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME 

(>>>>>> the right error is NT_STATUS_ACCESS_DENIED <<<<<)

(and after, for example, the kde smb browsing program not ask to the user the account data, and this cause the fail of the share browse)



And as final info, the share //exnet/gdbdesktop work fine with good account access:
smbclient //exnet/gdbdesktop
Enter gdb's password:
Domain=[EXNET] OS=[Unix] Server=[Samba 3.3.7]
smb: \> ls
  .                                   D        0  Thu Aug  6 17:18:47 2009
  ..                                  D        0  Thu Aug  6 15:16:55 2009
  DNS.txt                                    766  Tue Aug  4 17:46:58 2009
  gdb.html                               2308258  Tue Aug  4 17:16:49 2009
  Guide.pdf                           A   959721  Thu Jul  5 20:28:14 2007
  dvd-rw                                     249  Sun Oct 14 17:28:33 2007
................



Regards.
	Gdb
Comment 1 bepi 2009-08-09 09:33:46 UTC
If you want I can make a patch for this problems.

Comment 2 Jeremy Allison 2009-08-10 13:26:40 UTC
Patches are always welcome :-). Thanks !
Jeremy.
Comment 3 bepi 2009-08-12 07:46:07 UTC
Created attachment 4547 [details]
Patch for fix lost access denied

Apply patch:
cp local_eacces_patch.diff samba-3.3.7/
cd samba-3.3.7
patch -p0 < local_eacces_patch.diff

This patch fix wrong use of stat function on check of access to local directory.
Comment 4 bepi 2009-08-12 08:01:39 UTC
Done patch.
-------------------

Other question, debug samba with gdb debugger:
With ./configure --enable-debug CXXFLAGS='-ggdb' CFLAGS='-ggdb' is possible full debug the internal smbd functions (with breakpoint, step by step, etc.), but is necessary large increment of client timeout.

Therefore is useful add to smb.conf the ' client timeout ' key, or at least, add to the program smbclient the ' timeout ' option.

You want I make a patch for this? which solution You prefer?


Comment 5 bepi 2009-09-05 15:33:57 UTC
(In reply to comment #2)
> Patches are always welcome :-). Thanks !
> Jeremy.
> 

Patches are always welcome? are you sure?

Regards.
Gdb
Comment 6 Jeremy Allison 2009-09-05 17:56:17 UTC
Yes :-). This patch is pending in my master tree, but I went on vacation. I'll be back in at work on Tues (US Pacific time). Keep bugging me to make sure this gets in.
Jeremy.
Comment 7 bepi 2009-09-06 06:38:13 UTC
(In reply to comment #6)
> Yes :-). This patch is pending in my master tree, but I went on vacation. I'll
]zac[

:)

Thanks for your replay (any type of replay is what I wanted).
Good continuation of the vacation.


Additional questions:
- Please, for  ------- Comment  #4 From bepi@adria.it 2009-08-12 08:01:39 CST you have any kind of response?

- Please, change the 'new/open status' of assigned, or older, or closed bugs on bugzilla.samba (is difficult to understand the status of the bugs).

Regards.
Gdb
Comment 8 bepi 2010-02-14 06:58:41 UTC

*** This bug has been marked as a duplicate of bug 7126 ***