[SCM] Samba Shared Repository - branch v3-0-test updated -
release-3-0-28a-1182-ge3ecb18
Jeremy Allison
jra at samba.org
Mon May 19 20:12:09 GMT 2008
The branch, v3-0-test has been updated
via e3ecb1828791e3e142dd84d7248c4ae70afe5e0c (commit)
from d41bc18b77562ca2fe7360944d9782509b1552fe (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test
- Log -----------------------------------------------------------------
commit e3ecb1828791e3e142dd84d7248c4ae70afe5e0c
Author: Jeremy Allison <jra at samba.org>
Date: Mon May 19 13:11:41 2008 -0700
Restructuring of code to fix #5460. Remove search
by name code from conn, we were already doing the
same check in the dfs_redirect() function, so move
it into parse_dfs_path() instead.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/smbd/conn.c | 22 ----------------------
source/smbd/msdfs.c | 27 +++++++++++++--------------
2 files changed, 13 insertions(+), 36 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/smbd/conn.c b/source/smbd/conn.c
index ed8bdef..610e641 100644
--- a/source/smbd/conn.c
+++ b/source/smbd/conn.c
@@ -86,28 +86,6 @@ connection_struct *conn_find(unsigned cnum)
}
/****************************************************************************
- Find a conn given a service name.
-****************************************************************************/
-
-connection_struct *conn_find_byname(const char *service)
-{
- connection_struct *conn;
-
- for (conn=Connections;conn;conn=conn->next) {
- if (strequal(lp_servicename(SNUM(conn)),service)) {
- if (conn != Connections) {
- /* Promote if not first. */
- DLIST_PROMOTE(Connections, conn);
- }
- return conn;
- }
- }
-
- return NULL;
-}
-
-
-/****************************************************************************
find first available connection slot, starting from a random position.
The randomisation stops problems with the server dieing and clients
thinking the server is still available.
diff --git a/source/smbd/msdfs.c b/source/smbd/msdfs.c
index e89f24a..19527ec 100644
--- a/source/smbd/msdfs.c
+++ b/source/smbd/msdfs.c
@@ -33,6 +33,9 @@ extern uint32 global_client_caps;
form /hostname/service/reqpath.
We cope with either here.
+ If conn != NULL then ensure the provided service is
+ the one pointed to by the connection.
+
Unfortunately, due to broken clients who might set the
SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES bit and then
send a local path, we have to cope with that too....
@@ -40,7 +43,8 @@ extern uint32 global_client_caps;
JRA.
**********************************************************************/
-static NTSTATUS parse_dfs_path(const char *pathname,
+static NTSTATUS parse_dfs_path(connection_struct *conn,
+ const char *pathname,
BOOL allow_wcards,
struct dfs_path *pdp,
BOOL *ppath_contains_wcard)
@@ -114,7 +118,11 @@ static NTSTATUS parse_dfs_path(const char *pathname,
}
/* Is this really our servicename ? */
- if (NULL == conn_find_byname(servicename)) {
+ if (conn && !( strequal(servicename, lp_servicename(SNUM(conn)))
+ || (strequal(servicename, HOMES_NAME)
+ && strequal(lp_servicename(SNUM(conn)),
+ get_current_username()) )) ) {
+
DEBUG(10,("parse_dfs_path: %s is not our servicename\n",
servicename));
@@ -507,7 +515,7 @@ static NTSTATUS dfs_redirect( connection_struct *conn,
struct dfs_path dp;
pstring targetpath;
- status = parse_dfs_path(dfs_path, search_wcard_flag, &dp, ppath_contains_wcard);
+ status = parse_dfs_path(conn, dfs_path, search_wcard_flag, &dp, ppath_contains_wcard);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -534,15 +542,6 @@ static NTSTATUS dfs_redirect( connection_struct *conn,
return NT_STATUS_OK;
}
- if (!( strequal(dp.servicename, lp_servicename(SNUM(conn)))
- || (strequal(dp.servicename, HOMES_NAME)
- && strequal(lp_servicename(SNUM(conn)), get_current_username()) )) ) {
-
- /* The given sharename doesn't match this connection. */
-
- return NT_STATUS_OBJECT_PATH_NOT_FOUND;
- }
-
status = dfs_path_lookup(conn, dfs_path, &dp,
search_wcard_flag, NULL, targetpath);
if (!NT_STATUS_IS_OK(status)) {
@@ -616,7 +615,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
*self_referralp = False;
- status = parse_dfs_path(dfs_path, False, &dp, &dummy);
+ status = parse_dfs_path(NULL, dfs_path, False, &dp, &dummy);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -1012,7 +1011,7 @@ BOOL create_junction(const char *dfs_path, struct junction_map *jucn)
BOOL dummy;
struct dfs_path dp;
- NTSTATUS status = parse_dfs_path(dfs_path, False, &dp, &dummy);
+ NTSTATUS status = parse_dfs_path(NULL, dfs_path, False, &dp, &dummy);
if (!NT_STATUS_IS_OK(status)) {
return False;
--
Samba Shared Repository
More information about the samba-cvs
mailing list