svn rev #25510: branches/krb5-1-10/src/ include/ include/krb5/ kadmin/server/ ...
tlyu@MIT.EDU
tlyu at MIT.EDU
Mon Dec 5 15:16:05 EST 2011
http://src.mit.edu/fisheye/changelog/krb5/?cs=25510
Commit By: tlyu
Log Message:
ticket: 7019
version_fixed: 1.10
status: resolved
pull up r25475 and r25479 from trunk
------------------------------------------------------------------------
r25479 | ghudson | 2011-11-19 17:06:15 -0500 (Sat, 19 Nov 2011) | 8 lines
ticket: 7019
Improve documentation in preauth_plugin.h
Also declare the verto_context structure to ensure that it is has the
proper scope when used as the return type of the event_context
callback.
------------------------------------------------------------------------
r25475 | ghudson | 2011-11-14 21:42:58 -0500 (Mon, 14 Nov 2011) | 9 lines
ticket: 7019
subject: Make verto context available to kdcpreauth modules
target_version: 1.10
tags: pullup
Add an event_context callback to kdcpreauth. Adjust the internal KDC
and main loop interfaces to pass around the event context, and expose
it to kdcpreauth modules via the rock.
Changed Files:
U branches/krb5-1-10/src/include/krb5/preauth_plugin.h
U branches/krb5-1-10/src/include/net-server.h
U branches/krb5-1-10/src/kadmin/server/schpw.c
U branches/krb5-1-10/src/kdc/dispatch.c
U branches/krb5-1-10/src/kdc/do_as_req.c
U branches/krb5-1-10/src/kdc/kdc_preauth.c
U branches/krb5-1-10/src/kdc/kdc_util.h
U branches/krb5-1-10/src/lib/apputils/net-server.c
Modified: branches/krb5-1-10/src/include/krb5/preauth_plugin.h
===================================================================
--- branches/krb5-1-10/src/include/krb5/preauth_plugin.h 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/include/krb5/preauth_plugin.h 2011-12-05 20:16:05 UTC (rev 25510)
@@ -328,6 +328,10 @@
typedef struct krb5_kdcpreauth_moddata_st *krb5_kdcpreauth_moddata;
typedef struct krb5_kdcpreauth_modreq_st *krb5_kdcpreauth_modreq;
+/* The verto context structure type (typedef is in verto.h; we want to avoid a
+ * header dependency for the moment). */
+struct verto_context;
+
/* Before using a callback after version 1, modules must check the vers
* field of the callback structure. */
typedef struct krb5_kdcpreauth_callbacks_st {
@@ -377,6 +381,11 @@
* avoid a dependency on a libkdb5 type). */
void *(*client_entry)(krb5_context context, krb5_kdcpreauth_rock rock);
+ /* Get a pointer to the verto context which should be used by an
+ * asynchronous edata or verify method. */
+ struct verto_ctx *(*event_context)(krb5_context context,
+ krb5_kdcpreauth_rock rock);
+
/* End of version 1 kdcpreauth callbacks. */
} *krb5_kdcpreauth_callbacks;
@@ -417,9 +426,13 @@
/*
* Optional: provide pa_data to send to the client as part of the "you need to
- * use preauthentication" error. This function is not allowed to create a
- * modreq object because we have no guarantee that the client will ever make a
- * follow-up request, or that it will hit this KDC if it does.
+ * use preauthentication" error. The implementation must invoke the respond
+ * when complete, whether successful or not, either before returning or
+ * asynchronously using the verto context returned by cb->event_context().
+ *
+ * This function is not allowed to create a modreq object because we have no
+ * guarantee that the client will ever make a follow-up request, or that it
+ * will hit this KDC if it does.
*/
typedef void
(*krb5_kdcpreauth_edata_fn)(krb5_context context, krb5_kdc_req *request,
@@ -450,7 +463,8 @@
* Optional: verify preauthentication data sent by the client, setting the
* TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags"
* field as appropriate. The implementation must invoke the respond function
- * when complete, whether successful or not.
+ * when complete, whether successful or not, either before returning or
+ * asynchronously using the verto context returned by cb->event_context().
*/
typedef void
(*krb5_kdcpreauth_verify_fn)(krb5_context context,
Modified: branches/krb5-1-10/src/include/net-server.h
===================================================================
--- branches/krb5-1-10/src/include/net-server.h 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/include/net-server.h 2011-12-05 20:16:05 UTC (rev 25510)
@@ -68,7 +68,7 @@
krb5_data *response);
void dispatch(void *handle, struct sockaddr *local_addr,
const krb5_fulladdr *remote_addr, krb5_data *request,
- int is_tcp, loop_respond_fn respond, void *arg);
+ int is_tcp, verto_ctx *vctx, loop_respond_fn respond, void *arg);
krb5_error_code make_toolong_error (void *handle, krb5_data **);
/*
Modified: branches/krb5-1-10/src/kadmin/server/schpw.c
===================================================================
--- branches/krb5-1-10/src/kadmin/server/schpw.c 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/kadmin/server/schpw.c 2011-12-05 20:16:05 UTC (rev 25510)
@@ -442,7 +442,7 @@
void
dispatch(void *handle, struct sockaddr *local_saddr,
const krb5_fulladdr *remote_faddr, krb5_data *request, int is_tcp,
- loop_respond_fn respond, void *arg)
+ verto_ctx *vctx, loop_respond_fn respond, void *arg)
{
krb5_error_code ret;
krb5_keytab kt = NULL;
Modified: branches/krb5-1-10/src/kdc/dispatch.c
===================================================================
--- branches/krb5-1-10/src/kdc/dispatch.c 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/kdc/dispatch.c 2011-12-05 20:16:05 UTC (rev 25510)
@@ -81,8 +81,9 @@
}
void
-dispatch(void *cb, struct sockaddr *local_saddr, const krb5_fulladdr *from,
- krb5_data *pkt, int is_tcp, loop_respond_fn respond, void *arg)
+dispatch(void *cb, struct sockaddr *local_saddr,
+ const krb5_fulladdr *from, krb5_data *pkt, int is_tcp,
+ verto_ctx *vctx, loop_respond_fn respond, void *arg)
{
krb5_error_code retval;
krb5_kdc_req *as_req;
@@ -166,7 +167,8 @@
* process_as_req frees the request if it is called
*/
if (!(retval = setup_server_realm(as_req->server))) {
- process_as_req(as_req, pkt, from, finish_dispatch, state);
+ process_as_req(as_req, pkt, from, vctx, finish_dispatch,
+ state);
return;
}
else
Modified: branches/krb5-1-10/src/kdc/do_as_req.c
===================================================================
--- branches/krb5-1-10/src/kdc/do_as_req.c 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/kdc/do_as_req.c 2011-12-05 20:16:05 UTC (rev 25510)
@@ -452,7 +452,8 @@
/*ARGSUSED*/
void
process_as_req(krb5_kdc_req *request, krb5_data *req_pkt,
- const krb5_fulladdr *from, loop_respond_fn respond, void *arg)
+ const krb5_fulladdr *from, verto_ctx *vctx,
+ loop_respond_fn respond, void *arg)
{
krb5_error_code errcode;
krb5_timestamp rtime;
@@ -531,6 +532,7 @@
state->rock.request = state->request;
state->rock.inner_body = state->inner_body;
state->rock.rstate = state->rstate;
+ state->rock.vctx = vctx;
if (!state->request->client) {
state->status = "NULL_CLIENT";
errcode = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;
Modified: branches/krb5-1-10/src/kdc/kdc_preauth.c
===================================================================
--- branches/krb5-1-10/src/kdc/kdc_preauth.c 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/kdc/kdc_preauth.c 2011-12-05 20:16:05 UTC (rev 25510)
@@ -574,6 +574,12 @@
return rock->client;
}
+static verto_ctx *
+event_context(krb5_context context, krb5_kdcpreauth_rock rock)
+{
+ return rock->vctx;
+}
+
static struct krb5_kdcpreauth_callbacks_st callbacks = {
1,
max_time_skew,
@@ -583,7 +589,8 @@
fast_armor,
get_string,
free_string,
- client_entry
+ client_entry,
+ event_context
};
static krb5_error_code
Modified: branches/krb5-1-10/src/kdc/kdc_util.h
===================================================================
--- branches/krb5-1-10/src/kdc/kdc_util.h 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/kdc/kdc_util.h 2011-12-05 20:16:05 UTC (rev 25510)
@@ -121,7 +121,7 @@
void
process_as_req (krb5_kdc_req *, krb5_data *,
const krb5_fulladdr *,
- loop_respond_fn, void *);
+ verto_ctx *, loop_respond_fn, void *);
/* do_tgs_req.c */
krb5_error_code
@@ -135,6 +135,7 @@
const krb5_fulladdr *,
krb5_data *,
int,
+ verto_ctx *,
loop_respond_fn,
void *);
@@ -168,9 +169,9 @@
krb5_enc_tkt_part *enc_tkt_reply);
typedef void (*kdc_hint_respond_fn)(void *arg);
void
-get_preauth_hint_list(krb5_kdc_req *request, krb5_kdcpreauth_rock rock,
- krb5_pa_data ***e_data_out, kdc_hint_respond_fn respond,
- void *arg);
+get_preauth_hint_list(krb5_kdc_req *request,
+ krb5_kdcpreauth_rock rock, krb5_pa_data ***e_data_out,
+ kdc_hint_respond_fn respond, void *arg);
void
load_preauth_plugins(krb5_context context);
void
@@ -400,6 +401,7 @@
krb5_db_entry *client;
krb5_key_data *client_key;
struct kdc_request_state *rstate;
+ verto_ctx *vctx;
};
#define isflagset(flagfield, flag) (flagfield & (flag))
Modified: branches/krb5-1-10/src/lib/apputils/net-server.c
===================================================================
--- branches/krb5-1-10/src/lib/apputils/net-server.c 2011-12-05 19:44:11 UTC (rev 25509)
+++ branches/krb5-1-10/src/lib/apputils/net-server.c 2011-12-05 20:16:05 UTC (rev 25510)
@@ -1665,7 +1665,7 @@
init_addr(&state->faddr, ss2sa(&state->saddr));
/* This address is in net order. */
dispatch(state->handle, ss2sa(&state->daddr), &state->faddr,
- &state->request, 0, process_packet_response, state);
+ &state->request, 0, ctx, process_packet_response, state);
}
static int
@@ -1936,7 +1936,7 @@
local_saddrp = ss2sa(&state->local_saddr);
dispatch(state->conn->handle, local_saddrp, &conn->faddr,
- &state->request, 1, process_tcp_response, state);
+ &state->request, 1, ctx, process_tcp_response, state);
}
return;
More information about the cvs-krb5
mailing list