diff options
author | Jeremy Allison <jra@samba.org> | 2009-10-17 10:36:33 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-10-17 10:36:33 -0700 |
commit | 7c51fa6d699a653cafa90df8e44911b576118ebd (patch) | |
tree | 543bf9ca698e03eff81104898b33e77f1abed319 /source3/smbd/files.c | |
parent | cc3a6770c77ec8fe1cd63bf4c682853c56201f0c (diff) | |
parent | 3e3214fd91471bca5b6c4d3782e922d252d588fb (diff) | |
download | samba-7c51fa6d699a653cafa90df8e44911b576118ebd.tar.gz samba-7c51fa6d699a653cafa90df8e44911b576118ebd.tar.bz2 samba-7c51fa6d699a653cafa90df8e44911b576118ebd.zip |
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r-- | source3/smbd/files.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 146d809738..2bc5ba6816 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -405,14 +405,13 @@ bool file_find_subpath(files_struct *dir_fsp) files_struct *fsp; size_t dlen; 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) { - goto out; + return false; } dlen = strlen(d_fullname); @@ -429,28 +428,21 @@ bool file_find_subpath(files_struct *dir_fsp) fsp->conn->connectpath, fsp->fsp_name->base_name); - if (strnequal(d_fullname, d1_fullname, dlen)) { - 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; - } - + /* + * 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; + return false; } /**************************************************************************** |