[IRC-Dev CVS] [CVS] Module ircd-ircdev: Change committed
Brought to you by:
zolty
From: Toni G. <zo...@us...> - 2005-07-03 20:22:01
|
CVSROOT : /cvsroot/irc-dev Module : ircd-ircdev Commit time: 2005-07-03 20:21:52 UTC Modified files: ChangeLog ChangeLog.es include/client.h include/patchlevel.h include/res.h include/s_bsd.h include/s_misc.h ircd/hash.c ircd/ircd_auth.c ircd/ircd_crypt.c ircd/ircd_res.c ircd/list.c ircd/m_invite.c ircd/s_auth.c ircd/s_bsd.c ircd/s_conf.c ircd/s_misc.c ircd/s_serv.c ircd/s_user.c Log message: Author: zoltan <zo...@ir...> Log message: 2005-07-03 Toni García <zo...@ir...> 1.0.alpha42 * Sincronización Undernet ---------------------- diff included ---------------------- Index: ircd-ircdev/ChangeLog diff -u ircd-ircdev/ChangeLog:1.43 ircd-ircdev/ChangeLog:1.44 --- ircd-ircdev/ChangeLog:1.43 Sun Jul 3 11:44:51 2005 +++ ircd-ircdev/ChangeLog Sun Jul 3 13:21:41 2005 @@ -1,10 +1,13 @@ # # ChangeLog for ircd-ircdev # -# $Id: ChangeLog,v 1.43 2005/07/03 18:44:51 zolty Exp $ +# $Id: ChangeLog,v 1.44 2005/07/03 20:21:41 zolty Exp $ # # Insert new changes at beginning of the change list. # +2005-07-03 Toni García <zo...@ir...> 1.0.alpha42 + * Undernet synchronization + 2005-07-03 Toni García <zo...@ir...> 1.0.alpha41 * Crypted ips (only IPv4) Index: ircd-ircdev/ChangeLog.es diff -u ircd-ircdev/ChangeLog.es:1.43 ircd-ircdev/ChangeLog.es:1.44 --- ircd-ircdev/ChangeLog.es:1.43 Sun Jul 3 11:44:51 2005 +++ ircd-ircdev/ChangeLog.es Sun Jul 3 13:21:41 2005 @@ -1,10 +1,13 @@ # # Log de Cambios para ircd-ircdev # -# $Id: ChangeLog.es,v 1.43 2005/07/03 18:44:51 zolty Exp $ +# $Id: ChangeLog.es,v 1.44 2005/07/03 20:21:41 zolty Exp $ # # Insertar los nuevos cambios al principio de esta lista de cambios. # +2005-07-03 Toni García <zo...@ir...> 1.0.alpha42 + * Sincronización Undernet + 2005-07-03 Toni García <zo...@ir...> 1.0.alpha41 * IPs cifradas (sólo IPv4) Index: ircd-ircdev/include/client.h diff -u ircd-ircdev/include/client.h:1.15 ircd-ircdev/include/client.h:1.16 --- ircd-ircdev/include/client.h:1.15 Mon Apr 11 01:44:59 2005 +++ ircd-ircdev/include/client.h Sun Jul 3 13:21:41 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Structures and functions for handling local clients. - * @version $Id: client.h,v 1.15 2005/04/11 08:44:59 zolty Exp $ + * @version $Id: client.h,v 1.16 2005/07/03 20:21:41 zolty Exp $ */ #ifndef INCLUDED_client_h #define INCLUDED_client_h @@ -225,8 +225,6 @@ struct SLink* con_confs; /**< Associated configuration records. */ HandlerType con_handler; /**< Message index into command table for parsing. */ - struct DNSReply* con_dns_reply; /**< DNS reply received during client - registration. */ struct ListingArgs* con_listing; /**< Current LIST status. */ unsigned long con_unreg; /**< Indicate what still needs to be done */ unsigned int con_max_sendq; /**< cached max send queue for client */ @@ -382,8 +380,6 @@ #define cli_confs(cli) con_confs(cli_connect(cli)) /** Get handler type for client. */ #define cli_handler(cli) con_handler(cli_connect(cli)) -/** Get DNS reply for client. */ -#define cli_dns_reply(cli) con_dns_reply(cli_connect(cli)) /** Get LIST status for client. */ #define cli_listing(cli) con_listing(cli_connect(cli)) /** Get cached max SendQ for client. */ @@ -463,8 +459,6 @@ #define con_confs(con) ((con)->con_confs) /** Get command handler for the connection. */ #define con_handler(con) ((con)->con_handler) -/** Get DNS reply for the connection. */ -#define con_dns_reply(con) ((con)->con_dns_reply) /** Get the LIST status for the connection. */ #define con_listing(con) ((con)->con_listing) /** Get remining steps before registration completes. */ Index: ircd-ircdev/include/patchlevel.h diff -u ircd-ircdev/include/patchlevel.h:1.42 ircd-ircdev/include/patchlevel.h:1.43 --- ircd-ircdev/include/patchlevel.h:1.42 Wed Jun 22 03:01:25 2005 +++ ircd-ircdev/include/patchlevel.h Sun Jul 3 13:21:41 2005 @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: patchlevel.h,v 1.42 2005/06/22 10:01:25 zolty Exp $ + * $Id: patchlevel.h,v 1.43 2005/07/03 20:21:41 zolty Exp $ * */ -#define PATCHLEVEL ".alpha41" +#define PATCHLEVEL ".alpha42" #define RELEASE "1.0" Index: ircd-ircdev/include/res.h diff -u ircd-ircdev/include/res.h:1.7 ircd-ircdev/include/res.h:1.8 --- ircd-ircdev/include/res.h:1.7 Mon Jan 10 04:22:00 2005 +++ ircd-ircdev/include/res.h Sun Jul 3 13:21:41 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief IRC resolver API. - * @version $Id: res.h,v 1.7 2005/01/10 12:22:00 zolty Exp $ + * @version $Id: res.h,v 1.8 2005/07/03 20:21:41 zolty Exp $ */ #ifndef INCLUDED_res_h @@ -88,19 +88,8 @@ unsigned short port; /**< Port number, host-endian. */ }; -/** DNS reply structure. */ -struct DNSReply -{ - char *h_name; /**< Hostname. */ - struct irc_in_addr addr; /**< IP address. */ -}; - -/** DNS callback structure. */ -struct DNSQuery -{ - void *vptr; /**< pointer used by callback to identify request */ - void (*callback)(void* vptr, struct DNSReply *reply); /**< callback to call */ -}; +/** DNS callback function signature. */ +typedef void (*dns_callback_f)(void *vptr, const struct irc_in_addr *addr, const char *h_name); /** DNS query and response header. */ typedef struct @@ -145,8 +134,8 @@ extern size_t cres_mem(struct Client* cptr); extern void delete_resolver_queries(const void *vptr); extern void report_dns_servers(struct Client *source_p, const struct StatDesc *sd, char *param); -extern void gethost_byname(const char *name, const struct DNSQuery *query); -extern void gethost_byaddr(const struct irc_in_addr *addr, const struct DNSQuery *query); +extern void gethost_byname(const char *name, dns_callback_f callback, void *ctx); +extern void gethost_byaddr(const struct irc_in_addr *addr, dns_callback_f callback, void *ctx); /** Evaluate to non-zero if \a ADDR is a valid address (not all 0s and not all 1s). */ #define irc_in_addr_valid(ADDR) (((ADDR)->in6_16[0] && ~(ADDR)->in6_16[0]) \ Index: ircd-ircdev/include/s_bsd.h diff -u ircd-ircdev/include/s_bsd.h:1.6 ircd-ircdev/include/s_bsd.h:1.7 --- ircd-ircdev/include/s_bsd.h:1.6 Mon Jan 10 04:22:00 2005 +++ ircd-ircdev/include/s_bsd.h Sun Jul 3 13:21:41 2005 @@ -21,7 +21,7 @@ */ /** @file s_bsd.h * @brief Wrapper functions to avoid direct use of BSD APIs. - * @version $Id: s_bsd.h,v 1.6 2005/01/10 12:22:00 zolty Exp $ + * @version $Id: s_bsd.h,v 1.7 2005/07/03 20:21:41 zolty Exp $ */ #ifndef INCLUDED_s_bsd_h #define INCLUDED_s_bsd_h @@ -81,7 +81,6 @@ */ extern unsigned int deliver_it(struct Client *cptr, struct MsgQ *buf); extern int connect_server(struct ConfItem* aconf, struct Client* by); -extern void release_dns_reply(struct Client* cptr); extern int net_close_unregistered_connections(struct Client* source); extern void close_connection(struct Client *cptr); extern void add_connection(struct Listener* listener, int fd); Index: ircd-ircdev/include/s_misc.h diff -u ircd-ircdev/include/s_misc.h:1.4 ircd-ircdev/include/s_misc.h:1.5 --- ircd-ircdev/include/s_misc.h:1.4 Mon Jan 10 04:22:00 2005 +++ ircd-ircdev/include/s_misc.h Sun Jul 3 13:21:41 2005 @@ -21,7 +21,7 @@ */ /** @file s_misc.h * @brief Miscellaneous support functions and declarations. - * @version $Id: s_misc.h,v 1.4 2005/01/10 12:22:00 zolty Exp $ + * @version $Id: s_misc.h,v 1.5 2005/07/03 20:21:41 zolty Exp $ */ #ifndef INCLUDED_s_misc_h #define INCLUDED_s_misc_h @@ -105,7 +105,6 @@ struct Client *sptr, const char *pattern, ...); extern void initstats(void); extern char *date(time_t clock); -extern void get_sockhost(struct Client *cptr, char *host); extern int vexit_client_msg(struct Client *cptr, struct Client *bcptr, struct Client *sptr, const char *pattern, va_list vl); extern void tstats(struct Client *cptr, const struct StatDesc *sd, Index: ircd-ircdev/ircd/hash.c diff -u ircd-ircdev/ircd/hash.c:1.11 ircd-ircdev/ircd/hash.c:1.12 --- ircd-ircdev/ircd/hash.c:1.11 Wed Jun 22 02:58:52 2005 +++ ircd-ircdev/ircd/hash.c Sun Jul 3 13:21:42 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief Hash table management. - * @version $Id: hash.c,v 1.11 2005/06/22 09:58:52 zolty Exp $ + * @version $Id: hash.c,v 1.12 2005/07/03 20:21:42 zolty Exp $ * * This file used to use some very complicated hash function. Now it * uses CRC-32, but effectively remaps each input byte according to a @@ -40,6 +40,7 @@ #include "ircd_reply.h" #include "ircd_string.h" #include "ircd.h" +#include "match.h" #include "msg.h" #include "numeric.h" #include "random.h" Index: ircd-ircdev/ircd/ircd_auth.c diff -u ircd-ircdev/ircd/ircd_auth.c:1.6 ircd-ircdev/ircd/ircd_auth.c:1.7 --- ircd-ircdev/ircd/ircd_auth.c:1.6 Sat May 7 15:23:40 2005 +++ ircd-ircdev/ircd/ircd_auth.c Sun Jul 3 13:21:42 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief IAuth client implementation for an IRC server. - * @version $Id: ircd_auth.c,v 1.6 2005/05/07 22:23:40 zolty Exp $ + * @version $Id: ircd_auth.c,v 1.7 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" #include "client.h" @@ -84,7 +84,6 @@ struct Timer i_reconn_timer; /**< when to reconnect the connection */ struct Timer i_request_timer; /**< when the current request times out */ struct IAuthFlags i_flags; /**< connection state/status/flags */ - struct DNSQuery i_query; /**< DNS lookup for iauth server */ unsigned int i_recvM; /**< messages received */ unsigned int i_sendM; /**< messages sent */ unsigned int i_recvK; /**< kilobytes received */ @@ -408,13 +407,13 @@ * @param[in] vptr Pointer to the IAuth struct. * @param[in] he DNS reply parameters. */ -static void iauth_dns_callback(void *vptr, struct DNSReply *he) +static void iauth_dns_callback(void *vptr, const struct irc_in_addr *addr, const char *h_name) { struct IAuth *iauth = vptr; - if (!he) { + if (!addr) { log_write(LS_IAUTH, L_NOTICE, 0, "IAuth connection to %s failed: host lookup failed", i_host(iauth)); } else { - memcpy(&i_addr(iauth).addr, &he->addr, sizeof(i_addr(iauth).addr)); + memcpy(&i_addr(iauth).addr, &addr, sizeof(i_addr(iauth).addr)); if (!irc_in_addr_valid(&i_addr(iauth).addr)) { log_write(LS_IAUTH, L_NOTICE, 0, "IAuth connection to %s failed: host came back as unresolved", i_host(iauth)); return; @@ -463,9 +462,7 @@ log_write(LS_IAUTH, L_DEBUG, 0, "IAuth attempt connection to %s port %p.", i_host(iauth), i_port(iauth)); if (!irc_in_addr_valid(&i_addr(iauth).addr) && !ircd_aton(&i_addr(iauth).addr, i_host(iauth))) { - i_query(iauth).vptr = iauth; - i_query(iauth).callback = iauth_dns_callback; - gethost_byname(i_host(iauth), &i_query(iauth)); + gethost_byname(i_host(iauth), iauth_dns_callback, iauth); return; } local = irc_in_addr_is_ipv4(&i_addr(iauth).addr) ? &VirtualHost_v4 : &VirtualHost_v6; Index: ircd-ircdev/ircd/ircd_crypt.c diff -u ircd-ircdev/ircd/ircd_crypt.c:1.4 ircd-ircdev/ircd/ircd_crypt.c:1.5 --- ircd-ircdev/ircd/ircd_crypt.c:1.4 Mon Mar 21 10:39:07 2005 +++ ircd-ircdev/ircd/ircd_crypt.c Sun Jul 3 13:21:42 2005 @@ -22,7 +22,7 @@ /** * @file * @brief Core password encryption routines. - * @version $Id: ircd_crypt.c,v 1.4 2005/03/21 18:39:07 zolty Exp $ + * @version $Id: ircd_crypt.c,v 1.5 2005/07/03 20:21:42 zolty Exp $ * * This is a new look crypto API for ircu, it can handle different * password formats by the grace of magic tokens at the beginning of the @@ -202,9 +202,13 @@ /* try to use native crypt for an old-style (untagged) password */ if (strlen(salt) > 2) { + char *s; temp_hashed_pass = (char*)ircd_crypt_native(key, salt); if (!ircd_strcmp(temp_hashed_pass, salt)) - return strdup(temp_hashed_pass); + { + DupString(s, temp_hashed_pass); + return s; + } } return NULL; Index: ircd-ircdev/ircd/ircd_res.c diff -u ircd-ircdev/ircd/ircd_res.c:1.9 ircd-ircdev/ircd/ircd_res.c:1.10 --- ircd-ircdev/ircd/ircd_res.c:1.9 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/ircd/ircd_res.c Sun Jul 3 13:21:42 2005 @@ -41,7 +41,7 @@ */ /** @file * @brief IRC resolver functions. - * @version $Id: ircd_res.c,v 1.9 2005/06/22 07:54:29 zolty Exp $ + * @version $Id: ircd_res.c,v 1.10 2005/07/03 20:21:42 zolty Exp $ */ #include "client.h" #include "ircd_alloc.h" @@ -137,17 +137,19 @@ time_t timeout; /**< When this request times out. */ struct irc_in_addr addr; /**< Address for this request. */ char *name; /**< Hostname for this request. */ - struct DNSQuery query; /**< Query callback for this request. */ + dns_callback_f callback; /**< Callback function on completion. */ + void *callback_ctx; /**< Context pointer for callback. */ }; /** Base of request list. */ static struct dlink request_list; static void rem_request(struct reslist *request); -static struct reslist *make_request(const struct DNSQuery *query); -static void do_query_name(const struct DNSQuery *query, + +static struct reslist *make_request(dns_callback_f callback, void *ctx); +static void do_query_name(dns_callback_f callback, void *ctx, const char* name, struct reslist *request, int); -static void do_query_number(const struct DNSQuery *query, +static void do_query_number(dns_callback_f callback, void *ctx, const struct irc_in_addr *, struct reslist *request); static void query_name(const char *name, int query_class, int query_type, @@ -156,7 +158,6 @@ static void resend_query(struct reslist *request); static int proc_answer(struct reslist *request, HEADER *header, char *, char *); static struct reslist *find_id(int id); -static struct DNSReply *make_dnsreply(struct reslist *request); static void res_readreply(struct Event *ev); static void timeout_resolver(struct Event *notused); @@ -270,7 +271,7 @@ * @return Newly allocated and linked-in reslist. */ static struct reslist * -make_request(const struct DNSQuery* query) +make_request(dns_callback_f callback, void *ctx) { struct reslist *request; @@ -286,7 +287,8 @@ request->resend = 1; request->timeout = feature_int(FEAT_IRCD_RES_TIMEOUT); memset(&request->addr, 0, sizeof(request->addr)); - memcpy(&request->query, query, sizeof(request->query)); + request->callback = callback; + request->callback_ctx = ctx; add_dlink(&request->node, &request_list); return(request); @@ -335,7 +337,7 @@ if (--request->retries <= 0) { Debug((DEBUG_DNS, "Request %p out of retries; destroying", request)); - (*request->query.callback)(request->query.vptr, 0); + (*request->callback)(request->callback_ctx, NULL, NULL); rem_request(request); continue; } @@ -374,7 +376,7 @@ { next_ptr = ptr->next; request = (struct reslist*)ptr; - if (vptr == request->query.vptr) { + if (vptr == request->callback_ctx) { Debug((DEBUG_DNS, "Removing request %p with vptr %p", request, vptr)); rem_request(request); } @@ -439,9 +441,9 @@ * @param[in] query Callback information. */ void -gethost_byname(const char *name, const struct DNSQuery *query) +gethost_byname(const char *name, dns_callback_f callback, void *ctx) { - do_query_name(query, name, NULL, T_AAAA); + do_query_name(callback, ctx, name, NULL, T_AAAA); } /** Try to look up hostname for an address. @@ -449,9 +451,9 @@ * @param[in] query Callback information. */ void -gethost_byaddr(const struct irc_in_addr *addr, const struct DNSQuery *query) +gethost_byaddr(const struct irc_in_addr *addr, dns_callback_f callback, void *ctx) { - do_query_number(query, addr, NULL); + do_query_number(callback, ctx, addr, NULL); } /** Send a query to look up the address for a name. @@ -461,7 +463,7 @@ * @param[in] type Preferred request type. */ static void -do_query_name(const struct DNSQuery *query, const char *name, +do_query_name(dns_callback_f callback, void *ctx, const char *name, struct reslist *request, int type) { char host_name[HOSTLEN + 1]; @@ -471,7 +473,7 @@ if (request == NULL) { - request = make_request(query); + request = make_request(callback, ctx); DupString(request->name, host_name); #ifdef IPV6 if (type != T_A) @@ -492,7 +494,7 @@ * @param[in] request DNS lookup structure (may be NULL). */ static void -do_query_number(const struct DNSQuery *query, const struct irc_in_addr *addr, +do_query_number(dns_callback_f callback, void *ctx, const struct irc_in_addr *addr, struct reslist *request) { char ipbuf[128]; @@ -537,7 +539,7 @@ } if (request == NULL) { - request = make_request(query); + request = make_request(callback, ctx); request->state= REQ_PTR; request->type = T_PTR; memcpy(&request->addr, addr, sizeof(request->addr)); @@ -597,15 +599,15 @@ switch(request->type) { case T_PTR: - do_query_number(NULL, &request->addr, request); + do_query_number(NULL, NULL, &request->addr, request); break; case T_A: - do_query_name(NULL, request->name, request, request->type); + do_query_name(NULL, NULL, request->name, request, request->type); break; case T_AAAA: /* didn't work, try A */ if (request->state == REQ_AAAA) - do_query_name(NULL, request->name, request, T_A); + do_query_name(NULL, NULL, request->name, request, T_A); default: break; } @@ -774,7 +776,6 @@ char buf[sizeof(HEADER) + MAXPACKET]; HEADER *header; struct reslist *request = NULL; - struct DNSReply *reply = NULL; unsigned int rc; int answer_count; @@ -837,7 +838,7 @@ * send any more (no retries granted). */ Debug((DEBUG_DNS, "Request %p has bad response (state %d type %d rcode %d)", request, request->state, request->type, header->rcode)); - (*request->query.callback)(request->query.vptr, 0); + (*request->callback)(request->callback_ctx, NULL, NULL); rem_request(request); } } @@ -861,7 +862,7 @@ * don't bother trying again, the client address doesn't resolve */ Debug((DEBUG_DNS, "Request %p PTR had empty name", request)); - (*request->query.callback)(request->query.vptr, reply); + (*request->callback)(request->callback_ctx, NULL, NULL); rem_request(request); return; } @@ -872,10 +873,10 @@ */ #ifdef IPV6 if (!irc_in_addr_is_ipv4(&request->addr)) - do_query_name(&request->query, request->name, NULL, T_AAAA); + do_query_name(request->callback, request->callback_ctx, request->name, NULL, T_AAAA); else #endif - do_query_name(&request->query, request->name, NULL, T_A); + do_query_name(request->callback, request->callback_ctx, request->name, NULL, T_A); Debug((DEBUG_DNS, "Request %p switching to forward resolution", request)); rem_request(request); } @@ -884,8 +885,7 @@ /* * got a name and address response, client resolved */ - reply = make_dnsreply(request); - (*request->query.callback)(request->query.vptr, (reply) ? reply : 0); + (*request->callback)(request->callback_ctx, &request->addr, request->name); Debug((DEBUG_DNS, "Request %p got forward resolution", request)); rem_request(request); } @@ -903,23 +903,6 @@ } } -/** Build a DNSReply for a completed request. - * @param[in] request Completed DNS request. - * @return Newly allocated DNSReply containing host name and address. - */ -static struct DNSReply * -make_dnsreply(struct reslist *request) -{ - struct DNSReply *cp; - assert(request != 0); - - cp = (struct DNSReply *)MyMalloc(sizeof(struct DNSReply)); - - DupString(cp->h_name, request->name); - memcpy(&cp->addr, &request->addr, sizeof(cp->addr)); - return(cp); -} - /** Statistics callback to list DNS servers. * @param[in] source_p Client requesting statistics. * @param[in] sd Stats descriptor for request (ignored). Index: ircd-ircdev/ircd/list.c diff -u ircd-ircdev/ircd/list.c:1.8 ircd-ircdev/ircd/list.c:1.9 --- ircd-ircdev/ircd/list.c:1.8 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/ircd/list.c Sun Jul 3 13:21:42 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Singly and doubly linked list manipulation implementation. - * @version $Id: list.c,v 1.8 2005/06/22 07:54:29 zolty Exp $ + * @version $Id: list.c,v 1.9 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" @@ -168,10 +168,6 @@ Debug((DEBUG_LIST, "Deallocating connection %p", con)); - if (con_dns_reply(con)) { - MyFree(con_dns_reply(con)); - con_dns_reply(con) = 0; - } if (-1 < con_fd(con)) close(con_fd(con)); MsgQClear(&(con_sendQ(con))); Index: ircd-ircdev/ircd/m_invite.c diff -u ircd-ircdev/ircd/m_invite.c:1.12 ircd-ircdev/ircd/m_invite.c:1.13 --- ircd-ircdev/ircd/m_invite.c:1.12 Wed Jun 22 00:54:29 2005 +++ ircd-ircdev/ircd/m_invite.c Sun Jul 3 13:21:42 2005 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_invite.c,v 1.12 2005/06/22 07:54:29 zolty Exp $ + * $Id: m_invite.c,v 1.13 2005/07/03 20:21:42 zolty Exp $ * */ @@ -179,7 +179,7 @@ if (MyConnect(acptr)) { add_invite(acptr, chptr); sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr); - } else { + } else if (!IsLocalChannel(chptr->chname)) { sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr), chptr, chptr->creationtime); } Index: ircd-ircdev/ircd/s_auth.c diff -u ircd-ircdev/ircd/s_auth.c:1.11 ircd-ircdev/ircd/s_auth.c:1.12 --- ircd-ircdev/ircd/s_auth.c:1.11 Mon Mar 21 10:39:11 2005 +++ ircd-ircdev/ircd/s_auth.c Sun Jul 3 13:21:42 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief Implementation of DNS and ident lookups. - * @version $Id: s_auth.c,v 1.11 2005/03/21 18:39:11 zolty Exp $ + * @version $Id: s_auth.c,v 1.12 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" @@ -106,7 +106,7 @@ * @return Non-zero if the hostname is valid. */ static int -auth_verify_hostname(char *host, int maxlen) +auth_verify_hostname(const char *host, int maxlen) { int i; @@ -299,7 +299,7 @@ * @param vptr The pending struct AuthRequest. * @param hp Pointer to the DNS reply (or NULL, if lookup failed). */ -static void auth_dns_callback(void* vptr, struct DNSReply* hp) +static void auth_dns_callback(void* vptr, const struct irc_in_addr *addr, const char *h_name) { struct AuthRequest* auth = (struct AuthRequest*) vptr; assert(auth); @@ -310,31 +310,30 @@ */ ClearDNSPending(auth); - if (hp) { + if (addr) { /* * Verify that the host to ip mapping is correct both ways and that * the ip#(s) for the socket is listed for the host. */ - if (irc_in_addr_cmp(&hp->addr, &cli_ip(auth->client))) { + if (irc_in_addr_cmp(addr, &cli_ip(auth->client))) { if (IsUserPort(auth->client)) sendheader(auth->client, REPORT_IP_MISMATCH); sendto_opmask_butone(0, SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%s]", - cli_sock_ip(auth->client), hp->h_name, - ircd_ntoa(&hp->addr)); + cli_sock_ip(auth->client), h_name, + ircd_ntoa(addr)); if (feature_bool(FEAT_KILL_IPMISMATCH)) { auth_kill_client(auth); return; } } - else if (!auth_verify_hostname(hp->h_name, HOSTLEN)) + else if (!auth_verify_hostname(h_name, HOSTLEN)) { if (IsUserPort(auth->client)) sendheader(auth->client, REPORT_INVAL_DNS); } else { - cli_dns_reply(auth->client) = hp; - ircd_strncpy(cli_sockhost(auth->client), hp->h_name, HOSTLEN); + ircd_strncpy(cli_sockhost(auth->client), h_name, HOSTLEN); if (IsUserPort(auth->client)) sendheader(auth->client, REPORT_FIN_DNS); } @@ -549,15 +548,9 @@ if (irc_in_addr_is_loopback(&cli_ip(client))) strcpy(cli_sockhost(client), cli_name(&me)); else { - struct DNSQuery query; - - query.vptr = auth; - query.callback = auth_dns_callback; - if (IsUserPort(auth->client)) sendheader(client, REPORT_DO_DNS); - - gethost_byaddr(&cli_ip(client), &query); + gethost_byaddr(&cli_ip(client), auth_dns_callback, auth); SetDNSPending(auth); } } Index: ircd-ircdev/ircd/s_bsd.c diff -u ircd-ircdev/ircd/s_bsd.c:1.15 ircd-ircdev/ircd/s_bsd.c:1.16 --- ircd-ircdev/ircd/s_bsd.c:1.15 Wed Jun 22 00:54:30 2005 +++ ircd-ircdev/ircd/s_bsd.c Sun Jul 3 13:21:42 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Functions that now (or in the past) relied on BSD APIs. - * @version $Id: s_bsd.c,v 1.15 2005/06/22 07:54:30 zolty Exp $ + * @version $Id: s_bsd.c,v 1.16 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" @@ -175,14 +175,13 @@ * @param vptr The struct ConfItem representing the Connect block. * @param hp A pointer to the DNS lookup results (NULL on failure). */ -static void connect_dns_callback(void* vptr, struct DNSReply* hp) +static void connect_dns_callback(void* vptr, const struct irc_in_addr *addr, const char *h_name) { struct ConfItem* aconf = (struct ConfItem*) vptr; assert(aconf); aconf->dns_pending = 0; - if (hp) { - memcpy(&aconf->address, &hp->addr, sizeof(aconf->address)); - MyFree(hp); + if (addr) { + memcpy(&aconf->address, addr, sizeof(aconf->address)); connect_server(aconf, 0); } else @@ -326,21 +325,6 @@ return bytes_written; } -/** Free the client's DNS reply, if any. - * @param cptr Client to operate on. - */ -void release_dns_reply(struct Client* cptr) -{ - assert(0 != cptr); - assert(MyConnect(cptr)); - - if (cli_dns_reply(cptr)) { - MyFree(cli_dns_reply(cptr)->h_name); - MyFree(cli_dns_reply(cptr)); - cli_dns_reply(cptr) = 0; - } -} - /** Complete non-blocking connect()-sequence. Check access and * terminate connection, if trouble detected. * @param cptr Client to which we have connected, with all ConfItem structs attached. @@ -541,27 +525,32 @@ */ os_disable_options(fd); - /* - * Add this local client to the IPcheck registry. - * - * If they're throttled, murder them, but tell them why first. - */ - if (!IPcheck_local_connect(&addr.addr, &next_target) && !listener->server) + if (listener->server) { - ++ServerStats->is_ref; - write(fd, throttle_message, strlen(throttle_message)); - close(fd); - return; + new_client = make_client(0, STAT_UNKNOWN_SERVER); + } + else + { + /* + * Add this local client to the IPcheck registry. + * + * If they're throttled, murder them, but tell them why first. + */ + if (!IPcheck_local_connect(&addr.addr, &next_target)) + { + ++ServerStats->is_ref; + write(fd, throttle_message, strlen(throttle_message)); + close(fd); + return; + } + new_client = make_client(0, STAT_UNKNOWN_USER); + SetIPChecked(new_client); } - - new_client = make_client(0, ((listener->server) ? - STAT_UNKNOWN_SERVER : STAT_UNKNOWN_USER)); /* * Copy ascii address to 'sockhost' just in case. Then we have something * valid to put into error messages... */ - SetIPChecked(new_client); ircd_ntoa_r(cli_sock_ip(new_client), &addr.addr); strcpy(cli_sockhost(new_client), cli_sock_ip(new_client)); memcpy(&cli_ip(new_client), &addr.addr, sizeof(cli_ip(new_client))); @@ -766,14 +755,8 @@ if (!irc_in_addr_valid(&aconf->address.addr) && !ircd_aton(&aconf->address.addr, aconf->host)) { char buf[HOSTLEN + 1]; - struct DNSQuery query; - - query.vptr = aconf; - query.callback = connect_dns_callback; host_from_uh(buf, aconf->host, HOSTLEN); - buf[HOSTLEN] = '\0'; - - gethost_byname(buf, &query); + gethost_byname(buf, connect_dns_callback, aconf); aconf->dns_pending = 1; return 0; } Index: ircd-ircdev/ircd/s_conf.c diff -u ircd-ircdev/ircd/s_conf.c:1.19 ircd-ircdev/ircd/s_conf.c:1.20 --- ircd-ircdev/ircd/s_conf.c:1.19 Sun Jul 3 11:44:52 2005 +++ ircd-ircdev/ircd/s_conf.c Sun Jul 3 13:21:42 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief ircd configuration file driver - * @version $Id: s_conf.c,v 1.19 2005/07/03 18:44:52 zolty Exp $ + * @version $Id: s_conf.c,v 1.20 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" @@ -232,16 +232,13 @@ * @param vptr Pointer to struct ConfItem for the block. * @param hp DNS reply, or NULL if the lookup failed. */ -static void conf_dns_callback(void* vptr, struct DNSReply* hp) +static void conf_dns_callback(void* vptr, const struct irc_in_addr *addr, const char *h_name) { struct ConfItem* aconf = (struct ConfItem*) vptr; assert(aconf); aconf->dns_pending = 0; - if (hp) - { - memcpy(&aconf->address.addr, &hp->addr, sizeof(aconf->address.addr)); - MyFree(hp); - } + if (addr) + memcpy(&aconf->address.addr, addr, sizeof(aconf->address.addr)); } /** Start a nameserver lookup of the conf host. If the conf entry is @@ -252,13 +249,8 @@ { if (!aconf->dns_pending) { char buf[HOSTLEN + 1]; - struct DNSQuery query; - query.vptr = aconf; - query.callback = conf_dns_callback; host_from_uh(buf, aconf->host, HOSTLEN); - buf[HOSTLEN] = '\0'; - - gethost_byname(buf, &query); + gethost_byname(buf, conf_dns_callback, aconf); aconf->dns_pending = 1; } } @@ -402,11 +394,9 @@ enum AuthorizationCheckResult attach_iline(struct Client* cptr) { struct ConfItem* aconf; - struct DNSReply* hp; assert(0 != cptr); - hp = cli_dns_reply(cptr); for (aconf = GlobalConfList; aconf; aconf = aconf->next) { if (aconf->status != CONF_CLIENT) continue; @@ -420,7 +410,7 @@ if (match(aconf->username, cli_username(cptr))) continue; } - if (aconf->host && (!hp || match(aconf->host, hp->h_name))) + if (aconf->host && match(aconf->host, cli_sockhost(cptr))) continue; if ((aconf->addrbits >= 0) && !ipmask_check(&cli_ip(cptr), &aconf->address.addr, aconf->addrbits)) @@ -1171,28 +1161,10 @@ } } - if (!c_conf) { - if (cli_dns_reply(cptr)) { - struct DNSReply* hp = cli_dns_reply(cptr); - const char* name = hp->h_name; - /* - * If we are missing a C or N line from above, search for - * it under all known hostnames we have for this ip#. - */ - if ((c_conf = find_conf_byhost(lp, hp->h_name, CONF_SERVER))) - ircd_strncpy(cli_sockhost(cptr), name, HOSTLEN); - else - c_conf = find_conf_byip(lp, &hp->addr, CONF_SERVER); - } - else { - /* - * Check for C lines with the hostname portion the ip number - * of the host the server runs on. This also checks the case where - * there is a server connecting from 'localhost'. - */ - c_conf = find_conf_byhost(lp, cli_sockhost(cptr), CONF_SERVER); - } - } + /* Try finding the Connect block by DNS name and IP next. */ + if (!c_conf && !(c_conf = find_conf_byhost(lp, cli_sockhost(cptr), CONF_SERVER))) + c_conf = find_conf_byip(lp, &cli_ip(cptr), CONF_SERVER); + /* * Attach by IP# only if all other checks have failed. * It is quite possible to get here with the strange things that can Index: ircd-ircdev/ircd/s_misc.c diff -u ircd-ircdev/ircd/s_misc.c:1.10 ircd-ircdev/ircd/s_misc.c:1.11 --- ircd-ircdev/ircd/s_misc.c:1.10 Sat May 7 15:23:40 2005 +++ ircd-ircdev/ircd/s_misc.c Sun Jul 3 13:21:42 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Miscellaneous support functions. - * @version $Id: s_misc.c,v 1.10 2005/05/07 22:23:40 zolty Exp $ + * @version $Id: s_misc.c,v 1.11 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" @@ -172,22 +172,6 @@ return nbuf; } -/** Set cli_sockhost(cptr) from \a host. - * If \a host contains an '@', copy starting after that byte. - * Otherwise copy all of \a host. - * @param cptr Client to operate on. - * @param host hostname or user\@hostname string. - */ -void get_sockhost(struct Client *cptr, char *host) -{ - char *s; - if ((s = strchr(host, '@'))) - s++; - else - s = host; - ircd_strncpy(cli_sockhost(cptr), s, HOSTLEN); -} - /** * Exit one client, local or remote. Assuming for local client that * all dependents already have been removed, and socket is closed. Index: ircd-ircdev/ircd/s_serv.c diff -u ircd-ircdev/ircd/s_serv.c:1.13 ircd-ircdev/ircd/s_serv.c:1.14 --- ircd-ircdev/ircd/s_serv.c:1.13 Wed Jun 22 00:54:30 2005 +++ ircd-ircdev/ircd/s_serv.c Sun Jul 3 13:21:42 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Miscellaneous server support functions. - * @version $Id: s_serv.c,v 1.13 2005/06/22 07:54:30 zolty Exp $ + * @version $Id: s_serv.c,v 1.14 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" @@ -139,13 +139,6 @@ cli_serv(cptr)->timestamp, MAJOR_PROTOCOL, NumServCap(&me), feature_bool(FEAT_HUB) ? "h" : "", *(cli_info(&me)) ? cli_info(&me) : "IRCers United"); - - /* - * Don't charge this IP# for connecting - * XXX - if this comes from a server port, it will not have been added - * to the IP check registry, see add_connection in s_bsd.c - */ - IPcheck_connect_fail(cptr); } det_confs_butmask(cptr, CONF_SERVER | CONF_UWORLD); @@ -155,9 +148,6 @@ SetServer(cptr); cli_handler(cptr) = SERVER_HANDLER; Count_unknownbecomesserver(UserStats); - - release_dns_reply(cptr); - SetBurst(cptr); /* nextping = CurrentTime; */ Index: ircd-ircdev/ircd/s_user.c diff -u ircd-ircdev/ircd/s_user.c:1.23 ircd-ircdev/ircd/s_user.c:1.24 --- ircd-ircdev/ircd/s_user.c:1.23 Sun Jul 3 11:44:52 2005 +++ ircd-ircdev/ircd/s_user.c Sun Jul 3 13:21:42 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Miscellaneous user-related helper functions. - * @version $Id: s_user.c,v 1.23 2005/07/03 18:44:52 zolty Exp $ + * @version $Id: s_user.c,v 1.24 2005/07/03 20:21:42 zolty Exp $ */ #include "config.h" @@ -565,7 +565,6 @@ SetUser(sptr); cli_handler(sptr) = CLIENT_HANDLER; - release_dns_reply(sptr); SetLocalNumNick(sptr); send_reply(sptr, RPL_WELCOME, ----------------------- End of diff ----------------------- |