mirror of
https://github.com/samba-team/samba.git
synced 2025-03-30 06:50:24 +03:00
kdc: Add belts-and-braces check that we fail if the hdb version changes
This checks both if host system run-time Heimdal has changed version, and that the build-time version is supported. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-By: Jelmer Vernooij <jelmer@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Jan 20 22:26:49 CET 2014 on sn-devel-104
This commit is contained in:
parent
368208069e
commit
e758f41113
@ -60,6 +60,8 @@ static krb5_error_code hdb_samba4_create(krb5_context context, struct HDB **db,
|
||||
|
||||
if (NT_STATUS_IS_OK(nt_status)) {
|
||||
return 0;
|
||||
} else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION)) {
|
||||
return EINVAL;
|
||||
} else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_CANT_ACCESS_DOMAIN_INFO)) {
|
||||
|
||||
krb5_set_error_message(context, EINVAL, "Failed to open Samba4 LDB at %s", lpcfg_private_path(base_ctx, base_ctx->lp_ctx, "sam.ldb"));
|
||||
@ -70,6 +72,10 @@ static krb5_error_code hdb_samba4_create(krb5_context context, struct HDB **db,
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
#if (HDB_INTERFACE_VERSION != 8 && HDB_INTERFACE_VERSION != 7)
|
||||
#error "Unsupported Heimdal HDB version"
|
||||
#endif
|
||||
|
||||
#if HDB_INTERFACE_VERSION >= 8
|
||||
static krb5_error_code hdb_samba4_init(krb5_context context, void **ctx)
|
||||
{
|
||||
|
@ -176,6 +176,11 @@ NTSTATUS hdb_samba4_create_kdc(struct samba_kdc_base_context *base_ctx,
|
||||
struct samba_kdc_db_context *kdc_db_ctx;
|
||||
NTSTATUS nt_status;
|
||||
|
||||
if (hdb_interface_version != HDB_INTERFACE_VERSION) {
|
||||
krb5_set_error_message(context, EINVAL, "Heimdal HDB interface version mismatch between build-time and run-time libraries!");
|
||||
return NT_STATUS_ERROR_DS_INCOMPATIBLE_VERSION;
|
||||
}
|
||||
|
||||
*db = talloc(base_ctx, HDB);
|
||||
if (!*db) {
|
||||
krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
|
||||
|
Loading…
x
Reference in New Issue
Block a user