From: Chris Provenzano Date: Mon, 1 May 1995 20:46:56 +0000 (+0000) Subject: * sim_client.c (main()): Changes to auth_context to better X-Git-Tag: krb5-1.0-beta5~80 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=874486ea90b6d3cc069eff5341f3707d0254b785;p=krb5.git * sim_client.c (main()): Changes to auth_context to better support full addresses, for mk_safe() and friends. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5673 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/simple/client/ChangeLog b/src/appl/simple/client/ChangeLog index e1d1a30b0..a63bb3b71 100644 --- a/src/appl/simple/client/ChangeLog +++ b/src/appl/simple/client/ChangeLog @@ -1,4 +1,9 @@ +Mon May 01 15:56:32 1995 Chris Provenzano (proven@mit.edu) + + * sim_client.c (main()): Changes to auth_context to better + support full addresses, for mk_safe() and friends. + Mon Mar 27 09:25:21 1995 Chris Provenzano (proven@mit.edu) * sim_client.c: Don't set cksumtype because CKSUMTYPE_RSA_MD4_DES diff --git a/src/appl/simple/client/sim_client.c b/src/appl/simple/client/sim_client.c index 038a74510..bb58c6534 100644 --- a/src/appl/simple/client/sim_client.c +++ b/src/appl/simple/client/sim_client.c @@ -64,7 +64,7 @@ main(argc, argv) krb5_error_code retval; krb5_data packet, inbuf; krb5_ccache ccdef; - krb5_address local_addr, foreign_addr, *portlocal_addr; + krb5_address addr, *portlocal_addr; krb5_rcache rcache; extern krb5_deltat krb5_clockskew; @@ -114,10 +114,6 @@ main(argc, argv) s_sock.sin_family = AF_INET; s_sock.sin_port = serv->s_port; - foreign_addr.addrtype = ADDRTYPE_INET; - foreign_addr.length = sizeof(s_sock.sin_addr); - foreign_addr.contents = (krb5_octet *)&s_sock.sin_addr; - /* Open a socket */ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { com_err(PROGNAME, errno, "opening datagram socket"); @@ -173,11 +169,25 @@ main(argc, argv) com_err(PROGNAME, errno, "while getting socket name"); exit(1); } - local_addr.addrtype = ADDRTYPE_INET; - local_addr.length = sizeof(c_sock.sin_addr); - local_addr.contents = (krb5_octet *)&c_sock.sin_addr; - if (retval = krb5_gen_portaddr(context, &local_addr, + addr.addrtype = ADDRTYPE_IPPORT; + addr.length = sizeof(c_sock.sin_port); + addr.contents = (krb5_octet *)&c_sock.sin_port; + if (retval = krb5_auth_con_setports(context, auth_context, &addr, NULL)) { + com_err(PROGNAME, retval, "while setting local port\n"); + exit(1); + } + + addr.addrtype = ADDRTYPE_INET; + addr.length = sizeof(c_sock.sin_addr); + addr.contents = (krb5_octet *)&c_sock.sin_addr; + if (retval = krb5_auth_con_setaddrs(context, auth_context, &addr, NULL)) { + com_err(PROGNAME, retval, "while setting local addr\n"); + exit(1); + } + + /* THIS IS UGLY */ + if (retval = krb5_gen_portaddr(context, &addr, (krb5_pointer) &c_sock.sin_port, &portlocal_addr)) { com_err(PROGNAME, retval, "while generating port address"); @@ -211,10 +221,6 @@ main(argc, argv) exit(1); } - /* set auth_context data */ - krb5_auth_con_setaddrs(context, auth_context, - portlocal_addr, &foreign_addr); - /* set auth_context rcache */ krb5_auth_con_setrcache(context, auth_context, rcache);