From 25d345eb39c69b2b42a966846ae893b068de40a4 Mon Sep 17 00:00:00 2001 From: Steven Danneman Date: Thu, 22 Jan 2009 20:18:56 -0800 Subject: Pass stat buffer down through all levels of VFS_READDIR wrappers * VFS_OP_READDIR can now provide stat information, take advantage of it if it's available * is_visible_file(): optimistically expect the provided stat buffer is already valid * dptr_ReadDirName(): refactor code for easier readability, functionality is the same --- source3/smbd/reply.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'source3/smbd/reply.c') diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 151f9d0827..628f481c1c 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2368,7 +2368,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, char *p = NULL; int count=0; NTSTATUS status = NT_STATUS_OK; - SMB_STRUCT_STAT sbuf; + SMB_STRUCT_STAT sbuf, st; TALLOC_CTX *ctx = talloc_tos(); status = unix_convert(ctx, conn, name_in, has_wild, &name, NULL, &sbuf); @@ -2464,11 +2464,12 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, status = NT_STATUS_NO_SUCH_FILE; - while ((dname = ReadDirName(dir_hnd, &offset))) { - SMB_STRUCT_STAT st; + while ((dname = ReadDirName(dir_hnd, &offset, &st))) { char *fname = NULL; - if (!is_visible_file(conn, directory, dname, &st, True)) { + if (!is_visible_file(conn, directory, dname, &st, + true)) + { continue; } @@ -5005,15 +5006,15 @@ static bool recursive_rmdir(TALLOC_CTX *ctx, const char *dname = NULL; bool ret = True; long offset = 0; + SMB_STRUCT_STAT st; struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn, directory, NULL, 0); if(dir_hnd == NULL) return False; - while((dname = ReadDirName(dir_hnd, &offset))) { + while((dname = ReadDirName(dir_hnd, &offset, &st))) { char *fullname = NULL; - SMB_STRUCT_STAT st; if (ISDOT(dname) || ISDOTDOT(dname)) { continue; @@ -5110,7 +5111,7 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx, goto err; } - while ((dname = ReadDirName(dir_hnd,&dirpos))) { + while ((dname = ReadDirName(dir_hnd, &dirpos, &st))) { if((strcmp(dname, ".") == 0) || (strcmp(dname, "..")==0)) continue; if (!is_visible_file(conn, directory, dname, &st, False)) @@ -5133,7 +5134,7 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx, /* Do a recursive delete. */ RewindDir(dir_hnd,&dirpos); - while ((dname = ReadDirName(dir_hnd,&dirpos))) { + while ((dname = ReadDirName(dir_hnd, &dirpos, &st))) { char *fullname = NULL; if (ISDOT(dname) || ISDOTDOT(dname)) { @@ -5911,7 +5912,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, * - gentest fix. JRA */ - while ((dname = ReadDirName(dir_hnd, &offset))) { + while ((dname = ReadDirName(dir_hnd, &offset, &sbuf1))) { files_struct *fsp = NULL; char *fname = NULL; char *destname = NULL; @@ -6513,7 +6514,7 @@ void reply_copy(struct smb_request *req) error = ERRbadfile; - while ((dname = ReadDirName(dir_hnd, &offset))) { + while ((dname = ReadDirName(dir_hnd, &offset, &sbuf1))) { char *destname = NULL; char *fname = NULL; -- cgit