diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-24 12:39:15 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:02:26 -0500 |
commit | d5817271384ff74b3d0577d675476c28ccc0074b (patch) | |
tree | 5bae0e551757a315765b61e5a4244e4ec2da8646 /source4/ntvfs/common | |
parent | e9381dfd707a7b7ff9faca6e12262a2b2f9f193a (diff) | |
download | samba-d5817271384ff74b3d0577d675476c28ccc0074b.tar.gz samba-d5817271384ff74b3d0577d675476c28ccc0074b.tar.bz2 samba-d5817271384ff74b3d0577d675476c28ccc0074b.zip |
r3153: pvfs now passes the first 9 of the BASE-DELETE tests
(This used to be commit f8041feaebc9170763ce04d2dd90cfc1c7889c21)
Diffstat (limited to 'source4/ntvfs/common')
-rw-r--r-- | source4/ntvfs/common/opendb.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index f074c31f6e..3def23f190 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -169,6 +169,17 @@ static BOOL share_conflict(struct odb_entry *e1, struct odb_entry *e2) return True; } + if ((e1->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) || + (e2->create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) { + return True; + } + + if ((e1->access_mask & STD_RIGHT_DELETE_ACCESS) && + !(e2->share_access & NTCREATEX_SHARE_ACCESS_DELETE)) { + return True; + } + + return False; } @@ -256,7 +267,8 @@ NTSTATUS odb_close_file(struct odb_lock *lck, uint16_t fnum) odb->server == elist[i].server && odb->tid == elist[i].tid) { if (i < count-1) { - memmove(elist+i, elist+i+1, count - (i+1)); + memmove(elist+i, elist+i+1, + (count - (i+1)) * sizeof(struct odb_entry)); } break; } @@ -281,3 +293,45 @@ NTSTATUS odb_close_file(struct odb_lock *lck, uint16_t fnum) return status; } + + +/* + update create options on an open file +*/ +NTSTATUS odb_set_create_options(struct odb_lock *lck, + uint16_t fnum, uint32_t create_options) +{ + struct odb_context *odb = lck->odb; + TDB_DATA dbuf; + struct odb_entry *elist; + int i, count; + NTSTATUS status; + + dbuf = tdb_fetch(odb->w->tdb, lck->key); + if (dbuf.dptr == NULL) { + return NT_STATUS_UNSUCCESSFUL; + } + + elist = (struct odb_entry *)dbuf.dptr; + count = dbuf.dsize / sizeof(struct odb_entry); + + /* find the entry, and modify it */ + for (i=0;i<count;i++) { + if (fnum == elist[i].fnum && + odb->server == elist[i].server && + odb->tid == elist[i].tid) { + elist[i].create_options = create_options; + break; + } + } + + if (tdb_store(odb->w->tdb, lck->key, dbuf, TDB_REPLACE) != 0) { + status = NT_STATUS_INTERNAL_DB_CORRUPTION; + } else { + status = NT_STATUS_OK; + } + + free(dbuf.dptr); + + return status; +} |