[SCM] Samba Shared Repository - branch v3-2-test updated -
release-3-2-0pre2-2362-gf1021e4
Jeremy Allison
jra at samba.org
Mon May 19 20:11:56 GMT 2008
The branch, v3-2-test has been updated
via f1021e4c8d5ace6356c5b2106153288a6eb89a6b (commit)
from ced04ac5af954d91223421c6c7d34e4fc3fb2947 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit f1021e4c8d5ace6356c5b2106153288a6eb89a6b
Author: Jeremy Allison <jra at samba.org>
Date: Mon May 19 13:11:27 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 | 28 ++++++++++++----------------
2 files changed, 12 insertions(+), 38 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/smbd/conn.c b/source/smbd/conn.c
index 97861ed..c5a2df4 100644
--- a/source/smbd/conn.c
+++ b/source/smbd/conn.c
@@ -85,28 +85,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 eaa66ef..f0dd900 100644
--- a/source/smbd/msdfs.c
+++ b/source/smbd/msdfs.c
@@ -36,13 +36,17 @@ extern uint32 global_client_caps;
SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES bit and then
send a local path, we have to cope with that too....
+ If conn != NULL then ensure the provided service is
+ the one pointed to by the connection.
+
This version does everything using pointers within one copy of the
pathname string, talloced on the struct dfs_path pointer (which
must be talloced). This may be too clever to live....
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, /* MUST BE TALLOCED */
bool *ppath_contains_wcard)
@@ -136,7 +140,10 @@ 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));
@@ -621,7 +628,7 @@ static NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
return NT_STATUS_NO_MEMORY;
}
- status = parse_dfs_path(path_in, search_wcard_flag, pdp,
+ status = parse_dfs_path(conn, path_in, search_wcard_flag, pdp,
ppath_contains_wcard);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(pdp);
@@ -662,17 +669,6 @@ static NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
- if (!( strequal(pdp->servicename, lp_servicename(SNUM(conn)))
- || (strequal(pdp->servicename, HOMES_NAME)
- && strequal(lp_servicename(SNUM(conn)),
- get_current_username()) )) ) {
-
- /* The given sharename doesn't match this connection. */
- TALLOC_FREE(pdp);
-
- return NT_STATUS_OBJECT_PATH_NOT_FOUND;
- }
-
status = dfs_path_lookup(ctx, conn, path_in, pdp,
search_wcard_flag, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
@@ -758,7 +754,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
ZERO_STRUCT(conns);
*self_referralp = False;
- status = parse_dfs_path(dfs_path, False, pdp, &dummy);
+ status = parse_dfs_path(NULL, dfs_path, False, pdp, &dummy);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -1244,7 +1240,7 @@ bool create_junction(TALLOC_CTX *ctx,
if (!pdp) {
return False;
}
- status = parse_dfs_path(dfs_path, False, pdp, &dummy);
+ status = parse_dfs_path(NULL, dfs_path, False, pdp, &dummy);
if (!NT_STATUS_IS_OK(status)) {
return False;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list