From 24065c0bf5fd803f8792eb9459969536d4ee9c4a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 14 Apr 2002 06:24:17 +0000 Subject: 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) --- source3/smbd/service.c | 22 +++++++++++++++++++--- 1 file 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); -- cgit