Merge Todd's TCP changepw support, with a few fixups
authorKen Raeburn <raeburn@mit.edu>
Wed, 23 Aug 2006 22:56:29 +0000 (22:56 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 23 Aug 2006 22:56:29 +0000 (22:56 +0000)
commit8d8fc0bdc087ec77418f0832969e1dfc6dfa1a7c
tree77a6d0835ce6a9876069ba288fb6b075b46c9519
parentf3abd2b4e19b2c9a2b81841c30ad93ac68fcb6d3
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/cm.h
src/include/k5-int.h
src/lib/krb4/send_to_kdc.c
src/lib/krb5/krb/chpw.c
src/lib/krb5/os/changepw.c
src/lib/krb5/os/send524.c
src/lib/krb5/os/sendto_kdc.c