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:

committed by
Nico Williams

parent
16179383fb
commit
cfb32a638e
@@ -36,6 +36,8 @@
|
||||
#ifndef HEIMDAL_KRB5_AN2LN_PLUGIN_H
|
||||
#define HEIMDAL_KRB5_AN2LN_PLUGIN_H 1
|
||||
|
||||
#include <heimbase-svc.h>
|
||||
|
||||
#define KRB5_PLUGIN_AN2LN "an2ln"
|
||||
#define KRB5_PLUGIN_AN2LN_VERSION_0 0
|
||||
|
||||
@@ -80,9 +82,7 @@ typedef krb5_error_code (KRB5_LIB_CALL *set_result_f)(void *, const char *);
|
||||
* @ingroup krb5_support
|
||||
*/
|
||||
typedef struct krb5plugin_an2ln_ftable_desc {
|
||||
int minor_version;
|
||||
krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **);
|
||||
void (KRB5_LIB_CALL *fini)(void *);
|
||||
HEIM_PLUGIN_FTABLE_COMMON_ELEMENTS(krb5_context);
|
||||
krb5_error_code (KRB5_LIB_CALL *an2ln)(void *, krb5_context, const char *,
|
||||
krb5_const_principal, set_result_f, void *);
|
||||
} krb5plugin_an2ln_ftable;
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#ifndef HEIMDAL_KRB5_DB_PLUGIN_H
|
||||
#define HEIMDAL_KRB5_DB_PLUGIN_H 1
|
||||
|
||||
#include <heimbase-svc.h>
|
||||
|
||||
#define KRB5_PLUGIN_DB "krb5_db_plug"
|
||||
#define KRB5_PLUGIN_DB_VERSION_0 0
|
||||
|
||||
@@ -59,9 +61,7 @@
|
||||
* @ingroup krb5_support
|
||||
*/
|
||||
typedef struct krb5plugin_db_ftable_desc {
|
||||
int minor_version;
|
||||
krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **);
|
||||
void (KRB5_LIB_CALL *fini)(void *);
|
||||
HEIM_PLUGIN_FTABLE_COMMON_ELEMENTS(krb5_context);
|
||||
} krb5plugin_db_ftable;
|
||||
|
||||
#endif /* HEIMDAL_KRB5_DB_PLUGIN_H */
|
||||
|
@@ -32,6 +32,8 @@
|
||||
#ifndef HEIMDAL_KRB5_KUSEROK_PLUGIN_H
|
||||
#define HEIMDAL_KRB5_KUSEROK_PLUGIN_H 1
|
||||
|
||||
#include <heimbase-svc.h>
|
||||
|
||||
#define KRB5_PLUGIN_KUSEROK "krb5_plugin_kuserok"
|
||||
#define KRB5_PLUGIN_KUSEROK_VERSION_0 0
|
||||
|
||||
@@ -76,9 +78,7 @@
|
||||
* @ingroup krb5_support
|
||||
*/
|
||||
typedef struct krb5plugin_kuserok_ftable_desc {
|
||||
int minor_version;
|
||||
krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **);
|
||||
void (KRB5_LIB_CALL *fini)(void *);
|
||||
HEIM_PLUGIN_FTABLE_COMMON_ELEMENTS(krb5_context);
|
||||
krb5_error_code (KRB5_LIB_CALL *kuserok)(void *, krb5_context, const char *,
|
||||
unsigned int, const char *, const char *,
|
||||
krb5_const_principal,
|
||||
|
@@ -38,6 +38,8 @@
|
||||
#ifndef HEIMDAL_KRB5_LOCATE_PLUGIN_H
|
||||
#define HEIMDAL_KRB5_LOCATE_PLUGIN_H 1
|
||||
|
||||
#include <heimbase-svc.h>
|
||||
|
||||
#define KRB5_PLUGIN_LOCATE "service_locator"
|
||||
#define KRB5_PLUGIN_LOCATE_VERSION 1
|
||||
#define KRB5_PLUGIN_LOCATE_VERSION_0 0
|
||||
@@ -70,9 +72,7 @@ typedef krb5_error_code
|
||||
|
||||
|
||||
typedef struct krb5plugin_service_locate_ftable {
|
||||
int minor_version;
|
||||
krb5_error_code (KRB5_CALLCONV *init)(krb5_context, void **);
|
||||
void (KRB5_CALLCONV *fini)(void *);
|
||||
HEIM_PLUGIN_FTABLE_COMMON_ELEMENTS(krb5_context);
|
||||
krb5plugin_service_locate_lookup_old old_lookup;
|
||||
krb5plugin_service_locate_lookup lookup; /* version 2 */
|
||||
} krb5plugin_service_locate_ftable;
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#define HEIMDAL_KRB5_SEND_TO_KDC_PLUGIN_H 1
|
||||
|
||||
#include <krb5.h>
|
||||
#include <heimbase-svc.h>
|
||||
|
||||
#define KRB5_PLUGIN_SEND_TO_KDC "send_to_kdc"
|
||||
|
||||
@@ -61,9 +62,7 @@ typedef krb5_error_code
|
||||
|
||||
|
||||
typedef struct krb5plugin_send_to_kdc_ftable {
|
||||
int minor_version;
|
||||
krb5_error_code (KRB5_CALLCONV *init)(krb5_context, void **);
|
||||
void (KRB5_CALLCONV *fini)(void *);
|
||||
HEIM_PLUGIN_FTABLE_COMMON_ELEMENTS(krb5_context);
|
||||
krb5plugin_send_to_kdc_func send_to_kdc;
|
||||
krb5plugin_send_to_realm_func send_to_realm; /* added in version 2 */
|
||||
} krb5plugin_send_to_kdc_ftable;
|
||||
|
Reference in New Issue
Block a user