• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/samba-3.5.8/source3/lib/ldb/ldb_tdb/
1
2#ifdef _SAMBA_BUILD_
3#include "system/filesys.h"
4#endif
5
6#include "tdb.h"
7
8/* this private structure is used by the ltdb backend in the
9   ldb_context */
10struct ltdb_private {
11	TDB_CONTEXT *tdb;
12	unsigned int connect_flags;
13
14	/* a double is used for portability and ease of string
15	   handling. It has plenty of digits of precision */
16	unsigned long long sequence_number;
17
18	/* the low level tdb seqnum - used to avoid loading BASEINFO when
19	   possible */
20	int tdb_seqnum;
21
22	struct ltdb_cache {
23		struct ldb_message *indexlist;
24		struct ldb_message *attributes;
25		struct ldb_message *subclasses;
26
27		struct {
28			char *name;
29			int flags;
30		} last_attribute;
31	} *cache;
32};
33
34/*
35  the async local context
36  holds also internal search state during a full db search
37*/
38struct ltdb_context {
39	struct ldb_module *module;
40
41	/* search stuff */
42	const struct ldb_parse_tree *tree;
43	const struct ldb_dn *base;
44	enum ldb_scope scope;
45	const char * const *attrs;
46
47	/* async stuff */
48	void *context;
49	int (*callback)(struct ldb_context *, void *, struct ldb_reply *);
50};
51
52/* special record types */
53#define LTDB_INDEX      "@INDEX"
54#define LTDB_INDEXLIST  "@INDEXLIST"
55#define LTDB_IDX        "@IDX"
56#define LTDB_IDXATTR    "@IDXATTR"
57#define LTDB_BASEINFO   "@BASEINFO"
58#define LTDB_ATTRIBUTES "@ATTRIBUTES"
59#define LTDB_SUBCLASSES "@SUBCLASSES"
60
61/* special attribute types */
62#define LTDB_SEQUENCE_NUMBER "sequenceNumber"
63#define LTDB_MOD_TIMESTAMP "whenChanged"
64#define LTDB_OBJECTCLASS "objectClass"
65
66/* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c  */
67
68int ltdb_cache_reload(struct ldb_module *module);
69int ltdb_cache_load(struct ldb_module *module);
70int ltdb_increase_sequence_number(struct ldb_module *module);
71int ltdb_check_at_attributes_values(const struct ldb_val *value);
72
73/* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c  */
74
75struct ldb_parse_tree;
76
77int ltdb_search_indexed(struct ldb_handle *handle);
78int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
79int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
80int ltdb_reindex(struct ldb_module *module);
81
82/* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c  */
83
84int ltdb_pack_data(struct ldb_module *module,
85		   const struct ldb_message *message,
86		   struct TDB_DATA *data);
87void ltdb_unpack_data_free(struct ldb_module *module,
88			   struct ldb_message *message);
89int ltdb_unpack_data(struct ldb_module *module,
90		     const struct TDB_DATA *data,
91		     struct ldb_message *message);
92
93/* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c  */
94
95int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name,
96		      const struct ldb_val *val);
97void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
98int ltdb_search_dn1(struct ldb_module *module, const struct ldb_dn *dn, struct ldb_message *msg);
99int ltdb_add_attr_results(struct ldb_module *module,
100 			  TALLOC_CTX *mem_ctx,
101			  struct ldb_message *msg,
102			  const char * const attrs[],
103			  unsigned int *count,
104			  struct ldb_message ***res);
105int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs);
106int ltdb_search(struct ldb_module *module, struct ldb_request *req);
107
108/* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c  */
109struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
110				    struct ldb_request *req);
111struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn);
112int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
113int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn);
114int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
115
116int ltdb_index_del_value(struct ldb_module *module, const char *dn,
117			 struct ldb_message_element *el, int v_idx);
118
119struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
120				   const char *path, int hash_size, int tdb_flags,
121				   int open_flags, mode_t mode,
122				   struct ldb_context *ldb);
123
124