]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
kdc: Add belts-and-braces check that we fail if the hdb version changes
authorAndrew Bartlett <abartlet@samba.org>
Mon, 13 Jan 2014 22:23:04 +0000 (11:23 +1300)
committerKarolin Seeger <kseeger@samba.org>
Fri, 14 Feb 2014 19:08:23 +0000 (20:08 +0100)
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

(cherry picked from commit e758f4111356fafce5b5c8393648c9ea5c400601)

The last 3 patches address bug #10418 - INTERNAL ERROR: Signal 11 in the kdc
pid.

source4/kdc/hdb-samba4-plugin.c
source4/kdc/hdb-samba4.c

index cc38a60152aae16f02726651dc96dac1958752ed..6f76124995d327bbf9e0c2ef0d173a023da2f5d2 100644 (file)
@@ -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)
 {
index 6a9e5587bfd9340e88cbf416eb5996947d9ba734..4519fb99dcc788f847dc0ae59437503760125883 100644 (file)
@@ -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");