From 32a36e470333abae2745e27074a24ab54777b41e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 14 Apr 2009 20:39:14 +0200 Subject: Add notify_onelevel.tdb This optimizes non-recursive notifys. For non-recursive notifies we can use a per-directory file-id indexed notify record. This matters for the Windows Explorer and IIS cases which do not use recursive notifies. In these cases, we do not have to shuffle around the whole notify record on every change. For the cluster case, this improves correctness of the notifies, ctdb only distributes the tdb seqnum once a second, so we can lose notifies. --- source3/include/proto.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 25e81fde11..07e04edc3b 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -6554,6 +6554,11 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0, void (*callback)(void *, const struct notify_event *), void *private_data); NTSTATUS notify_remove(struct notify_context *notify, void *private_data); +NTSTATUS notify_remove_onelevel(struct notify_context *notify, + const struct file_id *fid, + void *private_data); +void notify_onelevel(struct notify_context *notify, uint32_t action, + uint32_t filter, struct file_id fid, const char *name); void notify_trigger(struct notify_context *notify, uint32_t action, uint32_t filter, const char *path); -- cgit From fd558b37f601b5286f227a77aa593255d75c2484 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 18 Apr 2009 13:30:38 +0200 Subject: Add some const --- source3/include/proto.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 07e04edc3b..6156a475a4 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5878,7 +5878,8 @@ NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx, bool init_pipe_handle_list(pipes_struct *p, const struct ndr_syntax_id *syntax); bool create_policy_hnd(pipes_struct *p, struct policy_handle *hnd, void *data_ptr); -bool find_policy_by_hnd(pipes_struct *p, struct policy_handle *hnd, void **data_p); +bool find_policy_by_hnd(pipes_struct *p, const struct policy_handle *hnd, + void **data_p); bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd); void close_policy_by_pipe(pipes_struct *p); bool pipe_access_check(pipes_struct *p); -- cgit From c9bc1728f971318ab291639f34b326157e918f5f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 18 Apr 2009 13:31:20 +0200 Subject: Add type-safe policy_handle_create/find --- source3/include/proto.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 6156a475a4..8eb5c46fbd 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5884,6 +5884,18 @@ bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd); void close_policy_by_pipe(pipes_struct *p); bool pipe_access_check(pipes_struct *p); +NTSTATUS _policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd, + void *pdata, size_t size, const char *name); +#define policy_handle_create(_p, _hnd, _ptr, _type) \ + _policy_handle_create((_p), (_hnd), (_ptr), sizeof(_type), #_type) + +void *_policy_handle_find(struct pipes_struct *p, + const struct policy_handle *hnd, + const char *type); +#define policy_handle_find(_p, _hnd, _type) \ + (_type *)_policy_handle_find((_p), (_hnd), #_type) + + /* The following definitions come from rpc_server/srv_pipe.c */ bool create_next_pdu(pipes_struct *p); -- cgit From 9b3f2e69f772a12c661879109e0edcda6c365be4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 18 Apr 2009 16:10:57 +0200 Subject: Make "struct policy" private to srv_lsa_hnd.c --- source3/include/ntdomain.h | 18 +----------------- source3/include/proto.h | 1 + 2 files changed, 2 insertions(+), 17 deletions(-) (limited to 'source3/include') diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index c95931b5d0..de53aebb91 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -110,23 +110,7 @@ typedef struct _input_data { prs_struct data; } input_data; -/* - * Handle database - stored per pipe. - */ - -struct policy { - struct policy *next, *prev; - - struct policy_handle pol_hnd; - - void *data_ptr; -}; - -struct handle_list { - struct policy *Policy; /* List of policies. */ - size_t count; /* Current number of handles. */ - size_t pipe_ref_count; /* Number of pipe handles referring to this list. */ -}; +struct handle_list; /* Domain controller authentication protocol info */ struct dcinfo { diff --git a/source3/include/proto.h b/source3/include/proto.h index 8eb5c46fbd..b99588f717 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5875,6 +5875,7 @@ NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx, /* The following definitions come from rpc_server/srv_lsa_hnd.c */ +size_t num_pipe_handles(struct handle_list *list); bool init_pipe_handle_list(pipes_struct *p, const struct ndr_syntax_id *syntax); bool create_policy_hnd(pipes_struct *p, struct policy_handle *hnd, void *data_ptr); -- cgit From 35e6a0e618db99287d12092cd8048276ffdb2356 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 18 Apr 2009 16:46:53 +0200 Subject: Add "uint32_t access_granted" to policy handles All policy handles have a mask of allowed operations attached that were calculated at creation time, so they should carry this mask. This is the basis for consolidating all our policy handle access checks. If you want to do your own more complicated access checks further down, just pass "0" to policy_handle_find. --- source3/include/proto.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index b99588f717..fa60e6de09 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5885,16 +5885,21 @@ bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd); void close_policy_by_pipe(pipes_struct *p); bool pipe_access_check(pipes_struct *p); -NTSTATUS _policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd, - void *pdata, size_t size, const char *name); -#define policy_handle_create(_p, _hnd, _ptr, _type) \ - _policy_handle_create((_p), (_hnd), (_ptr), sizeof(_type), #_type) +void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd, + uint32_t access_granted, size_t data_size, + const char *type, NTSTATUS *pstatus); +#define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \ + (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \ + (_pstatus)) void *_policy_handle_find(struct pipes_struct *p, const struct policy_handle *hnd, - const char *type); -#define policy_handle_find(_p, _hnd, _type) \ - (_type *)_policy_handle_find((_p), (_hnd), #_type) + uint32_t access_required, uint32_t *paccess_granted, + const char *name, const char *location, + NTSTATUS *pstatus); +#define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \ + (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \ + (_access_granted), #_type, __location__, (_pstatus)) /* The following definitions come from rpc_server/srv_pipe.c */ -- cgit