From bc6249cf813a59127d0a691cbb81962eea9d69e5 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 22 Jul 2002 20:45:59 +0000 Subject: [PATCH] reimplement macosx v4-local-addr changes; untested git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14665 dc483132-0cff-0310-8789-dd5450dbe970 --- src/krb524/ChangeLog | 18 ++++++++++++++++++ src/krb524/conv_creds.c | 14 +++++++++++++- src/krb524/krb524.h | 4 +++- src/krb524/sendmsg.c | 7 +++++-- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index 92141f0b7..3bb5c35e8 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,3 +1,21 @@ +2002-07-22 Ken Raeburn + + * sendmsg.c (krb524_sendto_kdc): Accept new arguments for local + address; pass them through to sendto_udp. + * krb524.h: Include port-sockets.h. + (krb524_sendto_kdc): Update declaration. + * conv_creds.c: Include socket-utils.h. + (krb524_convert_creds_kdc): Get local-address info from + krb524_sendto_kdc. On Mac, store the IPv4 address in the v4 + credentials. + +2002-07-19 Ken Raeburn + + * sendmsg.c (krb524_sendto_kdc): Accept new args for local address + return, pass them through to sendto_udp. + * conv_creds.c: Include socket-utils.h. + (krb524_convert_creds_kdc): + 2002-07-12 Ken Raeburn * conv_creds.c: Include port-sockets.h instead of winsock.h or diff --git a/src/krb524/conv_creds.c b/src/krb524/conv_creds.c index b4ebc1c40..5e52040f3 100644 --- a/src/krb524/conv_creds.c +++ b/src/krb524/conv_creds.c @@ -25,6 +25,7 @@ #include #include #include "port-sockets.h" +#include "socket-utils.h" #if TARGET_OS_MAC #include #include @@ -46,6 +47,8 @@ krb524_convert_creds_kdc(context, v5creds, v4creds) krb5_error_code ret; krb5_data reply; char *p; + struct sockaddr_storage ss; + socklen_t slen = sizeof(ss); ret = krb524_convert_creds_plain(context, v5creds, v4creds); if (ret) @@ -53,10 +56,19 @@ krb524_convert_creds_kdc(context, v5creds, v4creds) reply.data = NULL; ret = krb524_sendto_kdc(context, &v5creds->ticket, - &v5creds->server->realm, &reply); + &v5creds->server->realm, &reply, + ss2sa(&ss), &slen); if (ret) return ret; +#ifdef TARGET_OS_MAC + if (slen == sizeof(struct sockaddr_in) + && ss2sa(&ss)->sa_family == AF_INET) { + v4creds->address = ss2sin(&ss)->sin_addr.s_addr; + } + /* Otherwise, leave it set to all-zero. */ +#endif + p = reply.data; ret = ntohl(*((krb5_error_code *) p)); p += sizeof(krb5_int32); diff --git a/src/krb524/krb524.h b/src/krb524/krb524.h index cd46ae83c..0a7e23f4c 100644 --- a/src/krb524/krb524.h +++ b/src/krb524/krb524.h @@ -110,9 +110,11 @@ void krb524_init_ets /* sendmsg.c */ +#include "port-sockets.h" /* for socklen_t */ int krb524_sendto_kdc (krb5_context context, const krb5_data * message, - const krb5_data * realm, krb5_data * reply); + const krb5_data * realm, krb5_data * reply, + struct sockaddr *, socklen_t *); #endif /* KRB524_PRIVATE */ #if TARGET_OS_MAC diff --git a/src/krb524/sendmsg.c b/src/krb524/sendmsg.c index 879676b66..733da0b83 100644 --- a/src/krb524/sendmsg.c +++ b/src/krb524/sendmsg.c @@ -63,11 +63,13 @@ */ krb5_error_code -krb524_sendto_kdc (context, message, realm, reply) +krb524_sendto_kdc (context, message, realm, reply, addr, addrlen) krb5_context context; const krb5_data * message; const krb5_data * realm; krb5_data * reply; + struct sockaddr *addr; + socklen_t *addrlen; { int i; struct addrlist al = ADDRLIST_INIT; @@ -108,7 +110,8 @@ krb524_sendto_kdc (context, message, realm, reply) if (al.naddrs == 0) return KRB5_REALM_UNKNOWN; - retval = internals.sendto_udp (context, message, &al, reply, 0, 0); + retval = internals.sendto_udp (context, message, &al, reply, addr, + addrlen); internals.free_addrlist (&al); return retval; } -- 2.26.2