From: John Kohl Date: Fri, 8 Mar 1991 16:43:17 +0000 (+0000) Subject: fix up usage msg X-Git-Tag: krb5-1.0-alpha4~97 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2a8c98c5ea948c2e55b922893379ce57446e7c5d;p=krb5.git fix up usage msg add init_ets(); check sender addr git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1875 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/simple/server/sim_server.c b/src/appl/simple/server/sim_server.c index b73453145..a3b383466 100644 --- a/src/appl/simple/server/sim_server.c +++ b/src/appl/simple/server/sim_server.c @@ -59,10 +59,12 @@ char *argv[]; krb5_tkt_authent *ad; if (argc != 2) { - fprintf(stderr, "usage: %s \n",PROGNAME); + fprintf(stderr, "usage: %s \n",PROGNAME); exit(1); } + krb5_init_ets(); + if (retval = krb5_parse_name(SNAME, &sprinc)) { com_err(PROGNAME, retval, "while parsing server name %s", SNAME); exit(1); @@ -108,18 +110,26 @@ char *argv[]; /* GET KRB_AP_REQ MESSAGE */ - i = read(sock, (char *)pktbuf, sizeof(pktbuf)); + /* 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) { perror("receiving datagram"); exit(1); } + printf("Received %d bytes\n", i); packet.length = i; packet.data = (krb5_pointer) pktbuf; + foreign_addr.addrtype = c_sock.sin_family; + foreign_addr.length = sizeof(c_sock.sin_addr); + foreign_addr.contents = (krb5_octet *)&c_sock.sin_addr; + /* Check authentication info */ if (retval = krb5_rd_req_simple(&packet, sprinc, - 0, /* ignore sender address for now */ + &foreign_addr, &ad)) { com_err(PROGNAME, retval, "while reading request"); exit(1);