Changeset 740 for vendor/current/source4/ntvfs/common
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source4/ntvfs/common
- Files:
-
- 1 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/ntvfs/common/brlock.c
r414 r740 27 27 #include "includes.h" 28 28 #include "system/filesys.h" 29 #include "../tdb/include/tdb.h"29 #include <tdb.h> 30 30 #include "messaging/messaging.h" 31 31 #include "lib/messaging/irpc.h" … … 126 126 return ops->brl_close(brl, brlh); 127 127 } 128 129 /* 130 Get a number of locks associated with a open file. 131 */ 132 NTSTATUS brl_count(struct brl_context *brl, 133 struct brl_handle *brlh, 134 int *count) 135 { 136 return ops->brl_count(brl, brlh, count); 137 } -
vendor/current/source4/ntvfs/common/brlock.h
r414 r740 47 47 NTSTATUS (*brl_close)(struct brl_context *, 48 48 struct brl_handle *); 49 NTSTATUS (*brl_count)(struct brl_context *, 50 struct brl_handle *, 51 int *count); 49 52 }; 50 53 -
vendor/current/source4/ntvfs/common/brlock_tdb.c
r414 r740 27 27 #include "includes.h" 28 28 #include "system/filesys.h" 29 #include "../tdb/include/tdb.h"29 #include <tdb.h> 30 30 #include "messaging/messaging.h" 31 #include " tdb_wrap.h"31 #include "lib/util/tdb_wrap.h" 32 32 #include "lib/messaging/irpc.h" 33 33 #include "libcli/libcli.h" … … 81 81 }; 82 82 83 /* see if we have wrapped locks, which are no longer allowed (windows 84 * changed this in win7 */ 85 static bool brl_invalid_lock_range(uint64_t start, uint64_t size) 86 { 87 return (size > 1 && (start + size < start)); 88 } 89 83 90 /* 84 91 Open up the brlock.tdb database. Close it down using … … 299 306 kbuf.dptr = brlh->key.data; 300 307 kbuf.dsize = brlh->key.length; 308 309 if (brl_invalid_lock_range(start, size)) { 310 return NT_STATUS_INVALID_LOCK_RANGE; 311 } 301 312 302 313 if (tdb_chainlock(brl->w->tdb, kbuf) != 0) { … … 449 460 kbuf.dptr = brlh->key.data; 450 461 kbuf.dsize = brlh->key.length; 462 463 if (brl_invalid_lock_range(start, size)) { 464 return NT_STATUS_INVALID_LOCK_RANGE; 465 } 451 466 452 467 if (tdb_chainlock(brl->w->tdb, kbuf) != 0) { … … 621 636 kbuf.dsize = brlh->key.length; 622 637 638 if (brl_invalid_lock_range(start, size)) { 639 return NT_STATUS_INVALID_LOCK_RANGE; 640 } 641 623 642 dbuf = tdb_fetch(brl->w->tdb, kbuf); 624 643 if (dbuf.dptr == NULL) { … … 720 739 } 721 740 741 static NTSTATUS brl_tdb_count(struct brl_context *brl, struct brl_handle *brlh, 742 int *count) 743 { 744 TDB_DATA kbuf, dbuf; 745 746 kbuf.dptr = brlh->key.data; 747 kbuf.dsize = brlh->key.length; 748 *count = 0; 749 750 if (tdb_chainlock(brl->w->tdb, kbuf) != 0) { 751 return NT_STATUS_INTERNAL_DB_CORRUPTION; 752 } 753 754 dbuf = tdb_fetch(brl->w->tdb, kbuf); 755 if (!dbuf.dptr) { 756 tdb_chainunlock(brl->w->tdb, kbuf); 757 return NT_STATUS_OK; 758 } 759 760 *count = dbuf.dsize / sizeof(struct lock_struct); 761 762 free(dbuf.dptr); 763 tdb_chainunlock(brl->w->tdb, kbuf); 764 765 return NT_STATUS_OK; 766 } 722 767 723 768 static const struct brlock_ops brlock_tdb_ops = { … … 728 773 .brl_remove_pending = brl_tdb_remove_pending, 729 774 .brl_locktest = brl_tdb_locktest, 730 .brl_close = brl_tdb_close 775 .brl_close = brl_tdb_close, 776 .brl_count = brl_tdb_count 731 777 }; 732 778 -
vendor/current/source4/ntvfs/common/notify.c
r414 r740 26 26 #include "includes.h" 27 27 #include "system/filesys.h" 28 #include "../tdb/include/tdb.h"28 #include <tdb.h> 29 29 #include "../lib/util/util_tdb.h" 30 30 #include "messaging/messaging.h" 31 #include " tdb_wrap.h"31 #include "lib/util/tdb_wrap.h" 32 32 #include "lib/messaging/irpc.h" 33 #include "librpc/gen_ndr/ndr_ notify.h"33 #include "librpc/gen_ndr/ndr_s4_notify.h" 34 34 #include "../lib/util/dlinklist.h" 35 35 #include "ntvfs/common/ntvfs_common.h" … … 37 37 #include "cluster/cluster.h" 38 38 #include "param/param.h" 39 #include "lib/util/tsort.h" 39 40 40 41 struct notify_context { … … 46 47 int seqnum; 47 48 struct sys_notify_context *sys_notify_ctx; 48 struct smb_iconv_convenience *iconv_convenience;49 49 }; 50 50 … … 113 113 notify->list = NULL; 114 114 notify->array = NULL; 115 notify->iconv_convenience = lp_iconv_convenience(lp_ctx);116 115 notify->seqnum = tdb_get_seqnum(notify->w->tdb); 117 116 … … 178 177 blob.length = dbuf.dsize; 179 178 180 ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->iconv_convenience, 181 notify->array, 179 ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->array, 182 180 (ndr_pull_flags_fn_t)ndr_pull_notify_array); 183 181 free(dbuf.dptr); … … 227 225 NT_STATUS_HAVE_NO_MEMORY(tmp_ctx); 228 226 229 ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify-> iconv_convenience, notify->array,227 ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->array, 230 228 (ndr_push_flags_fn_t)ndr_push_notify_array); 231 229 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 263 261 } 264 262 265 ndr_err = ndr_pull_struct_blob(data, tmp_ctx, notify->iconv_convenience,&ev,263 ndr_err = ndr_pull_struct_blob(data, tmp_ctx, &ev, 266 264 (ndr_pull_flags_fn_t)ndr_pull_notify_event); 267 265 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 329 327 d->max_mask_subdir |= e->subdir_filter; 330 328 331 if (d->num_entries > 1) { 332 qsort(d->entries, d->num_entries, sizeof(d->entries[0]), notify_compare); 333 } 329 TYPESAFE_QSORT(d->entries, d->num_entries, notify_compare); 334 330 335 331 /* recalculate the maximum masks */ … … 562 558 tmp_ctx = talloc_new(notify); 563 559 564 ndr_err = ndr_push_struct_blob(&data, tmp_ctx, notify->iconv_convenience,&ev, (ndr_push_flags_fn_t)ndr_push_notify_event);560 ndr_err = ndr_push_struct_blob(&data, tmp_ctx, &ev, (ndr_push_flags_fn_t)ndr_push_notify_event); 565 561 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 566 562 talloc_free(tmp_ctx); -
vendor/current/source4/ntvfs/common/opendb_tdb.c
r414 r740 41 41 #include "includes.h" 42 42 #include "system/filesys.h" 43 #include "../tdb/include/tdb.h"43 #include <tdb.h> 44 44 #include "messaging/messaging.h" 45 #include " tdb_wrap.h"45 #include "lib/util/tdb_wrap.h" 46 46 #include "lib/messaging/irpc.h" 47 47 #include "librpc/gen_ndr/ndr_opendb.h" … … 247 247 blob.length = dbuf.dsize; 248 248 249 ndr_err = ndr_pull_struct_blob(&blob, lck, lp_iconv_convenience(lck->odb->ntvfs_ctx->lp_ctx),file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file);249 ndr_err = ndr_pull_struct_blob(&blob, lck, file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file); 250 250 free(dbuf.dptr); 251 251 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 275 275 } 276 276 277 ndr_err = ndr_push_struct_blob(&blob, lck, lp_iconv_convenience(lck->odb->ntvfs_ctx->lp_ctx),file, (ndr_push_flags_fn_t)ndr_push_opendb_file);277 ndr_err = ndr_push_struct_blob(&blob, lck, file, (ndr_push_flags_fn_t)ndr_push_opendb_file); 278 278 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 279 279 return ndr_map_error2ntstatus(ndr_err);
Note:
See TracChangeset
for help on using the changeset viewer.