X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/94c0bd4abe20814f3fcf191706303f7aa0f85937..1728a2acd0cc89dddb27ea92c4ff304e2f6b7a09:/src/res.c diff --git a/src/res.c b/src/res.c index 08b2c25..81e23c0 100644 --- a/src/res.c +++ b/src/res.c @@ -56,26 +56,16 @@ static PF res_readreply; #define RDLENGTH_SIZE (size_t)2 #define ANSWER_FIXED_SIZE (TYPE_SIZE + CLASS_SIZE + TTL_SIZE + RDLENGTH_SIZE) -typedef enum -{ - REQ_IDLE, /* We're doing not much at all */ - REQ_PTR, /* Looking up a PTR */ - REQ_A, /* Looking up an A or AAAA */ - REQ_CNAME /* We got a CNAME in response, we better get a real answer next */ -} request_state; - struct reslist { rb_dlink_node node; int id; int sent; /* number of requests sent */ - request_state state; /* State the resolver machine is in */ time_t ttl; char type; char queryname[128]; /* name currently being queried */ char retries; /* retry counter */ char sends; /* number of sends (>1 means resent) */ - char resend; /* send flag. 0 == dont resend */ time_t sentat; time_t timeout; struct rb_sockaddr_storage addr; @@ -296,10 +286,8 @@ static struct reslist *make_request(struct DNSQuery *query) request->sentat = rb_current_time(); request->retries = 3; - request->resend = 1; request->timeout = 4; /* start at 4 and exponential inc. */ request->query = query; - request->state = REQ_IDLE; rb_dlinkAdd(request, &request->node, &request_list); @@ -409,7 +397,6 @@ static void do_query_name(struct DNSQuery *query, const char *name, struct resli request = make_request(query); request->name = (char *)rb_malloc(strlen(host_name) + 1); strcpy(request->name, host_name); - request->state = REQ_A; } rb_strlcpy(request->queryname, host_name, sizeof(request->queryname)); @@ -517,9 +504,6 @@ static void query_name(struct reslist *request) static void resend_query(struct reslist *request) { - if (request->resend == 0) - return; - switch (request->type) { case T_PTR: @@ -679,22 +663,8 @@ static int proc_answer(struct reslist *request, HEADER * header, char *buf, char return (1); break; - case T_CNAME: /* first check we already havent started looking - into a cname */ - if (request->type != T_PTR) - return (0); - - if (request->state == REQ_CNAME) - { - n = irc_dn_expand((unsigned char *)buf, (unsigned char *)eob, - current, hostbuf, sizeof(hostbuf)); - - if (n < 0) - return (0); - return (1); - } - - request->state = REQ_CNAME; + case T_CNAME: + /* real answer will follow */ current += rd_length; break;