diff options
Diffstat (limited to 'src/appl')
-rw-r--r-- | src/appl/simple/server/ChangeLog | 6 | ||||
-rw-r--r-- | src/appl/simple/server/sim_server.c | 46 |
2 files changed, 27 insertions, 25 deletions
diff --git a/src/appl/simple/server/ChangeLog b/src/appl/simple/server/ChangeLog index a57c3a520..82a5e340f 100644 --- a/src/appl/simple/server/ChangeLog +++ b/src/appl/simple/server/ChangeLog @@ -1,3 +1,9 @@ + +Mon May 01 15:56:32 1995 Chris Provenzano (proven@mit.edu) + + * sim_server.c (main()): Changes to auth_context to better + support full addresses, for mk_safe() and friends. + Mon Mar 27 07:56:26 1995 Chris Provenzano (proven@mit.edu) * sim_server.c: Use new calling convention for krb5_rd_req(), diff --git a/src/appl/simple/server/sim_server.c b/src/appl/simple/server/sim_server.c index b0aff669b..974895555 100644 --- a/src/appl/simple/server/sim_server.c +++ b/src/appl/simple/server/sim_server.c @@ -64,10 +64,10 @@ char *argv[]; krb5_error_code retval; krb5_data packet, message; unsigned char pktbuf[BUFSIZ]; - krb5_address foreign_addr, *portforeign_addr; krb5_principal sprinc; krb5_context context; krb5_auth_context *auth_context = NULL; + krb5_address addr; krb5_ticket *ticket = NULL; if (argc != 2) { @@ -124,10 +124,9 @@ char *argv[]; /* GET KRB_AP_REQ MESSAGE */ /* use "recvfrom" so we know client's address */ - i = sizeof(c_sock); - i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, - (struct sockaddr *)&c_sock, &i); - if (i < 0) { + i = sizeof(struct sockaddr_in); + if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, + (struct sockaddr *)&c_sock, &i)) < 0) { perror("receiving datagram"); exit(1); } @@ -150,30 +149,28 @@ char *argv[]; free(cp); /* Set foreign_addr for rd_safe() and rd_priv() */ - foreign_addr.contents = (krb5_octet *)&c_sock.sin_addr; - foreign_addr.length = sizeof(c_sock.sin_addr); - foreign_addr.addrtype = c_sock.sin_family; - - if (retval = krb5_gen_portaddr(context, &foreign_addr, - (krb5_pointer) &c_sock.sin_port, - &portforeign_addr)) { - com_err(PROGNAME, retval, "while generating port address"); - 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, NULL, &addr)) { + com_err(PROGNAME, retval, "while setting foreign addr"); + exit(1); } - if (retval = krb5_auth_con_setaddrs(context, auth_context, NULL, - portforeign_addr)) { - com_err(PROGNAME, retval, "while setting foreign 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, NULL, &addr)) { + com_err(PROGNAME, retval, "while setting foreign port"); exit(1); } /* GET KRB_MK_SAFE MESSAGE */ /* use "recvfrom" so we know client's address */ - i = sizeof(c_sock); - i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, - (struct sockaddr *)&c_sock, &i); - if (i < 0) { + i = sizeof(struct sockaddr_in); + if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, + (struct sockaddr *)&c_sock, &i)) < 0) { perror("receiving datagram"); exit(1); } @@ -196,10 +193,9 @@ char *argv[]; /* NOW GET ENCRYPTED MESSAGE */ /* use "recvfrom" so we know client's address */ - i = sizeof(c_sock); - i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, - (struct sockaddr *)&c_sock, &i); - if (i < 0) { + i = sizeof(struct sockaddr_in); + if ((i = recvfrom(sock, (char *)pktbuf, sizeof(pktbuf), flags, + (struct sockaddr *)&c_sock, &i)) < 0) { perror("receiving datagram"); exit(1); } |