From 6a3aaa1197950d16bb623c26f910347bb1fceb83 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Tue, 13 Jul 2010 02:37:58 +0300 Subject: [PATCH] s4-ldb: use TALLOC_CTX type instead of 'void' --- source4/lib/ldb/common/ldb.c | 14 +++++++------- source4/lib/ldb/common/ldb_controls.c | 2 +- source4/lib/ldb/common/ldb_dn.c | 28 +++++++++++++-------------- source4/lib/ldb/common/ldb_ldif.c | 6 +++--- source4/lib/ldb/common/ldb_msg.c | 6 +++--- source4/lib/ldb/common/ldb_parse.c | 26 ++++++++++++------------- source4/lib/ldb/common/ldb_utf8.c | 6 +++--- source4/lib/ldb/include/ldb.h | 6 +++--- source4/lib/ldb/include/ldb_private.h | 4 ++-- 9 files changed, 49 insertions(+), 49 deletions(-) diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 877f283491..dbb0089db4 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -993,7 +993,7 @@ int ldb_op_default_callback(struct ldb_request *req, struct ldb_reply *ares) int ldb_build_search_req_ex(struct ldb_request **ret_req, struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn *base, enum ldb_scope scope, struct ldb_parse_tree *tree, @@ -1051,7 +1051,7 @@ int ldb_build_search_req_ex(struct ldb_request **ret_req, int ldb_build_search_req(struct ldb_request **ret_req, struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn *base, enum ldb_scope scope, const char *expression, @@ -1081,7 +1081,7 @@ int ldb_build_search_req(struct ldb_request **ret_req, int ldb_build_add_req(struct ldb_request **ret_req, struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, const struct ldb_message *message, struct ldb_control **controls, void *context, @@ -1123,7 +1123,7 @@ int ldb_build_add_req(struct ldb_request **ret_req, int ldb_build_mod_req(struct ldb_request **ret_req, struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, const struct ldb_message *message, struct ldb_control **controls, void *context, @@ -1165,7 +1165,7 @@ int ldb_build_mod_req(struct ldb_request **ret_req, int ldb_build_del_req(struct ldb_request **ret_req, struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn *dn, struct ldb_control **controls, void *context, @@ -1207,7 +1207,7 @@ int ldb_build_del_req(struct ldb_request **ret_req, int ldb_build_rename_req(struct ldb_request **ret_req, struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn *olddn, struct ldb_dn *newdn, struct ldb_control **controls, @@ -1280,7 +1280,7 @@ int ldb_extended_default_callback(struct ldb_request *req, int ldb_build_extended_req(struct ldb_request **ret_req, struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, const char *oid, void *data, struct ldb_control **controls, diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c index abdbb1496d..d75221e720 100644 --- a/source4/lib/ldb/common/ldb_controls.c +++ b/source4/lib/ldb/common/ldb_controls.c @@ -236,7 +236,7 @@ int ldb_reply_add_control(struct ldb_reply *ares, const char *oid, bool critical /* Parse controls from the format used on the command line and in ejs */ -struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *mem_ctx, const char **control_strings) +struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char **control_strings) { unsigned int i; struct ldb_control **ctrl; diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 847aa02f6f..9bbefddb8e 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -86,7 +86,7 @@ static void ldb_dn_mark_invalid(struct ldb_dn *dn) } /* strdn may be NULL */ -struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx, +struct ldb_dn *ldb_dn_from_ldb_val(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const struct ldb_val *strdn) { @@ -154,7 +154,7 @@ failed: } /* strdn may be NULL */ -struct ldb_dn *ldb_dn_new(void *mem_ctx, +struct ldb_dn *ldb_dn_new(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const char *strdn) { @@ -164,7 +164,7 @@ struct ldb_dn *ldb_dn_new(void *mem_ctx, return ldb_dn_from_ldb_val(mem_ctx, ldb, &blob); } -struct ldb_dn *ldb_dn_new_fmt(void *mem_ctx, +struct ldb_dn *ldb_dn_new_fmt(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const char *new_fmt, ...) { @@ -257,7 +257,7 @@ static int ldb_dn_escape_internal(char *dst, const char *src, int len) return (l + (d - dst)); } -char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value) +char *ldb_dn_escape_value(TALLOC_CTX *mem_ctx, struct ldb_val value) { char *dst; @@ -804,7 +804,7 @@ static int ldb_dn_extended_component_compare(const void *p1, const void *p2) return strcmp(ec1->name, ec2->name); } -char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode) +char *ldb_dn_get_extended_linearized(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, int mode) { const char *linearized = ldb_dn_get_linearized(dn); char *p = NULL; @@ -900,7 +900,7 @@ void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept) } -char *ldb_dn_alloc_linearized(void *mem_ctx, struct ldb_dn *dn) +char *ldb_dn_alloc_linearized(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) { return talloc_strdup(mem_ctx, ldb_dn_get_linearized(dn)); } @@ -1016,7 +1016,7 @@ const char *ldb_dn_get_casefold(struct ldb_dn *dn) return dn->casefold; } -char *ldb_dn_alloc_casefold(void *mem_ctx, struct ldb_dn *dn) +char *ldb_dn_alloc_casefold(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) { return talloc_strdup(mem_ctx, ldb_dn_get_casefold(dn)); } @@ -1187,7 +1187,7 @@ int ldb_dn_compare(struct ldb_dn *dn0, struct ldb_dn *dn1) } static struct ldb_dn_component ldb_dn_copy_component( - void *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn_component *src) { struct ldb_dn_component dst; @@ -1233,7 +1233,7 @@ static struct ldb_dn_component ldb_dn_copy_component( } static struct ldb_dn_ext_component ldb_dn_ext_copy_component( - void *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn_ext_component *src) { struct ldb_dn_ext_component dst; @@ -1258,7 +1258,7 @@ static struct ldb_dn_ext_component ldb_dn_ext_copy_component( return dst; } -struct ldb_dn *ldb_dn_copy(void *mem_ctx, struct ldb_dn *dn) +struct ldb_dn *ldb_dn_copy(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) { struct ldb_dn *new_dn; @@ -1684,7 +1684,7 @@ bool ldb_dn_remove_child_components(struct ldb_dn *dn, unsigned int num) return true; } -struct ldb_dn *ldb_dn_get_parent(void *mem_ctx, struct ldb_dn *dn) +struct ldb_dn *ldb_dn_get_parent(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) { struct ldb_dn *new_dn; @@ -1710,7 +1710,7 @@ struct ldb_dn *ldb_dn_get_parent(void *mem_ctx, struct ldb_dn *dn) the EX format has the last '/' replaced with a newline (\n). */ -static char *ldb_dn_canonical(void *mem_ctx, struct ldb_dn *dn, int ex_format) { +static char *ldb_dn_canonical(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, int ex_format) { long long int i; TALLOC_CTX *tmpctx; char *cracked = NULL; @@ -1770,12 +1770,12 @@ done: } /* Wrapper functions for the above, for the two different string formats */ -char *ldb_dn_canonical_string(void *mem_ctx, struct ldb_dn *dn) { +char *ldb_dn_canonical_string(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) { return ldb_dn_canonical(mem_ctx, dn, 0); } -char *ldb_dn_canonical_ex_string(void *mem_ctx, struct ldb_dn *dn) { +char *ldb_dn_canonical_ex_string(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) { return ldb_dn_canonical(mem_ctx, dn, 1); } diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c index 8e1e165ada..2628d4d5da 100644 --- a/source4/lib/ldb/common/ldb_ldif.c +++ b/source4/lib/ldb/common/ldb_ldif.c @@ -41,7 +41,7 @@ /* */ -static int ldb_read_data_file(void *mem_ctx, struct ldb_val *value) +static int ldb_read_data_file(TALLOC_CTX *mem_ctx, struct ldb_val *value) { struct stat statbuf; char *buf; @@ -150,7 +150,7 @@ int ldb_base64_decode(char *s) encode as base64 caller frees */ -char *ldb_base64_encode(void *mem_ctx, const char *buf, int len) +char *ldb_base64_encode(TALLOC_CTX *mem_ctx, const char *buf, int len) { const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int bit_offset, byte_offset, idx, i; @@ -449,7 +449,7 @@ static char *next_chunk(struct ldb_context *ldb, /* simple ldif attribute parser */ -static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val *value) +static int next_attr(TALLOC_CTX *mem_ctx, char **s, const char **attr, struct ldb_val *value) { char *p; int base64_encoded = 0; diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 4d0149af8f..4596ec1bf2 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -36,7 +36,7 @@ /* create a new ldb_message in a given memory context (NULL for top level) */ -struct ldb_message *ldb_msg_new(void *mem_ctx) +struct ldb_message *ldb_msg_new(TALLOC_CTX *mem_ctx) { return talloc_zero(mem_ctx, struct ldb_message); } @@ -92,7 +92,7 @@ struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, /* duplicate a ldb_val structure */ -struct ldb_val ldb_val_dup(void *mem_ctx, const struct ldb_val *v) +struct ldb_val ldb_val_dup(TALLOC_CTX *mem_ctx, const struct ldb_val *v) { struct ldb_val v2; v2.length = v->length; @@ -445,7 +445,7 @@ const char *ldb_msg_find_attr_as_string(const struct ldb_message *msg, } struct ldb_dn *ldb_msg_find_attr_as_dn(struct ldb_context *ldb, - void *mem_ctx, + TALLOC_CTX *mem_ctx, const struct ldb_message *msg, const char *attr_name) { diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index a6845939a0..746002e34a 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/lib/ldb/common/ldb_parse.c @@ -79,7 +79,7 @@ a filter is defined by: decode a RFC2254 binary string representation of a buffer. Used in LDAP filters. */ -struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str) +struct ldb_val ldb_binary_decode(TALLOC_CTX *mem_ctx, const char *str) { size_t i, j; struct ldb_val ret; @@ -116,7 +116,7 @@ struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str) encode a blob as a RFC2254 binary string, escaping any non-printable or '\' characters */ -char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) +char *ldb_binary_encode(TALLOC_CTX *mem_ctx, struct ldb_val val) { size_t i; char *ret; @@ -151,7 +151,7 @@ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) non-printable or '\' characters. This routine is suitable for use in escaping user data in ldap filters. */ -char *ldb_binary_encode_string(void *mem_ctx, const char *string) +char *ldb_binary_encode_string(TALLOC_CTX *mem_ctx, const char *string) { struct ldb_val val; val.data = discard_const_p(uint8_t, string); @@ -181,7 +181,7 @@ static char *ldb_parse_find_wildcard(char *value) /* return a NULL terminated list of binary strings representing the value chunks separated by wildcards that makes the value portion of the filter */ -static struct ldb_val **ldb_wildcard_decode(void *mem_ctx, const char *string) +static struct ldb_val **ldb_wildcard_decode(TALLOC_CTX *mem_ctx, const char *string) { struct ldb_val **ret = NULL; unsigned int val = 0; @@ -221,7 +221,7 @@ static struct ldb_val **ldb_wildcard_decode(void *mem_ctx, const char *string) return ret; } -static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s); +static struct ldb_parse_tree *ldb_parse_filter(TALLOC_CTX *mem_ctx, const char **s); /* @@ -275,7 +275,7 @@ failed: return NULL; } -static enum ldb_parse_op ldb_parse_filtertype(void *mem_ctx, char **type, char **value, const char **s) +static enum ldb_parse_op ldb_parse_filtertype(TALLOC_CTX *mem_ctx, char **type, char **value, const char **s) { enum ldb_parse_op filter = 0; char *name, *val, *k; @@ -373,7 +373,7 @@ static enum ldb_parse_op ldb_parse_filtertype(void *mem_ctx, char **type, char * /* ::= */ -static struct ldb_parse_tree *ldb_parse_simple(void *mem_ctx, const char **s) +static struct ldb_parse_tree *ldb_parse_simple(TALLOC_CTX *mem_ctx, const char **s) { char *attr, *value; struct ldb_parse_tree *ret; @@ -488,7 +488,7 @@ static struct ldb_parse_tree *ldb_parse_simple(void *mem_ctx, const char **s) ::= '|' ::= | */ -static struct ldb_parse_tree *ldb_parse_filterlist(void *mem_ctx, const char **s) +static struct ldb_parse_tree *ldb_parse_filterlist(TALLOC_CTX *mem_ctx, const char **s) { struct ldb_parse_tree *ret, *next; enum ldb_parse_op op; @@ -556,7 +556,7 @@ static struct ldb_parse_tree *ldb_parse_filterlist(void *mem_ctx, const char **s /* ::= '!' */ -static struct ldb_parse_tree *ldb_parse_not(void *mem_ctx, const char **s) +static struct ldb_parse_tree *ldb_parse_not(TALLOC_CTX *mem_ctx, const char **s) { struct ldb_parse_tree *ret; const char *p = *s; @@ -588,7 +588,7 @@ static struct ldb_parse_tree *ldb_parse_not(void *mem_ctx, const char **s) parse a filtercomp ::= | | | */ -static struct ldb_parse_tree *ldb_parse_filtercomp(void *mem_ctx, const char **s) +static struct ldb_parse_tree *ldb_parse_filtercomp(TALLOC_CTX *mem_ctx, const char **s) { struct ldb_parse_tree *ret; const char *p = *s; @@ -625,7 +625,7 @@ static struct ldb_parse_tree *ldb_parse_filtercomp(void *mem_ctx, const char **s /* ::= '(' ')' */ -static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s) +static struct ldb_parse_tree *ldb_parse_filter(TALLOC_CTX *mem_ctx, const char **s) { struct ldb_parse_tree *ret; const char *p = *s; @@ -657,7 +657,7 @@ static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s) expression ::= | */ -struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s) +struct ldb_parse_tree *ldb_parse_tree(TALLOC_CTX *mem_ctx, const char *s) { if (s == NULL || *s == 0) { s = "(|(objectClass=*)(distinguishedName=*))"; @@ -676,7 +676,7 @@ struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s) /* construct a ldap parse filter given a parse tree */ -char *ldb_filter_from_tree(void *mem_ctx, struct ldb_parse_tree *tree) +char *ldb_filter_from_tree(TALLOC_CTX *mem_ctx, struct ldb_parse_tree *tree) { char *s, *s2, *ret; unsigned int i; diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c index 73ae71bb9c..55d8f905d3 100644 --- a/source4/lib/ldb/common/ldb_utf8.c +++ b/source4/lib/ldb/common/ldb_utf8.c @@ -53,7 +53,7 @@ void ldb_set_utf8_fns(struct ldb_context *ldb, a simple case folding function NOTE: does not handle UTF8 */ -char *ldb_casefold_default(void *context, void *mem_ctx, const char *s, size_t n) +char *ldb_casefold_default(void *context, TALLOC_CTX *mem_ctx, const char *s, size_t n) { size_t i; char *ret = talloc_strndup(mem_ctx, s, n); @@ -72,7 +72,7 @@ void ldb_set_utf8_default(struct ldb_context *ldb) ldb_set_utf8_fns(ldb, NULL, ldb_casefold_default); } -char *ldb_casefold(struct ldb_context *ldb, void *mem_ctx, const char *s, size_t n) +char *ldb_casefold(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *s, size_t n) { return ldb->utf8_fns.casefold(ldb->utf8_fns.context, mem_ctx, s, n); } @@ -109,7 +109,7 @@ int ldb_valid_attr_name(const char *s) return 1; } -char *ldb_attr_casefold(void *mem_ctx, const char *s) +char *ldb_attr_casefold(TALLOC_CTX *mem_ctx, const char *s) { size_t i; char *ret = talloc_strdup(mem_ctx, s); diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 039f70895a..38525ecc68 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -1633,7 +1633,7 @@ char *ldb_dn_alloc_linearized(TALLOC_CTX *mem_ctx, struct ldb_dn *dn); \param dn The DN to linearize \param mode Style of extended DN to return (0 is HEX representation of binary form, 1 is a string form) */ -char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode); +char *ldb_dn_get_extended_linearized(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, int mode); const struct ldb_val *ldb_dn_get_extended_component(struct ldb_dn *dn, const char *name); int ldb_dn_set_extended_component(struct ldb_dn *dn, const char *name, const struct ldb_val *val); void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept); @@ -1673,7 +1673,7 @@ struct ldb_dn *ldb_dn_new_fmt(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, cons \note The DN will not be parsed at this time. Use ldb_dn_validate to tell if the DN is syntacticly correct */ -struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx, struct ldb_context *ldb, const struct ldb_val *strdn); +struct ldb_dn *ldb_dn_from_ldb_val(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const struct ldb_val *strdn); /** Determine if this DN is syntactically valid @@ -2058,7 +2058,7 @@ unsigned int ldb_get_flags(struct ldb_context *ldb); void ldb_set_flags(struct ldb_context *ldb, unsigned flags); -struct ldb_dn *ldb_dn_binary_from_ldb_val(void *mem_ctx, +struct ldb_dn *ldb_dn_binary_from_ldb_val(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const struct ldb_val *strdn); diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index aac21c7fe6..6bbcfa280d 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -157,7 +157,7 @@ void ldb_subclass_remove(struct ldb_context *ldb, const char *classname); int ldb_subclass_add(struct ldb_context *ldb, const char *classname, const char *subclass); /* The following definitions come from lib/ldb/common/ldb_utf8.c */ -char *ldb_casefold_default(void *context, void *mem_ctx, const char *s, size_t n); +char *ldb_casefold_default(void *context, TALLOC_CTX *mem_ctx, const char *s, size_t n); void ldb_dump_results(struct ldb_context *ldb, struct ldb_result *result, FILE *f); @@ -169,7 +169,7 @@ int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, str int ldb_load_modules(struct ldb_context *ldb, const char *options[]); int ldb_init_module_chain(struct ldb_context *ldb, struct ldb_module *module); -struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str); +struct ldb_val ldb_binary_decode(TALLOC_CTX *mem_ctx, const char *str); /* The following definitions come from lib/ldb/common/ldb_options.c */ -- 2.34.1