From 6a0b96cbdbba249c04f6048adca70ffc2d033e85 Mon Sep 17 00:00:00 2001 From: Bleep Date: Thu, 6 Apr 2000 06:50:18 +0000 Subject: [PATCH] Author: Bleep Log message: Sync with changes to 2.10.10.pl6 (shorten auth timeout, localhost to server alias). git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@137 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 6 +++++- include/numeric.h | 6 +++--- ircd/s_auth.c | 40 ++++++++++++++++++++++++++-------------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68a7ad7..5d77143 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2000-04-06 Thomas Helvey + * ircd/s_auth.c: Shorten auth connect timeout to 60 seconds + set client host to server alias if connection from localhost + 2000-04-06 Perry Lorier * ircd/ircd.c: Fix core during pinging (oops) @@ -301,7 +305,7 @@ # # ChangeLog for ircu2.10.11 # -# $Id: ChangeLog,v 1.61 2000-04-06 04:00:28 isomer Exp $ +# $Id: ChangeLog,v 1.62 2000-04-06 06:50:18 bleep Exp $ # # Insert new changes at beginning of the change list. # diff --git a/include/numeric.h b/include/numeric.h index 02ebde1..bfaabd6 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -117,10 +117,10 @@ extern const struct Numeric* get_error_numeric(int err); /* RPL_STATSXLINE 247 hybrid extension */ /* RPL_STATSBLINE 247 Numerics List: IRCnet */ #define RPL_STATSULINE 248 /* Undernet extension */ -/* RPL_STATSDEFINE 248 /* Numerics List: IRCnet */ +/* RPL_STATSDEFINE 248 Numerics List: IRCnet */ #define RPL_STATSDEBUG 249 /* Extension to RFC1459 */ #define RPL_STATSCONN 250 /* Undernet extension */ -/* RPL_STATSDLINE 250 /* Numerics List: IRCnet */ +/* RPL_STATSDLINE 250 Numerics List: IRCnet */ #define RPL_LUSERCLIENT 251 #define RPL_LUSEROP 252 @@ -259,7 +259,7 @@ extern const struct Numeric* get_error_numeric(int err); #define RPL_YOUREOPER 381 #define RPL_REHASHING 382 -/* RPL_YOURSERVICE 383 /* Numeric List: various */ +/* RPL_YOURSERVICE 383 Numeric List: various */ #define RPL_MYPORTIS 384 /* not used */ #define RPL_NOTOPERANYMORE 385 /* Extension to RFC1459, not used */ diff --git a/ircd/s_auth.c b/ircd/s_auth.c index 58ca8a1..b84d100 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -48,6 +48,7 @@ #include "struct.h" #include "sys.h" /* TRUE bleah */ +#include /* inet_netof */ #include /* struct hostent */ #include #include @@ -96,6 +97,8 @@ typedef enum { struct AuthRequest* AuthPollList = 0; /* GLOBAL - auth queries pending io */ static struct AuthRequest* AuthIncompleteList = 0; +enum { AUTH_TIMEOUT = 60 }; + /* * make_auth_request - allocate a new auth request */ @@ -107,7 +110,7 @@ static struct AuthRequest* make_auth_request(struct Client* client) memset(auth, 0, sizeof(struct AuthRequest)); auth->fd = -1; auth->client = client; - auth->timeout = CurrentTime + CONNECTTIMEOUT; + auth->timeout = CurrentTime + AUTH_TIMEOUT; return auth; } @@ -507,9 +510,10 @@ static char* GetValidIdent(char *buf) /* * start_auth - starts auth (identd) and dns queries for a client */ +enum { LOOPBACK = 127 }; + void start_auth(struct Client* client) { - struct DNSQuery query; struct AuthRequest* auth = 0; assert(0 != client); @@ -517,22 +521,30 @@ void start_auth(struct Client* client) auth = make_auth_request(client); assert(0 != auth); - query.vptr = auth; - query.callback = auth_dns_callback; +#if !defined(NODNS) + if (LOOPBACK == inet_netof(client->ip)) { + strcpy(client->sockhost, me.name); + } + else { + struct DNSQuery query; - if (IsUserPort(auth->client)) - sendheader(client, REPORT_DO_DNS); + query.vptr = auth; + query.callback = auth_dns_callback; -#if !defined(NODNS) - client->dns_reply = gethost_byaddr((const char*) &client->ip, &query); - if (client->dns_reply) { - ++client->dns_reply->ref_count; - ircd_strncpy(client->sockhost, client->dns_reply->hp->h_name, HOSTLEN); if (IsUserPort(auth->client)) - sendheader(client, REPORT_FIN_DNSC); + sendheader(client, REPORT_DO_DNS); + + client->dns_reply = gethost_byaddr((const char*) &client->ip, &query); + + if (client->dns_reply) { + ++client->dns_reply->ref_count; + ircd_strncpy(client->sockhost, client->dns_reply->hp->h_name, HOSTLEN); + if (IsUserPort(auth->client)) + sendheader(client, REPORT_FIN_DNSC); + } + else + SetDNSPending(auth); } - else - SetDNSPending(auth); #endif if (start_auth_query(auth)) -- 2.20.1