summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShirish Kalele <kalele@samba.org>2003-04-23 19:05:47 +0000
committerShirish Kalele <kalele@samba.org>2003-04-23 19:05:47 +0000
commite1d936f95c6cfead846f0a2175e938c53c941b38 (patch)
tree1c263e799b322ea29d6abc8a01ebb4b1d8773192
parent78bc883162f83adc436244ac8f4a98a0b4158e23 (diff)
downloadsamba-e1d936f95c6cfead846f0a2175e938c53c941b38.tar.gz
samba-e1d936f95c6cfead846f0a2175e938c53c941b38.tar.bz2
samba-e1d936f95c6cfead846f0a2175e938c53c941b38.zip
For deep referrals, track consumed path using a counter, and calculate the
consumed count only if and when it is needed. Check into HEAD. (This used to be commit 11281c39209b501a69f4e6f32ea2081d15947f0a)
-rw-r--r--source3/msdfs/msdfs.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source3/msdfs/msdfs.c b/source3/msdfs/msdfs.c
index fa6617cb52..69a315d4e4 100644
--- a/source3/msdfs/msdfs.c
+++ b/source3/msdfs/msdfs.c
@@ -212,10 +212,9 @@ static BOOL resolve_dfs_path(char* dfspath, struct dfs_path* dp,
BOOL* self_referralp, int* consumedcntp)
{
fstring localpath;
-
+ int consumed_level = 1;
char *p;
fstring reqpath;
- pstring consumedbuf;
if (!dp || !conn) {
DEBUG(1,("resolve_dfs_path: NULL dfs_path* or NULL connection_struct*!\n"));
@@ -248,9 +247,6 @@ static BOOL resolve_dfs_path(char* dfspath, struct dfs_path* dp,
}
}
- pstrcpy(consumedbuf, dfspath);
- trim_string(consumedbuf, NULL, "\\");
-
/* redirect if any component in the path is a link */
fstrcpy(reqpath, dp->reqpath);
p = strrchr(reqpath, '/');
@@ -269,16 +265,21 @@ static BOOL resolve_dfs_path(char* dfspath, struct dfs_path* dp,
*/
if (consumedcntp) {
char *q;
- q = strrchr(consumedbuf, '\\');
- if (q)
- *q = '\0';
- *consumedcntp = strlen(consumedbuf);
- DEBUG(10, ("resolve_dfs_path: Path consumed: %d\n", *consumedcntp));
+ pstring buf;
+ pstrcpy(buf, dfspath);
+ trim_string(buf, NULL, "\\");
+ for (; consumed_level; consumed_level--) {
+ q = strrchr(buf, '\\');
+ if (q) *q = 0;
+ }
+ *consumedcntp = strlen(buf);
+ DEBUG(10, ("resolve_dfs_path: Path consumed: %s (%d)\n", buf, *consumedcntp));
}
return True;
}
p = strrchr(reqpath, '/');
+ consumed_level++;
}
return False;