[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2424-g635035d

Jeremy Allison jra at samba.org
Tue May 13 22:03:26 GMT 2008


The branch, v3-3-test has been updated
       via  635035d999fcd8e06b70c8cb1137127c289dc9e6 (commit)
      from  e1cda82f6f7de3306a653af920756c1640057f2d (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 635035d999fcd8e06b70c8cb1137127c289dc9e6
Author: Jeremy Allison <jra at samba.org>
Date:   Tue May 13 15:02:11 2008 -0700

    Second part of patch for bug #5460. Cope with pathnames
    that don't look like \xxx\yyy, cope with arbitrary length.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/smbd/msdfs.c |   54 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 39 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/msdfs.c b/source/smbd/msdfs.c
index 6306745..4e673d8 100644
--- a/source/smbd/msdfs.c
+++ b/source/smbd/msdfs.c
@@ -49,6 +49,7 @@ static NTSTATUS parse_dfs_path(const char *pathname,
 {
 	char *pathname_local;
 	char *p,*temp;
+	char *servicename;
 	char *eos_ptr;
 	NTSTATUS status = NT_STATUS_OK;
 	char sepchar;
@@ -128,25 +129,48 @@ static NTSTATUS parse_dfs_path(const char *pathname,
 	DEBUG(10,("parse_dfs_path: hostname: %s\n",pdp->hostname));
 
 	/* Parse out servicename. */
-	temp = p+1;
-	p = strchr_m(temp,sepchar);
+	servicename = p+1;
+	p = strchr_m(servicename,sepchar);
+	if (p) {
+		*p = '\0';
+	}
+
+	/* Is this really our servicename ? */
+	if (NULL == conn_find_byname(servicename)) {
+		DEBUG(10,("parse_dfs_path: %s is not our servicename\n",
+			servicename));
+
+		/*
+		 * Possibly client sent a local path by mistake.
+		 * Try and convert to a local path.
+		 */
+
+		pdp->hostname = eos_ptr; /* "" */
+		pdp->servicename = eos_ptr; /* "" */
+
+		/* Repair the path - replace the sepchar's
+		   we nulled out */
+		servicename--;
+		*servicename = sepchar;
+		if (p) {
+			*p = sepchar;
+		}
+
+		p = temp;
+		DEBUG(10,("parse_dfs_path: trying to convert %s "
+			"to a local path\n",
+			temp));
+		goto local_path;
+	}
+
+	pdp->servicename = servicename;
+
 	if(p == NULL) {
-		pdp->servicename = temp;
+		/* Client sent self referral \server\share. */
 		pdp->reqpath = eos_ptr; /* "" */
-		/* Is this really our servicename ? */
-		if (NULL == conn_find_byname(pdp->servicename)) {
-			DEBUG(10,("parse_dfs_path: %s is not our servicename\n",
-				pdp->servicename));
-			p = temp;
-			DEBUG(10,("parse_dfs_path: trying to convert %s "
-				"to a local path\n",
-				temp));
-			goto local_path;
-		}
 		return NT_STATUS_OK;
 	}
-	*p = '\0';
-	pdp->servicename = temp;
+
 	DEBUG(10,("parse_dfs_path: servicename: %s\n",pdp->servicename));
 
 	p++;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list