#define KRB5_DB_LOCKMODE_PERMANENT 0x0008
/* db_invoke methods */
-#define KRB5_KDB_METHOD_CHECK_TRANSITED_REALMS 0x00000020
#define KRB5_KDB_METHOD_CHECK_POLICY_AS 0x00000030
#define KRB5_KDB_METHOD_CHECK_POLICY_TGS 0x00000040
#define KRB5_KDB_METHOD_AUDIT_AS 0x00000050
#define KRB5_KDB_METHOD_REFRESH_POLICY 0x00000070
#define KRB5_KDB_METHOD_CHECK_ALLOWED_TO_DELEGATE 0x00000080
-typedef struct _kdb_check_transited_realms_req {
- krb5_magic magic;
- const krb5_data *tr_contents;
- const krb5_data *client_realm;
- const krb5_data *server_realm;
-} kdb_check_transited_realms_req;
-
typedef struct _kdb_check_policy_as_req {
krb5_magic magic;
krb5_kdc_req *request;
krb5_authdata **tgt_auth_data,
krb5_authdata ***signed_auth_data);
+krb5_error_code krb5_db_check_transited_realms(krb5_context kcontext,
+ const krb5_data *tr_contents,
+ const krb5_data *client_realm,
+ const krb5_data *server_realm);
+
krb5_error_code krb5_db_invoke ( krb5_context kcontext,
unsigned int method,
const krb5_data *req,
krb5_authdata **tgt_auth_data,
krb5_authdata ***signed_auth_data);
+ /*
+ * Optional: Perform a policy check on a cross-realm ticket's transited
+ * field and return an error (other than KRB5_PLUGIN_OP_NOTSUPP) if the
+ * check fails.
+ */
+ krb5_error_code (*check_transited_realms)(krb5_context kcontext,
+ const krb5_data *tr_contents,
+ const krb5_data *client_realm,
+ const krb5_data *server_realm);
+
/*
* Optional: Perform an operation on input data req with output stored in
* rep. Return KRB5_PLUGIN_OP_NOTSUPP if the module does not implement the
* method. Defined methods are:
*
- *
- * KRB5_KDB_METHOD_CHECK_TRANSITED_REALMS: req contains a
- * kdb_check_transited_realms_req structure. Perform a policy check on
- * a cross-realm ticket's transited field and return an error (other
- * than KRB5_PLUGIN_OP_NOTSUPP) if the check fails. Leave rep alone.
- *
* KRB5_KDB_METHOD_CHECK_POLICY_AS: req contains a kdb_check_policy_as_req
* structure. Perform a policy check on an AS request, in addition to
* the standard policy checks. Return 0 if the AS request is allowed
const krb5_data *realm2)
{
krb5_error_code code;
- kdb_check_transited_realms_req req;
- krb5_data req_data;
- krb5_data rep_data;
- /* First check using krb5.conf */
+ /* Check using krb5.conf */
code = krb5_check_transited_list(kdc_context, trans, realm1, realm2);
if (code)
return code;
- memset(&req, 0, sizeof(req));
-
- req.tr_contents = trans;
- req.client_realm = realm1;
- req.server_realm = realm2;
-
- req_data.data = (void *)&req;
- req_data.length = sizeof(req);
-
- rep_data.data = NULL;
- rep_data.length = 0;
-
- code = krb5_db_invoke(context,
- KRB5_KDB_METHOD_CHECK_TRANSITED_REALMS,
- &req_data,
- &rep_data);
- if (code == KRB5_PLUGIN_OP_NOTSUPP) {
+ /* Check against the KDB module. */
+ code = krb5_db_check_transited_realms(context, trans, realm1, realm2);
+ if (code == KRB5_PLUGIN_OP_NOTSUPP)
code = 0;
- }
-
- assert(rep_data.length == 0);
-
return code;
}
signed_auth_data);
}
+krb5_error_code
+krb5_db_check_transited_realms(krb5_context kcontext,
+ const krb5_data *tr_contents,
+ const krb5_data *client_realm,
+ const krb5_data *server_realm)
+{
+ krb5_error_code status;
+ kdb_vftabl *v;
+
+ status = get_vftabl(kcontext, &v);
+ if (status)
+ return status;
+ if (v->check_transited_realms == NULL)
+ return KRB5_PLUGIN_OP_NOTSUPP;
+ return v->check_transited_realms(kcontext, tr_contents, client_realm,
+ server_realm);
+}
+
krb5_error_code
krb5_db_invoke(krb5_context kcontext,
unsigned int method,
krb5_db_inited
krb5_db_alloc
krb5_db_free
+krb5_db_check_transited_realms
krb5_db_create
krb5_db_delete_principal
krb5_db_destroy
/* get_master_key_list */ wrap_krb5_db2_get_mkey_list,
/* blah blah blah */ 0,0,0,0,0,
/* promote_db */ wrap_krb5_db2_promote_db,
- 0, 0, 0,
+ 0, 0, 0, 0,
/* invoke */ wrap_krb5_db2_invoke
};
/* decrypt_key_data */ NULL,
/* encrypt_key_data */ NULL,
/* sign_authdata */ NULL,
+ /* check_transited_realms */ NULL,
/* invoke */ krb5_ldap_invoke,
};