summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-24 13:40:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:02:27 -0500
commit5ea5d5c2355eb0789131cd5d9ffffc5b004b02c8 (patch)
treef8ae0dc5486521e569e011fbc2e0631c2ca5b8eb
parent3965113fc7c621ab4bbf2457775386694e82ac82 (diff)
downloadsamba-5ea5d5c2355eb0789131cd5d9ffffc5b004b02c8.tar.gz
samba-5ea5d5c2355eb0789131cd5d9ffffc5b004b02c8.tar.bz2
samba-5ea5d5c2355eb0789131cd5d9ffffc5b004b02c8.zip
r3159: use easy to recognise file handle numbers for new file, old file and directory
in pvfs_open, to make analysing sniffs easy (This used to be commit 5c16ed02542f7e143d66f4ba8d166bb6882bf53a)
-rw-r--r--source4/ntvfs/posix/pvfs_open.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 95990f6332..44a09fe25d 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -23,6 +23,12 @@
#include "include/includes.h"
#include "vfs_posix.h"
+/*
+ create file handles with convenient numbers for sniffers
+*/
+#define PVFS_MIN_FILE_FNUM 0x100
+#define PVFS_MIN_NEW_FNUM 0x200
+#define PVFS_MIN_DIR_FNUM 0x1000
/*
find open file handle given fnum
@@ -114,7 +120,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
return NT_STATUS_NO_MEMORY;
}
- fnum = idr_get_new(pvfs->idtree_fnum, f, UINT16_MAX);
+ fnum = idr_get_new_above(pvfs->idtree_fnum, f, PVFS_MIN_DIR_FNUM, UINT16_MAX);
if (fnum == -1) {
talloc_free(f);
return NT_STATUS_TOO_MANY_OPENED_FILES;
@@ -202,6 +208,13 @@ static int pvfs_fd_destructor(void *p)
idr_remove(f->pvfs->idtree_fnum, f->fnum);
+ if (f->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) {
+ if (unlink(f->name->full_name) != 0) {
+ DEBUG(0,("pvfs_close: failed to delete '%s'\n",
+ f->name->full_name));
+ }
+ }
+
lck = odb_lock(f, f->pvfs->odb_context, &f->locking_key);
if (lck == NULL) {
DEBUG(0,("Unable to lock opendb for close\n"));
@@ -214,12 +227,7 @@ static int pvfs_fd_destructor(void *p)
f->name->full_name, nt_errstr(status)));
}
- if (f->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) {
- if (unlink(f->name->full_name) != 0) {
- DEBUG(0,("pvfs_close: failed to delete '%s'\n",
- f->name->full_name));
- }
- }
+ talloc_free(lck);
return 0;
}
@@ -280,7 +288,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
return NT_STATUS_NO_MEMORY;
}
- fnum = idr_get_new(pvfs->idtree_fnum, f, UINT16_MAX);
+ fnum = idr_get_new_above(pvfs->idtree_fnum, f, PVFS_MIN_NEW_FNUM, UINT16_MAX);
if (fnum == -1) {
return NT_STATUS_TOO_MANY_OPENED_FILES;
}
@@ -498,7 +506,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
}
/* allocate a fnum */
- fnum = idr_get_new(pvfs->idtree_fnum, f, UINT16_MAX);
+ fnum = idr_get_new_above(pvfs->idtree_fnum, f, PVFS_MIN_FILE_FNUM, UINT16_MAX);
if (fnum == -1) {
return NT_STATUS_TOO_MANY_OPENED_FILES;
}