From 8d8fc0bdc087ec77418f0832969e1dfc6dfa1a7c Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 23 Aug 2006 22:56:29 +0000 Subject: Merge Todd's TCP changepw support, with a few fixups * include/cm.h (state_strings, enum conn_states, struct incoming_krb5_message, struct conn_state): Moved here from lib/krb5/os/sendto_kdc.c. (stuct sendto_callback_info): New type. * lib/krb5/os/sendto_kdc.c (set_conn_state_msg_length): New function. (setup_connection): Deleted argument message_len_buf. Don't store message length; call set_conn_state_msg_length instead. (start_connection): New arguments callback_info and callback_buffer. Invoke callback function if any, and set message length on success. (maybe_send): New arguments callback_info and callback_buffer; pass them to start_connection. (krb5int_sendto): New arguments callback_info, remoteaddr, remoteaddrlen. If callback info is provided, allocate per-connection buffers, and pass them to maybe_send. On cleanup, invoke the cleanup callback function if any. (krb5_sendto_kdc): Update krb5int_sendto call. * include/k5-int.h (struct sendto_callback_info): Add forward declaration. (krb5int_sendto, struct _krb5int_access.sendto_udp): Update for new signature. * lib/krb5/os/send524 (krb5int_524_sendto_kdc): Update krb5int_sendto call. * lib/krb4/send_to_kdc.c (krb5int_send_to_kdc_addr): Update sendto_udp call. * lib/krb5/os/changepw.c (struct sendto_callback_context): New type. (krb5_locate_kpasswd): New argument useTcp, used to select socket type in krb5int_locate_server call. (kpasswd_sendto_msg_cleanup, kpasswd_sendto_msg_callback): New functions. (krb5_change_set_password): Call krb5int_sendto with callbacks, instead of managing the exchange here. On RESPONSE_TOO_BIG error, try again with TCP only. * lib/krb5/krb/chpw.c (krb5int_rd_chpw_rep): If length is wrong, check if a buggy server sent a KRB_ERROR. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18518 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/k5-int.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/include/k5-int.h') diff --git a/src/include/k5-int.h b/src/include/k5-int.h index a8b9e5d..a55fea7 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -487,15 +487,19 @@ extern char *strdup (const char *); #include struct addrlist; +struct sendto_callback_info; /* libos.spec */ krb5_error_code krb5_lock_file (krb5_context, int, int); krb5_error_code krb5_unlock_file (krb5_context, int); krb5_error_code krb5_sendto_kdc (krb5_context, const krb5_data *, const krb5_data *, krb5_data *, int *, int); -krb5_error_code krb5int_sendto (krb5_context, const krb5_data *, - const struct addrlist *, krb5_data *, - struct sockaddr *, socklen_t *, int *); + +krb5_error_code krb5int_sendto (krb5_context context, const krb5_data *message, + const struct addrlist *addrs, struct sendto_callback_info* callback_info, + krb5_data *reply, struct sockaddr *localaddr, socklen_t *localaddrlen, + struct sockaddr *remoteaddr, socklen_t *remoteaddrlen, int *addr_used); + krb5_error_code krb5_get_krbhst (krb5_context, const krb5_data *, char *** ); krb5_error_code krb5_free_krbhst (krb5_context, char * const * ); krb5_error_code krb5_create_secure_file (krb5_context, const char * pathname); @@ -1610,7 +1614,7 @@ krb5int_generate_and_save_subkey (krb5_context, krb5_auth_context, /* set and change password helpers */ krb5_error_code krb5int_mk_chpw_req - (krb5_context context, krb5_auth_context auth_context, + (krb5_context context, krb5_auth_context auth_context, krb5_data *ap_req, char *passwd, krb5_data *packet); krb5_error_code krb5int_rd_chpw_rep (krb5_context context, krb5_auth_context auth_context, @@ -1673,8 +1677,9 @@ typedef struct _krb5int_access { krb5_data *output); /* service location and communication */ krb5_error_code (*sendto_udp) (krb5_context, const krb5_data *msg, - const struct addrlist *, krb5_data *reply, - struct sockaddr *, socklen_t *, int *); + const struct addrlist *, struct sendto_callback_info*, krb5_data *reply, + struct sockaddr *, socklen_t *,struct sockaddr *, + socklen_t *, int *); krb5_error_code (*add_host_to_list)(struct addrlist *lp, const char *hostname, int port, int secport, -- cgit v1.1