diff -Nru ldb-1.2.2/ABI/ldb-1.2.3.sigs ldb-1.2.3/ABI/ldb-1.2.3.sigs --- ldb-1.2.2/ABI/ldb-1.2.3.sigs 1970-01-01 00:00:00.000000000 +0000 +++ ldb-1.2.3/ABI/ldb-1.2.3.sigs 2017-10-10 07:08:20.000000000 +0000 @@ -0,0 +1,277 @@ +ldb_add: int (struct ldb_context *, const struct ldb_message *) +ldb_any_comparison: int (struct ldb_context *, void *, ldb_attr_handler_t, const struct ldb_val *, const struct ldb_val *) +ldb_asprintf_errstring: void (struct ldb_context *, const char *, ...) +ldb_attr_casefold: char *(TALLOC_CTX *, const char *) +ldb_attr_dn: int (const char *) +ldb_attr_in_list: int (const char * const *, const char *) +ldb_attr_list_copy: const char **(TALLOC_CTX *, const char * const *) +ldb_attr_list_copy_add: const char **(TALLOC_CTX *, const char * const *, const char *) +ldb_base64_decode: int (char *) +ldb_base64_encode: char *(TALLOC_CTX *, const char *, int) +ldb_binary_decode: struct ldb_val (TALLOC_CTX *, const char *) +ldb_binary_encode: char *(TALLOC_CTX *, struct ldb_val) +ldb_binary_encode_string: char *(TALLOC_CTX *, const char *) +ldb_build_add_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_del_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_extended_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, const char *, void *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_mod_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_rename_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, struct ldb_dn *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_search_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, enum ldb_scope, const char *, const char * const *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_search_req_ex: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, enum ldb_scope, struct ldb_parse_tree *, const char * const *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_casefold: char *(struct ldb_context *, TALLOC_CTX *, const char *, size_t) +ldb_casefold_default: char *(void *, TALLOC_CTX *, const char *, size_t) +ldb_check_critical_controls: int (struct ldb_control **) +ldb_comparison_binary: int (struct ldb_context *, void *, const struct ldb_val *, const struct ldb_val *) +ldb_comparison_fold: int (struct ldb_context *, void *, const struct ldb_val *, const struct ldb_val *) +ldb_connect: int (struct ldb_context *, const char *, unsigned int, const char **) +ldb_control_to_string: char *(TALLOC_CTX *, const struct ldb_control *) +ldb_controls_except_specified: struct ldb_control **(struct ldb_control **, TALLOC_CTX *, struct ldb_control *) +ldb_debug: void (struct ldb_context *, enum ldb_debug_level, const char *, ...) +ldb_debug_add: void (struct ldb_context *, const char *, ...) +ldb_debug_end: void (struct ldb_context *, enum ldb_debug_level) +ldb_debug_set: void (struct ldb_context *, enum ldb_debug_level, const char *, ...) +ldb_delete: int (struct ldb_context *, struct ldb_dn *) +ldb_dn_add_base: bool (struct ldb_dn *, struct ldb_dn *) +ldb_dn_add_base_fmt: bool (struct ldb_dn *, const char *, ...) +ldb_dn_add_child: bool (struct ldb_dn *, struct ldb_dn *) +ldb_dn_add_child_fmt: bool (struct ldb_dn *, const char *, ...) +ldb_dn_alloc_casefold: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_alloc_linearized: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_canonical_ex_string: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_canonical_string: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_check_local: bool (struct ldb_module *, struct ldb_dn *) +ldb_dn_check_special: bool (struct ldb_dn *, const char *) +ldb_dn_compare: int (struct ldb_dn *, struct ldb_dn *) +ldb_dn_compare_base: int (struct ldb_dn *, struct ldb_dn *) +ldb_dn_copy: struct ldb_dn *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_escape_value: char *(TALLOC_CTX *, struct ldb_val) +ldb_dn_extended_add_syntax: int (struct ldb_context *, unsigned int, const struct ldb_dn_extended_syntax *) +ldb_dn_extended_filter: void (struct ldb_dn *, const char * const *) +ldb_dn_extended_syntax_by_name: const struct ldb_dn_extended_syntax *(struct ldb_context *, const char *) +ldb_dn_from_ldb_val: struct ldb_dn *(TALLOC_CTX *, struct ldb_context *, const struct ldb_val *) +ldb_dn_get_casefold: const char *(struct ldb_dn *) +ldb_dn_get_comp_num: int (struct ldb_dn *) +ldb_dn_get_component_name: const char *(struct ldb_dn *, unsigned int) +ldb_dn_get_component_val: const struct ldb_val *(struct ldb_dn *, unsigned int) +ldb_dn_get_extended_comp_num: int (struct ldb_dn *) +ldb_dn_get_extended_component: const struct ldb_val *(struct ldb_dn *, const char *) +ldb_dn_get_extended_linearized: char *(TALLOC_CTX *, struct ldb_dn *, int) +ldb_dn_get_ldb_context: struct ldb_context *(struct ldb_dn *) +ldb_dn_get_linearized: const char *(struct ldb_dn *) +ldb_dn_get_parent: struct ldb_dn *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_get_rdn_name: const char *(struct ldb_dn *) +ldb_dn_get_rdn_val: const struct ldb_val *(struct ldb_dn *) +ldb_dn_has_extended: bool (struct ldb_dn *) +ldb_dn_is_null: bool (struct ldb_dn *) +ldb_dn_is_special: bool (struct ldb_dn *) +ldb_dn_is_valid: bool (struct ldb_dn *) +ldb_dn_map_local: struct ldb_dn *(struct ldb_module *, void *, struct ldb_dn *) +ldb_dn_map_rebase_remote: struct ldb_dn *(struct ldb_module *, void *, struct ldb_dn *) +ldb_dn_map_remote: struct ldb_dn *(struct ldb_module *, void *, struct ldb_dn *) +ldb_dn_minimise: bool (struct ldb_dn *) +ldb_dn_new: struct ldb_dn *(TALLOC_CTX *, struct ldb_context *, const char *) +ldb_dn_new_fmt: struct ldb_dn *(TALLOC_CTX *, struct ldb_context *, const char *, ...) +ldb_dn_remove_base_components: bool (struct ldb_dn *, unsigned int) +ldb_dn_remove_child_components: bool (struct ldb_dn *, unsigned int) +ldb_dn_remove_extended_components: void (struct ldb_dn *) +ldb_dn_replace_components: bool (struct ldb_dn *, struct ldb_dn *) +ldb_dn_set_component: int (struct ldb_dn *, int, const char *, const struct ldb_val) +ldb_dn_set_extended_component: int (struct ldb_dn *, const char *, const struct ldb_val *) +ldb_dn_update_components: int (struct ldb_dn *, const struct ldb_dn *) +ldb_dn_validate: bool (struct ldb_dn *) +ldb_dump_results: void (struct ldb_context *, struct ldb_result *, FILE *) +ldb_error_at: int (struct ldb_context *, int, const char *, const char *, int) +ldb_errstring: const char *(struct ldb_context *) +ldb_extended: int (struct ldb_context *, const char *, void *, struct ldb_result **) +ldb_extended_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_filter_from_tree: char *(TALLOC_CTX *, const struct ldb_parse_tree *) +ldb_get_config_basedn: struct ldb_dn *(struct ldb_context *) +ldb_get_create_perms: unsigned int (struct ldb_context *) +ldb_get_default_basedn: struct ldb_dn *(struct ldb_context *) +ldb_get_event_context: struct tevent_context *(struct ldb_context *) +ldb_get_flags: unsigned int (struct ldb_context *) +ldb_get_opaque: void *(struct ldb_context *, const char *) +ldb_get_root_basedn: struct ldb_dn *(struct ldb_context *) +ldb_get_schema_basedn: struct ldb_dn *(struct ldb_context *) +ldb_global_init: int (void) +ldb_handle_get_event_context: struct tevent_context *(struct ldb_handle *) +ldb_handle_new: struct ldb_handle *(TALLOC_CTX *, struct ldb_context *) +ldb_handle_use_global_event_context: void (struct ldb_handle *) +ldb_handler_copy: int (struct ldb_context *, void *, const struct ldb_val *, struct ldb_val *) +ldb_handler_fold: int (struct ldb_context *, void *, const struct ldb_val *, struct ldb_val *) +ldb_init: struct ldb_context *(TALLOC_CTX *, struct tevent_context *) +ldb_ldif_message_redacted_string: char *(struct ldb_context *, TALLOC_CTX *, enum ldb_changetype, const struct ldb_message *) +ldb_ldif_message_string: char *(struct ldb_context *, TALLOC_CTX *, enum ldb_changetype, const struct ldb_message *) +ldb_ldif_parse_modrdn: int (struct ldb_context *, const struct ldb_ldif *, TALLOC_CTX *, struct ldb_dn **, struct ldb_dn **, bool *, struct ldb_dn **, struct ldb_dn **) +ldb_ldif_read: struct ldb_ldif *(struct ldb_context *, int (*)(void *), void *) +ldb_ldif_read_file: struct ldb_ldif *(struct ldb_context *, FILE *) +ldb_ldif_read_file_state: struct ldb_ldif *(struct ldb_context *, struct ldif_read_file_state *) +ldb_ldif_read_free: void (struct ldb_context *, struct ldb_ldif *) +ldb_ldif_read_string: struct ldb_ldif *(struct ldb_context *, const char **) +ldb_ldif_write: int (struct ldb_context *, int (*)(void *, const char *, ...), void *, const struct ldb_ldif *) +ldb_ldif_write_file: int (struct ldb_context *, FILE *, const struct ldb_ldif *) +ldb_ldif_write_redacted_trace_string: char *(struct ldb_context *, TALLOC_CTX *, const struct ldb_ldif *) +ldb_ldif_write_string: char *(struct ldb_context *, TALLOC_CTX *, const struct ldb_ldif *) +ldb_load_modules: int (struct ldb_context *, const char **) +ldb_map_add: int (struct ldb_module *, struct ldb_request *) +ldb_map_delete: int (struct ldb_module *, struct ldb_request *) +ldb_map_init: int (struct ldb_module *, const struct ldb_map_attribute *, const struct ldb_map_objectclass *, const char * const *, const char *, const char *) +ldb_map_modify: int (struct ldb_module *, struct ldb_request *) +ldb_map_rename: int (struct ldb_module *, struct ldb_request *) +ldb_map_search: int (struct ldb_module *, struct ldb_request *) +ldb_match_msg: int (struct ldb_context *, const struct ldb_message *, const struct ldb_parse_tree *, struct ldb_dn *, enum ldb_scope) +ldb_match_msg_error: int (struct ldb_context *, const struct ldb_message *, const struct ldb_parse_tree *, struct ldb_dn *, enum ldb_scope, bool *) +ldb_match_msg_objectclass: int (const struct ldb_message *, const char *) +ldb_mod_register_control: int (struct ldb_module *, const char *) +ldb_modify: int (struct ldb_context *, const struct ldb_message *) +ldb_modify_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_module_call_chain: char *(struct ldb_request *, TALLOC_CTX *) +ldb_module_connect_backend: int (struct ldb_context *, const char *, const char **, struct ldb_module **) +ldb_module_done: int (struct ldb_request *, struct ldb_control **, struct ldb_extended *, int) +ldb_module_flags: uint32_t (struct ldb_context *) +ldb_module_get_ctx: struct ldb_context *(struct ldb_module *) +ldb_module_get_name: const char *(struct ldb_module *) +ldb_module_get_ops: const struct ldb_module_ops *(struct ldb_module *) +ldb_module_get_private: void *(struct ldb_module *) +ldb_module_init_chain: int (struct ldb_context *, struct ldb_module *) +ldb_module_load_list: int (struct ldb_context *, const char **, struct ldb_module *, struct ldb_module **) +ldb_module_new: struct ldb_module *(TALLOC_CTX *, struct ldb_context *, const char *, const struct ldb_module_ops *) +ldb_module_next: struct ldb_module *(struct ldb_module *) +ldb_module_popt_options: struct poptOption **(struct ldb_context *) +ldb_module_send_entry: int (struct ldb_request *, struct ldb_message *, struct ldb_control **) +ldb_module_send_referral: int (struct ldb_request *, char *) +ldb_module_set_next: void (struct ldb_module *, struct ldb_module *) +ldb_module_set_private: void (struct ldb_module *, void *) +ldb_modules_hook: int (struct ldb_context *, enum ldb_module_hook_type) +ldb_modules_list_from_string: const char **(struct ldb_context *, TALLOC_CTX *, const char *) +ldb_modules_load: int (const char *, const char *) +ldb_msg_add: int (struct ldb_message *, const struct ldb_message_element *, int) +ldb_msg_add_empty: int (struct ldb_message *, const char *, int, struct ldb_message_element **) +ldb_msg_add_fmt: int (struct ldb_message *, const char *, const char *, ...) +ldb_msg_add_linearized_dn: int (struct ldb_message *, const char *, struct ldb_dn *) +ldb_msg_add_steal_string: int (struct ldb_message *, const char *, char *) +ldb_msg_add_steal_value: int (struct ldb_message *, const char *, struct ldb_val *) +ldb_msg_add_string: int (struct ldb_message *, const char *, const char *) +ldb_msg_add_value: int (struct ldb_message *, const char *, const struct ldb_val *, struct ldb_message_element **) +ldb_msg_canonicalize: struct ldb_message *(struct ldb_context *, const struct ldb_message *) +ldb_msg_check_string_attribute: int (const struct ldb_message *, const char *, const char *) +ldb_msg_copy: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_copy_attr: int (struct ldb_message *, const char *, const char *) +ldb_msg_copy_shallow: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_diff: struct ldb_message *(struct ldb_context *, struct ldb_message *, struct ldb_message *) +ldb_msg_difference: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message *, struct ldb_message *, struct ldb_message **) +ldb_msg_element_compare: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_compare_name: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_equal_ordered: bool (const struct ldb_message_element *, const struct ldb_message_element *) +ldb_msg_find_attr_as_bool: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_dn: struct ldb_dn *(struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, const char *) +ldb_msg_find_attr_as_double: double (const struct ldb_message *, const char *, double) +ldb_msg_find_attr_as_int: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_int64: int64_t (const struct ldb_message *, const char *, int64_t) +ldb_msg_find_attr_as_string: const char *(const struct ldb_message *, const char *, const char *) +ldb_msg_find_attr_as_uint: unsigned int (const struct ldb_message *, const char *, unsigned int) +ldb_msg_find_attr_as_uint64: uint64_t (const struct ldb_message *, const char *, uint64_t) +ldb_msg_find_common_values: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message_element *, struct ldb_message_element *, uint32_t) +ldb_msg_find_duplicate_val: int (struct ldb_context *, TALLOC_CTX *, const struct ldb_message_element *, struct ldb_val **, uint32_t) +ldb_msg_find_element: struct ldb_message_element *(const struct ldb_message *, const char *) +ldb_msg_find_ldb_val: const struct ldb_val *(const struct ldb_message *, const char *) +ldb_msg_find_val: struct ldb_val *(const struct ldb_message_element *, struct ldb_val *) +ldb_msg_new: struct ldb_message *(TALLOC_CTX *) +ldb_msg_normalize: int (struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, struct ldb_message **) +ldb_msg_remove_attr: void (struct ldb_message *, const char *) +ldb_msg_remove_element: void (struct ldb_message *, struct ldb_message_element *) +ldb_msg_rename_attr: int (struct ldb_message *, const char *, const char *) +ldb_msg_sanity_check: int (struct ldb_context *, const struct ldb_message *) +ldb_msg_sort_elements: void (struct ldb_message *) +ldb_next_del_trans: int (struct ldb_module *) +ldb_next_end_trans: int (struct ldb_module *) +ldb_next_init: int (struct ldb_module *) +ldb_next_prepare_commit: int (struct ldb_module *) +ldb_next_read_lock: int (struct ldb_module *) +ldb_next_read_unlock: int (struct ldb_module *) +ldb_next_remote_request: int (struct ldb_module *, struct ldb_request *) +ldb_next_request: int (struct ldb_module *, struct ldb_request *) +ldb_next_start_trans: int (struct ldb_module *) +ldb_op_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_options_find: const char *(struct ldb_context *, const char **, const char *) +ldb_pack_data: int (struct ldb_context *, const struct ldb_message *, struct ldb_val *) +ldb_parse_control_from_string: struct ldb_control *(struct ldb_context *, TALLOC_CTX *, const char *) +ldb_parse_control_strings: struct ldb_control **(struct ldb_context *, TALLOC_CTX *, const char **) +ldb_parse_tree: struct ldb_parse_tree *(TALLOC_CTX *, const char *) +ldb_parse_tree_attr_replace: void (struct ldb_parse_tree *, const char *, const char *) +ldb_parse_tree_copy_shallow: struct ldb_parse_tree *(TALLOC_CTX *, const struct ldb_parse_tree *) +ldb_parse_tree_walk: int (struct ldb_parse_tree *, int (*)(struct ldb_parse_tree *, void *), void *) +ldb_qsort: void (void * const, size_t, size_t, void *, ldb_qsort_cmp_fn_t) +ldb_register_backend: int (const char *, ldb_connect_fn, bool) +ldb_register_extended_match_rule: int (struct ldb_context *, const struct ldb_extended_match_rule *) +ldb_register_hook: int (ldb_hook_fn) +ldb_register_module: int (const struct ldb_module_ops *) +ldb_rename: int (struct ldb_context *, struct ldb_dn *, struct ldb_dn *) +ldb_reply_add_control: int (struct ldb_reply *, const char *, bool, void *) +ldb_reply_get_control: struct ldb_control *(struct ldb_reply *, const char *) +ldb_req_get_custom_flags: uint32_t (struct ldb_request *) +ldb_req_is_untrusted: bool (struct ldb_request *) +ldb_req_location: const char *(struct ldb_request *) +ldb_req_mark_trusted: void (struct ldb_request *) +ldb_req_mark_untrusted: void (struct ldb_request *) +ldb_req_set_custom_flags: void (struct ldb_request *, uint32_t) +ldb_req_set_location: void (struct ldb_request *, const char *) +ldb_request: int (struct ldb_context *, struct ldb_request *) +ldb_request_add_control: int (struct ldb_request *, const char *, bool, void *) +ldb_request_done: int (struct ldb_request *, int) +ldb_request_get_control: struct ldb_control *(struct ldb_request *, const char *) +ldb_request_get_status: int (struct ldb_request *) +ldb_request_replace_control: int (struct ldb_request *, const char *, bool, void *) +ldb_request_set_state: void (struct ldb_request *, int) +ldb_reset_err_string: void (struct ldb_context *) +ldb_save_controls: int (struct ldb_control *, struct ldb_request *, struct ldb_control ***) +ldb_schema_attribute_add: int (struct ldb_context *, const char *, unsigned int, const char *) +ldb_schema_attribute_add_with_syntax: int (struct ldb_context *, const char *, unsigned int, const struct ldb_schema_syntax *) +ldb_schema_attribute_by_name: const struct ldb_schema_attribute *(struct ldb_context *, const char *) +ldb_schema_attribute_fill_with_syntax: int (struct ldb_context *, TALLOC_CTX *, const char *, unsigned int, const struct ldb_schema_syntax *, struct ldb_schema_attribute *) +ldb_schema_attribute_remove: void (struct ldb_context *, const char *) +ldb_schema_attribute_remove_flagged: void (struct ldb_context *, unsigned int) +ldb_schema_attribute_set_override_handler: void (struct ldb_context *, ldb_attribute_handler_override_fn_t, void *) +ldb_schema_set_override_indexlist: void (struct ldb_context *, bool) +ldb_search: int (struct ldb_context *, TALLOC_CTX *, struct ldb_result **, struct ldb_dn *, enum ldb_scope, const char * const *, const char *, ...) +ldb_search_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_sequence_number: int (struct ldb_context *, enum ldb_sequence_type, uint64_t *) +ldb_set_create_perms: void (struct ldb_context *, unsigned int) +ldb_set_debug: int (struct ldb_context *, void (*)(void *, enum ldb_debug_level, const char *, va_list), void *) +ldb_set_debug_stderr: int (struct ldb_context *) +ldb_set_default_dns: void (struct ldb_context *) +ldb_set_errstring: void (struct ldb_context *, const char *) +ldb_set_event_context: void (struct ldb_context *, struct tevent_context *) +ldb_set_flags: void (struct ldb_context *, unsigned int) +ldb_set_modules_dir: void (struct ldb_context *, const char *) +ldb_set_opaque: int (struct ldb_context *, const char *, void *) +ldb_set_require_private_event_context: void (struct ldb_context *) +ldb_set_timeout: int (struct ldb_context *, struct ldb_request *, int) +ldb_set_timeout_from_prev_req: int (struct ldb_context *, struct ldb_request *, struct ldb_request *) +ldb_set_utf8_default: void (struct ldb_context *) +ldb_set_utf8_fns: void (struct ldb_context *, void *, char *(*)(void *, void *, const char *, size_t)) +ldb_setup_wellknown_attributes: int (struct ldb_context *) +ldb_should_b64_encode: int (struct ldb_context *, const struct ldb_val *) +ldb_standard_syntax_by_name: const struct ldb_schema_syntax *(struct ldb_context *, const char *) +ldb_strerror: const char *(int) +ldb_string_to_time: time_t (const char *) +ldb_string_utc_to_time: time_t (const char *) +ldb_timestring: char *(TALLOC_CTX *, time_t) +ldb_timestring_utc: char *(TALLOC_CTX *, time_t) +ldb_transaction_cancel: int (struct ldb_context *) +ldb_transaction_cancel_noerr: int (struct ldb_context *) +ldb_transaction_commit: int (struct ldb_context *) +ldb_transaction_prepare_commit: int (struct ldb_context *) +ldb_transaction_start: int (struct ldb_context *) +ldb_unpack_data: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *) +ldb_unpack_data_only_attr_list: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *, const char * const *, unsigned int, unsigned int *) +ldb_unpack_data_only_attr_list_flags: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *, const char * const *, unsigned int, unsigned int, unsigned int *) +ldb_val_dup: struct ldb_val (TALLOC_CTX *, const struct ldb_val *) +ldb_val_equal_exact: int (const struct ldb_val *, const struct ldb_val *) +ldb_val_map_local: struct ldb_val (struct ldb_module *, void *, const struct ldb_map_attribute *, const struct ldb_val *) +ldb_val_map_remote: struct ldb_val (struct ldb_module *, void *, const struct ldb_map_attribute *, const struct ldb_val *) +ldb_val_string_cmp: int (const struct ldb_val *, const char *) +ldb_val_to_time: int (const struct ldb_val *, time_t *) +ldb_valid_attr_name: int (const char *) +ldb_vdebug: void (struct ldb_context *, enum ldb_debug_level, const char *, va_list) +ldb_wait: int (struct ldb_handle *, enum ldb_wait_type) diff -Nru ldb-1.2.2/ABI/pyldb-util-1.2.3.sigs ldb-1.2.3/ABI/pyldb-util-1.2.3.sigs --- ldb-1.2.2/ABI/pyldb-util-1.2.3.sigs 1970-01-01 00:00:00.000000000 +0000 +++ ldb-1.2.3/ABI/pyldb-util-1.2.3.sigs 2017-10-10 07:08:20.000000000 +0000 @@ -0,0 +1,2 @@ +pyldb_Dn_FromDn: PyObject *(struct ldb_dn *) +pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **) diff -Nru ldb-1.2.2/ABI/pyldb-util.py3-1.2.3.sigs ldb-1.2.3/ABI/pyldb-util.py3-1.2.3.sigs --- ldb-1.2.2/ABI/pyldb-util.py3-1.2.3.sigs 1970-01-01 00:00:00.000000000 +0000 +++ ldb-1.2.3/ABI/pyldb-util.py3-1.2.3.sigs 2017-10-10 07:08:20.000000000 +0000 @@ -0,0 +1,2 @@ +pyldb_Dn_FromDn: PyObject *(struct ldb_dn *) +pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **) diff -Nru ldb-1.2.2/buildtools/wafsamba/samba_dist.py ldb-1.2.3/buildtools/wafsamba/samba_dist.py --- ldb-1.2.2/buildtools/wafsamba/samba_dist.py 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/buildtools/wafsamba/samba_dist.py 2017-12-22 13:37:07.000000000 +0000 @@ -115,7 +115,7 @@ blacklisted = True if blacklisted: continue - if os.path.isdir(abspath) and not os.path.islink(abspath): + if os.path.isdir(abspath): continue if dstsubdir != '.': f = dstsubdir + '/' + f @@ -182,7 +182,7 @@ absfile = os.path.join(srcdir, file) - if os.path.isdir(absfile) and not os.path.islink(absfile): + if os.path.isdir(absfile): destdir = destfile dir = file files = list_directory_files(dir) diff -Nru ldb-1.2.2/buildtools/wafsamba/samba_patterns.py ldb-1.2.3/buildtools/wafsamba/samba_patterns.py --- ldb-1.2.2/buildtools/wafsamba/samba_patterns.py 2017-09-07 10:04:11.000000000 +0000 +++ ldb-1.2.3/buildtools/wafsamba/samba_patterns.py 2017-12-22 13:37:07.000000000 +0000 @@ -108,7 +108,6 @@ fp.write(" output(screen,\" PIDDIR: %s\\n\", get_dyn_PIDDIR());\n") fp.write(" output(screen,\" SMB_PASSWD_FILE: %s\\n\",get_dyn_SMB_PASSWD_FILE());\n") fp.write(" output(screen,\" PRIVATE_DIR: %s\\n\",get_dyn_PRIVATE_DIR());\n") - fp.write(" output(screen,\" BINDDNS_DIR: %s\\n\",get_dyn_BINDDNS_DIR());\n") fp.write("\n") def write_build_options_footer(fp): diff -Nru ldb-1.2.2/buildtools/wafsamba/wafsamba.py ldb-1.2.3/buildtools/wafsamba/wafsamba.py --- ldb-1.2.2/buildtools/wafsamba/wafsamba.py 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/buildtools/wafsamba/wafsamba.py 2017-12-22 13:37:07.000000000 +0000 @@ -885,31 +885,13 @@ python_fixup=python_fixup, base_name=trim_path) Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD -def INSTALL_DIR(bld, path, chmod=0o755): - """Install a directory if it doesn't exist, always set permissions.""" - if not path: - return [] - - if bld.is_install > 0: - path = bld.EXPAND_VARIABLES(path) - if not os.path.isdir(path): - try: - os.makedirs(path) - os.chmod(path, chmod) - except OSError, e: - if not os.path.isdir(path): - raise Utils.WafError("Cannot create the folder '%s' (error: %s)" % (path, e)) - else: - os.chmod(path, chmod) -Build.BuildContext.INSTALL_DIR = INSTALL_DIR - -def INSTALL_DIRS(bld, destdir, dirs, chmod=0o755): +def INSTALL_DIRS(bld, destdir, dirs): '''install a set of directories''' destdir = bld.EXPAND_VARIABLES(destdir) dirs = bld.EXPAND_VARIABLES(dirs) for d in TO_LIST(dirs): - INSTALL_DIR(bld, os.path.join(destdir, d), chmod) + bld.install_dir(os.path.join(destdir, d)) Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS diff -Nru ldb-1.2.2/debian/changelog ldb-1.2.3/debian/changelog --- ldb-1.2.2/debian/changelog 2017-10-26 08:28:05.000000000 +0000 +++ ldb-1.2.3/debian/changelog 2018-01-11 06:36:33.000000000 +0000 @@ -1,3 +1,13 @@ +ldb (2:1.2.3-1) unstable; urgency=medium + + * New upstream version 1.2.3 + - Update symbols (no change) + * Standards-Version: 4.1.3, no change + * Repository moved to salsa: Update Vcs-* fields + * Bumping debhelper compat from 9 to 11 + + -- Mathieu Parent Thu, 11 Jan 2018 07:36:33 +0100 + ldb (2:1.2.2-2) unstable; urgency=medium * Upload to sid @@ -475,7 +485,7 @@ ldb (0.92~git20080616-1) unstable; urgency=low * New upstream snapshot. - * Add patch to remove dependency on events lib in pkg-config file, + * Add patch to remove dependency on events lib in pkg-config file, which is not packaged yet. -- Jelmer Vernooij Mon, 16 Jun 2008 21:00:43 +0200 diff -Nru ldb-1.2.2/debian/compat ldb-1.2.3/debian/compat --- ldb-1.2.2/debian/compat 2017-10-04 15:25:47.000000000 +0000 +++ ldb-1.2.3/debian/compat 2018-01-11 06:36:33.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru ldb-1.2.2/debian/control ldb-1.2.3/debian/control --- ldb-1.2.2/debian/control 2017-10-04 15:25:47.000000000 +0000 +++ ldb-1.2.3/debian/control 2018-01-11 06:36:33.000000000 +0000 @@ -4,7 +4,7 @@ Maintainer: Debian Samba Maintainers Uploaders: Jelmer Vernooij , Mathieu Parent -Build-Depends: debhelper (>> 9), +Build-Depends: debhelper (>> 11), dh-python, docbook-xml, docbook-xsl, @@ -22,9 +22,9 @@ python-tdb (>= 1.3.15~), xsltproc Homepage: http://ldb.samba.org/ -Standards-Version: 4.0.0 -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-samba/ldb.git -Vcs-Git: https://anonscm.debian.org/git/pkg-samba/ldb.git +Standards-Version: 4.1.3 +Vcs-Browser: https://salsa.debian.org/samba-team/ldb +Vcs-Git: https://salsa.debian.org/samba-team/ldb.git Package: libldb1 Multi-Arch: same diff -Nru ldb-1.2.2/debian/libldb1.symbols ldb-1.2.3/debian/libldb1.symbols --- ldb-1.2.2/debian/libldb1.symbols 2017-10-04 15:25:47.000000000 +0000 +++ ldb-1.2.3/debian/libldb1.symbols 2018-01-10 22:39:11.000000000 +0000 @@ -48,6 +48,7 @@ LDB_1.2.0@LDB_1.2.0 2:1.2.0 LDB_1.2.1@LDB_1.2.1 2:1.2.1 LDB_1.2.2@LDB_1.2.2 2:1.2.2 + LDB_1.2.3@LDB_1.2.3 2:1.2.3 ldb_check_critical_controls@LDB_0.9.22 0.9.22 ldb_controls_except_specified@LDB_0.9.22 0.9.22 ldb_control_to_string@LDB_1.0.2 1.0.2~git20110403 diff -Nru ldb-1.2.2/debian/python-ldb.symbols ldb-1.2.3/debian/python-ldb.symbols --- ldb-1.2.2/debian/python-ldb.symbols 2017-10-04 15:25:47.000000000 +0000 +++ ldb-1.2.3/debian/python-ldb.symbols 2018-01-10 22:39:11.000000000 +0000 @@ -35,5 +35,6 @@ PYLDB_UTIL_1.2.0@PYLDB_UTIL_1.2.0 2:1.2.0 PYLDB_UTIL_1.2.1@PYLDB_UTIL_1.2.1 2:1.2.1 PYLDB_UTIL_1.2.2@PYLDB_UTIL_1.2.2 2:1.2.2 + PYLDB_UTIL_1.2.3@PYLDB_UTIL_1.2.3 2:1.2.3 pyldb_Dn_FromDn@PYLDB_UTIL_1.1.2 1.1.2~ pyldb_Object_AsDn@PYLDB_UTIL_1.1.2 1.1.2~ diff -Nru ldb-1.2.2/ldb_tdb/ldb_index.c ldb-1.2.3/ldb_tdb/ldb_index.c --- ldb-1.2.2/ldb_tdb/ldb_index.c 2017-09-07 10:04:11.000000000 +0000 +++ ldb-1.2.3/ldb_tdb/ldb_index.c 2017-12-22 13:37:07.000000000 +0000 @@ -79,7 +79,9 @@ find a entry in a dn_list, using a ldb_val. Uses a case sensitive comparison with the dn returns -1 if not found */ -static int ltdb_dn_list_find_val(const struct dn_list *list, const struct ldb_val *v) +static int ltdb_dn_list_find_val(struct ltdb_private *ltdb, + const struct dn_list *list, + const struct ldb_val *v) { unsigned int i; for (i=0; icount; i++) { @@ -94,12 +96,14 @@ find a entry in a dn_list. Uses a case sensitive comparison with the dn returns -1 if not found */ -static int ltdb_dn_list_find_str(struct dn_list *list, const char *dn) +static int ltdb_dn_list_find_str(struct ltdb_private *ltdb, + struct dn_list *list, + const char *dn) { struct ldb_val v; v.data = discard_const_p(unsigned char, dn); v.length = strlen(dn); - return ltdb_dn_list_find_val(list, &v); + return ltdb_dn_list_find_val(ltdb, list, &v); } /* @@ -219,7 +223,9 @@ /* save a dn_list into a full @IDX style record */ -static int ltdb_dn_list_store_full(struct ldb_module *module, struct ldb_dn *dn, +static int ltdb_dn_list_store_full(struct ldb_module *module, + struct ltdb_private *ltdb, + struct ldb_dn *dn, struct dn_list *list) { struct ldb_message *msg; @@ -274,7 +280,8 @@ struct dn_list *list2; if (ltdb->idxptr == NULL) { - return ltdb_dn_list_store_full(module, dn, list); + return ltdb_dn_list_store_full(module, ltdb, + dn, list); } if (ltdb->idxptr->itdb == NULL) { @@ -345,7 +352,8 @@ return -1; } - ltdb->idxptr->error = ltdb_dn_list_store_full(module, dn, list); + ltdb->idxptr->error = ltdb_dn_list_store_full(module, ltdb, + dn, list); talloc_free(dn); if (ltdb->idxptr->error != 0) { return -1; @@ -575,6 +583,7 @@ list = list & list2 */ static bool list_intersect(struct ldb_context *ldb, + struct ltdb_private *ltdb, struct dn_list *list, const struct dn_list *list2) { struct dn_list *list3; @@ -622,7 +631,8 @@ list3->count = 0; for (i=0;icount;i++) { - if (ltdb_dn_list_find_val(list2, &list->dn[i]) != -1) { + if (ltdb_dn_list_find_val(ltdb, list2, + &list->dn[i]) != -1) { list3->dn[list3->count] = list->dn[i]; list3->count++; } @@ -846,7 +856,8 @@ list->dn = list2->dn; list->count = list2->count; found = true; - } else if (!list_intersect(ldb, list, list2)) { + } else if (!list_intersect(ldb, ltdb, + list, list2)) { talloc_free(list2); return LDB_ERR_OPERATIONS_ERROR; } @@ -952,7 +963,8 @@ filter a candidate dn_list from an indexed search into a set of results extracting just the given attributes */ -static int ltdb_index_filter(const struct dn_list *dn_list, +static int ltdb_index_filter(struct ltdb_private *ltdb, + const struct dn_list *dn_list, struct ltdb_context *ac, uint32_t *match_count) { @@ -1063,6 +1075,7 @@ */ int ltdb_search_indexed(struct ltdb_context *ac, uint32_t *match_count) { + struct ldb_context *ldb = ldb_module_get_ctx(ac->module); struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(ac->module), struct ltdb_private); struct dn_list *dn_list; int ret; @@ -1097,6 +1110,8 @@ break; case LDB_SCOPE_ONELEVEL: + { + struct dn_list *idx_one_tree_list = NULL; if (!ltdb->cache->one_level_indexes) { talloc_free(dn_list); return LDB_ERR_OPERATIONS_ERROR; @@ -1106,8 +1121,54 @@ talloc_free(dn_list); return ret; } - break; + /* + * If we have too many matches, also try the filter + * tree and do index work there + * + * We only do this in the GUID index mode, which is + * O(n*log(m)) otherwise the intersection below will + * be too costly at O(n*m). + */ + idx_one_tree_list + = talloc_zero(ac, struct dn_list); + if (idx_one_tree_list == NULL) { + return ldb_module_oom(ac->module); + } + + if (!ltdb->cache->attribute_indexes) { + talloc_free(idx_one_tree_list); + talloc_free(dn_list); + return LDB_ERR_OPERATIONS_ERROR; + } + /* + * Here we load the index for the tree. + */ + ret = ltdb_index_dn(ac->module, ltdb, ac->tree, + idx_one_tree_list); + if (ret != LDB_SUCCESS) { + talloc_free(idx_one_tree_list); + talloc_free(dn_list); + return ret; + } + + /* + * We have to avoid the O(n*m) behaviour here blowing + * up, so we only intersect the lists if it will + * really help + */ + if (idx_one_tree_list->count < 10) { + if (!list_intersect(ldb, ltdb, + dn_list, idx_one_tree_list)) { + talloc_free(idx_one_tree_list); + talloc_free(dn_list); + return LDB_ERR_OPERATIONS_ERROR; + } + } else { + talloc_free(idx_one_tree_list); + } + break; + } case LDB_SCOPE_SUBTREE: case LDB_SCOPE_DEFAULT: if (!ltdb->cache->attribute_indexes) { @@ -1123,7 +1184,7 @@ break; } - ret = ltdb_index_filter(dn_list, ac, match_count); + ret = ltdb_index_filter(ltdb, dn_list, ac, match_count); talloc_free(dn_list); return ret; } @@ -1148,7 +1209,9 @@ * * @return An ldb error code */ -static int ltdb_index_add1(struct ldb_module *module, const char *dn, +static int ltdb_index_add1(struct ldb_module *module, + struct ltdb_private *ltdb, + const char *dn, struct ldb_message_element *el, int v_idx) { struct ldb_context *ldb; @@ -1227,12 +1290,15 @@ /* add index entries for one elements in a message */ -static int ltdb_index_add_el(struct ldb_module *module, const char *dn, +static int ltdb_index_add_el(struct ldb_module *module, + struct ltdb_private *ltdb, + const char *dn, struct ldb_message_element *el) { unsigned int i; for (i = 0; i < el->num_values; i++) { - int ret = ltdb_index_add1(module, dn, el, i); + int ret = ltdb_index_add1(module, ltdb, + dn, el, i); if (ret != LDB_SUCCESS) { return ret; } @@ -1244,11 +1310,12 @@ /* add index entries for all elements in a message */ -static int ltdb_index_add_all(struct ldb_module *module, const char *dn, +static int ltdb_index_add_all(struct ldb_module *module, + struct ltdb_private *ltdb, + const char *dn, struct ldb_message_element *elements, unsigned int num_el) { - struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private); unsigned int i; if (dn[0] == '@') { @@ -1265,7 +1332,7 @@ if (!ltdb_is_indexed(module, ltdb, elements[i].name)) { continue; } - ret = ltdb_index_add_el(module, dn, &elements[i]); + ret = ltdb_index_add_el(module, ltdb, dn, &elements[i]); if (ret != LDB_SUCCESS) { struct ldb_context *ldb = ldb_module_get_ctx(module); ldb_asprintf_errstring(ldb, @@ -1321,9 +1388,9 @@ el.num_values = 1; if (add) { - ret = ltdb_index_add1(module, dn, &el, 0); + ret = ltdb_index_add1(module, ltdb, dn, &el, 0); } else { /* delete */ - ret = ltdb_index_del_value(module, msg->dn, &el, 0); + ret = ltdb_index_del_value(module, ltdb, msg->dn, &el, 0); } talloc_free(pdn); @@ -1335,23 +1402,27 @@ add the index entries for a new element in a record The caller guarantees that these element values are not yet indexed */ -int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn, +int ltdb_index_add_element(struct ldb_module *module, + struct ltdb_private *ltdb, + struct ldb_dn *dn, struct ldb_message_element *el) { - struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private); if (ldb_dn_is_special(dn)) { return LDB_SUCCESS; } if (!ltdb_is_indexed(module, ltdb, el->name)) { return LDB_SUCCESS; } - return ltdb_index_add_el(module, ldb_dn_get_linearized(dn), el); + return ltdb_index_add_el(module, ltdb, + ldb_dn_get_linearized(dn), el); } /* add the index entries for a new record */ -int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg) +int ltdb_index_add_new(struct ldb_module *module, + struct ltdb_private *ltdb, + const struct ldb_message *msg) { const char *dn; int ret; @@ -1365,7 +1436,8 @@ return LDB_ERR_OPERATIONS_ERROR; } - ret = ltdb_index_add_all(module, dn, msg->elements, msg->num_elements); + ret = ltdb_index_add_all(module, ltdb, dn, msg->elements, + msg->num_elements); if (ret != LDB_SUCCESS) { return ret; } @@ -1377,7 +1449,9 @@ /* delete an index entry for one message element */ -int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn, +int ltdb_index_del_value(struct ldb_module *module, + struct ltdb_private *ltdb, + struct ldb_dn *dn, struct ldb_message_element *el, unsigned int v_idx) { struct ldb_context *ldb; @@ -1422,7 +1496,7 @@ return ret; } - i = ltdb_dn_list_find_str(list, dn_str); + i = ltdb_dn_list_find_str(ltdb, list, dn_str); if (i == -1) { /* nothing to delete */ talloc_free(dn_key); @@ -1452,10 +1526,11 @@ delete the index entries for a element return -1 on failure */ -int ltdb_index_del_element(struct ldb_module *module, struct ldb_dn *dn, +int ltdb_index_del_element(struct ldb_module *module, + struct ltdb_private *ltdb, + struct ldb_dn *dn, struct ldb_message_element *el) { - struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private); const char *dn_str; int ret; unsigned int i; @@ -1478,7 +1553,7 @@ return LDB_SUCCESS; } for (i = 0; i < el->num_values; i++) { - ret = ltdb_index_del_value(module, dn, el, i); + ret = ltdb_index_del_value(module, ltdb, dn, el, i); if (ret != LDB_SUCCESS) { return ret; } @@ -1512,7 +1587,8 @@ } for (i = 0; i < msg->num_elements; i++) { - ret = ltdb_index_del_element(module, msg->dn, &msg->elements[i]); + ret = ltdb_index_del_element(module, ltdb, + msg->dn, &msg->elements[i]); if (ret != LDB_SUCCESS) { return ret; } @@ -1677,6 +1753,8 @@ struct ldb_context *ldb; struct ltdb_reindex_context *ctx = (struct ltdb_reindex_context *)state; struct ldb_module *module = ctx->module; + struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), + struct ltdb_private); struct ldb_message *msg; const char *dn = NULL; unsigned int nb_elements_in_db; @@ -1738,7 +1816,8 @@ return -1; } - ret = ltdb_index_add_all(module, dn, msg->elements, msg->num_elements); + ret = ltdb_index_add_all(module, ltdb, dn, + msg->elements, msg->num_elements); if (ret != LDB_SUCCESS) { ctx->error = ret; diff -Nru ldb-1.2.2/ldb_tdb/ldb_tdb.c ldb-1.2.3/ldb_tdb/ldb_tdb.c --- ldb-1.2.2/ldb_tdb/ldb_tdb.c 2017-09-07 10:04:11.000000000 +0000 +++ ldb-1.2.3/ldb_tdb/ldb_tdb.c 2017-12-22 13:37:07.000000000 +0000 @@ -355,6 +355,7 @@ } static int ltdb_add_internal(struct ldb_module *module, + struct ltdb_private *ltdb, const struct ldb_message *msg, bool check_single_value) { @@ -419,7 +420,7 @@ return ret; } - ret = ltdb_index_add_new(module, msg); + ret = ltdb_index_add_new(module, ltdb, msg); if (ret != LDB_SUCCESS) { return ret; } @@ -436,6 +437,8 @@ { struct ldb_module *module = ctx->module; struct ldb_request *req = ctx->req; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret = LDB_SUCCESS; ret = ltdb_check_special_dn(module, req->op.add.message); @@ -449,7 +452,8 @@ return LDB_ERR_OPERATIONS_ERROR; } - ret = ltdb_add_internal(module, req->op.add.message, true); + ret = ltdb_add_internal(module, ltdb, + req->op.add.message, true); return ret; } @@ -609,6 +613,7 @@ delete all elements having a specified attribute name */ static int msg_delete_attribute(struct ldb_module *module, + struct ltdb_private *ltdb, struct ldb_message *msg, const char *name) { unsigned int i; @@ -621,7 +626,7 @@ } i = el - msg->elements; - ret = ltdb_index_del_element(module, msg->dn, el); + ret = ltdb_index_del_element(module, ltdb, msg->dn, el); if (ret != LDB_SUCCESS) { return ret; } @@ -643,6 +648,7 @@ return LDB Error on failure */ static int msg_delete_element(struct ldb_module *module, + struct ltdb_private *ltdb, struct ldb_message *msg, const char *name, const struct ldb_val *val) @@ -675,10 +681,11 @@ } if (matched) { if (el->num_values == 1) { - return msg_delete_attribute(module, msg, name); + return msg_delete_attribute(module, + ltdb, msg, name); } - ret = ltdb_index_del_value(module, msg->dn, el, i); + ret = ltdb_index_del_value(module, ltdb, msg->dn, el, i); if (ret != LDB_SUCCESS) { return ret; } @@ -715,6 +722,8 @@ struct ldb_request *req) { struct ldb_context *ldb = ldb_module_get_ctx(module); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message *msg2; unsigned int i, j; int ret = LDB_SUCCESS, idx; @@ -800,7 +809,8 @@ ret = LDB_ERR_OTHER; goto done; } - ret = ltdb_index_add_element(module, msg2->dn, + ret = ltdb_index_add_element(module, ltdb, + msg2->dn, el); if (ret != LDB_SUCCESS) { goto done; @@ -881,7 +891,8 @@ el2->values = vals; el2->num_values += el->num_values; - ret = ltdb_index_add_element(module, msg2->dn, el); + ret = ltdb_index_add_element(module, ltdb, + msg2->dn, el); if (ret != LDB_SUCCESS) { goto done; } @@ -945,7 +956,8 @@ } /* Delete the attribute if it exists in the DB */ - if (msg_delete_attribute(module, msg2, + if (msg_delete_attribute(module, ltdb, + msg2, el->name) != 0) { ret = LDB_ERR_OTHER; goto done; @@ -958,7 +970,8 @@ goto done; } - ret = ltdb_index_add_element(module, msg2->dn, el); + ret = ltdb_index_add_element(module, ltdb, + msg2->dn, el); if (ret != LDB_SUCCESS) { goto done; } @@ -974,7 +987,9 @@ if (msg->elements[i].num_values == 0) { /* Delete the whole attribute */ - ret = msg_delete_attribute(module, msg2, + ret = msg_delete_attribute(module, + ltdb, + msg2, msg->elements[i].name); if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE && control_permissive) { @@ -991,6 +1006,7 @@ /* Delete specified values from an attribute */ for (j=0; j < msg->elements[i].num_values; j++) { ret = msg_delete_element(module, + ltdb, msg2, msg->elements[i].name, &msg->elements[i].values[j]); @@ -1142,7 +1158,7 @@ * deleted attributes. We could go through all elements but that's * maybe not the most efficient way */ - ret = ltdb_add_internal(module, msg, false); + ret = ltdb_add_internal(module, ltdb, msg, false); talloc_free(msg); diff -Nru ldb-1.2.2/ldb_tdb/ldb_tdb.h ldb-1.2.3/ldb_tdb/ldb_tdb.h --- ldb-1.2.2/ldb_tdb/ldb_tdb.h 2017-09-07 10:04:11.000000000 +0000 +++ ldb-1.2.3/ldb_tdb/ldb_tdb.h 2017-12-22 13:37:07.000000000 +0000 @@ -82,13 +82,21 @@ struct ldb_parse_tree; int ltdb_search_indexed(struct ltdb_context *ctx, uint32_t *); -int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg); +int ltdb_index_add_new(struct ldb_module *module, + struct ltdb_private *ltdb, + const struct ldb_message *msg); int ltdb_index_delete(struct ldb_module *module, const struct ldb_message *msg); -int ltdb_index_del_element(struct ldb_module *module, struct ldb_dn *dn, +int ltdb_index_del_element(struct ldb_module *module, + struct ltdb_private *ltdb, + struct ldb_dn *dn, struct ldb_message_element *el); -int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn, +int ltdb_index_add_element(struct ldb_module *module, + struct ltdb_private *ltdb, + struct ldb_dn *dn, struct ldb_message_element *el); -int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn, +int ltdb_index_del_value(struct ldb_module *module, + struct ltdb_private *ltdb, + struct ldb_dn *dn, struct ldb_message_element *el, unsigned int v_idx); int ltdb_reindex(struct ldb_module *module); int ltdb_index_transaction_start(struct ldb_module *module); diff -Nru ldb-1.2.2/lib/replace/wscript ldb-1.2.3/lib/replace/wscript --- ldb-1.2.2/lib/replace/wscript 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/replace/wscript 2017-12-22 13:37:07.000000000 +0000 @@ -249,24 +249,15 @@ if conf.CONFIG_SET('HAVE_MEMALIGN'): conf.CHECK_DECLS('memalign', headers='malloc.h') - # glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT. - if conf.CHECK_CODE(''' -#define _XOPEN_SOURCE 600 -#include -#if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4)) -#error probably broken posix_fallocate -#endif -''', - '_POSIX_FALLOCATE_CAPABLE_LIBC', - msg='Checking for posix_fallocate-capable libc'): - conf.CHECK_FUNCS('posix_fallocate') - conf.CHECK_FUNCS('prctl dirname basename') + strlcpy_in_bsd = False + # libbsd on some platforms provides strlcpy and strlcat if not conf.CHECK_FUNCS('strlcpy strlcat'): - conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', - checklibc=True) + if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', + checklibc=True): + strlcpy_in_bsd = True if not conf.CHECK_FUNCS('getpeereid'): conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): @@ -623,6 +614,9 @@ # look for a method of finding the list of network interfaces for method in ['HAVE_IFACE_GETIFADDRS', 'HAVE_IFACE_AIX', 'HAVE_IFACE_IFCONF', 'HAVE_IFACE_IFREQ']: + bsd_for_strlcpy = '' + if strlcpy_in_bsd: + bsd_for_strlcpy = ' bsd' if conf.CHECK_CODE(''' #define %s 1 #define NO_CONFIG_H 1 @@ -635,7 +629,7 @@ #include "test/getifaddrs.c" ''' % method, method, - lib='nsl socket', + lib='nsl socket' + bsd_for_strlcpy, addmain=False, execute=True): break diff -Nru ldb-1.2.2/lib/talloc/ABI/pytalloc-util-2.1.10.sigs ldb-1.2.3/lib/talloc/ABI/pytalloc-util-2.1.10.sigs --- ldb-1.2.2/lib/talloc/ABI/pytalloc-util-2.1.10.sigs 2017-07-22 22:23:56.000000000 +0000 +++ ldb-1.2.3/lib/talloc/ABI/pytalloc-util-2.1.10.sigs 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -_pytalloc_check_type: int (PyObject *, const char *) -_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) -_pytalloc_get_ptr: void *(PyObject *) -_pytalloc_get_type: void *(PyObject *, const char *) -pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) -pytalloc_BaseObject_check: int (PyObject *) -pytalloc_BaseObject_size: size_t (void) -pytalloc_CObject_FromTallocPtr: PyObject *(void *) -pytalloc_Check: int (PyObject *) -pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) -pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) -pytalloc_GetBaseObjectType: PyTypeObject *(void) -pytalloc_GetObjectType: PyTypeObject *(void) -pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) -pytalloc_steal: PyObject *(PyTypeObject *, void *) -pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -Nru ldb-1.2.2/lib/talloc/ABI/pytalloc-util.py3-2.1.10.sigs ldb-1.2.3/lib/talloc/ABI/pytalloc-util.py3-2.1.10.sigs --- ldb-1.2.2/lib/talloc/ABI/pytalloc-util.py3-2.1.10.sigs 2017-07-22 22:23:56.000000000 +0000 +++ ldb-1.2.3/lib/talloc/ABI/pytalloc-util.py3-2.1.10.sigs 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -_pytalloc_check_type: int (PyObject *, const char *) -_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) -_pytalloc_get_ptr: void *(PyObject *) -_pytalloc_get_type: void *(PyObject *, const char *) -pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) -pytalloc_BaseObject_check: int (PyObject *) -pytalloc_BaseObject_size: size_t (void) -pytalloc_Check: int (PyObject *) -pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) -pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) -pytalloc_GetBaseObjectType: PyTypeObject *(void) -pytalloc_GetObjectType: PyTypeObject *(void) -pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) -pytalloc_steal: PyObject *(PyTypeObject *, void *) -pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -Nru ldb-1.2.2/lib/talloc/ABI/talloc-2.1.10.sigs ldb-1.2.3/lib/talloc/ABI/talloc-2.1.10.sigs --- ldb-1.2.2/lib/talloc/ABI/talloc-2.1.10.sigs 2017-07-22 22:23:56.000000000 +0000 +++ ldb-1.2.3/lib/talloc/ABI/talloc-2.1.10.sigs 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -_talloc: void *(const void *, size_t) -_talloc_array: void *(const void *, size_t, unsigned int, const char *) -_talloc_free: int (void *, const char *) -_talloc_get_type_abort: void *(const void *, const char *, const char *) -_talloc_memdup: void *(const void *, const void *, size_t, const char *) -_talloc_move: void *(const void *, const void *) -_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) -_talloc_realloc: void *(const void *, void *, size_t, const char *) -_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) -_talloc_reference_loc: void *(const void *, const void *, const char *) -_talloc_set_destructor: void (const void *, int (*)(void *)) -_talloc_steal_loc: void *(const void *, const void *, const char *) -_talloc_zero: void *(const void *, size_t, const char *) -_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) -talloc_asprintf: char *(const void *, const char *, ...) -talloc_asprintf_append: char *(char *, const char *, ...) -talloc_asprintf_append_buffer: char *(char *, const char *, ...) -talloc_autofree_context: void *(void) -talloc_check_name: void *(const void *, const char *) -talloc_disable_null_tracking: void (void) -talloc_enable_leak_report: void (void) -talloc_enable_leak_report_full: void (void) -talloc_enable_null_tracking: void (void) -talloc_enable_null_tracking_no_autofree: void (void) -talloc_find_parent_byname: void *(const void *, const char *) -talloc_free_children: void (void *) -talloc_get_name: const char *(const void *) -talloc_get_size: size_t (const void *) -talloc_increase_ref_count: int (const void *) -talloc_init: void *(const char *, ...) -talloc_is_parent: int (const void *, const void *) -talloc_named: void *(const void *, size_t, const char *, ...) -talloc_named_const: void *(const void *, size_t, const char *) -talloc_parent: void *(const void *) -talloc_parent_name: const char *(const void *) -talloc_pool: void *(const void *, size_t) -talloc_realloc_fn: void *(const void *, void *, size_t) -talloc_reference_count: size_t (const void *) -talloc_reparent: void *(const void *, const void *, const void *) -talloc_report: void (const void *, FILE *) -talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) -talloc_report_depth_file: void (const void *, int, int, FILE *) -talloc_report_full: void (const void *, FILE *) -talloc_set_abort_fn: void (void (*)(const char *)) -talloc_set_log_fn: void (void (*)(const char *)) -talloc_set_log_stderr: void (void) -talloc_set_memlimit: int (const void *, size_t) -talloc_set_name: const char *(const void *, const char *, ...) -talloc_set_name_const: void (const void *, const char *) -talloc_show_parents: void (const void *, FILE *) -talloc_strdup: char *(const void *, const char *) -talloc_strdup_append: char *(char *, const char *) -talloc_strdup_append_buffer: char *(char *, const char *) -talloc_strndup: char *(const void *, const char *, size_t) -talloc_strndup_append: char *(char *, const char *, size_t) -talloc_strndup_append_buffer: char *(char *, const char *, size_t) -talloc_test_get_magic: int (void) -talloc_total_blocks: size_t (const void *) -talloc_total_size: size_t (const void *) -talloc_unlink: int (const void *, void *) -talloc_vasprintf: char *(const void *, const char *, va_list) -talloc_vasprintf_append: char *(char *, const char *, va_list) -talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) -talloc_version_major: int (void) -talloc_version_minor: int (void) diff -Nru ldb-1.2.2/lib/talloc/wscript ldb-1.2.3/lib/talloc/wscript --- ldb-1.2.2/lib/talloc/wscript 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/talloc/wscript 2017-12-22 13:37:07.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.1.10' +VERSION = '2.1.9' blddir = 'bin' @@ -74,22 +74,19 @@ implied_deps='replace'): conf.define('USING_SYSTEM_TALLOC', 1) - if conf.env.disable_python: + using_system_pytalloc_util = True + if not conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION, + implied_deps='talloc replace'): using_system_pytalloc_util = False - else: - using_system_pytalloc_util = True - if not conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION, + + # We need to get a pytalloc-util for all the python versions + # we are building for + if conf.env['EXTRA_PYTHON']: + name = 'pytalloc-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG'] + if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION, implied_deps='talloc replace'): using_system_pytalloc_util = False - # We need to get a pytalloc-util for all the python versions - # we are building for - if conf.env['EXTRA_PYTHON']: - name = 'pytalloc-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG'] - if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION, - implied_deps='talloc replace'): - using_system_pytalloc_util = False - if using_system_pytalloc_util: conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1) @@ -174,18 +171,12 @@ def test(ctx): '''run talloc testsuite''' import Utils, samba_utils - - samba_utils.ADD_LD_LIBRARY_PATH('bin/shared') - samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private') - cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite') ret = samba_utils.RUN_COMMAND(cmd) print("testsuite returned %d" % ret) magic_helper_cmd = os.path.join(Utils.g_module.blddir, 'talloc_test_magic_differs_helper') magic_cmd = os.path.join(srcdir, 'lib', 'talloc', 'test_magic_differs.sh') - if not os.path.exists(magic_cmd): - magic_cmd = os.path.join(srcdir, 'test_magic_differs.sh') magic_ret = samba_utils.RUN_COMMAND(magic_cmd + " " + magic_helper_cmd) print("magic differs test returned %d" % magic_ret) diff -Nru ldb-1.2.2/lib/tdb/ABI/tdb-1.3.15.sigs ldb-1.2.3/lib/tdb/ABI/tdb-1.3.15.sigs --- ldb-1.2.2/lib/tdb/ABI/tdb-1.3.15.sigs 2017-08-24 11:57:41.000000000 +0000 +++ ldb-1.2.3/lib/tdb/ABI/tdb-1.3.15.sigs 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -tdb_add_flags: void (struct tdb_context *, unsigned int) -tdb_append: int (struct tdb_context *, TDB_DATA, TDB_DATA) -tdb_chainlock: int (struct tdb_context *, TDB_DATA) -tdb_chainlock_mark: int (struct tdb_context *, TDB_DATA) -tdb_chainlock_nonblock: int (struct tdb_context *, TDB_DATA) -tdb_chainlock_read: int (struct tdb_context *, TDB_DATA) -tdb_chainlock_read_nonblock: int (struct tdb_context *, TDB_DATA) -tdb_chainlock_unmark: int (struct tdb_context *, TDB_DATA) -tdb_chainunlock: int (struct tdb_context *, TDB_DATA) -tdb_chainunlock_read: int (struct tdb_context *, TDB_DATA) -tdb_check: int (struct tdb_context *, int (*)(TDB_DATA, TDB_DATA, void *), void *) -tdb_close: int (struct tdb_context *) -tdb_delete: int (struct tdb_context *, TDB_DATA) -tdb_dump_all: void (struct tdb_context *) -tdb_enable_seqnum: void (struct tdb_context *) -tdb_error: enum TDB_ERROR (struct tdb_context *) -tdb_errorstr: const char *(struct tdb_context *) -tdb_exists: int (struct tdb_context *, TDB_DATA) -tdb_fd: int (struct tdb_context *) -tdb_fetch: TDB_DATA (struct tdb_context *, TDB_DATA) -tdb_firstkey: TDB_DATA (struct tdb_context *) -tdb_freelist_size: int (struct tdb_context *) -tdb_get_flags: int (struct tdb_context *) -tdb_get_logging_private: void *(struct tdb_context *) -tdb_get_seqnum: int (struct tdb_context *) -tdb_hash_size: int (struct tdb_context *) -tdb_increment_seqnum_nonblock: void (struct tdb_context *) -tdb_jenkins_hash: unsigned int (TDB_DATA *) -tdb_lock_nonblock: int (struct tdb_context *, int, int) -tdb_lockall: int (struct tdb_context *) -tdb_lockall_mark: int (struct tdb_context *) -tdb_lockall_nonblock: int (struct tdb_context *) -tdb_lockall_read: int (struct tdb_context *) -tdb_lockall_read_nonblock: int (struct tdb_context *) -tdb_lockall_unmark: int (struct tdb_context *) -tdb_log_fn: tdb_log_func (struct tdb_context *) -tdb_map_size: size_t (struct tdb_context *) -tdb_name: const char *(struct tdb_context *) -tdb_nextkey: TDB_DATA (struct tdb_context *, TDB_DATA) -tdb_null: dptr = 0xXXXX, dsize = 0 -tdb_open: struct tdb_context *(const char *, int, int, int, mode_t) -tdb_open_ex: struct tdb_context *(const char *, int, int, int, mode_t, const struct tdb_logging_context *, tdb_hash_func) -tdb_parse_record: int (struct tdb_context *, TDB_DATA, int (*)(TDB_DATA, TDB_DATA, void *), void *) -tdb_printfreelist: int (struct tdb_context *) -tdb_remove_flags: void (struct tdb_context *, unsigned int) -tdb_reopen: int (struct tdb_context *) -tdb_reopen_all: int (int) -tdb_repack: int (struct tdb_context *) -tdb_rescue: int (struct tdb_context *, void (*)(TDB_DATA, TDB_DATA, void *), void *) -tdb_runtime_check_for_robust_mutexes: bool (void) -tdb_set_logging_function: void (struct tdb_context *, const struct tdb_logging_context *) -tdb_set_max_dead: void (struct tdb_context *, int) -tdb_setalarm_sigptr: void (struct tdb_context *, volatile sig_atomic_t *) -tdb_store: int (struct tdb_context *, TDB_DATA, TDB_DATA, int) -tdb_storev: int (struct tdb_context *, TDB_DATA, const TDB_DATA *, int, int) -tdb_summary: char *(struct tdb_context *) -tdb_transaction_active: bool (struct tdb_context *) -tdb_transaction_cancel: int (struct tdb_context *) -tdb_transaction_commit: int (struct tdb_context *) -tdb_transaction_prepare_commit: int (struct tdb_context *) -tdb_transaction_start: int (struct tdb_context *) -tdb_transaction_start_nonblock: int (struct tdb_context *) -tdb_transaction_write_lock_mark: int (struct tdb_context *) -tdb_transaction_write_lock_unmark: int (struct tdb_context *) -tdb_traverse: int (struct tdb_context *, tdb_traverse_func, void *) -tdb_traverse_read: int (struct tdb_context *, tdb_traverse_func, void *) -tdb_unlock: int (struct tdb_context *, int, int) -tdb_unlockall: int (struct tdb_context *) -tdb_unlockall_read: int (struct tdb_context *) -tdb_validate_freelist: int (struct tdb_context *, int *) -tdb_wipe_all: int (struct tdb_context *) diff -Nru ldb-1.2.2/lib/tdb/common/dump.c ldb-1.2.3/lib/tdb/common/dump.c --- ldb-1.2.2/lib/tdb/common/dump.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/dump.c 2017-12-22 13:37:07.000000000 +0000 @@ -62,11 +62,7 @@ { tdb_off_t rec_ptr, top; - if (i == -1) { - top = FREELIST_TOP; - } else { - top = TDB_HASH_TOP(i); - } + top = TDB_HASH_TOP(i); if (tdb_lock(tdb, i, F_WRLCK) != 0) return -1; diff -Nru ldb-1.2.2/lib/tdb/common/io.c ldb-1.2.3/lib/tdb/common/io.c --- ldb-1.2.2/lib/tdb/common/io.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/io.c 2017-12-22 13:37:07.000000000 +0000 @@ -52,68 +52,29 @@ static ssize_t tdb_pwrite(struct tdb_context *tdb, const void *buf, size_t count, off_t offset) { - ssize_t ret; - if (!tdb_adjust_offset(tdb, &offset)) { return -1; } - - do { - ret = pwrite(tdb->fd, buf, count, offset); - } while ((ret == -1) && (errno == EINTR)); - - return ret; + return pwrite(tdb->fd, buf, count, offset); } static ssize_t tdb_pread(struct tdb_context *tdb, void *buf, size_t count, off_t offset) { - ssize_t ret; - if (!tdb_adjust_offset(tdb, &offset)) { return -1; } - - do { - ret = pread(tdb->fd, buf, count, offset); - } while ((ret == -1) && (errno == EINTR)); - - return ret; + return pread(tdb->fd, buf, count, offset); } static int tdb_ftruncate(struct tdb_context *tdb, off_t length) { - ssize_t ret; - if (!tdb_adjust_offset(tdb, &length)) { return -1; } - - do { - ret = ftruncate(tdb->fd, length); - } while ((ret == -1) && (errno == EINTR)); - - return ret; + return ftruncate(tdb->fd, length); } -#if HAVE_POSIX_FALLOCATE -static int tdb_posix_fallocate(struct tdb_context *tdb, off_t offset, - off_t len) -{ - ssize_t ret; - - if (!tdb_adjust_offset(tdb, &offset)) { - return -1; - } - - do { - ret = posix_fallocate(tdb->fd, offset, len); - } while ((ret == -1) && (errno == EINTR)); - - return ret; -} -#endif - static int tdb_fstat(struct tdb_context *tdb, struct stat *buf) { int ret; @@ -397,7 +358,6 @@ { char buf[8192]; tdb_off_t new_size; - int ret; if (tdb->read_only || tdb->traverse_read) { tdb->ecode = TDB_ERR_RDONLY; @@ -413,36 +373,7 @@ return -1; } -#if HAVE_POSIX_FALLOCATE - ret = tdb_posix_fallocate(tdb, size, addition); - if (ret == 0) { - return 0; - } - if (ret == ENOSPC) { - /* - * The Linux glibc (at least as of 2.24) fallback if - * the file system does not support fallocate does not - * reset the file size back to where it was. Also, to - * me it is unclear from the posix spec of - * posix_fallocate whether this is allowed or - * not. Better be safe than sorry and "goto fail" but - * "return -1" here, leaving the EOF pointer too - * large. - */ - goto fail; - } - - /* - * Retry the "old" way. Possibly unnecessary, but looking at - * our configure script there seem to be weird failure modes - * for posix_fallocate. See commit 3264a98ff16de, which - * probably refers to - * https://sourceware.org/bugzilla/show_bug.cgi?id=1083. - */ -#endif - - ret = tdb_ftruncate(tdb, new_size); - if (ret == -1) { + if (tdb_ftruncate(tdb, new_size) == -1) { char b = 0; ssize_t written = tdb_pwrite(tdb, &b, 1, new_size - 1); if (written == 0) { @@ -478,14 +409,14 @@ TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file write " "returned 0 twice: giving up!\n")); errno = ENOSPC; - goto fail; + return -1; } if (written == -1) { tdb->ecode = TDB_ERR_OOM; TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file write of " "%u bytes failed (%s)\n", (int)n, strerror(errno))); - goto fail; + return -1; } if (written != n) { TDB_LOG((tdb, TDB_DEBUG_WARNING, "expand_file: wrote " @@ -496,28 +427,6 @@ size += written; } return 0; - -fail: - { - int err = errno; - - /* - * We're holding the freelist lock or are inside a - * transaction. Cutting the file is safe, the space we - * tried to allocate can't have been used anywhere in - * the meantime. - */ - - ret = tdb_ftruncate(tdb, size); - if (ret == -1) { - TDB_LOG((tdb, TDB_DEBUG_WARNING, "expand_file: " - "retruncate to %ju failed\n", - (uintmax_t)size)); - } - errno = err; - } - - return -1; } diff -Nru ldb-1.2.2/lib/tdb/common/lock.c ldb-1.2.3/lib/tdb/common/lock.c --- ldb-1.2.2/lib/tdb/common/lock.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/lock.c 2017-12-22 13:37:07.000000000 +0000 @@ -137,33 +137,7 @@ return fcntl(tdb->fd, F_SETLKW, &fl); } -/* - * Calculate the lock offset for a list - * - * list -1 is the freelist, otherwise a hash chain. - * - * Note that we consistently (but without real reason) lock hash chains at an - * offset that is 4 bytes below the real offset of the corresponding list head - * in the db. - * - * This is the memory layout of the hashchain array: - * - * FREELIST_TOP + 0 = freelist - * FREELIST_TOP + 4 = hashtbale list 0 - * FREELIST_TOP + 8 = hashtbale list 1 - * ... - * - * Otoh lock_offset computes: - * - * freelist = FREELIST_TOP - 4 - * list 0 = FREELIST_TOP + 0 - * list 1 = FREELIST_TOP + 4 - * ... - * - * Unfortunately we can't change this calculation in order to align the locking - * offset with the memory layout, as that would make the locking incompatible - * between different tdb versions. - */ +/* list -1 is the alloc list, otherwise a hash chain. */ static tdb_off_t lock_offset(int list) { return FREELIST_TOP + 4*list; diff -Nru ldb-1.2.2/lib/tdb/common/open.c ldb-1.2.3/lib/tdb/common/open.c --- ldb-1.2.2/lib/tdb/common/open.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/open.c 2017-12-22 13:37:07.000000000 +0000 @@ -300,8 +300,7 @@ struct tdb_header header; struct tdb_context *tdb; struct stat st; - int rev = 0; - bool locked = false; + int rev = 0, locked = 0; unsigned char *vp; uint32_t vertest; unsigned v; @@ -513,42 +512,37 @@ /* we need to zero database if we are the only one with it open */ if ((tdb_flags & TDB_CLEAR_IF_FIRST) && - (!tdb->read_only)) { - ret = tdb_nest_lock(tdb, ACTIVE_LOCK, F_WRLCK, - TDB_LOCK_NOWAIT|TDB_LOCK_PROBE); - locked = (ret == 0); - - if (locked) { - ret = tdb_brlock(tdb, F_WRLCK, FREELIST_TOP, 0, - TDB_LOCK_WAIT); - if (ret == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " - "tdb_brlock failed for %s: %s\n", - name, strerror(errno))); - goto fail; - } - ret = tdb_new_database(tdb, &header, hash_size); - if (ret == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " - "tdb_new_database failed for " - "%s: %s\n", name, strerror(errno))); - tdb_unlockall(tdb); - goto fail; - } - ret = tdb_brunlock(tdb, F_WRLCK, FREELIST_TOP, 0); - if (ret == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " - "tdb_unlockall failed for %s: %s\n", - name, strerror(errno))); - goto fail; - } - ret = lseek(tdb->fd, 0, SEEK_SET); - if (ret == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " - "lseek failed for %s: %s\n", - name, strerror(errno))); - goto fail; - } + (!tdb->read_only) && + (locked = (tdb_nest_lock(tdb, ACTIVE_LOCK, F_WRLCK, TDB_LOCK_NOWAIT|TDB_LOCK_PROBE) == 0))) { + ret = tdb_brlock(tdb, F_WRLCK, FREELIST_TOP, 0, + TDB_LOCK_WAIT); + if (ret == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " + "tdb_brlock failed for %s: %s\n", + name, strerror(errno))); + goto fail; + } + ret = tdb_new_database(tdb, &header, hash_size); + if (ret == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " + "tdb_new_database failed for %s: %s\n", + name, strerror(errno))); + tdb_unlockall(tdb); + goto fail; + } + ret = tdb_brunlock(tdb, F_WRLCK, FREELIST_TOP, 0); + if (ret == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " + "tdb_unlockall failed for %s: %s\n", + name, strerror(errno))); + goto fail; + } + ret = lseek(tdb->fd, 0, SEEK_SET); + if (ret == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " + "lseek failed for %s: %s\n", + name, strerror(errno))); + goto fail; } } diff -Nru ldb-1.2.2/lib/tdb/common/tdb.c ldb-1.2.3/lib/tdb/common/tdb.c --- ldb-1.2.2/lib/tdb/common/tdb.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/tdb.c 2017-12-22 13:37:07.000000000 +0000 @@ -541,11 +541,6 @@ for (i=0; iecode = TDB_ERR_EINVAL; - goto fail; - } - dbufs_len += dsize; if (dbufs_len < dsize) { tdb->ecode = TDB_ERR_OOM; @@ -619,10 +614,6 @@ ofs += key.dsize; for (i=0; imethods->tdb_write(tdb, ofs, dbufs[i].dptr, dbufs[i].dsize); if (ret == -1) { diff -Nru ldb-1.2.2/lib/tdb/common/tdb_private.h ldb-1.2.3/lib/tdb/common/tdb_private.h --- ldb-1.2.2/lib/tdb/common/tdb_private.h 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/tdb_private.h 2017-12-22 13:37:07.000000000 +0000 @@ -126,22 +126,6 @@ #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); (x)=NULL;} } while(0) #endif -/* - * Note: the BUCKET macro is broken as it returns an unexpected result when - * called as BUCKET(-1) for the freelist: - * - * -1 is sign converted to an unsigned int 4294967295 and then the modulo - * tdb->hashtable_size is computed. So with a hashtable_size of 10 the result - * is - * - * 4294967295 % hashtable_size = 5. - * - * where it should be -1 (C uses symmetric modulo). - * - * As all callers will lock the same wrong list consistently locking is still - * consistent. We can not change this without an incompatible on-disk format - * change, otherwise different tdb versions would use incompatible locking. - */ #define BUCKET(hash) ((hash) % tdb->hash_size) #define DOCONV() (tdb->flags & TDB_CONVERT) @@ -194,7 +178,7 @@ struct tdb_traverse_lock { struct tdb_traverse_lock *next; uint32_t off; - uint32_t list; + uint32_t hash; int lock_rw; }; diff -Nru ldb-1.2.2/lib/tdb/common/transaction.c ldb-1.2.3/lib/tdb/common/transaction.c --- ldb-1.2.2/lib/tdb/common/transaction.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/transaction.c 2017-12-22 13:37:07.000000000 +0000 @@ -43,7 +43,7 @@ tdb_free() the old record to place it on the normal tdb freelist before allocating the new record - - during transactions, keep a linked list of all writes that have + - during transactions, keep a linked list of writes all that have been performed by intercepting all tdb_write() calls. The hooked transaction versions of tdb_read() and tdb_write() check this linked list and try to use the elements of the list in preference @@ -210,10 +210,6 @@ { uint32_t blk; - if (buf == NULL) { - return -1; - } - /* Only a commit is allowed on a prepared transaction */ if (tdb->transaction->prepared) { tdb->ecode = TDB_ERR_EINVAL; @@ -238,7 +234,9 @@ } len -= len2; off += len2; - buf = (const void *)(len2 + (const char *)buf); + if (buf != NULL) { + buf = (const void *)(len2 + (const char *)buf); + } } if (len == 0) { @@ -291,7 +289,11 @@ } /* overwrite part of an existing block */ - memcpy(tdb->transaction->blocks[blk] + off, buf, len); + if (buf == NULL) { + memset(tdb->transaction->blocks[blk] + off, 0, len); + } else { + memcpy(tdb->transaction->blocks[blk] + off, buf, len); + } if (blk == tdb->transaction->num_blocks-1) { if (len + off > tdb->transaction->last_block_size) { tdb->transaction->last_block_size = len + off; @@ -391,20 +393,10 @@ static int transaction_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t addition) { - const char buf_zero[8192] = {0}; - size_t buf_len = sizeof(buf_zero); - - while (addition > 0) { - size_t n = MIN(addition, buf_len); - int ret; - - ret = transaction_write(tdb, size, buf_zero, n); - if (ret != 0) { - return ret; - } - - addition -= n; - size += n; + /* add a write to the transaction elements, so subsequent + reads see the zero data */ + if (transaction_write(tdb, size, NULL, addition) != 0) { + return -1; } tdb->transaction->expanded = true; diff -Nru ldb-1.2.2/lib/tdb/common/traverse.c ldb-1.2.3/lib/tdb/common/traverse.c --- ldb-1.2.2/lib/tdb/common/traverse.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tdb/common/traverse.c 2017-12-22 13:37:07.000000000 +0000 @@ -37,8 +37,8 @@ int want_next = (tlock->off != 0); /* Lock each chain from the start one. */ - for (; tlock->list < tdb->hash_size; tlock->list++) { - if (!tlock->off && tlock->list != 0) { + for (; tlock->hash < tdb->hash_size; tlock->hash++) { + if (!tlock->off && tlock->hash != 0) { /* this is an optimisation for the common case where the hash chain is empty, which is particularly common for the use of tdb with ldb, where large @@ -67,18 +67,18 @@ factor of around 80 in speed on a linux 2.6.x system (testing using ldbtest). */ - tdb->methods->next_hash_chain(tdb, &tlock->list); - if (tlock->list == tdb->hash_size) { + tdb->methods->next_hash_chain(tdb, &tlock->hash); + if (tlock->hash == tdb->hash_size) { continue; } } - if (tdb_lock(tdb, tlock->list, tlock->lock_rw) == -1) + if (tdb_lock(tdb, tlock->hash, tlock->lock_rw) == -1) return TDB_NEXT_LOCK_ERR; /* No previous record? Start at top of chain. */ if (!tlock->off) { - if (tdb_ofs_read(tdb, TDB_HASH_TOP(tlock->list), + if (tdb_ofs_read(tdb, TDB_HASH_TOP(tlock->hash), &tlock->off) == -1) goto fail; } else { @@ -121,7 +121,7 @@ tdb_do_delete(tdb, current, rec) != 0) goto fail; } - tdb_unlock(tdb, tlock->list, tlock->lock_rw); + tdb_unlock(tdb, tlock->hash, tlock->lock_rw); want_next = 0; } /* We finished iteration without finding anything */ @@ -130,7 +130,7 @@ fail: tlock->off = 0; - if (tdb_unlock(tdb, tlock->list, tlock->lock_rw) != 0) + if (tdb_unlock(tdb, tlock->hash, tlock->lock_rw) != 0) TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_next_lock: On error unlock failed!\n")); return TDB_NEXT_LOCK_ERR; } @@ -181,7 +181,7 @@ if (key.dptr == NULL) { ret = -1; - if (tdb_unlock(tdb, tl->list, tl->lock_rw) + if (tdb_unlock(tdb, tl->hash, tl->lock_rw) != 0) { goto out; } @@ -205,7 +205,7 @@ key.dptr, full_len, 0); if (nread == -1) { ret = -1; - if (tdb_unlock(tdb, tl->list, tl->lock_rw) != 0) + if (tdb_unlock(tdb, tl->hash, tl->lock_rw) != 0) goto out; if (tdb_unlock_record(tdb, tl->off) != 0) TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_traverse: key.dptr == NULL and unlock_record failed!\n")); @@ -218,7 +218,7 @@ tdb_trace_1rec_retrec(tdb, "traverse", key, dbuf); /* Drop chain lock, call out */ - if (tdb_unlock(tdb, tl->list, tl->lock_rw) != 0) { + if (tdb_unlock(tdb, tl->hash, tl->lock_rw) != 0) { ret = -1; goto out; } @@ -314,7 +314,7 @@ /* release any old lock */ if (tdb_unlock_record(tdb, tdb->travlocks.off) != 0) return tdb_null; - tdb->travlocks.off = tdb->travlocks.list = 0; + tdb->travlocks.off = tdb->travlocks.hash = 0; tdb->travlocks.lock_rw = F_RDLCK; /* Grab first record: locks chain and returned record. */ @@ -330,7 +330,7 @@ tdb_trace_retrec(tdb, "tdb_firstkey", key); /* Unlock the hash chain of the record we just read. */ - if (tdb_unlock(tdb, tdb->travlocks.list, tdb->travlocks.lock_rw) != 0) + if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0) TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_firstkey: error occurred while tdb_unlocking!\n")); return key; } @@ -338,7 +338,7 @@ /* find the next entry in the database, returning its key */ _PUBLIC_ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey) { - uint32_t oldlist; + uint32_t oldhash; TDB_DATA key = tdb_null; struct tdb_record rec; unsigned char *k = NULL; @@ -346,7 +346,7 @@ /* Is locked key the old key? If so, traverse will be reliable. */ if (tdb->travlocks.off) { - if (tdb_lock(tdb,tdb->travlocks.list,tdb->travlocks.lock_rw)) + if (tdb_lock(tdb,tdb->travlocks.hash,tdb->travlocks.lock_rw)) return tdb_null; if (tdb_rec_read(tdb, tdb->travlocks.off, &rec) == -1 || !(k = tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec), @@ -359,7 +359,7 @@ SAFE_FREE(k); return tdb_null; } - if (tdb_unlock(tdb, tdb->travlocks.list, tdb->travlocks.lock_rw) != 0) { + if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0) { SAFE_FREE(k); return tdb_null; } @@ -376,13 +376,13 @@ tdb_trace_1rec_retrec(tdb, "tdb_nextkey", oldkey, tdb_null); return tdb_null; } - tdb->travlocks.list = BUCKET(rec.full_hash); + tdb->travlocks.hash = BUCKET(rec.full_hash); if (tdb_lock_record(tdb, tdb->travlocks.off) != 0) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: lock_record failed (%s)!\n", strerror(errno))); return tdb_null; } } - oldlist = tdb->travlocks.list; + oldhash = tdb->travlocks.hash; /* Grab next record: locks chain and returned record, unlocks old record */ @@ -392,11 +392,11 @@ key.dptr = tdb_alloc_read(tdb, tdb->travlocks.off+sizeof(rec), key.dsize); /* Unlock the chain of this new record */ - if (tdb_unlock(tdb, tdb->travlocks.list, tdb->travlocks.lock_rw) != 0) + if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0) TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n")); } /* Unlock the chain of old record */ - if (tdb_unlock(tdb, oldlist, tdb->travlocks.lock_rw) != 0) + if (tdb_unlock(tdb, BUCKET(oldhash), tdb->travlocks.lock_rw) != 0) TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n")); tdb_trace_1rec_retrec(tdb, "tdb_nextkey", oldkey, key); return key; diff -Nru ldb-1.2.2/lib/tdb/wscript ldb-1.2.3/lib/tdb/wscript --- ldb-1.2.2/lib/tdb/wscript 2017-08-24 11:29:08.000000000 +0000 +++ ldb-1.2.3/lib/tdb/wscript 2017-12-22 13:37:07.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tdb' -VERSION = '1.3.15' +VERSION = '1.3.14' blddir = 'bin' diff -Nru ldb-1.2.2/lib/tevent/ABI/tevent-0.9.34.sigs ldb-1.2.3/lib/tevent/ABI/tevent-0.9.34.sigs --- ldb-1.2.2/lib/tevent/ABI/tevent-0.9.34.sigs 1970-01-01 00:00:00.000000000 +0000 +++ ldb-1.2.3/lib/tevent/ABI/tevent-0.9.34.sigs 2017-11-13 10:03:44.000000000 +0000 @@ -0,0 +1,99 @@ +_tevent_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +_tevent_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +_tevent_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +_tevent_create_immediate: struct tevent_immediate *(TALLOC_CTX *, const char *) +_tevent_loop_once: int (struct tevent_context *, const char *) +_tevent_loop_until: int (struct tevent_context *, bool (*)(void *), void *, const char *) +_tevent_loop_wait: int (struct tevent_context *, const char *) +_tevent_queue_create: struct tevent_queue *(TALLOC_CTX *, const char *, const char *) +_tevent_req_callback_data: void *(struct tevent_req *) +_tevent_req_cancel: bool (struct tevent_req *, const char *) +_tevent_req_create: struct tevent_req *(TALLOC_CTX *, void *, size_t, const char *, const char *) +_tevent_req_data: void *(struct tevent_req *) +_tevent_req_done: void (struct tevent_req *, const char *) +_tevent_req_error: bool (struct tevent_req *, uint64_t, const char *) +_tevent_req_nomem: bool (const void *, struct tevent_req *, const char *) +_tevent_req_notify_callback: void (struct tevent_req *, const char *) +_tevent_req_oom: void (struct tevent_req *, const char *) +_tevent_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +_tevent_threaded_schedule_immediate: void (struct tevent_threaded_context *, struct tevent_immediate *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_backend_list: const char **(TALLOC_CTX *) +tevent_cleanup_pending_signal_handlers: void (struct tevent_signal *) +tevent_common_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +tevent_common_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +tevent_common_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_add_timer_v2: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_check_signal: int (struct tevent_context *) +tevent_common_context_destructor: int (struct tevent_context *) +tevent_common_fd_destructor: int (struct tevent_fd *) +tevent_common_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_common_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_common_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_common_have_events: bool (struct tevent_context *) +tevent_common_loop_immediate: bool (struct tevent_context *) +tevent_common_loop_timer_delay: struct timeval (struct tevent_context *) +tevent_common_loop_wait: int (struct tevent_context *, const char *) +tevent_common_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_common_threaded_activate_immediate: void (struct tevent_context *) +tevent_common_wakeup: int (struct tevent_context *) +tevent_common_wakeup_fd: int (int) +tevent_common_wakeup_init: int (struct tevent_context *) +tevent_context_init: struct tevent_context *(TALLOC_CTX *) +tevent_context_init_byname: struct tevent_context *(TALLOC_CTX *, const char *) +tevent_context_init_ops: struct tevent_context *(TALLOC_CTX *, const struct tevent_ops *, void *) +tevent_debug: void (struct tevent_context *, enum tevent_debug_level, const char *, ...) +tevent_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_fd_set_auto_close: void (struct tevent_fd *) +tevent_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_get_trace_callback: void (struct tevent_context *, tevent_trace_callback_t *, void *) +tevent_loop_allow_nesting: void (struct tevent_context *) +tevent_loop_set_nesting_hook: void (struct tevent_context *, tevent_nesting_hook, void *) +tevent_num_signals: size_t (void) +tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_length: size_t (struct tevent_queue *) +tevent_queue_running: bool (struct tevent_queue *) +tevent_queue_start: void (struct tevent_queue *) +tevent_queue_stop: void (struct tevent_queue *) +tevent_queue_wait_recv: bool (struct tevent_req *) +tevent_queue_wait_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct tevent_queue *) +tevent_re_initialise: int (struct tevent_context *) +tevent_register_backend: bool (const char *, const struct tevent_ops *) +tevent_req_default_print: char *(struct tevent_req *, TALLOC_CTX *) +tevent_req_defer_callback: void (struct tevent_req *, struct tevent_context *) +tevent_req_is_error: bool (struct tevent_req *, enum tevent_req_state *, uint64_t *) +tevent_req_is_in_progress: bool (struct tevent_req *) +tevent_req_poll: bool (struct tevent_req *, struct tevent_context *) +tevent_req_post: struct tevent_req *(struct tevent_req *, struct tevent_context *) +tevent_req_print: char *(TALLOC_CTX *, struct tevent_req *) +tevent_req_received: void (struct tevent_req *) +tevent_req_reset_endtime: void (struct tevent_req *) +tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, void *) +tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn) +tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn) +tevent_req_set_endtime: bool (struct tevent_req *, struct tevent_context *, struct timeval) +tevent_req_set_print_fn: void (struct tevent_req *, tevent_req_print_fn) +tevent_sa_info_queue_count: size_t (void) +tevent_set_abort_fn: void (void (*)(const char *)) +tevent_set_debug: int (struct tevent_context *, void (*)(void *, enum tevent_debug_level, const char *, va_list), void *) +tevent_set_debug_stderr: int (struct tevent_context *) +tevent_set_default_backend: void (const char *) +tevent_set_trace_callback: void (struct tevent_context *, tevent_trace_callback_t, void *) +tevent_signal_support: bool (struct tevent_context *) +tevent_thread_proxy_create: struct tevent_thread_proxy *(struct tevent_context *) +tevent_thread_proxy_schedule: void (struct tevent_thread_proxy *, struct tevent_immediate **, tevent_immediate_handler_t, void *) +tevent_threaded_context_create: struct tevent_threaded_context *(TALLOC_CTX *, struct tevent_context *) +tevent_timeval_add: struct timeval (const struct timeval *, uint32_t, uint32_t) +tevent_timeval_compare: int (const struct timeval *, const struct timeval *) +tevent_timeval_current: struct timeval (void) +tevent_timeval_current_ofs: struct timeval (uint32_t, uint32_t) +tevent_timeval_is_zero: bool (const struct timeval *) +tevent_timeval_set: struct timeval (uint32_t, uint32_t) +tevent_timeval_until: struct timeval (const struct timeval *, const struct timeval *) +tevent_timeval_zero: struct timeval (void) +tevent_trace_point_callback: void (struct tevent_context *, enum tevent_trace_point) +tevent_update_timer: void (struct tevent_timer *, struct timeval) +tevent_wakeup_recv: bool (struct tevent_req *) +tevent_wakeup_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct timeval) diff -Nru ldb-1.2.2/lib/tevent/testsuite.c ldb-1.2.3/lib/tevent/testsuite.c --- ldb-1.2.2/lib/tevent/testsuite.c 2017-08-24 11:27:53.000000000 +0000 +++ ldb-1.2.3/lib/tevent/testsuite.c 2017-12-22 13:37:07.000000000 +0000 @@ -25,7 +25,7 @@ */ #include "includes.h" -#include "tevent.h" +#include "lib/tevent/tevent.h" #include "system/filesys.h" #include "system/select.h" #include "system/network.h" diff -Nru ldb-1.2.2/lib/tevent/tevent.c ldb-1.2.3/lib/tevent/tevent.c --- ldb-1.2.2/lib/tevent/tevent.c 2017-06-23 12:20:41.000000000 +0000 +++ ldb-1.2.3/lib/tevent/tevent.c 2017-10-10 07:08:20.000000000 +0000 @@ -128,7 +128,6 @@ done = true; - tevent_select_init(); tevent_poll_init(); tevent_poll_mt_init(); #if defined(HAVE_EPOLL) diff -Nru ldb-1.2.2/lib/tevent/tevent_internal.h ldb-1.2.3/lib/tevent/tevent_internal.h --- ldb-1.2.2/lib/tevent/tevent_internal.h 2016-10-07 04:45:35.000000000 +0000 +++ ldb-1.2.3/lib/tevent/tevent_internal.h 2017-10-10 07:08:20.000000000 +0000 @@ -377,7 +377,6 @@ void tevent_cleanup_pending_signal_handlers(struct tevent_signal *se); bool tevent_standard_init(void); -bool tevent_select_init(void); bool tevent_poll_init(void); void tevent_poll_event_add_fd_internal(struct tevent_context *ev, struct tevent_fd *fde); diff -Nru ldb-1.2.2/lib/tevent/tevent_select.c ldb-1.2.3/lib/tevent/tevent_select.c --- ldb-1.2.2/lib/tevent/tevent_select.c 2016-08-24 08:42:51.000000000 +0000 +++ ldb-1.2.3/lib/tevent/tevent_select.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,280 +0,0 @@ -/* - Unix SMB/CIFS implementation. - main select loop and event handling - Copyright (C) Andrew Tridgell 2003-2005 - Copyright (C) Stefan Metzmacher 2005-2009 - - ** NOTE! The following LGPL license applies to the tevent - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include "replace.h" -#include "system/filesys.h" -#include "system/select.h" -#include "tevent.h" -#include "tevent_util.h" -#include "tevent_internal.h" - -struct select_event_context { - /* a pointer back to the generic event_context */ - struct tevent_context *ev; - - /* the maximum file descriptor number in fd_events */ - int maxfd; -}; - -/* - create a select_event_context structure. -*/ -static int select_event_context_init(struct tevent_context *ev) -{ - struct select_event_context *select_ev; - - /* - * We might be called during tevent_re_initialise() - * which means we need to free our old additional_data. - */ - TALLOC_FREE(ev->additional_data); - - select_ev = talloc_zero(ev, struct select_event_context); - if (!select_ev) return -1; - select_ev->ev = ev; - - ev->additional_data = select_ev; - return 0; -} - -/* - recalculate the maxfd -*/ -static void calc_maxfd(struct select_event_context *select_ev) -{ - struct tevent_fd *fde; - - select_ev->maxfd = 0; - for (fde = select_ev->ev->fd_events; fde; fde = fde->next) { - if (fde->fd > select_ev->maxfd) { - select_ev->maxfd = fde->fd; - } - } -} - - -/* to mark the ev->maxfd invalid - * this means we need to recalculate it - */ -#define EVENT_INVALID_MAXFD (-1) - -/* - destroy an fd_event -*/ -static int select_event_fd_destructor(struct tevent_fd *fde) -{ - struct tevent_context *ev = fde->event_ctx; - struct select_event_context *select_ev = NULL; - - if (ev) { - select_ev = talloc_get_type_abort(ev->additional_data, - struct select_event_context); - - if (select_ev->maxfd == fde->fd) { - select_ev->maxfd = EVENT_INVALID_MAXFD; - } - } - - return tevent_common_fd_destructor(fde); -} - -/* - add a fd based event - return NULL on failure (memory allocation error) -*/ -static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - tevent_fd_handler_t handler, - void *private_data, - const char *handler_name, - const char *location) -{ - struct select_event_context *select_ev = - talloc_get_type_abort(ev->additional_data, - struct select_event_context); - struct tevent_fd *fde; - - if (fd < 0 || fd >= FD_SETSIZE) { - errno = EBADF; - return NULL; - } - - fde = tevent_common_add_fd(ev, mem_ctx, fd, flags, - handler, private_data, - handler_name, location); - if (!fde) return NULL; - - if ((select_ev->maxfd != EVENT_INVALID_MAXFD) - && (fde->fd > select_ev->maxfd)) { - select_ev->maxfd = fde->fd; - } - talloc_set_destructor(fde, select_event_fd_destructor); - - return fde; -} - -/* - event loop handling using select() -*/ -static int select_event_loop_select(struct select_event_context *select_ev, struct timeval *tvalp) -{ - fd_set r_fds, w_fds; - struct tevent_fd *fde; - int selrtn; - int select_errno; - - /* we maybe need to recalculate the maxfd */ - if (select_ev->maxfd == EVENT_INVALID_MAXFD) { - calc_maxfd(select_ev); - } - - FD_ZERO(&r_fds); - FD_ZERO(&w_fds); - - /* setup any fd events */ - for (fde = select_ev->ev->fd_events; fde; fde = fde->next) { - if (fde->fd < 0 || fde->fd >= FD_SETSIZE) { - tevent_debug(select_ev->ev, TEVENT_DEBUG_FATAL, - "ERROR: EBADF fd[%d] >= %d " - "select_event_loop_once\n", - fde->fd, FD_SETSIZE); - errno = EBADF; - return -1; - } - - if (fde->flags & TEVENT_FD_READ) { - FD_SET(fde->fd, &r_fds); - } - if (fde->flags & TEVENT_FD_WRITE) { - FD_SET(fde->fd, &w_fds); - } - } - - if (select_ev->ev->signal_events && - tevent_common_check_signal(select_ev->ev)) { - return 0; - } - - tevent_trace_point_callback(select_ev->ev, TEVENT_TRACE_BEFORE_WAIT); - selrtn = select(select_ev->maxfd+1, &r_fds, &w_fds, NULL, tvalp); - select_errno = errno; - tevent_trace_point_callback(select_ev->ev, TEVENT_TRACE_AFTER_WAIT); - - if (selrtn == -1 && select_errno == EINTR && - select_ev->ev->signal_events) { - tevent_common_check_signal(select_ev->ev); - return 0; - } - - if (selrtn == -1 && select_errno == EBADF) { - /* the socket is dead! this should never - happen as the socket should have first been - made readable and that should have removed - the event, so this must be a bug. This is a - fatal error. */ - tevent_debug(select_ev->ev, TEVENT_DEBUG_FATAL, - "ERROR: EBADF on select_event_loop_once\n"); - errno = select_errno; - return -1; - } - - if (selrtn == 0 && tvalp) { - /* we don't care about a possible delay here */ - tevent_common_loop_timer_delay(select_ev->ev); - return 0; - } - - if (selrtn > 0) { - /* at least one file descriptor is ready - check - which ones and call the handler, being careful to allow - the handler to remove itself when called */ - for (fde = select_ev->ev->fd_events; fde; fde = fde->next) { - uint16_t flags = 0; - - if (FD_ISSET(fde->fd, &r_fds) && (fde->flags & TEVENT_FD_READ)) { - flags |= TEVENT_FD_READ; - } - if (FD_ISSET(fde->fd, &w_fds) && (fde->flags & TEVENT_FD_WRITE)) { - flags |= TEVENT_FD_WRITE; - } - if (flags) { - DLIST_DEMOTE(select_ev->ev->fd_events, fde); - fde->handler(select_ev->ev, fde, flags, fde->private_data); - break; - } - } - } - - return 0; -} - -/* - do a single event loop using the events defined in ev -*/ -static int select_event_loop_once(struct tevent_context *ev, const char *location) -{ - struct select_event_context *select_ev = - talloc_get_type_abort(ev->additional_data, - struct select_event_context); - struct timeval tval; - - if (ev->signal_events && - tevent_common_check_signal(ev)) { - return 0; - } - - if (ev->threaded_contexts != NULL) { - tevent_common_threaded_activate_immediate(ev); - } - - if (ev->immediate_events && - tevent_common_loop_immediate(ev)) { - return 0; - } - - tval = tevent_common_loop_timer_delay(ev); - if (tevent_timeval_is_zero(&tval)) { - return 0; - } - - return select_event_loop_select(select_ev, &tval); -} - -static const struct tevent_ops select_event_ops = { - .context_init = select_event_context_init, - .add_fd = select_event_add_fd, - .set_fd_close_fn = tevent_common_fd_set_close_fn, - .get_fd_flags = tevent_common_fd_get_flags, - .set_fd_flags = tevent_common_fd_set_flags, - .add_timer = tevent_common_add_timer_v2, - .schedule_immediate = tevent_common_schedule_immediate, - .add_signal = tevent_common_add_signal, - .loop_once = select_event_loop_once, - .loop_wait = tevent_common_loop_wait, -}; - -_PRIVATE_ bool tevent_select_init(void) -{ - return tevent_register_backend("select", &select_event_ops); -} diff -Nru ldb-1.2.2/lib/tevent/tevent_threads.c ldb-1.2.3/lib/tevent/tevent_threads.c --- ldb-1.2.2/lib/tevent/tevent_threads.c 2017-06-23 12:20:41.000000000 +0000 +++ ldb-1.2.3/lib/tevent/tevent_threads.c 2017-11-13 09:57:29.000000000 +0000 @@ -451,7 +451,7 @@ { #ifdef HAVE_PTHREAD struct tevent_context *ev; - int ret; + int ret, wakeup_fd; ret = pthread_mutex_lock(&tctx->event_ctx_mutex); if (ret != 0) { @@ -495,6 +495,8 @@ abort(); } + wakeup_fd = tctx->wakeup_fd; + ret = pthread_mutex_unlock(&tctx->event_ctx_mutex); if (ret != 0) { abort(); @@ -510,7 +512,7 @@ * than a noncontended one. So I'd opt for the lower footprint * initially. Maybe we have to change that later. */ - tevent_common_wakeup_fd(tctx->wakeup_fd); + tevent_common_wakeup_fd(wakeup_fd); #else /* * tevent_threaded_context_create() returned NULL with ENOSYS... diff -Nru ldb-1.2.2/lib/tevent/wscript ldb-1.2.3/lib/tevent/wscript --- ldb-1.2.2/lib/tevent/wscript 2017-07-22 22:25:22.000000000 +0000 +++ ldb-1.2.3/lib/tevent/wscript 2017-11-13 09:57:39.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tevent' -VERSION = '0.9.33' +VERSION = '0.9.34' blddir = 'bin' @@ -77,7 +77,7 @@ bld.RECURSE('lib/talloc') SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c - tevent_queue.c tevent_req.c tevent_select.c + tevent_queue.c tevent_req.c tevent_poll.c tevent_threads.c tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c''' diff -Nru ldb-1.2.2/wscript ldb-1.2.3/wscript --- ldb-1.2.2/wscript 2017-09-07 10:04:11.000000000 +0000 +++ ldb-1.2.3/wscript 2017-12-22 13:37:07.000000000 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'ldb' -VERSION = '1.2.2' +VERSION = '1.2.3' blddir = 'bin'