diff options
author | Wesley Shields <wxs@FreeBSD.org> | 2011-06-15 13:51:06 +0000 |
---|---|---|
committer | Wesley Shields <wxs@FreeBSD.org> | 2011-06-15 13:51:06 +0000 |
commit | 606a979463584202f5edae00e1faf6957e244b86 (patch) | |
tree | d31b9c19b8c0843b5675ef34d8096f0780f65871 /net-mgmt | |
parent | 5b067436f436a8547ec1dc078b805eb04d5ea8bd (diff) | |
download | ports-606a979463584202f5edae00e1faf6957e244b86.tar.gz ports-606a979463584202f5edae00e1faf6957e244b86.zip |
Notes
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/nagircbot/Makefile | 2 | ||||
-rw-r--r-- | net-mgmt/nagircbot/distinfo | 4 | ||||
-rw-r--r-- | net-mgmt/nagircbot/files/patch-Makefile | 16 | ||||
-rw-r--r-- | net-mgmt/nagircbot/files/patch-anna.cpp | 146 | ||||
-rw-r--r-- | net-mgmt/nagircbot/files/patch-br.h | 13 | ||||
-rw-r--r-- | net-mgmt/nagircbot/files/patch-error.c | 11 |
6 files changed, 42 insertions, 150 deletions
diff --git a/net-mgmt/nagircbot/Makefile b/net-mgmt/nagircbot/Makefile index 3552be0f41c4..99af4407401b 100644 --- a/net-mgmt/nagircbot/Makefile +++ b/net-mgmt/nagircbot/Makefile @@ -6,7 +6,7 @@ # PORTNAME= nagircbot -PORTVERSION= 0.0.20 +PORTVERSION= 0.0.33 CATEGORIES= net-mgmt irc MASTER_SITES= http://www.vanheusden.com/nagircbot/ EXTRACT_SUFX= .tgz diff --git a/net-mgmt/nagircbot/distinfo b/net-mgmt/nagircbot/distinfo index 5fa2e7d8c6cd..0e7fcdc2ba56 100644 --- a/net-mgmt/nagircbot/distinfo +++ b/net-mgmt/nagircbot/distinfo @@ -1,2 +1,2 @@ -SHA256 (nagircbot-0.0.20.tgz) = 22164ff2290c4bf2bebda60d5c09438f61e1973529d03a53bebd3bb36e43fc59 -SIZE (nagircbot-0.0.20.tgz) = 17548 +SHA256 (nagircbot-0.0.33.tgz) = 7a7c63a409bdad125b19ec852a772746eda2b1feef71bbdf58bd2a2c785a0887 +SIZE (nagircbot-0.0.33.tgz) = 20085 diff --git a/net-mgmt/nagircbot/files/patch-Makefile b/net-mgmt/nagircbot/files/patch-Makefile index 909634c2cb1d..9fb06ae0cc7a 100644 --- a/net-mgmt/nagircbot/files/patch-Makefile +++ b/net-mgmt/nagircbot/files/patch-Makefile @@ -1,19 +1,15 @@ ---- Makefile.orig Mon Nov 27 06:21:58 2006 -+++ Makefile Sat Apr 28 14:14:16 2007 -@@ -1,9 +1,10 @@ - VERSION=0.0.20 +--- Makefile.orig 2011-01-18 05:39:10.000000000 -0500 ++++ Makefile 2011-05-31 22:06:29.000000000 -0400 +@@ -3,7 +3,7 @@ + VERSION=0.0.33 DEBUG= -g -D_DEBUG #-fprofile-arcs -ftest-coverage # -pg -g -CXXFLAGS+=-Wall -O2 -DVERSION=\"${VERSION}\" $(DEBUG) +CXXFLAGS+=-DUSE_MMAP -Wall -O2 -DVERSION=\"${VERSION}\" $(DEBUG) CFLAGS+=${CXXFLAGS} --LDFLAGS+=$(DEBUG) -lstdc++ -+LDFLAGS+=$(DEBUG) -lstdc++ -lutil -+PREFIX?=/usr/local + LDFLAGS+=$(DEBUG) -lcrypto -lssl -lstdc++ - OBJS=error.o log.o utils.o br.o pl.o anna.o - -@@ -13,7 +14,7 @@ +@@ -15,7 +15,7 @@ $(CC) -Wall -W $(OBJS) $(LDFLAGS) -o nagircbot install: nagircbot diff --git a/net-mgmt/nagircbot/files/patch-anna.cpp b/net-mgmt/nagircbot/files/patch-anna.cpp index aacfeba47e02..9a1a2968be71 100644 --- a/net-mgmt/nagircbot/files/patch-anna.cpp +++ b/net-mgmt/nagircbot/files/patch-anna.cpp @@ -1,75 +1,45 @@ ---- anna.cpp.orig Mon Nov 27 06:21:58 2006 -+++ anna.cpp Sat Apr 28 19:27:02 2007 -@@ -12,6 +12,8 @@ - #include <stdlib.h> - #include <signal.h> - #include <pwd.h> -+#include <sys/param.h> -+#include <libutil.h> - - #include "utils.h" - #include "pl.h" -@@ -19,6 +21,7 @@ - #include "error.h" +--- anna.cpp.orig 2011-01-18 05:39:10.000000000 -0500 ++++ anna.cpp 2011-05-31 22:45:11.000000000 -0400 +@@ -23,6 +23,7 @@ + #include "ssl.h" #include "log.h" } +#include "anna.h" #define S_DISCONNECTED 1 #define S_CONNECTED 2 -@@ -39,6 +42,7 @@ +@@ -43,6 +44,7 @@ int minimum_time_for_successfull_login = 25; // one needs to be on-channel for at least 5 seconds to be considered a successfull login int join_timeout = 5; // it should take no longer then 5 seconds to join a channel, otherwhise: abort connection and retry int max_n_join_tries = 2; // try 2 times to get on a channel +int throttle_delay = 1; // don't send more than one message per 1 seconds char *server = "localhost:6667"; /* default irc server */ char *channel = "#nagircbot"; /* default channel to connect to */ - char *nick = "nagircbot"; -@@ -56,7 +60,7 @@ - int max_time_last_host_update = 300, max_time_oldest_host_update = 3600, max_time_last_host_check = 300, max_time_oldest_host_check = 3 * 86400, max_time_last_service_check = 20 * 60, max_time_oldest_service_check = 3 * 86400, max_time_oldest_next_service_check = 20 * 60; - - char *state_str[4] = { " OK ", "WARN", "CRIT", " ?? " }; --char *color_str[4] = { mystrdup("_3,1 "), mystrdup("_8,1 "), mystrdup("_4,1 "), mystrdup("_11,1 ") }; /* FIXME */ -+char *color_str[4] = { mystrdup("_9,1 "), mystrdup("_8,1 "), mystrdup("_4,1 "), mystrdup("_11,1 ") }; /* FIXME */ - struct stats *prev = NULL; - int n_prev = 0; - char topic[4096] = { 0 }; -@@ -105,13 +109,18 @@ - if (irc_set_nick(fd, nick) == -1) - return -1; - -+ /* "Currently this requires that clients send a PASS command before sending -+ * the NICK/USER combination and servers *must* send a PASS command before -+ * any SERVER command." */ -+ if (password != NULL) { -+ if (send_irc(fd, "PASS %s", password) == -1) -+ return -1; + char *nick_prefix = ""; /* prefix text for all messages sent to channel */ +@@ -53,7 +55,7 @@ + int one_line = 1; + char *username = "Nagios IRC Bot " VERSION ", (C) www.vanheusden.com"; /* complete username */ + int verbose = 255; /* default is log everything */ +-char *statuslog = "/usr/local/nagios/var/status.log"; ++char *statuslog = "/var/spool/nagios/status.dat"; + int statuslog_version = 2; + int statuslog_location = L_FILE; + char use_colors = 0; +@@ -174,6 +176,13 @@ + + int irc_privmsg(server_t server_conn, char *channel, char *msg) + { ++ static time_t last_msg = time(NULL); ++ time_t diff = time(NULL) - last_msg; ++ if (diff < throttle_delay) { ++ sleep(throttle_delay - diff); + } ++ time(&last_msg); + - /* FIXME: localhost must be, ehr, local host */ - if (send_irc(fd, "USER %s \"localhost\" \"%s\" :%s", user, server, username) == -1) - return -1; - -- if (password != NULL && send_irc(fd, "PASS %s", password) == -1) -- return -1; -- - return 0; + return send_irc(server_conn, "PRIVMSG %s :%s", channel, msg); } -@@ -153,6 +162,12 @@ - - int irc_privmsg(int fd, char *channel, char *msg) - { -+ static time_t last_msg = time(NULL); -+ time_t diff = time(NULL) - last_msg; -+ if (diff < throttle_delay) { -+ sleep(throttle_delay - diff); -+ } -+ time(&last_msg); - return send_irc(fd, "PRIVMSG %s :%s", channel, msg); - } - -@@ -166,7 +181,7 @@ +@@ -192,7 +201,7 @@ /* open file or connection to nagios status socket */ if (is_file == 1) /* file */ @@ -78,7 +48,7 @@ else fd = connect_to(statuslog); if (fd == -1) -@@ -416,7 +431,7 @@ +@@ -490,7 +499,7 @@ if (verbose > 1) dolog("reload_statuslog started"); if (statuslog_location == L_FILE) /* file */ @@ -87,65 +57,3 @@ else fd_sl = connect_to(statuslog); -@@ -712,6 +727,7 @@ - printf("-z user user to run as\n"); - printf("-H show only state type 'HARD' (default)\n"); - printf("-S show also state type 'SOFT'\n"); -+ printf("-P file store the pid in a file\n"); - } - - int main(int argc, char *argv[]) -@@ -724,14 +740,19 @@ - time_t time_join_channel_started = (time_t)0; - time_t time_tcp_connected = (time_t)0; - int join_tries = 0; -- char *runas = NULL; -+ char *runas = NULL, *pidfile = NULL; -+ pid_t otherpid; -+ - - color_str[0][0] = color_str[1][0] = color_str[2][0] = color_str[3][0] = 3; - -- while((c = getopt(argc, argv, "xXF:f:i:hHSs:c:Ctn:u:U:p:T:mvdVz:")) != -1) -+ while((c = getopt(argc, argv, "xXP:F:f:i:hHSs:c:Ctn:u:U:p:T:mvdVz:")) != -1) - { - switch(c) - { -+ case 'P': -+ pidfile = optarg; -+ break; - case 'z': - runas = optarg; - break; -@@ -867,6 +888,14 @@ - } - } - -+ pfh = pidfile_open(pidfile, 0600, &otherpid); -+ if (pfh == NULL) { -+ if (errno == EEXIST) -+ error_exit("Daemon already running, pid: %d.", otherpid); -+ /* If we cannot create pidfile from other reasons, only warn. */ -+ dolog("Cannot open or create pidfile"); -+ } -+ - if (do_fork) - { - if (daemon(0, 0) == -1) -@@ -875,6 +904,9 @@ - } - } - -+ pidfile_write(pfh); -+ -+ - signal(SIGPIPE, SIG_IGN); - - for(;;) -@@ -1056,5 +1088,6 @@ - } - } - -+ pidfile_remove(pfh); - return 0; - } diff --git a/net-mgmt/nagircbot/files/patch-br.h b/net-mgmt/nagircbot/files/patch-br.h index ccba410e2097..ade60765a07e 100644 --- a/net-mgmt/nagircbot/files/patch-br.h +++ b/net-mgmt/nagircbot/files/patch-br.h @@ -1,15 +1,14 @@ ---- br.h.orig Mon Nov 27 06:21:58 2006 -+++ br.h Sat Apr 28 13:45:23 2007 -@@ -16,6 +16,8 @@ - * - */ +--- br.h.orig 2011-01-18 05:39:10.000000000 -0500 ++++ br.h 2011-05-31 22:12:14.000000000 -0400 +@@ -1,5 +1,7 @@ + /* (C) 2006-2010 by folkert@vanheusden.com GPLv2 applies */ +#include <sys/types.h> + /* code taken from linux kernel */ #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 #define __builtin_expect(x, expected_value) (x) -@@ -33,7 +35,7 @@ +@@ -17,7 +19,7 @@ char *buffer; long long int buffer_length, buffer_pointer; char *mmap_addr, *cur_offset; @@ -18,7 +17,7 @@ int number_of_bytes_in_buffer(void); int read_into_buffer(void); -@@ -46,5 +48,5 @@ +@@ -30,5 +32,5 @@ char * read_line(void); diff --git a/net-mgmt/nagircbot/files/patch-error.c b/net-mgmt/nagircbot/files/patch-error.c index 87afc42d1e6a..486883fb5604 100644 --- a/net-mgmt/nagircbot/files/patch-error.c +++ b/net-mgmt/nagircbot/files/patch-error.c @@ -7,14 +7,3 @@ +#include <sys/param.h> +#include <libutil.h> +#include "anna.h" - - void error_exit(char *format, ...) - { -@@ -17,6 +20,7 @@ - - fprintf(stderr, "%s: errno=%d (if applicable)\n", buffer, errno); - syslog(LOG_ERR, "'%s': %m", buffer); -+ pidfile_remove(pfh); - - exit(EXIT_FAILURE); - } |