Introduce macro for common plugin structure elements

Heimdal's HDB plugin interface, and hence Samba's KDC that depends upon
it, doesn't work on 32-bit builds due to structure fields being arranged
in the wrong order. This problem presents itself in the form of
segmentation faults on 32-bit systems, but goes unnoticed on 64-bit
builds thanks to extra structure padding absorbing the errant fields.

This commit reorders the HDB plugin structure fields to prevent crashes
and introduces a common macro to ensure every plugin presents a
consistent interface.

Samba BUG: https://bugzilla.samba.org/show_bug.cgi?id=15110

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Joseph Sutton
2022-10-22 10:11:53 +13:00
committed by Nico Williams
parent 16179383fb
commit cfb32a638e
17 changed files with 57 additions and 63 deletions

View File

@@ -35,6 +35,8 @@
#define KADM5_HOOK_VERSION_V1 1
#include <heimbase-svc.h>
/*
* Each hook is called before the operation using KADM5_STAGE_PRECOMMIT and
* then after the operation using KADM5_STAGE_POSTCOMMIT. If the hook returns
@@ -53,9 +55,7 @@ enum kadm5_hook_stage {
#define KADM5_HOOK_FLAG_CONDITIONAL 0x2 /* only change password if different */
typedef struct kadm5_hook_ftable {
int version;
krb5_error_code (KRB5_CALLCONV *init)(krb5_context, void **data);
void (KRB5_CALLCONV *fini)(void *data);
HEIM_PLUGIN_FTABLE_COMMON_ELEMENTS(krb5_context);
const char *name;
const char *vendor;