From: Gabriel B. <sh...@us...> - 2005-09-04 05:24:26
|
Update of /cvsroot/solidircd/solidircd-stable/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24987/src Modified Files: Makefile.in ircd.c s_conf.c s_serv.c s_user.c userban.c Log Message: updates need to finish m_gline.c Index: Makefile.in =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/Makefile.in,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.in 9 Jul 2005 03:09:11 -0000 1.3 --- Makefile.in 4 Sep 2005 05:24:13 -0000 1.4 *************** *** 20,27 **** SOURCES = blalloc.c bsd.c channel.c clientlist.c clones.c confparse.c \ ! fdlist.c fds.c hash.c hide.c inet_addr.c ircd.c ircsprintf.c list.c \ ! m_shun.c m_nick.c m_rwho.c m_server.c m_services.c m_stats.c m_who.c match.c \ ! memcount.c modules.c packet.c parse.c pcre.c probability.c res.c \ ! s_auth.c s_bsd.c s_conf.c s_debug.c s_err.c s_misc.c s_numeric.c \ s_serv.c s_user.c sbuf.c scache.c send.c ssl.c struct.c support.c \ toys.c throttle.c userban.c whowas.c zlink.c \ --- 20,27 ---- SOURCES = blalloc.c bsd.c channel.c clientlist.c clones.c confparse.c \ ! fdlist.c fds.c hash.c hide.c inet_addr.c ircd.c ircsprintf.c \ ! klines.c list.c m_gline.c m_shun.c m_nick.c m_rwho.c m_server.c m_services.c \ ! m_stats.c m_who.c match.c memcount.c modules.c packet.c parse.c pcre.c\ ! probability.c res.c s_auth.c s_bsd.c s_conf.c s_debug.c s_err.c s_misc.c s_numeric.c \ s_serv.c s_user.c sbuf.c scache.c send.c ssl.c struct.c support.c \ toys.c throttle.c userban.c whowas.c zlink.c \ *************** *** 136,139 **** --- 136,144 ---- ../include/fds.h ../include/memcount.h ../include/blalloc.h ircsprintf.o: ircsprintf.c ../include/ircsprintf.h ../include/setup.h + klines.o: klines.c ../include/struct.h ../include/config.h \ + ../include/setup.h ../include/defs.h ../include/sys.h ../include/hash.h \ + ../include/sbuf.h ../include/common.h ../include/h.h ../include/send.h \ + ../include/fdlist.h ../include/ircsprintf.h ../include/find.h \ + ../include/userban.h ../include/numeric.h list.o: list.c ../include/struct.h ../include/config.h ../include/setup.h \ ../include/defs.h ../include/sys.h ../include/hash.h ../include/sbuf.h \ *************** *** 143,146 **** --- 148,156 ---- ../include/zlink.h ../include/memcount.h ../include/throttle.h \ ../include/queue.h + m_gline.o: m_gline.c ../include/struct.h ../include/dbuf.h ../include/config.h \ + ../include/setup.h ../include/defs.h ../include/hash.h \ + ../include/h.h ../include/send.h ../include/common.h \ + ../include/ircsprintf.h ../include/msg.h ../include/sys.h \ + ../include/userban.h ../include/common.h m_shun.o: m_shun.c ../include/struct.h ../include/config.h \ ../include/setup.h ../include/defs.h ../include/hash.h \ Index: s_conf.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/s_conf.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** s_conf.c 9 Jul 2005 20:18:50 -0000 1.8 --- s_conf.c 4 Sep 2005 05:24:13 -0000 1.9 *************** *** 85,88 **** --- 85,89 ---- #endif extern void confparse_error(char *, int); + extern int klinestore_init(int); /* initclass() *************** *** 1538,1542 **** return lnum; /* this isnt a parser problem - dont pull out */ ! ban->flags |= UBAN_LOCAL; DupString(ban->reason, ub_r); ban->timeset = NOW; --- 1539,1543 ---- return lnum; /* this isnt a parser problem - dont pull out */ ! ban->flags |= (UBAN_LOCAL|UBAN_CONF); DupString(ban->reason, ub_r); ban->timeset = NOW; *************** *** 2324,2328 **** sendto_ops("Got signal SIGHUP, reloading ircd conf. file"); remove_userbans_match_flags(UBAN_NETWORK, 0); ! remove_userbans_match_flags(UBAN_LOCAL|UBAN_TEMPORARY, 0); remove_simbans_match_flags(SBAN_NICK|SBAN_LOCAL|SBAN_TEMPORARY, 0); remove_simbans_match_flags(SBAN_CHAN|SBAN_LOCAL|SBAN_TEMPORARY, 0); --- 2325,2330 ---- sendto_ops("Got signal SIGHUP, reloading ircd conf. file"); remove_userbans_match_flags(UBAN_NETWORK, 0); ! /* remove all but kill {} blocks from conf */ ! remove_userbans_match_flags(UBAN_LOCAL, UBAN_CONF); remove_simbans_match_flags(SBAN_NICK|SBAN_LOCAL|SBAN_TEMPORARY, 0); remove_simbans_match_flags(SBAN_CHAN|SBAN_LOCAL|SBAN_TEMPORARY, 0); *************** *** 2350,2355 **** flush_cache(); /* Flush DNS cache */ ! /* remove perm klines */ ! remove_userbans_match_flags(UBAN_LOCAL, UBAN_TEMPORARY); remove_simbans_match_flags(SBAN_NICK|SBAN_LOCAL, SBAN_TEMPORARY); remove_simbans_match_flags(SBAN_CHAN|SBAN_LOCAL, SBAN_TEMPORARY); --- 2352,2357 ---- flush_cache(); /* Flush DNS cache */ ! /* remove kill {} blocks */ ! remove_userbans_match_flags(UBAN_LOCAL|UBAN_CONF, 0); remove_simbans_match_flags(SBAN_NICK|SBAN_LOCAL, SBAN_TEMPORARY); remove_simbans_match_flags(SBAN_CHAN|SBAN_LOCAL, SBAN_TEMPORARY); *************** *** 2377,2380 **** --- 2379,2386 ---- merge_confs(); build_rplcache(); + nextconnect = 1; /* reset autoconnects */ + + /* replay journal if necessary */ + klinestore_init( (sig == SIGHUP) ? 0 : 1 ); rehashed = 1; Index: s_user.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/s_user.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** s_user.c 9 Jul 2005 23:30:03 -0000 1.12 --- s_user.c 4 Sep 2005 05:24:13 -0000 1.13 *************** *** 527,530 **** --- 527,543 ---- #endif + + + /* used by m_user, m_put, m_post */ + static int + reject_proxy(aClient *cptr, char *cmd, char *args) + { + sendto_realops_lev(REJ_LEV, "proxy attempt from %s: %s %s", + inetntoa((char *)&cptr->ip), cmd, args ? args : ""); + return exit_client(cptr, cptr, &me, "relay connection"); + } + + + /* * * register_user *************** *** 2293,2297 **** - /* * m_user --- 2306,2309 ---- *************** *** 2305,2312 **** m_user(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - #define UFLAGS (UMODE_i|UMODE_v|UMODE_R) char *username, *host, *server, *realname; struct simBan *ban; if (parc > 2 && (username = (char *) strchr(parv[1], '@'))) --- 2317,2327 ---- m_user(aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *username, *host, *server, *realname; struct simBan *ban; + + /* FTP proxy */ + if (!IsRegistered(cptr) && parc == 2 && cptr->receiveM == 1) + return reject_proxy(cptr, "USER", parv[1]); if (parc > 2 && (username = (char *) strchr(parv[1], '@'))) *************** *** 2354,2358 **** user->server = find_or_add(server); strncpyzt(user->host, host, sizeof(user->host)); - strncpyzt(user->realhost, host, sizeof(user->host)); } else --- 2369,2372 ---- *************** *** 2364,2368 **** return 0; } ! #ifndef NO_DEFAULT_INVISIBLE sptr->umode |= UMODE_i; --- 2378,2382 ---- return 0; } ! sptr->umode |= (USER_UMODES & atoi(host)); #ifndef NO_DEFAULT_INVISIBLE sptr->umode |= UMODE_i; *************** *** 2379,2383 **** SetUmodez(sptr); #endif - #ifdef NO_USER_SERVERKILLS sptr->umode &= ~UMODE_k; --- 2393,2396 ---- *************** *** 2386,2393 **** sptr->umode &= ~UMODE_s; #endif - - sptr->umode |= (UFLAGS & atoi(host)); strncpyzt(user->host, host, sizeof(user->host)); - strncpyzt(user->realhost, host, sizeof(user->host)); user->server = me.name; } --- 2399,2403 ---- *************** *** 2415,2419 **** return 0; } ! /* * m_quit --- 2425,2429 ---- return 0; } ! /* * m_quit *************** *** 4285,4288 **** --- 4295,4318 ---- #endif + int + m_put(aClient *cptr, aClient *sptr, int parc, char *parv[]) + { + /* HTTP PUT proxy */ + if (!IsRegistered(cptr) && cptr->receiveM == 1) + return reject_proxy(cptr, "PUT", parv[1]); + + return 0; + } + + int + m_post(aClient *cptr, aClient *sptr, int parc, char *parv[]) + { + /* HTTP POST proxy */ + if (!IsRegistered(cptr) && cptr->receiveM == 1) + return reject_proxy(cptr, "POST", parv[1]); + + return 0; + } + u_long *************** *** 4367,4370 **** --- 4397,4403 ---- } + + + mc->total.c = mc->aways.c + mc->silences.c + mc->servers.c; mc->total.m = mc->aways.m + mc->silences.m + mc->servers.m; Index: s_serv.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/s_serv.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** s_serv.c 5 Jul 2005 21:53:42 -0000 1.4 --- s_serv.c 4 Sep 2005 05:24:13 -0000 1.5 *************** *** 162,170 **** } - - - - - /* * m_squit --- 162,165 ---- *************** *** 419,422 **** --- 414,418 ---- * parv[1] = servername */ + int m_info(aClient *cptr, aClient *sptr, int parc, char *parv[]) *************** *** 524,527 **** --- 520,524 ---- * parv[1] = servername */ + int m_dalinfo(aClient *cptr, aClient *sptr, int parc, char *parv[]) *************** *** 577,580 **** --- 574,578 ---- * parv[1] = servername */ + int m_solidinfo(aClient *cptr, aClient *sptr, int parc, char *parv[]) *************** *** 623,629 **** } - - - /* * * m_links --- 621,624 ---- *************** *** 841,850 **** * * 199970918 JRL hacked to ignore parv[1] completely and require parc > 3 * * Now if parv[1] is anything other than *, it forces a recount. * -Quension [May 2005] - * to cause a force */ - int m_lusers(aClient *cptr, aClient *sptr, int parc, char *parv[]) --- 836,844 ---- * * 199970918 JRL hacked to ignore parv[1] completely and require parc > 3 + * to cause a force * * Now if parv[1] is anything other than *, it forces a recount. * -Quension [May 2005] */ int m_lusers(aClient *cptr, aClient *sptr, int parc, char *parv[]) *************** *** 876,881 **** int send_lusers(aClient *cptr, aClient *sptr, int parc, char *parv[]) { ! ! /* forced recount */ if (IsAnOper(sptr) && (parc > 1) && (*parv[1] != '*')) { --- 870,874 ---- int send_lusers(aClient *cptr, aClient *sptr, int parc, char *parv[]) { ! /* forced recount */ if (IsAnOper(sptr) && (parc > 1) && (*parv[1] != '*')) { *************** *** 936,947 **** } } - - - /* sanity check */ - - if (m_server != Count.myserver) - { ! sendto_realops_lev(DEBUG_LEV, "Local server count off by %d", Count.myserver - m_server); Count.myserver = m_server; --- 929,937 ---- } } ! /* sanity check */ ! if (m_server != Count.myserver) ! { ! sendto_realops_lev(DEBUG_LEV, "Local server count off by %d", Count.myserver - m_server); Count.myserver = m_server; *************** *** 987,996 **** sendto_realops_lev(DEBUG_LEV, "Unknown connection count off by %d", Count.unknown - u_count); ! Count.unknown = u_count; ! ! } } /* Recount loop */ - /* save stats */ if ((timeofday - last_stat_save) > 3600) --- 977,984 ---- sendto_realops_lev(DEBUG_LEV, "Unknown connection count off by %d", Count.unknown - u_count); ! Count.unknown = u_count; ! } } /* Recount loop */ /* save stats */ if ((timeofday - last_stat_save) > 3600) *************** *** 1018,1022 **** #endif sendto_one(sptr, rpl_str(RPL_LUSERCLIENT), me.name, parv[0], ! Count.total - Count.invisi, Count.invisi, Count.server); #ifndef SHOW_INVISIBLE_LUSERS else --- 1006,1010 ---- #endif sendto_one(sptr, rpl_str(RPL_LUSERCLIENT), me.name, parv[0], ! Count.total - Count.invisi, Count.invisi, Count.server); #ifndef SHOW_INVISIBLE_LUSERS else *************** *** 1027,1031 **** #endif ! if (Count.oper) sendto_one(sptr, rpl_str(RPL_LUSEROP), me.name, parv[0], Count.oper); --- 1015,1019 ---- #endif ! if (Count.oper) sendto_one(sptr, rpl_str(RPL_LUSEROP), me.name, parv[0], Count.oper); *************** *** 1040,1048 **** sendto_one(sptr, rpl_str(RPL_LUSERME), #ifdef HIDEULINEDSERVS ! me.name, parv[0], Count.local, ! IsOper(sptr) ? Count.myserver : Count.myserver - Count.myulined); #else me.name, parv[0], Count.local, Count.myserver); #endif sendto_one(sptr, rpl_str(RPL_LOCALUSERS), me.name, parv[0], Count.local, Count.max_loc); --- 1028,1037 ---- sendto_one(sptr, rpl_str(RPL_LUSERME), #ifdef HIDEULINEDSERVS ! me.name, parv[0], Count.local, ! IsOper(sptr) ? Count.myserver : Count.myserver - Count.myulined); #else me.name, parv[0], Count.local, Count.myserver); #endif + sendto_one(sptr, rpl_str(RPL_LOCALUSERS), me.name, parv[0], Count.local, Count.max_loc); *************** *** 1141,1145 **** me.name, IsAnOper(cptr) ? "Local" : "Remote", parv[1], parv[2] ? parv[2] : "", ! sptr->name); #if defined(USE_SYSLOG) && defined(SYSLOG_CONNECT) --- 1130,1134 ---- me.name, IsAnOper(cptr) ? "Local" : "Remote", parv[1], parv[2] ? parv[2] : "", ! sptr->name); #if defined(USE_SYSLOG) && defined(SYSLOG_CONNECT) *************** *** 2012,2015 **** --- 2001,2005 ---- } + #if 0 int m_kline(aClient *cptr, aClient *sptr, int parc, char *parv[]) { *************** *** 2298,2303 **** if ((k->kline = strdup(buffer)) == NULL) { ! free(k->comment); ! free(k); sendto_one(sptr, ":%s NOTICE %s :Problem allocating memory", me.name, parv[0]); --- 2288,2293 ---- if ((k->kline = strdup(buffer)) == NULL) { ! free(k->comment); ! free(k); sendto_one(sptr, ":%s NOTICE %s :Problem allocating memory", me.name, parv[0]); *************** *** 2356,2359 **** --- 2346,2350 ---- #endif /* LOCKFILE */ } + #endif /* *************** *** 2402,2406 **** } ! #ifdef UNKLINE /* * * m_unkline --- 2393,2397 ---- } ! #if 0 /* * * m_unkline *************** *** 2475,2478 **** --- 2466,2470 ---- remove_userban(oban); + klinestore_remove(oban); userban_free(oban); userban_free(ban); *************** *** 2580,2593 **** return 0; } - #ifdef HAVE_SSL - else if(mycmp(parv[1], "SSL") == 0) - { - sendto_ops("%s is reloading SSL support", parv[0]); - sendto_one(sptr, rpl_str(RPL_REHASHING), me.name, parv[0], - "SSL support"); - - rehash_ssl(); - } - #endif } else --- 2572,2575 ---- *************** *** 3636,3646 **** if ((acptr = find_person(lp->value.wptr->nick, NULL))) sendto_one(sptr, rpl_str(RPL_NOWON), me.name, parv[0], ! acptr->name, acptr->user->username, MyConnect(acptr) ? acptr->sockhost : acptr->user->realhost, acptr->user->host, acptr->tsinfo); - - if (IsUmodev(acptr)) - sendto_one(cptr, "SVHOST %s %s", - acptr->name, acptr->user->host); - /* * But actually, only show them offline if its a capital --- 3618,3623 ---- if ((acptr = find_person(lp->value.wptr->nick, NULL))) sendto_one(sptr, rpl_str(RPL_NOWON), me.name, parv[0], ! acptr->name, acptr->user->username, acptr->user->host, acptr->tsinfo); /* * But actually, only show them offline if its a capital *************** *** 4133,4137 **** } - u_long memcount_s_serv(MCs_serv *mc) --- 4110,4113 ---- *************** *** 4164,4176 **** mc->total.c += mc->help.c; mc->total.m += mc->help.m; ! /* This is just a future reminder for me -Sheik 07/04/2005 ! for (m =rulesfile; m; m = m->next) ! { ! mc->rules.c++; ! mc->rules.m += sizeof(*m); ! } ! mc->total.c += mc->rules.c; ! mc->total.m += mc->rules.m; ! */ return mc->total.m; } --- 4140,4145 ---- mc->total.c += mc->help.c; mc->total.m += mc->help.m; ! return mc->total.m; } + Index: userban.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/userban.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** userban.c 5 Jul 2005 21:53:42 -0000 1.4 --- userban.c 4 Sep 2005 05:24:13 -0000 1.5 *************** *** 540,543 **** --- 540,549 ---- kset[0] = 'K'; } + + else if (ban->flags & UBAN_GLINE) + { + kset[0] = 'g'; + } + else if (ban->flags & UBAN_SHUN) { *************** *** 562,565 **** --- 568,585 ---- (ban->reason) ? ban->reason : "No reason"); } + else if (ban->flags & UBAN_SHUN) + { + sendto_one(cptr, ":%s SHUN %d %s@%s :%s", me.name, + (ban->flags & UBAN_TEMPORARY) ? ((ban->duration + ban->timeset) - NOW) : 0, + (ban->flags & UBAN_WILDUSER) ? "*" : ban->u, host, + (ban->reason) ? ban->reason : "No reason"); + } + else if (ban->flags & UBAN_GLINE) + { + sendto_one(cptr, ":%s GLINE %d %s@%s :%s", me.name, + (ban->flags & UBAN_TEMPORARY) ? ((ban->duration + ban->timeset) - NOW) : 0, + (ban->flags & UBAN_WILDUSER) ? "*" : ban->u, host, + (ban->reason) ? ban->reason : "No reason"); + } bl = LIST_NEXT(bl, lp); *************** *** 1589,1592 **** --- 1609,1711 ---- } + + /* + * Dump all local connections that match a userban. + */ + void userban_sweep(struct userBan *ban) + { + char rbuf[512]; + aClient *acptr; + char *reason; + char *btext; + int clientonly = 1; + int i; + + if (ban->flags & UBAN_NETWORK) + btext = NETWORK_BANNED_NAME; + else + btext = LOCAL_BANNED_NAME; + + if (!(reason = ban->reason)) + reason = "<no reason>"; + + /* if it's purely IP based, dump unregistered and server connections too */ + if (ban->flags & UBAN_WILDUSER) + if (ban->flags & (UBAN_IP|UBAN_CIDR4|UBAN_CIDR4BIG)) + clientonly = 0; + + ircsnprintf(rbuf, sizeof(rbuf), "%s: %s", btext, reason); + + for (i = 0; i <= highest_fd; i++) + { + if (!(acptr = local[i]) || acptr->status < STAT_UNKNOWN) + continue; + + if (clientonly && !IsPerson(acptr)) + continue; + + if (user_match_ban(acptr, ban)) + { + sendto_ops("%s active for %s", btext, + get_client_name(acptr, FALSE)); + exit_client(acptr, acptr, &me, rbuf); + i--; + } + } + } + + + /* + * ks_dumpklines() helper + */ + static void + ks_dumplist(int f, uBanEnt *be) + { + struct userBan *ub; + + /* klines.c */ + extern void ks_write(int, char, struct userBan *); + + for (; be; be = LIST_NEXT(be, lp)) + { + ub = be->ban; + + /* must be local and not from conf */ + if ((ub->flags & (UBAN_LOCAL|UBAN_CONF)) != UBAN_LOCAL) + continue; + + /* must be over the storage threshold duration */ + if ((ub->flags & UBAN_TEMPORARY) + && ub->duration < (KLINE_MIN_STORE_TIME * 60)) + continue; + + ks_write(f, '+', ub); + } + } + + /* + * Called from klines.c during a storage GC. + */ + void + ks_dumpklines(int f) + { + int i, j; + + for (i = 0; i < 256; i++) + for (j = 0; j < 256; j++) + ks_dumplist(f, LIST_FIRST(&CIDR4_bans[i][j])); + + ks_dumplist(f, LIST_FIRST(&CIDR4BIG_bans)); + ks_dumplist(f, LIST_FIRST(&host_bans.wild_list)); + ks_dumplist(f, LIST_FIRST(&ip_bans.wild_list)); + + for (i = 0; i < HASH_SIZE; i++) + { + ks_dumplist(f, LIST_FIRST(&host_bans.hash_list[i])); + ks_dumplist(f, LIST_FIRST(&ip_bans.hash_list[i])); + } + } + + static void mc_userlist(MemCount *mc, uBanEnt *be) Index: ircd.c =================================================================== RCS file: /cvsroot/solidircd/solidircd-stable/src/ircd.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ircd.c 9 Jul 2005 03:09:11 -0000 1.5 --- ircd.c 4 Sep 2005 05:24:13 -0000 1.6 *************** *** 125,128 **** --- 125,129 ---- extern void read_help(char *); /* defined in s_serv.c */ extern void init_globals(); + extern int klinestore_init(int); /* defined in klines.c */ char **myargv; *************** *** 918,921 **** --- 919,926 ---- /* the pid file must be written *AFTER* the fork */ write_pidfile(); + + + /* this should be sooner, but the fork/detach stuff is so brain-dead... */ + klinestore_init(0); |