reimplement macosx v4-local-addr changes; untested
authorKen Raeburn <raeburn@mit.edu>
Mon, 22 Jul 2002 20:45:59 +0000 (20:45 +0000)
committerKen Raeburn <raeburn@mit.edu>
Mon, 22 Jul 2002 20:45:59 +0000 (20:45 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14665 dc483132-0cff-0310-8789-dd5450dbe970

src/krb524/ChangeLog
src/krb524/conv_creds.c
src/krb524/krb524.h
src/krb524/sendmsg.c

index 92141f0b7812d7149fc9edc8ae64909fa71d655f..3bb5c35e8f7a0a35296d9d897ca4ec2ead0c1182 100644 (file)
@@ -1,3 +1,21 @@
+2002-07-22  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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  <raeburn@mit.edu>
+
+       * 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  <raeburn@mit.edu>
 
        * conv_creds.c: Include port-sockets.h instead of winsock.h or
index b4ebc1c40796653f0514dd0fcd8a6c11d7785ee7..5e52040f305e0a36333e4e292a288409e3677de8 100644 (file)
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include "port-sockets.h"
+#include "socket-utils.h"
 #if TARGET_OS_MAC
 #include <Kerberos/krb.h>
 #include <Kerberos/krb524.h>
@@ -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);
index cd46ae83c66b00b7a276e4412903a172b896cc88..0a7e23f4c62dbdb558eea110531353a67daa828d 100644 (file)
@@ -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
index 879676b669a480e6ec56bb3852b90e41e2cc5b17..733da0b839065618a450842b5793809487a3a50c 100644 (file)
  */
 
 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;
 }