X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Famindexd.c;h=7ad24e871941771e3da41b7fb987f9457607afc4;hb=2df780bff19c457b0debb7adc29972a0bc2a5dc2;hp=e35d2709fe2ed89c4108cec033778f2e464f4fc3;hpb=0de2ad0a86685398621fb8ffa6990c029681bb3a;p=debian%2Famanda diff --git a/server-src/amindexd.c b/server-src/amindexd.c index e35d270..7ad24e8 100644 --- a/server-src/amindexd.c +++ b/server-src/amindexd.c @@ -24,7 +24,7 @@ * file named AUTHORS, in the root directory of this distribution. */ /* - * $Id: amindexd.c,v 1.39.2.11.4.4.2.13.2.1 2004/04/05 17:22:59 martinea Exp $ + * $Id: amindexd.c,v 1.39.2.11.4.4.2.13.2.3 2005/10/02 13:48:42 martinea Exp $ * * This is the server daemon part of the index client/server system. * It is assumed that this is launched from inetd instead of being @@ -798,27 +798,17 @@ char **argv; char *s, *fp; int ch; char *cmd_undo, cmd_undo_ch; - int i; + socklen_t socklen; struct sockaddr_in his_addr; struct hostent *his_name; char *arg; char *cmd; int len; - int fd; int user_validated = 0; char *errstr = NULL; char *pgm = "amindexd"; /* in case argv[0] is not set */ - for(fd = 3; fd < FD_SETSIZE; fd++) { - /* - * Make sure nobody spoofs us with a lot of extra open files - * that would cause an open we do to get a very high file - * descriptor, which in turn might be used as an index into - * an array (e.g. an fd_set). - */ - close(fd); - } - + safe_fd(-1, 0); safe_cd(); /* @@ -913,8 +903,8 @@ char **argv; (char *)his_name->h_addr_list[0], his_name->h_length); } else { /* who are we talking to? */ - i = sizeof (his_addr); - if (getpeername(0, (struct sockaddr *)&his_addr, &i) == -1) + socklen = sizeof (his_addr); + if (getpeername(0, (struct sockaddr *)&his_addr, &socklen) == -1) error("getpeername: %s", strerror(errno)); } if (his_addr.sin_family != AF_INET || ntohs(his_addr.sin_port) == 20)