summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2009-08-08 08:07:24 +0300
committerAlexander Bokovoy <ab@samba.org>2009-08-08 08:07:24 +0300
commit8eac1896299d820fec0fd92b2b8b6a058ae39642 (patch)
treef97b0a2c21eb4f91aa51cb2af4381287c3525727 /source3/smbd/files.c
parent217e3086c74eb0b46fab512b5887d9a5a5b7ee9a (diff)
parentd296c774c5981baa863c697782dba1b6280d632e (diff)
downloadsamba-8eac1896299d820fec0fd92b2b8b6a058ae39642.tar.gz
samba-8eac1896299d820fec0fd92b2b8b6a058ae39642.tar.bz2
samba-8eac1896299d820fec0fd92b2b8b6a058ae39642.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index a170f774fe..146d809738 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -404,14 +404,15 @@ bool file_find_subpath(files_struct *dir_fsp)
{
files_struct *fsp;
size_t dlen;
- char *d_fullname;
+ char *d_fullname = NULL;
+ bool ret = false;
d_fullname = talloc_asprintf(talloc_tos(), "%s/%s",
dir_fsp->conn->connectpath,
dir_fsp->fsp_name->base_name);
if (!d_fullname) {
- return false;
+ goto out;
}
dlen = strlen(d_fullname);
@@ -429,15 +430,27 @@ bool file_find_subpath(files_struct *dir_fsp)
fsp->fsp_name->base_name);
if (strnequal(d_fullname, d1_fullname, dlen)) {
- TALLOC_FREE(d_fullname);
+ int d1_len = strlen(d1_fullname);
+
+ /*
+ * 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_len == dlen) {
+ TALLOC_FREE(d1_fullname);
+ continue;
+ }
+
TALLOC_FREE(d1_fullname);
- return true;
+ ret = true;
+ goto out;
}
TALLOC_FREE(d1_fullname);
}
-
+ out:
TALLOC_FREE(d_fullname);
- return false;
+ return ret;
}
/****************************************************************************