X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fs_conf.c;h=7db9ff2e4722e68136e3532d6cc7cc5446b475df;hb=refs%2Fheads%2Fupstream-ssl;hp=cc425ca79c69e01f1a98578b84262a3b8fd16848;hpb=035c0c79c4fae59ea299fe0f70f2f9b80c72ac46;p=ircu2.10.12-pk.git diff --git a/ircd/s_conf.c b/ircd/s_conf.c index cc425ca..7db9ff2 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -34,7 +34,6 @@ #include "hash.h" #include "ircd.h" #include "ircd_alloc.h" -#include "ircd_auth.h" #include "ircd_chattr.h" #include "ircd_log.h" #include "ircd_reply.h" @@ -49,6 +48,7 @@ #include "opercmds.h" #include "parse.h" #include "res.h" +#include "s_auth.h" #include "s_bsd.h" #include "s_debug.h" #include "s_misc.h" @@ -94,7 +94,6 @@ static void killcomment(struct Client* sptr, const char* filename) FBFILE* file = 0; char line[80]; struct stat sb; - struct tm* tm; if (NULL == (file = fbopen(filename, "r"))) { send_reply(sptr, ERR_NOMOTD); @@ -103,7 +102,6 @@ static void killcomment(struct Client* sptr, const char* filename) return; } fbstat(&sb, file); - tm = localtime((time_t*) &sb.st_mtime); /* NetBSD needs cast */ while (fbgets(line, sizeof(line) - 1, file)) { char* end = line + strlen(line); while (end > line) { @@ -221,7 +219,6 @@ void conf_parse_userhost(struct ConfItem *aconf, char *host) aconf->addrbits = addrbits; else aconf->addrbits = -1; - MyFree(host); } /** Copies a completed DNS query into its ConfItem. @@ -345,22 +342,6 @@ void det_confs_butmask(struct Client* cptr, int mask) } } -/** Check client limits and attach Client block. - * If there are more connections from the IP than \a aconf->maximum - * allows, return ACR_TOO_MANY_FROM_IP. Otherwise, attach \a aconf to - * \a cptr. - * @param cptr Client getting \a aconf. - * @param aconf Configuration item to attach. - * @return Authorization check result. - */ -static enum AuthorizationCheckResult -check_limit_and_attach(struct Client* cptr, struct ConfItem* aconf) -{ - if (IPcheck_nr(cptr) > aconf->maximum) - return ACR_TOO_MANY_FROM_IP; - return attach_conf(cptr, aconf); -} - /** Find the first (best) Client block to attach. * @param cptr Client for whom to check rules. * @return Authorization check result. @@ -379,17 +360,18 @@ enum AuthorizationCheckResult attach_iline(struct Client* cptr) */ if (aconf->address.port && aconf->address.port != cli_listener(cptr)->addr.port) continue; - if (aconf->username) { - SetFlag(cptr, FLAG_DOID); - if (match(aconf->username, cli_username(cptr))) - continue; - } + if (aconf->username && match(aconf->username, cli_username(cptr))) + continue; if (aconf->host && match(aconf->host, cli_sockhost(cptr))) continue; if ((aconf->addrbits >= 0) && !ipmask_check(&cli_ip(cptr), &aconf->address.addr, aconf->addrbits)) continue; - return check_limit_and_attach(cptr, aconf); + if (IPcheck_nr(cptr) > aconf->maximum) + return ACR_TOO_MANY_FROM_IP; + if (aconf->username) + SetFlag(cptr, FLAG_DOID); + return attach_conf(cptr, aconf); } return ACR_NO_AUTHORIZATION; } @@ -497,7 +479,8 @@ struct ConfItem *conf_debug_iline(const char *client) (aconf->username ? aconf->username : "(null)"), (aconf->host ? aconf->host : "(null)"), (aconf->name ? aconf->name : "(null)"), - ConfClass(aconf), aconf->maximum, aconf->passwd); + ConfClass(aconf), aconf->maximum, + (aconf->passwd ? aconf->passwd : "(null)")); break; } @@ -670,6 +653,7 @@ struct ConfItem* find_conf_exact(const char* name, struct Client *cptr, int stat else if (!ipmask_check(&cli_ip(cptr), &tmp->address.addr, tmp->addrbits)) continue; if ((tmp->status & CONF_OPERATOR) + && (MaxLinks(tmp->conn_class) > 0) && (tmp->clients >= MaxLinks(tmp->conn_class))) continue; return tmp; @@ -830,9 +814,9 @@ void clear_quarantines(void) static int conf_error; /** When non-zero, indicates that the configuration file was loaded at least once. */ static int conf_already_read; -extern FILE *yyin; extern void yyparse(void); -extern void init_lexer(void); +extern int init_lexer(void); +extern void deinit_lexer(void); /** Read configuration file. * @return Zero on failure, non-zero on success. */ @@ -840,11 +824,11 @@ int read_configuration_file(void) { conf_error = 0; feature_unmark(); /* unmark all features for resetting later */ - /* Now just open an fd. The buffering isn't really needed... */ - init_lexer(); + clear_nameservers(); /* clear previous list of DNS servers */ + if (!init_lexer()) + return 0; yyparse(); - fclose(yyin); - yyin = NULL; + deinit_lexer(); feature_mark(); /* reset unmarked features */ conf_already_read = 1; return 1; @@ -958,19 +942,19 @@ int rehash(struct Client *cptr, int sig) clear_quarantines(); - if (sig != 2) - restart_resolver(); - class_mark_delete(); mark_listeners_closing(); - iauth_mark_closing(); + auth_mark_closing(); close_mappings(); read_configuration_file(); + if (sig != 2) + restart_resolver(); + log_reopen(); /* reopen log files */ - iauth_close_unused(); + auth_close_unused(); close_listeners(); class_delete_marked(); /* unless it fails */ @@ -1098,7 +1082,7 @@ int find_kill(struct Client *cptr) return -1; } - if ((agline = gline_lookup(cptr, 0))) { + if (!feature_bool(FEAT_DISABLE_GLINES) && (agline = gline_lookup(cptr, 0))) { /* * find active glines * added a check against the user's IP address to find_gline() -Kev