summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-01-28 21:01:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:13 -0500
commitde728fa81ae549b496f2ff26ebb082092aae2204 (patch)
tree3d3198f7422045cc496c9fc318f2c3ae98e11d8a /source3/smbd/reply.c
parent575ff396254cc433b8b73a9d8d2e649dde9b364d (diff)
downloadsamba-de728fa81ae549b496f2ff26ebb082092aae2204.tar.gz
samba-de728fa81ae549b496f2ff26ebb082092aae2204.tar.bz2
samba-de728fa81ae549b496f2ff26ebb082092aae2204.zip
r5063: Shamelessly steal the Samba4 logic (and some code :-) for directory
evaluation. This stops us from reading the entire directory into memory at one go, and allows partial reads. It also keeps almost the same interface to the OpenDir/ReadDir etc. code (sorry James :-). Next I will optimise the findfirst with exact match code. This speeds up our interactive response for large directories, but not when a missing (ie. negative) findfirst is done. Jeremy (This used to be commit 0af1d2f6f24f238cb05e10d7d53dcd5b5e0f5f5d)
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 26a0c9e7a9..86ee331e6b 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1614,11 +1614,12 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name)
if (dirptr) {
error = NT_STATUS_NO_SUCH_FILE;
-
+ long offset = 0;
+
if (strequal(mask,"????????.???"))
pstrcpy(mask,"*");
- while ((dname = ReadDirName(dirptr))) {
+ while ((dname = ReadDirName(dirptr, &offset))) {
pstring fname;
BOOL sys_direntry = False;
pstrcpy(fname,dname);
@@ -3361,12 +3362,13 @@ static BOOL recursive_rmdir(connection_struct *conn, char *directory)
{
const char *dname = NULL;
BOOL ret = False;
+ long offset = 0;
void *dirptr = OpenDir(conn, directory, False);
if(dirptr == NULL)
return True;
- while((dname = ReadDirName(dirptr))) {
+ while((dname = ReadDirName(dirptr, &offset))) {
pstring fullname;
SMB_STRUCT_STAT st;
@@ -3428,8 +3430,8 @@ BOOL rmdir_internals(connection_struct *conn, char *directory)
void *dirptr = OpenDir(conn, directory, False);
if(dirptr != NULL) {
- int dirpos = TellDir(dirptr);
- while ((dname = ReadDirName(dirptr))) {
+ long dirpos = TellDir(dirptr);
+ while ((dname = ReadDirName(dirptr,&dirpos))) {
if((strcmp(dname, ".") == 0) || (strcmp(dname, "..")==0))
continue;
if(!IS_VETO_PATH(conn, dname)) {
@@ -3440,7 +3442,7 @@ BOOL rmdir_internals(connection_struct *conn, char *directory)
if(all_veto_files) {
SeekDir(dirptr,dirpos);
- while ((dname = ReadDirName(dirptr))) {
+ while ((dname = ReadDirName(dirptr,&dirpos))) {
pstring fullname;
SMB_STRUCT_STAT st;
@@ -3984,13 +3986,14 @@ directory = %s, newname = %s, last_component_dest = %s, is_8_3 = %d\n",
dirptr = OpenDir(conn, directory, True);
if (dirptr) {
+ long offset = 0;
error = NT_STATUS_NO_SUCH_FILE;
/* Was error = NT_STATUS_OBJECT_NAME_NOT_FOUND; - gentest fix. JRA */
if (strequal(mask,"????????.???"))
pstrcpy(mask,"*");
- while ((dname = ReadDirName(dirptr))) {
+ while ((dname = ReadDirName(dirptr, &offset))) {
pstring fname;
BOOL sysdir_entry = False;
@@ -4337,12 +4340,13 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
dirptr = OpenDir(conn, directory, True);
if (dirptr) {
+ long offset = 0;
error = ERRbadfile;
if (strequal(mask,"????????.???"))
pstrcpy(mask,"*");
- while ((dname = ReadDirName(dirptr))) {
+ while ((dname = ReadDirName(dirptr, &offset))) {
pstring fname;
pstrcpy(fname,dname);