*/
struct ldb_utf8_fns {
void *context;
- int (*caseless_cmp)(void *context, const char *s1, const char *s2);
char *(*casefold)(void *context, void *mem_ctx, const char *s);
};
/**
OID for LDAP Attribute Scoped Query extension.
- This control is include in SearchRequest or SearchResponse
+ This control is included in SearchRequest or SearchResponse
messages as part of the controls field of the LDAPMessage.
*/
#define LDB_CONTROL_ASQ_OID "1.2.840.113556.1.4.1504"
/**
- OID for LDAPrectory Sync extension.
+ OID for LDAP Directory Sync extension.
- This control is include in SearchRequest or SearchResponse
+ This control is included in SearchRequest or SearchResponse
messages as part of the controls field of the LDAPMessage.
*/
#define LDB_CONTROL_DIRSYNC_OID "1.2.840.113556.1.4.841"
+/**
+ OID for LDAP Virtual List View Request extension.
+
+ This control is included in SearchRequest messages
+ as part of the controls field of the LDAPMessage.
+*/
+#define LDB_CONTROL_VLV_REQ_OID "2.16.840.1.113730.3.4.9"
+
+/**
+ OID for LDAP Virtual List View Response extension.
+
+ This control is included in SearchResponse messages
+ as part of the controls field of the LDAPMessage.
+*/
+#define LDB_CONTROL_VLV_RESP_OID "2.16.840.1.113730.3.4.10"
+
struct ldb_paged_control {
int size;
int cookie_len;
char *cookie;
};
+struct ldb_vlv_req_control {
+ int beforeCount;
+ int afterCount;
+ int type;
+ union {
+ struct {
+ int offset;
+ int contentCount;
+ } byOffset;
+ struct {
+ int value_len;
+ char *value;
+ } gtOrEq;
+ } match;
+ int ctxid_len;
+ char *contextId;
+};
+
+struct ldb_vlv_resp_control {
+ int targetPosition;
+ int contentCount;
+ int vlv_result;
+ int ctxid_len;
+ char *contextId;
+};
+
struct ldb_control {
const char *oid;
int critical;
LDB_REQ_MODIFY,
LDB_REQ_DELETE,
LDB_REQ_RENAME,
+ LDB_ASYNC_SEARCH,
+ LDB_ASYNC_ADD,
+ LDB_ASYNC_MODIFY,
+ LDB_ASYNC_DELETE,
+ LDB_ASYNC_RENAME,
+
LDB_REQ_REGISTER
};
+enum ldb_reply_type {
+ LDB_REPLY_ENTRY,
+ LDB_REPLY_REFERRAL,
+ LDB_REPLY_DONE
+};
+
+enum ldb_async_wait_type {
+ LDB_WAIT_ALL,
+ LDB_WAIT_NONE
+};
+
+enum ldb_async_state {
+ LDB_ASYNC_INIT,
+ LDB_ASYNC_PENDING,
+ LDB_ASYNC_DONE
+};
+
struct ldb_result {
unsigned int count;
struct ldb_message **msgs;
+ char **refs;
struct ldb_control **controls;
};
+struct ldb_async_result {
+ enum ldb_reply_type type;
+ struct ldb_message *message;
+ char *referral;
+ struct ldb_control **controls;
+};
+
+struct ldb_async_handle {
+ int status;
+ enum ldb_async_state state;
+ void *private_data;
+ struct ldb_module *module;
+};
+
struct ldb_search {
const struct ldb_dn *base;
enum ldb_scope scope;
struct ldb_control **controls;
struct ldb_credentials *creds;
+
+ struct {
+ void *context;
+ int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
+
+ int timeout;
+ struct ldb_async_handle *handle;
+ } async;
};
int ldb_request(struct ldb_context *ldb, struct ldb_request *request);
+int ldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type);
+
+/**
+ Initialise ldbs' global information
+
+ This is required before any other LDB call
+
+ \return 0 if initialisation succeeded, -1 otherwise
+*/
+int ldb_global_init(void);
+
/**
Initialise an ldb context
*/
char *ldb_casefold(struct ldb_context *ldb, void *mem_ctx, const char *s);
-/**
- Compare two strings, without regard to case.
-
- \param ldb the ldb context
- \param s1 the first string to compare
- \param s2 the second string to compare
-
- \return 0 if the strings are the same, non-zero if there are any
- differences except for case.
-
- \note The default function is not yet UTF8 aware. Provide your own
- set of functions through ldb_set_utf8_fns()
-*/
-int ldb_caseless_cmp(struct ldb_context *ldb, const char *s1, const char *s2);
-
/**
Check the attribute name is valid according to rfc2251
\param s tthe string to check
int ldb_attr_cmp(const char *attr1, const char *attr2);
char *ldb_attr_casefold(void *mem_ctx, const char *s);
int ldb_attr_dn(const char *attr);
-char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value);
/**
Create an empty message
int ldb_msg_add_value(struct ldb_message *msg,
const char *attr_name,
const struct ldb_val *val);
+int ldb_msg_add_steal_value(struct ldb_message *msg,
+ const char *attr_name,
+ struct ldb_val *val);
+int ldb_msg_add_steal_string(struct ldb_message *msg,
+ const char *attr_name, char *str);
int ldb_msg_add_string(struct ldb_message *msg,
const char *attr_name, const char *str);
int ldb_msg_add_fmt(struct ldb_message *msg,
*/
void ldb_set_utf8_fns(struct ldb_context *ldb,
void *context,
- int (*cmp)(void *, const char *, const char *),
char *(*casefold)(void *, void *, const char *));
/**