summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-07-14 18:34:36 +0200
committerVolker Lendecke <vl@samba.org>2009-07-14 20:49:06 +0200
commit749a50874906ba38f1085065933f2781b81d5dfa (patch)
treef4ffdfc2989d0a9d1008d03b80fc13ae433ffadc /source3/smbd/reply.c
parent72da71acf925ffe4cc87ca2bcba3770af3fe3d8b (diff)
downloadsamba-749a50874906ba38f1085065933f2781b81d5dfa.tar.gz
samba-749a50874906ba38f1085065933f2781b81d5dfa.tar.bz2
samba-749a50874906ba38f1085065933f2781b81d5dfa.zip
Create a talloc_stackframe for each file in wildcard unlink
There might be *many* files to delete
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index e35c5bc6d6..4d0a2b8c97 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2646,18 +2646,23 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
while ((dname = ReadDirName(dir_hnd, &offset,
&smb_fname->st))) {
+ TALLOC_CTX *frame = talloc_stackframe();
+
if (!is_visible_file(conn, fname_dir, dname,
&smb_fname->st, true)) {
+ TALLOC_FREE(frame);
continue;
}
/* Quick check for "." and ".." */
if (ISDOT(dname) || ISDOTDOT(dname)) {
+ TALLOC_FREE(frame);
continue;
}
if(!mask_match(dname, fname_mask,
conn->case_sensitive)) {
+ TALLOC_FREE(frame);
continue;
}
@@ -2669,23 +2674,28 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
if (!smb_fname->base_name) {
TALLOC_FREE(dir_hnd);
status = NT_STATUS_NO_MEMORY;
+ TALLOC_FREE(frame);
goto out;
}
status = check_name(conn, smb_fname->base_name);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(dir_hnd);
+ TALLOC_FREE(frame);
goto out;
}
status = do_unlink(conn, req, smb_fname, dirtype);
if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
continue;
}
count++;
DEBUG(3,("unlink_internals: successful unlink [%s]\n",
smb_fname->base_name));
+
+ TALLOC_FREE(frame);
}
TALLOC_FREE(dir_hnd);
}