Difference between revisions of "Samba4 Port: hdb & ldb Interfaces"
(→Samba's internal ldb library) |
(→Samba's internal ldb library) |
||
Line 857: | Line 857: | ||
| attr |
| attr |
||
⚫ | |||
+ | |||
=== ldb_build_..._req calls === |
=== ldb_build_..._req calls === |
||
⚫ | |||
⚫ | |||
+ | | common/ldb.c |
||
+ | | |
||
+ | | ++ |
||
+ | | |
||
+ | | + |
||
+ | | |
||
+ | | build...req |
||
⚫ | |||
+ | |- |
||
− | + | | ldb_build_del_req |
|
− | + | | common/ldb.c |
|
− | + | | |
|
− | + | | ++ |
|
− | + | | |
|
− | + | | + |
|
+ | | |
||
+ | | build...req |
||
+ | |||
+ | |- |
||
+ | | ldb_build_extended_req |
||
+ | | common/ldb.c |
||
+ | | |
||
+ | | 1 |
||
+ | | |
||
+ | | + |
||
+ | | |
||
+ | | build...req |
||
+ | |||
+ | |- |
||
+ | | ldb_build_mod_req |
||
+ | | common/ldb.c |
||
+ | | |
||
+ | | ++ |
||
+ | | |
||
+ | | + |
||
+ | | |
||
+ | | build...req |
||
+ | |||
+ | |- |
||
+ | | ldb_build_rename_req |
||
+ | | common/ldb.c |
||
+ | | |
||
+ | | ++ |
||
+ | | |
||
+ | | + |
||
+ | | |
||
+ | | build...req |
||
+ | |||
+ | |- |
||
+ | | ldb_build_search_req |
||
+ | | common/ldb.c |
||
+ | | |
||
+ | | ++ |
||
+ | | |
||
+ | | + |
||
+ | | |
||
+ | | build...req |
||
+ | |||
+ | |- |
||
+ | | ldb_build_search_req_ex |
||
+ | | common/ldb.c |
||
+ | | |
||
+ | | ++ |
||
+ | | |
||
+ | | ++ |
||
+ | | |
||
+ | | build...req |
||
+ | |||
+ | |} |
||
=== ldb_dn_ calls === |
=== ldb_dn_ calls === |
Revision as of 20:04, 15 September 2009
This page aims to reduce the confusion about four DB libraries:
- Two hdb libraries (one each for Samba4 & Heimdal);
- Samba4's LDB library, and
- Samba4's ldb library.
This page also answers two questions that we've wondered about, and which are important for the Samba4 port to MIT-krb:
- Does Heimdal call Samba4 directly?
- Does Samba4 call Heimdal functions directly, without going through the libkdc interface?
Unfortunately, the answer to both questions is "Yes."
Contents
- 1 Samba4's LDB interface to LDAP
- 2 Heimdal's hdb Interface to Samba4's LDB
- 3 Heimdal's internal hdb library
- 4 Samba's internal ldb library
- 4.1 ldb_build_..._req calls
- 4.2 ldb_dn_ calls
- 4.3 ldb_extended_ calls
- 4.4 ldb_get_ calls
- 4.5 ldb_ldif_ calls
- 4.6 ldb_module_ calls
- 4.7 ldb_..._module_ops calls
- 4.8 ldb_msg_ calls
- 4.9 ldb_next_
- 4.10 ldb_request
- 4.11 ldb_schema_ calls
- 4.12 ldb_set_ calls
- 4.13 ldb time calls
- 4.14 ldb_transaction_ calls
- 4.15 ldb_val_ calls
- 4.16 ldb misc grouped calls
- 4.17 ldb miscellaneous calls
Samba4's LDB interface to LDAP
Almost all of the LDB_ routines are in source4/kdc/hdb-samba4.c , and these routines make up half of Samba's kdc-specific code.
Entry-point | Heim use | Smb4 use | Comment |
LDB_destroy | hdb | ||
LDB_fetch | hdb | ||
LDB_firstkey | hdb | ||
LDB_nextkey | hdb | wrapper for LDB_seq | |
LDB_open | hdb | stub | |
LDB_close | hdb | stub | |
LDB_remove | hdb | stub | |
LDB_rename | hdb | stub | |
LDB_store | hdb | stub | |
LDB_lock | hdb | stub | |
LDB_unlock | hdb | stub | |
hdb_samba4_create | hdb | callback | |
kdc_hdb_samba4_create | hdb | kdc_task_init | |
LDB_seq | LDB | ||
LDB_fetch_client | LDB | ||
LDB_fetch_krbtgt | LDB | ||
LDB_fetch_server | LDB | ||
LDB_lookup_principal | LDB | ||
LDB_lookup_spn_alias | samdb | defined in dsdb/samdb | |
LDB_lookup_trust | LDB | ||
LDB_message2entry | LDB | ||
LDB_message2entry_keys | LDB | ||
LDB_trust_message2entry | LDB |
Heimdal's hdb Interface to Samba4's LDB
Samba4's file kdc/hdb-samba4.c contains the LDB_ functions, which only Samba4 uses directly.
In Samba4's heimdal/lib/hdb/hdb.h, Heimdal's HDB structure contains "hdb-" prefixed function-pointers to the LDB functions. Only Heimdal uses this function-pointer interface to Samba4's LDB_ functions:
- (HDB *)->hdb_dbc = NULL;
- (HDB *)->hdb_open = LDB_open;
- (HDB *)->hdb_close = LDB_close;
- (HDB *)->hdb_fetch = LDB_fetch;
- (HDB *)->hdb_store = LDB_store;
- (HDB *)->hdb_remove = LDB_remove;
- (HDB *)->hdb_firstkey = LDB_firstkey;
- (HDB *)->hdb_nextkey = LDB_nextkey;
- (HDB *)->hdb_lock = LDB_lock;
- (HDB *)->hdb_unlock = LDB_unlock;
- (HDB *)->hdb_rename = LDB_rename;
- (HDB *)->hdb__get = NULL;
- (HDB *)->hdb__put = NULL;
- (HDB *)->hdb__del = NULL;
- (HDB *)->hdb_destroy = LDB_destroy;
Samba4's hdb_ library also includes a local function invoked via a function-pointer:
- hdb_ldb_free_entry in kdc/hdb-samba4.c
This function-pointer gets used by both Heimdal & Samba4.
Heimdal's internal hdb library
This library isn't completely "internal," because four of these routines get used by Samba, too:
- initialize_hdb_error_table_r
- free_hdb_entry
- hdb_enctype2key
- hdb_free_entry
Further, the global struct hdb_kt_ops{} gets used only by Samba4.
Two functions here, hdb_lock & hdb_unlock, have the same names as two of the LDB function-pointers (see above):
- (HDB *)->hdb_lock ,
- (HDB *)->hdb_unlock .
Heimdal uses these two function pointers heavily.
Entry-point | heimdal/lib/hdb file | Heim use | Smb4 use |
copy_hdb_entry | asn1_hdb_entry.c | ||
copy_hdb_entry_alias | asn1_hdb_entry_alias.c | ||
decode_hdb_entry | asn1_hdb_entry.c | ||
decode_hdb_entry_alias | asn1_hdb_entry_alias.c | ||
encode_hdb_entry | asn1_hdb_entry.c | ||
encode_hdb_entry_alias | asn1_hdb_entry_alias.c | ||
free_hdb_entry | asn1_hdb_entry.c | hdb ++ | LDB + |
free_hdb_entry_alias | asn1_hdb_entry_alias.c | ||
initialize_hdb_error_table | hdb_err.c | ||
initialize_hdb_error_table_r | hdb_err.c | hdb | kdc |
length_hdb_entry | asn1_hdb_entry.c | ||
length_hdb_entry_alias | asn1_hdb_entry_alias.c | ||
_hdb_fetch | common.c | hdb | |
_hdb_store | common.c | hdb | |
_hdb_remove | common.c | hdb | |
_hdb_find_master_key | mkey.c | hdb | |
_hdb_mkey_decrypt | mkey.c | hdb | |
_hdb_mkey_version | mkey.c | hdb | |
hdb_add_master_key | mkey.c | ||
hdb_check_db_format | hdb.c | NDBM, DB, hdb | |
hdb_clear_extension | ext.c | hdb | |
hdb_clear_master_key | mkey.c | NDBM, DB | |
hdb_create | hdb.c | hdb | |
hdb_db_dr | dbinfo.c | kdc | |
hdb_dbinfo_get_acl_file | dbinfo.c | ||
hdb_dbinfo_get_binding | dbinfo.c | ||
hdb_dbinfo_get_dbname | dbinfo.c | ||
hdb_dbinfo_get_label | dbinfo.c | ||
hdb_dbinfo_get_log_file | dbinfo.c | ||
hdb_dbinfo_get_mkey_file | dbinfo.c | ||
hdb_dbinfo_get_next | dbinfo.c | ||
hdb_dbinfo_get_realm | dbinfo.c | ||
hdb_free_dbinfo | dbinfo.c | ||
hdb_get_dbinfo | dbinfo.c | ||
hdb_default_db | dbinfo.c | ||
hdb_init_db | hdb.c | NDBM, DB, hdb | |
hdb_enctype2key | hdb.c | kdc ++, tgs ++ | kdc |
hdb_entry_check_mandatory | ext.c | ||
hdb_entry_clear_password | ext.c | ||
hdb_entry_get_aliases | ext.c | ||
hdb_entry_get_ConstrainedDelegACL | ext.c | tgs | |
hdb_entry_get_password | ext.c | kdc | |
hdb_entry_get_pkinit_acl | ext.c | kdc | |
hdb_entry_get_pkinit_hash | ext.c | ||
hdb_entry_get_pw_change_time | ext.c | ||
hdb_entry_set_password | ext.c | ||
hdb_entry_set_pw_change_time | ext.c | ||
hdb_find_extension | ext.c | hdb ++ | |
hdb_foreach | hdb.c | ||
hdb_free_entry | hdb.c | NDBM, DB, kdc, hdb + | kdc ++ |
hdb_free_key | hdb.c | ||
hdb_free_keys | keys.c | ||
hdb_free_master_key | mkey.c | hdb | |
hdb_generate_key_set | keys.c | hdb | |
hdb_generate_key_set_password | keys.c | ||
hdb_kt_ops{} | keytab.c | kdc | |
hdb_list_builtin | hdb.c | ||
hdb_lock | hdb.c | NDBM, DB | |
hdb_next_enctype2key | hdb.c | kdc +, hdb | |
hdb_process_master_key | mkey.c | hdb ++ | |
hdb_read_master_key | mkey.c | hdb | |
hdb_replace_extension | ext.c | hdb | |
hdb_seal_key | mkey.c | ||
hdb_seal_keys | mkey.c | ||
hdb_seal_key_mkey | mkey.c | hdb | |
hdb_seal_keys_mkey | mkey.c | hdb | |
hdb_set_master_key | mkey.c | ||
hdb_set_master_keyfile | mkey.c | hdb + | |
hdb_unlock | hdb.c | NDBM, DB | |
hdb_unseal_key | mkey.c | ||
hdb_unseal_keys | mkey.c | NDBM, DB | |
hdb_unseal_key_mkey | mkey.c | hdb | |
hdb_unseal_keys_mkey | mkey.c | hdb |
Samba's internal ldb library
These routines are defined & used only in Samba4, and not in Samba4's heimdal snapshot tree.
Entry-point | Samba4 file | *srv | dsdb | net | ldb | other | ldb grp |
ldb_add | common/ldb.c | + | + | + | ++ | basic | |
ldb_connect | common/ldb.c | 1 | ++ | basic | |||
ldb_debug | common/ldb_debug.c | 1 | ++ | ++ | basic | ||
ldb_delete | common/ldb.c | 1 | + | ++ | basic | ||
ldb_errstring | common/ldb.c | ++ | ++ | ++ | ++ | kdc | basic |
ldb_init | common/ldb.c | 1 | ++ | basic | |||
ldb_modify | common/ldb.c | + | + | + | + | basic | |
ldb_qsort | common/qsort.c | 1 | 1 | 1 | 1 | basic | |
ldb_rename | common/ldb.c | 1 | 1 | + | basic | ||
ldb_request | common/ldb.c | 1 | + | ++ | basic | ||
ldb_search | common/ldb.c | ++ | ++ | ++ | ++ | basic | |
ldb_wait | common/ldb.c | 1 | + | 1 | ++ | basic | |
ldb_attr_casefold | common/ldb_utf8.c | + | attr | ||||
ldb_attr_cmp | lib/ldb/include/ldb.h | ++ | ++ | attr | |||
ldb_attr_dn | common/ldb_utf8.c | 1 | attr | ||||
ldb_attr_in_list | common/ldb_msg.c | + | + | attr | |||
ldb_attr_list_copy | common/ldb_msg.c | 1 | attr | ||||
ldb_attr_list_copy_add | common/ldb_msg.c | 1 | 1 | attr
ldb_build_..._req calls | |||
ldb_build_add_req | common/ldb.c | ++ | + | build...req | |||
ldb_build_del_req | common/ldb.c | ++ | + | build...req | |||
ldb_build_extended_req | common/ldb.c | 1 | + | build...req | |||
ldb_build_mod_req | common/ldb.c | ++ | + | build...req | |||
ldb_build_rename_req | common/ldb.c | ++ | + | build...req | |||
ldb_build_search_req | common/ldb.c | ++ | + | build...req | |||
ldb_build_search_req_ex | common/ldb.c | ++ | ++ | build...req |
ldb_dn_ calls
- ldb_dn_add_base
- ldb_dn_add_base_fmt
- ldb_dn_add_child
- ldb_dn_add_child_fmt
- ldb_dn_alloc_casefold
- ldb_dn_alloc_linearized
- ldb_dn_canonical_ex_strin
- ldb_dn_canonical_string
- ldb_dn_check_local
- ldb_dn_check_special
- ldb_dn_compare
- ldb_dn_compare_base
- ldb_dn_copy
- ldb_dn_escape_value
- ldb_dn_extended_add_synta
- ldb_dn_extended_syntax_by
- ldb_dn_from_ldb_val
- ldb_dn_get_casefold
- ldb_dn_get_comp_num
- ldb_dn_get_component_name
- ldb_dn_get_component_val
- ldb_dn_get_extended_compo
- ldb_dn_get_extended_linea
- ldb_dn_get_linearized
- ldb_dn_get_parent
- ldb_dn_get_rdn_name
- ldb_dn_get_rdn_val
- ldb_dn_has_extended
- ldb_dn_is_null
- ldb_dn_is_special
- ldb_dn_is_valid
- ldb_dn_map_local
- ldb_dn_map_rebase_remote
- ldb_dn_new
- ldb_dn_new_fmt
- ldb_dn_remove_base_compon
- ldb_dn_remove_child_compo
- ldb_dn_set_component
- ldb_dn_set_extended_compo
- ldb_dn_validate
ldb_extended_ calls
- ldb_extended
- ldb_extended_default_call
- ldb_extended_dn_in_module
- ldb_extended_dn_out_deref
- ldb_extended_dn_out_ldb_m
- ldb_extended_dn_store_mod
ldb_get_ calls
- ldb_get_config_basedn
- ldb_get_create_perms
- ldb_get_default_basedn
- ldb_get_event_context
- ldb_get_opaque
- ldb_get_root_basedn
- ldb_get_schema_basedn
ldb_ldif_ calls
- ldb_ldif_read_file
- ldb_ldif_read_free
- ldb_ldif_read_string
- ldb_ldif_write_file
ldb_module_ calls
- ldb_module_done
- ldb_module_get_ctx
- ldb_module_get_private
- ldb_module_new
- ldb_module_send_entry
- ldb_module_send_referral
- ldb_module_set_private
- ldb_modules_list_from_str
- ldb_init_module_chain
- ldb_load_modules
- ldb_load_modules_list
ldb_..._module_ops calls
- ldb_anr_module_ops
- ldb_asq_module_ops
- ldb_dsdb_cache_module_ops
- ldb_entryuuid_module_ops
- ldb_instancetype_module_ops
- ldb_kludge_acl_module_ops
- ldb_ldap_backend_ops
- ldb_ldapi_backend_ops
- ldb_ldaps_backend_ops
- ldb_linked_attributes_module_ops
- ldb_local_password_module_ops
- ldb_naming_fsmo_module_ops
- ldb_nsuniqueid_module_ops
- ldb_objectclass_module_ops
- ldb_objectguid_module_ops
- ldb_operational_module_ops
- ldb_paged_results_module_ops
- ldb_paged_searches_module_ops
- ldb_partition_module_ops
- ldb_password_hash_module_ops
- ldb_pdc_fsmo_module_ops
- ldb_ranged_results_module_ops
- ldb_rdn_name_module_ops
- ldb_register_module
- ldb_repl_meta_data_module_ops
- ldb_rootdse_module_ops
- ldb_samba3sam_module_ops
- ldb_samldb_module_ops
- ldb_server_sort_module_ops
- ldb_show_deleted_module_ops
- ldb_skel_module_ops
- ldb_subtree_delete_module_ops
- ldb_subtree_rename_module_ops
- ldb_tdb_backend_ops
- ldb_update_keytab_module_ops
- ldb_wins_ldb_module_ops
ldb_msg_ calls
- ldb_msg_add
- ldb_msg_add_empty
- ldb_msg_add_fmt
- ldb_msg_add_steal_string
- ldb_msg_add_steal_value
- ldb_msg_add_string
- ldb_msg_add_value
- ldb_msg_canonicalize
- ldb_msg_check_string_attr
- ldb_msg_copy
- ldb_msg_copy_attr
- ldb_msg_copy_shallow
- ldb_msg_diff
- ldb_msg_element_compare
- ldb_msg_find_attr_as_bool
- ldb_msg_find_attr_as_dn
- ldb_msg_find_attr_as_int
- ldb_msg_find_attr_as_int6
- ldb_msg_find_attr_as_stri
- ldb_msg_find_attr_as_uint
- ldb_msg_find_element
- ldb_msg_find_ldb_val
- ldb_msg_find_val
- ldb_msg_new
- ldb_msg_remove_attr
- ldb_msg_remove_element
- ldb_msg_sanity_check
- ldb_msg_sort_elements
ldb_next_
- ldb_next_del_trans
- ldb_next_end_trans
- ldb_next_init
- ldb_next_remote_request
- ldb_next_request
- ldb_next_start_trans
ldb_request
- ldb_request_add_control
- ldb_request_done
- ldb_request_get_control
- ldb_request_get_status
- ldb_request_set_state
ldb_schema_ calls
- ldb_schema_attribute_add
- ldb_schema_attribute_add_
- ldb_schema_attribute_by_n
- ldb_schema_attribute_remo
- ldb_schema_attribute_set_
- ldb_schema_fsmo_module_op
ldb_set_ calls
- ldb_set_create_perms
- ldb_set_debug
- ldb_set_debug_stderr
- ldb_set_default_dns
- ldb_set_errstring
- ldb_set_modules_dir
- ldb_set_opaque
- ldb_set_timeout
- ldb_set_utf8_default
- ldb_set_utf8_fns
ldb time calls
- ldb_string_to_time
- ldb_string_utc_to_time
- ldb_timestring
- ldb_timestring_utc
ldb_transaction_ calls
- ldb_transaction_cancel
- ldb_transaction_commit
- ldb_transaction_start
ldb_val_ calls
- ldb_val_dup
- ldb_val_equal_exact
- ldb_valid_attr_name
- ldb_val_map_local
- ldb_val_map_remote
ldb misc grouped calls
- ldb_should_b64_encode
- ldb_base64_decode
- ldb_base64_encode
- ldb_binary_encode
- ldb_binary_encode_string
- ldb_parse_tree
- ldb_parse_tree_attr_replace
- ldb_samba_syntax_by_lDAPD
- ldb_samba_syntax_by_name
- ldb_standard_syntax_by_name
ldb miscellaneous calls
- ldb_asprintf_errstring
- ldb_casefold
- ldb_cmdline_process
- ldb_comparison_binary
- ldb_connect_backend
- ldb_debug_set
- ldb_filter_from_tree
- ldb_handle_new
- ldb_handler_copy
- ldb_map_init
- ldb_match_msg
- ldb_mod_register_control
- ldb_op_default_callback
- ldb_parse_control_strings
- ldb_register_samba_handle
- ldb_reply_get_control
- ldb_reset_err_string
- ldb_search_default_callback
- ldb_sequence_number
- ldb_setup_wellknown_attributes
- ldb_strerror
- ldb_wrap_connect