36c36
< RCSID("$Id: connect.c,v 1.69 2000/02/11 17:45:45 assar Exp $");
---
> RCSID("$Id: connect.c,v 1.70 2000/02/19 18:41:24 assar Exp $");
195a196,199
> struct sockaddr_storage __ss;
> struct sockaddr *sa;
> int sock_len;
> char addr_string[128];
210a215
> d->sa = (struct sockaddr *)&d->__ss;
377a383,386
> /*
> * Handle the request in `buf, len' to socket `d'
> */
>
380c389
< int socket, struct sockaddr *from, size_t from_len)
---
> struct descr *d)
384d392
< char addr[128];
386,387d393
< addr_to_string(from, from_len, addr, sizeof(addr));
<
389c395,396
< ret = process_request(buf, len, &reply, &sendlength, addr, from);
---
> ret = process_request(buf, len, &reply, &sendlength,
> d->addr_string, d->sa);
391c398
< kdc_log(5, "sending %d bytes to %s", reply.length, addr);
---
> kdc_log(5, "sending %d bytes to %s", reply.length, d->addr_string);
398,399c405,406
< if(sendto(socket, len, sizeof(len), 0, from, from_len) < 0) {
< kdc_log (0, "sendto(%s): %s", addr, strerror(errno));
---
> if(sendto(d->s, len, sizeof(len), 0, d->sa, d->sock_len) < 0) {
> kdc_log (0, "sendto(%s): %s", d->addr_string, strerror(errno));
404,405c411,412
< if(sendto(socket, reply.data, reply.length, 0, from, from_len) < 0) {
< kdc_log (0, "sendto(%s): %s", addr, strerror(errno));
---
> if(sendto(d->s, reply.data, reply.length, 0, d->sa, d->sock_len) < 0) {
> kdc_log (0, "sendto(%s): %s", d->addr_string, strerror(errno));
413c420
< (unsigned long)len, addr);
---
> (unsigned long)len, d->addr_string);
415a423,426
> /*
> * Handle incoming data to the UDP socket in `d'
> */
>
420,422d430
< struct sockaddr_storage __ss;
< struct sockaddr *sa = (struct sockaddr *)&__ss;
< int from_len;
431,434c439,441
< from_len = sizeof(__ss);
< n = recvfrom(d->s, buf, max_request, 0,
< sa, &from_len);
< if(n < 0){
---
> d->sock_len = sizeof(d->__ss);
> n = recvfrom(d->s, buf, max_request, 0, d->sa, &d->sock_len);
> if(n < 0)
436c443,446
< goto out;
---
> else {
> addr_to_string (d->sa, d->sock_len,
> d->addr_string, sizeof(d->addr_string));
> do_request(buf, n, 0, d);
438,442d447
< if(n == 0) {
< goto out;
< }
< do_request(buf, n, 0, d->s, sa, from_len);
< out:
486,487d490
< struct sockaddr_storage __ss;
< struct sockaddr *sa = (struct sockaddr *)&__ss;
489d491
< int from_len;
491,493c493,495
< from_len = sizeof(__ss);
< s = accept(d[index].s, sa, &from_len);
< if(s < 0){
---
> d->sock_len = sizeof(d->__ss);
> s = accept(d[index].s, d->sa, &d->sock_len);
> if(s < 0) {
504a507,508
> addr_to_string (d[min_free].sa, d[min_free].sock_len,
> d[min_free].addr_string, sizeof(d[min_free].addr_string));
567c571
< handle_http_tcp (struct descr *d, const char *addr)
---
> handle_http_tcp (struct descr *d)
578c582
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
586c590
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
591c595
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
602c606
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
609c613
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
626c630
< kdc_log(0, "HTTP request from %s is non KDC request", addr);
---
> kdc_log(0, "HTTP request from %s is non KDC request", d->addr_string);
654,657d657
< char addr[32];
< struct sockaddr_storage __ss;
< struct sockaddr *sa = (struct sockaddr *)&__ss;
< int from_len;
666,670d665
< /*
< * We can't trust recvfrom to return an address so we always call
< * getpeername.
< */
<
676,681d670
< from_len = sizeof(__ss);
< if (getpeername(d[index].s, sa, &from_len) < 0) {
< krb5_warn(context, errno, "getpeername");
< return;
< }
< addr_to_string(sa, from_len, addr, sizeof(addr));
693c682
< ret = handle_http_tcp (&d[index], addr);
---
> ret = handle_http_tcp (&d[index]);
697c686
< kdc_log (0, "TCP data of strange type from %s", addr);
---
> kdc_log (0, "TCP data of strange type from %s", d[index].addr_string);
703,704c692
< do_request(d[index].buf, d[index].len, 1,
< d[index].s, sa, from_len);
---
> do_request(d[index].buf, d[index].len, 1, &d[index]);
728,734c716
< d[i].timeout && d[i].timeout < time(NULL)){
< struct sockaddr sa;
< int salen = sizeof(sa);
< char addr[32];
<
< getpeername(d[i].s, &sa, &salen);
< addr_to_string(&sa, salen, addr, sizeof(addr));
---
> d[i].timeout && d[i].timeout < time(NULL)) {
736c718
< addr, d[i].len);
---
> d[i].addr_string, d[i].len);
< RCSID("$Id: connect.c,v 1.69 2000/02/11 17:45:45 assar Exp $");
---
> RCSID("$Id: connect.c,v 1.70 2000/02/19 18:41:24 assar Exp $");
195a196,199
> struct sockaddr_storage __ss;
> struct sockaddr *sa;
> int sock_len;
> char addr_string[128];
210a215
> d->sa = (struct sockaddr *)&d->__ss;
377a383,386
> /*
> * Handle the request in `buf, len' to socket `d'
> */
>
380c389
< int socket, struct sockaddr *from, size_t from_len)
---
> struct descr *d)
384d392
< char addr[128];
386,387d393
< addr_to_string(from, from_len, addr, sizeof(addr));
<
389c395,396
< ret = process_request(buf, len, &reply, &sendlength, addr, from);
---
> ret = process_request(buf, len, &reply, &sendlength,
> d->addr_string, d->sa);
391c398
< kdc_log(5, "sending %d bytes to %s", reply.length, addr);
---
> kdc_log(5, "sending %d bytes to %s", reply.length, d->addr_string);
398,399c405,406
< if(sendto(socket, len, sizeof(len), 0, from, from_len) < 0) {
< kdc_log (0, "sendto(%s): %s", addr, strerror(errno));
---
> if(sendto(d->s, len, sizeof(len), 0, d->sa, d->sock_len) < 0) {
> kdc_log (0, "sendto(%s): %s", d->addr_string, strerror(errno));
404,405c411,412
< if(sendto(socket, reply.data, reply.length, 0, from, from_len) < 0) {
< kdc_log (0, "sendto(%s): %s", addr, strerror(errno));
---
> if(sendto(d->s, reply.data, reply.length, 0, d->sa, d->sock_len) < 0) {
> kdc_log (0, "sendto(%s): %s", d->addr_string, strerror(errno));
413c420
< (unsigned long)len, addr);
---
> (unsigned long)len, d->addr_string);
415a423,426
> /*
> * Handle incoming data to the UDP socket in `d'
> */
>
420,422d430
< struct sockaddr_storage __ss;
< struct sockaddr *sa = (struct sockaddr *)&__ss;
< int from_len;
431,434c439,441
< from_len = sizeof(__ss);
< n = recvfrom(d->s, buf, max_request, 0,
< sa, &from_len);
< if(n < 0){
---
> d->sock_len = sizeof(d->__ss);
> n = recvfrom(d->s, buf, max_request, 0, d->sa, &d->sock_len);
> if(n < 0)
436c443,446
< goto out;
---
> else {
> addr_to_string (d->sa, d->sock_len,
> d->addr_string, sizeof(d->addr_string));
> do_request(buf, n, 0, d);
438,442d447
< if(n == 0) {
< goto out;
< }
< do_request(buf, n, 0, d->s, sa, from_len);
< out:
486,487d490
< struct sockaddr_storage __ss;
< struct sockaddr *sa = (struct sockaddr *)&__ss;
489d491
< int from_len;
491,493c493,495
< from_len = sizeof(__ss);
< s = accept(d[index].s, sa, &from_len);
< if(s < 0){
---
> d->sock_len = sizeof(d->__ss);
> s = accept(d[index].s, d->sa, &d->sock_len);
> if(s < 0) {
504a507,508
> addr_to_string (d[min_free].sa, d[min_free].sock_len,
> d[min_free].addr_string, sizeof(d[min_free].addr_string));
567c571
< handle_http_tcp (struct descr *d, const char *addr)
---
> handle_http_tcp (struct descr *d)
578c582
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
586c590
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
591c595
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
602c606
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
609c613
< kdc_log(0, "Malformed HTTP request from %s", addr);
---
> kdc_log(0, "Malformed HTTP request from %s", d->addr_string);
626c630
< kdc_log(0, "HTTP request from %s is non KDC request", addr);
---
> kdc_log(0, "HTTP request from %s is non KDC request", d->addr_string);
654,657d657
< char addr[32];
< struct sockaddr_storage __ss;
< struct sockaddr *sa = (struct sockaddr *)&__ss;
< int from_len;
666,670d665
< /*
< * We can't trust recvfrom to return an address so we always call
< * getpeername.
< */
<
676,681d670
< from_len = sizeof(__ss);
< if (getpeername(d[index].s, sa, &from_len) < 0) {
< krb5_warn(context, errno, "getpeername");
< return;
< }
< addr_to_string(sa, from_len, addr, sizeof(addr));
693c682
< ret = handle_http_tcp (&d[index], addr);
---
> ret = handle_http_tcp (&d[index]);
697c686
< kdc_log (0, "TCP data of strange type from %s", addr);
---
> kdc_log (0, "TCP data of strange type from %s", d[index].addr_string);
703,704c692
< do_request(d[index].buf, d[index].len, 1,
< d[index].s, sa, from_len);
---
> do_request(d[index].buf, d[index].len, 1, &d[index]);
728,734c716
< d[i].timeout && d[i].timeout < time(NULL)){
< struct sockaddr sa;
< int salen = sizeof(sa);
< char addr[32];
<
< getpeername(d[i].s, &sa, &salen);
< addr_to_string(&sa, salen, addr, sizeof(addr));
---
> d[i].timeout && d[i].timeout < time(NULL)) {
736c718
< addr, d[i].len);
---
> d[i].addr_string, d[i].len);