summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-10-07 15:39:38 -0700
committerJeremy Allison <jra@samba.org>2009-10-07 15:39:38 -0700
commit94ce06f01d9c84e79df1029ec3e2c6defc7fa800 (patch)
tree29250a979522001c18da2fb9e2c455fdc6a050cf
parent91456b8dc5c4237eb76ac82afa0c5f4a35bdca65 (diff)
downloadsamba-94ce06f01d9c84e79df1029ec3e2c6defc7fa800.tar.gz
samba-94ce06f01d9c84e79df1029ec3e2c6defc7fa800.tar.bz2
samba-94ce06f01d9c84e79df1029ec3e2c6defc7fa800.zip
Make the logic a lot clearer and fix the comment to match.
Jeremy
-rw-r--r--source3/smbd/files.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index bf216050b8..f7509d75fd 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -429,24 +429,19 @@ bool file_find_subpath(files_struct *dir_fsp)
fsp->conn->connectpath,
fsp->fsp_name->base_name);
- if (strnequal(d_fullname, d1_fullname, dlen)) {
- /*
- * If the open file is a second file handle to the
- * same name or is a stream on the original file, then
- * don't return true.
- */
- if (d1_fullname[dlen] != '/') {
- TALLOC_FREE(d1_fullname);
- continue;
- }
-
+ /*
+ * If the open file has a path that is a longer
+ * component, then it's a subpath.
+ */
+ if (strnequal(d_fullname, d1_fullname, dlen) &&
+ (d1_fullname[dlen] == '/')) {
TALLOC_FREE(d1_fullname);
- ret = true;
- goto out;
+ TALLOC_FREE(d_fullname);
+ return true;
}
TALLOC_FREE(d1_fullname);
- }
- out:
+ }
+
TALLOC_FREE(d_fullname);
return ret;
}