summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-04-14 06:24:17 +0000
committerAndrew Tridgell <tridge@samba.org>2002-04-14 06:24:17 +0000
commit24065c0bf5fd803f8792eb9459969536d4ee9c4a (patch)
treee5999ad33322f837ff3532b419988ba1a48c0aab /source3/smbd
parenta83a0ac9c560f92ad6f7a67cd9d769708ec8a554 (diff)
downloadsamba-24065c0bf5fd803f8792eb9459969536d4ee9c4a.tar.gz
samba-24065c0bf5fd803f8792eb9459969536d4ee9c4a.tar.bz2
samba-24065c0bf5fd803f8792eb9459969536d4ee9c4a.zip
win2000 does not check the permissions on the share directory on
tconx, so win2000 clients don't expect a permissions error in tconx. We now match this behaviour, by only checking that the directory exists during tconx and relying on the permissions on other calls to protect directories (This used to be commit 4fc476686476da31cc2b45badb05cb0765259f98)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/service.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 0ae49b7adf..9ca44b65c3 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -328,7 +328,7 @@ connection_struct *make_connection(char *service, DATA_BLOB password,
BOOL force = False;
connection_struct *conn;
uid_t euid;
-
+ struct stat st;
fstring user;
ZERO_STRUCT(user);
@@ -626,6 +626,11 @@ connection_struct *make_connection(char *service, DATA_BLOB password,
}
}
+#if CHECK_PATH_ON_TCONX
+ /* 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) */
if (vfs_ChDir(conn,conn->connectpath) != 0) {
DEBUG(0,("%s (%s) Can't change directory to %s (%s)\n",
remote_machine, conn->client_address,
@@ -636,12 +641,23 @@ connection_struct *make_connection(char *service, DATA_BLOB password,
*status = NT_STATUS_BAD_NETWORK_NAME;
return NULL;
}
+#else
+ /* the alternative is just to check the directory exists */
+ if (stat(conn->connectpath, &st) != 0 || !S_ISDIR(st.st_mode)) {
+ DEBUG(0,("%s is not a directory\n", conn->connectpath));
+ change_to_root_user();
+ yield_connection(conn, lp_servicename(SNUM(conn)));
+ conn_free(conn);
+ *status = NT_STATUS_BAD_NETWORK_NAME;
+ return NULL;
+ }
+#endif
string_set(&conn->origpath,conn->connectpath);
#if SOFTLINK_OPTIMISATION
- /* resolve any soft links early */
- {
+ /* resolve any soft links early if possible */
+ if (vfs_ChDir(conn,conn->connectpath) == 0) {
pstring s;
pstrcpy(s,conn->connectpath);
vfs_GetWd(conn,s);