krb5_clpreauth_moddata moddata);
/*
- * Mandatory: Return flags indicating if the module is a "real" or an "info"
- * mechanism, and so on. This function is called for each entry in the
- * client_pa_type_list.
+ * Optional (mandatory before MIT krb5 1.12): pa_type will be a member of the
+ * vtable's pa_type_list. Return PA_REAL if pa_type is a real
+ * preauthentication type or PA_INFO if it is an informational type. If this
+ * function is not defined in 1.12 or later, all pa_type values advertised by
+ * the module will be assumed to be real.
*/
typedef int
(*krb5_clpreauth_get_flags_fn)(krb5_context context, krb5_preauthtype pa_type);
clpreauth_is_real(krb5_context context, clpreauth_handle h,
krb5_preauthtype pa_type)
{
+ if (h->vt.flags == NULL)
+ return 1;
return (h->vt.flags(context, pa_type) & PA_REAL) != 0;
}
#include <krb5/clpreauth_plugin.h>
#include "int-proto.h"
-static int
-ec_flags(krb5_context context, krb5_preauthtype pa_type)
-{
- return PA_REAL;
-}
-
static krb5_error_code
ec_prep_questions(krb5_context context, krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq modreq, krb5_get_init_creds_opt *opt,
vt = (krb5_clpreauth_vtable)vtable;
vt->name = "encrypted_challenge";
vt->pa_type_list = ec_types;
- vt->flags = ec_flags;
vt->prep_questions = ec_prep_questions;
vt->process = ec_process;
return 0;
#include <krb5/clpreauth_plugin.h>
#include "int-proto.h"
-static int
-encts_flags(krb5_context context, krb5_preauthtype pa_type)
-{
- return PA_REAL;
-}
-
static krb5_error_code
encts_prep_questions(krb5_context context, krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq modreq,
vt = (krb5_clpreauth_vtable)vtable;
vt->name = "encrypted_timestamp";
vt->pa_type_list = encts_pa_types;
- vt->flags = encts_flags;
vt->prep_questions = encts_prep_questions;
vt->process = encts_process;
return 0;
return 0;
}
-static int
-otp_client_get_flags(krb5_context context, krb5_preauthtype pa_type)
-{
- return PA_REAL;
-}
-
static void
otp_client_request_init(krb5_context context, krb5_clpreauth_moddata moddata,
krb5_clpreauth_modreq *modreq_out)
vt = (krb5_clpreauth_vtable)vtable;
vt->name = "otp";
vt->pa_type_list = otp_client_supported_pa_types;
- vt->flags = otp_client_get_flags;
vt->request_init = otp_client_request_init;
vt->prep_questions = otp_client_prep_questions;
vt->process = otp_client_process;
#include "int-proto.h"
#include "init_creds_ctx.h"
-static int
-sam2_flags(krb5_context context, krb5_preauthtype pa_type)
-{
- return PA_REAL;
-}
-
/* this macro expands to the int,ptr necessary for "%.*s" in an sprintf */
#define SAMDATA(kdata, str, maxsize) \
vt = (krb5_clpreauth_vtable)vtable;
vt->name = "sam2";
vt->pa_type_list = sam2_pa_types;
- vt->flags = sam2_flags;
vt->process = sam2_process;
return 0;
}