Difference between revisions of "Samba4 Port: hdb & ldb Interfaces"
(→Samba's internal ldb library) |
(→Samba's internal ldb library) |
||
Line 814: | Line 814: | ||
| |
| |
||
| + |
| + |
||
⚫ | |||
⚫ | |||
− | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | | |
||
− | | |
||
⚫ | |||
| |
| |
||
| attr |
| attr |
||
Line 835: | Line 825: | ||
| + |
| + |
||
| |
| |
||
⚫ | |||
+ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | | |
||
⚫ | |||
+ | | |
||
| attr |
| attr |
||
Revision as of 14:00, 16 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
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_search | common/ldb.c | ++ | ++ | ++ | ++ | param | basic |
ldb_errstring | common/ldb.c | ++ | ++ | ++ | ++ | kdc, param | basic |
ldb_add | common/ldb.c | + | + | + | ++ | param | basic |
ldb_delete | common/ldb.c | 1 | + | ++ | param | basic | |
ldb_wait | common/ldb.c | 1 | + | 1 | ++ | basic | |
ldb_connect | common/ldb.c | 1 | ++ | param | basic | ||
ldb_debug | common/ldb_debug.c | 1 | ++ | ++ | basic | ||
ldb_init | common/ldb.c | 1 | ++ | basic | |||
ldb_modify | common/ldb.c | + | + | + | + | param | basic |
ldb_qsort | common/qsort.c | 1 | 1 | 1 | 1 | basic | |
ldb_rename | common/ldb.c | 1 | 1 | + | param | basic | |
ldb_request | common/ldb.c | 1 | + | ++ | basic | ||
ldb_attr_cmp | ldb/include/ldb.h | ++ | ++ | attr | |||
ldb_attr_casefold | common/ldb_utf8.c | + | attr | ||||
ldb_attr_in_list | common/ldb_msg.c | + | + | attr | |||
ldb_attr_dn | common/ldb_utf8.c | 1 | 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_search_req_ex | common/ldb.c | ++ | ++ | build...req | |||
ldb_build_add_req | common/ldb.c | ++ | + | build...req | |||
ldb_build_del_req | common/ldb.c | ++ | + | 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_extended_req | common/ldb.c | 1 | + | build...req | |||
ldb_dn_new | common/ldb_dn.c | ++ | ++ | ++ | ++ | gpo, auth, winbind, utils, param, ntptr | dn |
ldb_dn_get_linearized | common/ldb_dn.c | ++ | ++ | ++ | ++ | kdc, gpo, auth | dn |
ldb_dn_add_child_fmt | common/ldb_dn.h | ++ | + | + | + | dn | |
ldb_dn_new_fmt | common/ldb_dn.c | + | + | ++ | + | winbind, param, ntptr | dn |
ldb_dn_copy | + | + | + | ++ | utils | dn | |
ldb_dn_validate | common/ldb_dn.c | + | + | + | ++ | utils | dn |
ldb_dn_alloc_linearized | common/ldb_dn.h | 1 | + | + | ++ | dn | |
ldb_dn_compare | common/ldb_dn.c | 1 | ++ | + | + | dn | |
ldb_dn_is_special | common/ldb_dn.c | 1 | ++ | ++ | dn | ||
ldb_dn_get_parent | common/ldb_dn.c | 1 | + | + | + | dn | |
ldb_dn_get_component_val | common/ldb_dn.c | + | + | + | dn | ||
ldb_dn_get_comp_num | common/ldb_dn.c | + | + | + | dn | ||
ldb_dn_get_component_name | common/ldb_dn.c | + | + | + | dn | ||
ldb_dn_from_ldb_val | common/ldb_dn.c | 1 | + | + | auth | dn | |
ldb_dn_get_extended_linearized | common/ldb_dn.c | 1 | + | + | dn | ||
ldb_dn_get_rdn_val | common/ldb_dn.c | 1 | + | + | dn | ||
ldb_dn_get_rdn_name | common/ldb_dn.c | 1 | + | + | dn | ||
ldb_dn_add_base | common/ldb_dn.h | + | + | dn | |||
ldb_dn_set_component | common/ldb_dn.c | + | + | dn | |||
ldb_dn_compare_base | common/ldb_dn.c | + | + | dn | |||
ldb_dn_remove_base_components | common/ldb_dn.c | + | + | dn | |||
ldb_dn_has_extended | common/ldb_dn.c | + | + | dn | |||
ldb_dn_is_null | common/ldb_dn.c | + | + | dn | |||
ldb_dn_is_valid | common/ldb_dn.c | + | + | dn | |||
ldb_dn_canonical_string | common/ldb_dn.h | 1 | 1 | + | dn | ||
ldb_dn_add_base_fmt | common/ldb_dn.h | 1 | + | dn | |||
ldb_dn_canonical_ex_string | common/ldb_dn.h | 1 | + | dn | |||
ldb_dn_escape_value | common/ldb_dn.c | + | dn | ||||
ldb_dn_check_local | ldb_map/ldb_map.c | + | dn | ||||
ldb_dn_check_special | common/ldb_dn.c | + | dn | ||||
ldb_dn_alloc_casefold | common/ldb_dn.h | + | dn | ||||
ldb_dn_extended_syntax_by_name | common/ldb_attributes.c | + | dn | ||||
ldb_dn_get_casefold | common/ldb_dn.c | + | dn | ||||
ldb_dn_get_extended_component | common/ldb_dn.c | + | auth | dn | |||
ldb_dn_set_extended_compo | common/ldb_dn.c | + | dn | ||||
ldb_dn_map_local | ldb_map/ldb_map.c | + | dn | ||||
ldb_dn_remove_child_components | common/ldb_dn.c | 1 | 1 | dn | |||
ldb_dn_add_child | common/ldb_dn.c | 1 | dn | ||||
ldb_dn_extended_add_syntax | common/ldb_attributes.c | 1 | dn | ||||
ldb_dn_map_rebase_remote | ldb_map/ldb_map_outbound.c | 1 | dn | ||||
ldb_extended | extended | ||||||
ldb_extended_default_call | extended | ||||||
ldb_extended_dn_in_module | extended | ||||||
ldb_extended_dn_out_deref | extended | ||||||
ldb_extended_dn_out_ldb_m | extended | ||||||
ldb_extended_dn_store_mod | extended | ||||||
ldb_get_config_basedn | get | ||||||
ldb_get_create_perms | get | ||||||
ldb_get_default_basedn | get | ||||||
ldb_get_event_context | get | ||||||
ldb_get_opaque | get | ||||||
ldb_get_root_basedn | get | ||||||
ldb_get_schema_basedn | get | ||||||
ldb_ldif_read_file | ldif | ||||||
ldb_ldif_read_free | ldif | ||||||
ldb_ldif_read_string | ldif | ||||||
ldb_ldif_write_file | ldif | ||||||
ldb_module_done | module | ||||||
ldb_module_get_ctx | module | ||||||
ldb_module_get_private | module | ||||||
ldb_module_new | module | ||||||
ldb_module_send_entry | module | ||||||
ldb_module_send_referral | module | ||||||
ldb_module_set_private | module | ||||||
ldb_modules_list_from_str | module | ||||||
ldb_init_module_chain | module | ||||||
ldb_load_modules | module | ||||||
ldb_load_modules_list | module | ||||||
ldb_anr_module_ops | module_ops | ||||||
ldb_asq_module_ops | module_ops | ||||||
ldb_dsdb_cache_module_ops | module_ops | ||||||
ldb_entryuuid_module_ops | module_ops | ||||||
ldb_instancetype_module_ops | module_ops | ||||||
ldb_kludge_acl_module_ops | module_ops | ||||||
ldb_ldap_backend_ops | module_ops | ||||||
ldb_ldapi_backend_ops | module_ops | ||||||
ldb_ldaps_backend_ops | module_ops | ||||||
ldb_linked_attributes_module_ops | module_ops | ||||||
ldb_local_password_module_ops | module_ops | ||||||
ldb_naming_fsmo_module_ops | module_ops | ||||||
ldb_nsuniqueid_module_ops | module_ops | ||||||
ldb_objectclass_module_ops | module_ops | ||||||
ldb_objectguid_module_ops | module_ops | ||||||
ldb_operational_module_ops | module_ops | ||||||
ldb_paged_results_module_ops | module_ops | ||||||
ldb_paged_searches_module_ops | module_ops | ||||||
ldb_partition_module_ops | module_ops | ||||||
ldb_password_hash_module_ops | module_ops | ||||||
ldb_pdc_fsmo_module_ops | module_ops | ||||||
ldb_ranged_results_module_ops | module_ops | ||||||
ldb_rdn_name_module_ops | module_ops | ||||||
ldb_register_module | module_ops | ||||||
ldb_repl_meta_data_module_ops | module_ops | ||||||
ldb_rootdse_module_ops | module_ops | ||||||
ldb_samba3sam_module_ops | module_ops | ||||||
ldb_samldb_module_ops | module_ops | ||||||
ldb_server_sort_module_ops | module_ops | ||||||
ldb_show_deleted_module_ops | module_ops | ||||||
ldb_skel_module_ops | module_ops | ||||||
ldb_subtree_delete_module_ops | module_ops | ||||||
ldb_subtree_rename_module_ops | module_ops | ||||||
ldb_tdb_backend_ops | module_ops | ||||||
ldb_update_keytab_module_ops | module_ops | ||||||
ldb_wins_ldb_module_ops | module_ops | ||||||
ldb_msg_add | msg | ||||||
ldb_msg_add_empty | msg | ||||||
ldb_msg_add_fmt | msg | ||||||
ldb_msg_add_steal_string | msg | ||||||
ldb_msg_add_steal_value | msg | ||||||
ldb_msg_add_string | msg | ||||||
ldb_msg_add_value | msg | ||||||
ldb_msg_canonicalize | msg | ||||||
ldb_msg_check_string_attr | msg | ||||||
ldb_msg_copy | msg | ||||||
ldb_msg_copy_attr | msg | ||||||
ldb_msg_copy_shallow | msg | ||||||
ldb_msg_diff | msg | ||||||
ldb_msg_element_compare | msg | ||||||
ldb_msg_find_attr_as_bool | msg | ||||||
ldb_msg_find_attr_as_dn | msg | ||||||
ldb_msg_find_attr_as_int | msg | ||||||
ldb_msg_find_attr_as_int6 | msg | ||||||
ldb_msg_find_attr_as_stri | msg | ||||||
ldb_msg_find_attr_as_uint | msg | ||||||
ldb_msg_find_element | msg | ||||||
ldb_msg_find_ldb_val | msg | ||||||
ldb_msg_find_val | msg | ||||||
ldb_msg_new | msg | ||||||
ldb_msg_remove_attr | msg | ||||||
ldb_msg_remove_element | msg | ||||||
ldb_msg_sanity_check | msg | ||||||
ldb_msg_sort_elements | msg | ||||||
ldb_next_del_trans | next | ||||||
ldb_next_end_trans | next | ||||||
ldb_next_init | next | ||||||
ldb_next_remote_request | next | ||||||
ldb_next_request | next | ||||||
ldb_next_start_trans | next | ||||||
ldb_request_add_control | request | ||||||
ldb_request_done | request | ||||||
ldb_request_get_control | request | ||||||
ldb_request_get_status | request | ||||||
ldb_request_set_state | request | ||||||
ldb_schema_attribute_add | schema | ||||||
ldb_schema_attribute_add_ | schema | ||||||
ldb_schema_attribute_by_n | schema | ||||||
ldb_schema_attribute_remo | schema | ||||||
ldb_schema_attribute_set_ | schema | ||||||
ldb_schema_fsmo_module_ops | schema | ||||||
ldb_set_create_perms | set | ||||||
ldb_set_debug | set | ||||||
ldb_set_debug_stderr | set | ||||||
ldb_set_default_dns | set | ||||||
ldb_set_errstring | set | ||||||
ldb_set_modules_dir | set | ||||||
ldb_set_opaque | set | ||||||
ldb_set_timeout | set | ||||||
ldb_set_utf8_default | set | ||||||
ldb_set_utf8_fns | set | ||||||
ldb_string_to_time | time | ||||||
ldb_string_utc_to_time | time | ||||||
ldb_timestring | time | ||||||
ldb_timestring_utc | time | ||||||
ldb_transaction_cancel | transaction | ||||||
ldb_transaction_commit | transaction | ||||||
ldb_transaction_start | transaction | ||||||
ldb_val_dup | val | ||||||
ldb_val_equal_exact | val | ||||||
ldb_valid_attr_name | val | ||||||
ldb_val_map_local | |||||||
ldb_val_map_remote | val | ||||||
ldb_should_b64_encode | misc grouped | ||||||
ldb_base64_decode | misc grouped | ||||||
ldb_base64_encode | misc grouped | ||||||
ldb_binary_encode | misc grouped | ||||||
ldb_binary_encode_string | misc grouped | ||||||
ldb_parse_tree | misc grouped | ||||||
ldb_parse_tree_attr_replace | misc grouped | ||||||
ldb_samba_syntax_by_lDAPD | misc grouped | ||||||
ldb_samba_syntax_by_name | misc grouped | ||||||
ldb_standard_syntax_by_name | misc grouped | ||||||
ldb_asprintf_errstring | misc | ||||||
ldb_casefold | misc | ||||||
ldb_cmdline_process | misc | ||||||
ldb_comparison_binary | misc | ||||||
ldb_connect_backend | misc | ||||||
ldb_debug_set | misc | ||||||
ldb_filter_from_tree | misc | ||||||
ldb_handle_new | misc | ||||||
ldb_handler_copy | misc | ||||||
ldb_map_init | misc | ||||||
ldb_match_msg | misc | ||||||
ldb_mod_register_control | misc | ||||||
ldb_op_default_callback | misc | ||||||
ldb_parse_control_strings | misc | ||||||
ldb_register_samba_handle | misc | ||||||
ldb_reply_get_control | misc | ||||||
ldb_reset_err_string | misc | ||||||
ldb_search_default_callback | misc | ||||||
ldb_sequence_number | misc | ||||||
ldb_setup_wellknown_attributes | misc | ||||||
ldb_strerror | misc | ||||||
ldb_wrap_connect | misc |