]> jfr.im git - solanum.git/blobdiff - ircd/bandbi.c
make more snotes L_NETWIDE
[solanum.git] / ircd / bandbi.c
index 1e713220887ed64248f93376432c0f1a9ebe55a3..29a3bfa27d94b0107c7c1448f3a5e38a0755cc60 100644 (file)
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id$
  */
 #include "stdinc.h"
-#include "ratbox_lib.h"
+#include "rb_lib.h"
 #include "client.h"
 #include "s_conf.h"
 #include "logger.h"
@@ -48,6 +46,9 @@
 #include "msg.h"       /* XXX: MAXPARA */
 #include "operhash.h"
 
+static void
+bandb_handle_failure(rb_helper *helper, char **parv, int parc) __attribute__((noreturn));
+
 static char bandb_add_letter[LAST_BANDB_TYPE] = {
        'K', 'D', 'X', 'R'
 };
@@ -82,21 +83,21 @@ start_bandb(void)
        const char *suffix = "";
 #endif
 
-       rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
+       rb_setenv("BANDB_DBPATH", ircd_paths[IRCD_PATH_BANDB], 1);
        if(bandb_path == NULL)
        {
-               rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);
+               snprintf(fullpath, sizeof(fullpath), "%s%cbandb%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix);
 
                if(access(fullpath, X_OK) == -1)
                {
-                       rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s",
-                                   ConfigFileEntry.dpath, suffix);
+                       snprintf(fullpath, sizeof(fullpath), "%s%cbin%cbandb%s",
+                                   ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix);
 
                        if(access(fullpath, X_OK) == -1)
                        {
                                ilog(L_MAIN,
                                     "Unable to execute bandb%s in %s or %s/bin",
-                                    suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath);
+                                    suffix, ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath);
                                return 0;
                        }
                }
@@ -109,7 +110,7 @@ start_bandb(void)
        if(bandb_helper == NULL)
        {
                ilog(L_MAIN, "Unable to start bandb: %s", strerror(errno));
-               sendto_realops_snomask(SNO_GENERAL, L_ALL, "Unable to start bandb: %s",
+               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Unable to start bandb: %s",
                                     strerror(errno));
                return 1;
        }
@@ -127,7 +128,7 @@ bandb_add(bandb_type type, struct Client *source_p, const char *mask1,
 
        static char buf[BUFSIZE];
 
-       rb_snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1);
+       snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1);
 
        if(!EmptyString(mask2))
                rb_snprintf_append(buf, sizeof(buf), "%s ", mask2);
@@ -225,11 +226,9 @@ bandb_check_kline(struct ConfItem *aconf)
 
        if(aftype != HM_HOST)
        {
-#ifdef RB_IPV6
                if(aftype == HM_IPV6)
                        aftype = AF_INET6;
                else
-#endif
                        aftype = AF_INET;
 
                kconf = find_conf_by_address(aconf->host, NULL, NULL, (struct sockaddr *)&daddr,
@@ -328,7 +327,7 @@ bandb_handle_finish(void)
        struct ConfItem *aconf;
        rb_dlink_node *ptr, *next_ptr;
 
-       clear_out_address_conf_bans();
+       clear_out_address_conf(AC_BANDB);
        clear_s_newconf_bans();
 
        RB_DLINK_FOREACH_SAFE(ptr, next_ptr, bandb_pending.head)
@@ -391,7 +390,7 @@ bandb_handle_failure(rb_helper *helper, char **parv, int parc)
                fprintf(stderr, "bandb - bandb failure: %s\n", parv[1]);
 
        ilog(L_MAIN, "bandb - bandb failure: %s", parv[1]);
-       sendto_realops_snomask(SNO_GENERAL, L_ALL, "bandb - bandb failure: %s", parv[1]);
+       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "bandb - bandb failure: %s", parv[1]);
        exit(1);
 }
 
@@ -399,12 +398,12 @@ static void
 bandb_parse(rb_helper *helper)
 {
        static char buf[READBUF_SIZE];
-       char *parv[MAXPARA + 1];
+       char *parv[MAXPARA];
        int len, parc;
 
        while((len = rb_helper_read(helper, buf, sizeof(buf))))
        {
-               parc = rb_string_to_array(buf, parv, MAXPARA);
+               parc = rb_string_to_array(buf, parv, sizeof(parv));
 
                if(parc < 1)
                        continue;
@@ -442,7 +441,7 @@ static void
 bandb_restart_cb(rb_helper *helper)
 {
        ilog(L_MAIN, "bandb - bandb_restart_cb called, bandb helper died?");
-       sendto_realops_snomask(SNO_GENERAL, L_ALL,
+       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                             "bandb - bandb_restart_cb called, bandb helper died?");
        if(helper != NULL)
        {