--- eggdrop-1.6.19.orig/configure +++ eggdrop-1.6.19/configure @@ -10034,7 +10034,6 @@ fi - if test "$egg_cv_var_tcl_threaded" = "yes"; then if test "$enable_tcl_threads" = "no"; then cat << 'EOF' >&2 @@ -10056,7 +10055,6 @@ if test ! "${ac_cv_lib_pthread-x}" = "x"; then LIBS="$ac_cv_lib_pthread $LIBS" fi - fi if test "$EGG_CYGWIN" = "yes"; then --- eggdrop-1.6.19.orig/src/eggdrop.h +++ eggdrop-1.6.19/src/eggdrop.h @@ -75,7 +75,7 @@ /* Language stuff */ -#define LANGDIR "./language" /* language file directory */ +#define LANGDIR "/usr/share/eggdrop/language" /* language file directory */ #define BASELANG "english" /* language which always gets loaded before all other languages. You do not want to change this. */ --- eggdrop-1.6.19.orig/src/main.c.new +++ eggdrop-1.6.19/src/main.c.new @@ -0,0 +1,1107 @@ +/* + * main.c -- handles: + * core event handling + * signal handling + * command line arguments + * context and assert debugging + * + * $Id: main.c,v 1.121 2008-02-16 21:41:03 guppy Exp $ + */ +/* + * Copyright (C) 1997 Robey Pointer + * Copyright (C) 1999 - 2008 Eggheads Development Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* + * The author (Robey Pointer) can be reached at: robey@netcom.com + * NOTE: Robey is no long working on this code, there is a discussion + * list available at eggheads@eggheads.org. + */ + +#include "main.h" + +#include +#include +#include +#include +#include + +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#ifdef STOP_UAC /* osf/1 complains a lot */ +# include +# define UAC_NOPRINT 0x00000001 /* Don't report unaligned fixups */ +#endif + +#include "chan.h" +#include "modules.h" +#include "tandem.h" +#include "bg.h" + +#ifndef ENABLE_STRIP +# include +#endif + +#ifdef CYGWIN_HACKS +# include +#endif + +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE 1 /* Solaris needs this */ +#endif + +extern char origbotname[], userfile[], botnetnick[]; +extern int dcc_total, conmask, cache_hit, cache_miss, max_logs, quick_logs; +extern struct dcc_t *dcc; +extern struct userrec *userlist; +extern struct chanset_t *chanset; +extern log_t *logs; +extern Tcl_Interp *interp; +extern tcl_timer_t *timer, *utimer; +extern sigjmp_buf alarmret; +time_t now; + +/* + * Please use the PATCH macro instead of directly altering the version + * string from now on (it makes it much easier to maintain patches). + * Also please read the README file regarding your rights to distribute + * modified versions of this bot. + */ + +char egg_version[1024] = "1.6.19"; +int egg_numver = 1061900; + +char notify_new[121] = ""; /* Person to send a note to for new users */ +int default_flags = 0; /* Default user flags */ +int default_uflags = 0; /* Default user-definied flags */ + +int backgrd = 1; /* Run in the background? */ +int con_chan = 0; /* Foreground: constantly display channel stats? */ +int term_z = 0; /* Foreground: use the terminal as a partyline? */ +int use_stderr = 1; /* Send stuff to stderr instead of logfiles? */ + +char configfile[121] = "eggdrop.conf"; /* Default config file name */ +char pid_file[120]; /* Name of the pid file */ +char helpdir[121] = "help/"; /* Directory of help files */ +char textdir[121] = "text/"; /* Directory for text files */ + +int keep_all_logs = 0; /* Never erase logfiles? */ +char logfile_suffix[21] = ".%d%b%Y"; /* Format of logfile suffix */ +int switch_logfiles_at = 300; /* When to switch logfiles */ + +time_t online_since; /* time that the bot was started */ + +int make_userfile = 0; /* Using bot in userfile-creation mode? */ +char owner[121] = ""; /* Permanent owner(s) of the bot */ + +int save_users_at = 0; /* Minutes past the hour to save the userfile? */ +int notify_users_at = 0; /* Minutes past the hour to notify users of notes? */ + +char version[81]; /* Version info (long form) */ +char ver[41]; /* Version info (short form) */ +char egg_xtra[2048]; /* Patch info */ + +int do_restart = 0; /* .restart has been called, restart ASAP */ +int die_on_sighup = 0; /* Die if bot receives SIGHUP */ +int die_on_sigterm = 1; /* Die if bot receives SIGTERM */ +int resolve_timeout = 15; /* Hostname/address lookup timeout */ +char quit_msg[1024]; /* Quit message */ + +/* Traffic stats */ +unsigned long otraffic_irc = 0; +unsigned long otraffic_irc_today = 0; +unsigned long otraffic_bn = 0; +unsigned long otraffic_bn_today = 0; +unsigned long otraffic_dcc = 0; +unsigned long otraffic_dcc_today = 0; +unsigned long otraffic_filesys = 0; +unsigned long otraffic_filesys_today = 0; +unsigned long otraffic_trans = 0; +unsigned long otraffic_trans_today = 0; +unsigned long otraffic_unknown = 0; +unsigned long otraffic_unknown_today = 0; +unsigned long itraffic_irc = 0; +unsigned long itraffic_irc_today = 0; +unsigned long itraffic_bn = 0; +unsigned long itraffic_bn_today = 0; +unsigned long itraffic_dcc = 0; +unsigned long itraffic_dcc_today = 0; +unsigned long itraffic_trans = 0; +unsigned long itraffic_trans_today = 0; +unsigned long itraffic_unknown = 0; +unsigned long itraffic_unknown_today = 0; + +#ifdef DEBUG_CONTEXT +/* Context storage for fatal crashes */ +char cx_file[16][30]; +char cx_note[16][256]; +int cx_line[16]; +int cx_ptr = 0; +#endif + + +void fatal(const char *s, int recoverable) +{ + int i; + + putlog(LOG_MISC, "*", "* %s", s); + flushlogs(); + for (i = 0; i < dcc_total; i++) + if (dcc[i].sock >= 0) + killsock(dcc[i].sock); + unlink(pid_file); + if (!recoverable) { + bg_send_quit(BG_ABORT); + exit(1); + } +} + +int expmem_chanprog(); +int expmem_users(); +int expmem_misc(); +int expmem_dccutil(); +int expmem_botnet(); +int expmem_tcl(); +int expmem_tclhash(); +int expmem_net(); +int expmem_modules(int); +int expmem_language(); +int expmem_tcldcc(); +int expmem_tclmisc(); + +/* For mem.c : calculate memory we SHOULD be using + */ +int expected_memory(void) +{ + int tot; + + tot = expmem_chanprog() + expmem_users() + expmem_misc() + expmem_dccutil() + + expmem_botnet() + expmem_tcl() + expmem_tclhash() + expmem_net() + + expmem_modules(0) + expmem_language() + expmem_tcldcc() + + expmem_tclmisc(); + return tot; +} + +static void check_expired_dcc() +{ + int i; + + for (i = 0; i < dcc_total; i++) + if (dcc[i].type && dcc[i].type->timeout_val && + ((now - dcc[i].timeval) > *(dcc[i].type->timeout_val))) { + if (dcc[i].type->timeout) + dcc[i].type->timeout(i); + else if (dcc[i].type->eof) + dcc[i].type->eof(i); + else + continue; + /* Only timeout 1 socket per cycle, too risky for more */ + return; + } +} + +#ifdef DEBUG_CONTEXT +static int nested_debug = 0; + +void write_debug() +{ + int x; + char s[25]; + int y; + + if (nested_debug) { + /* Yoicks, if we have this there's serious trouble! + * All of these are pretty reliable, so we'll try these. + * + * NOTE: dont try and display context-notes in here, it's + * _not_ safe + */ + x = creat("DEBUG.DEBUG", 0644); + setsock(x, SOCK_NONSOCK); + if (x >= 0) { + strncpyz(s, ctime(&now), sizeof s); + dprintf(-x, "Debug (%s) written %s\n", ver, s); + dprintf(-x, "Please report problem to bugs@eggheads.org\n"); + dprintf(-x, "after a visit to http://www.eggheads.org/bugzilla/\n"); + dprintf(-x, "Full Patch List: %s\n", egg_xtra); + dprintf(-x, "Context: "); + cx_ptr = cx_ptr & 15; + for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15)) + dprintf(-x, "%s/%d,\n ", cx_file[y], cx_line[y]); + dprintf(-x, "%s/%d\n\n", cx_file[y], cx_line[y]); + killsock(x); + close(x); + } + bg_send_quit(BG_ABORT); + exit(1); /* Dont even try & tell people about, that may + * have caused the fault last time. */ + } else + nested_debug = 1; + putlog(LOG_MISC, "*", "* Last context: %s/%d [%s]", cx_file[cx_ptr], + cx_line[cx_ptr], cx_note[cx_ptr][0] ? cx_note[cx_ptr] : ""); + putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); + putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); + x = creat("DEBUG", 0644); + setsock(x, SOCK_NONSOCK); + if (x < 0) { + putlog(LOG_MISC, "*", "* Failed to write DEBUG"); + } else { + strncpyz(s, ctime(&now), sizeof s); + dprintf(-x, "Debug (%s) written %s\n", ver, s); + dprintf(-x, "Full Patch List: %s\n", egg_xtra); +#ifdef STATIC + dprintf(-x, "STATICALLY LINKED\n"); +#endif + + /* info library */ + dprintf(-x, "Tcl library: %s\n", + ((interp) && (Tcl_Eval(interp, "info library") == TCL_OK)) ? + interp->result : "*unknown*"); + + /* info tclversion/patchlevel */ + dprintf(-x, "Tcl version: %s (header version %s)\n", + ((interp) && (Tcl_Eval(interp, "info patchlevel") == TCL_OK)) ? + interp->result : (Tcl_Eval(interp, "info tclversion") == TCL_OK) ? + interp->result : "*unknown*", TCL_PATCH_LEVEL ? TCL_PATCH_LEVEL : + "*unknown*"); + +#ifdef HAVE_TCL_THREADS + dprintf(-x, "Tcl is threaded\n"); +#endif + +#ifdef CCFLAGS + dprintf(-x, "Compile flags: %s\n", CCFLAGS); +#endif + +#ifdef LDFLAGS + dprintf(-x, "Link flags: %s\n", LDFLAGS); +#endif + +#ifdef STRIPFLAGS + dprintf(-x, "Strip flags: %s\n", STRIPFLAGS); +#endif + + dprintf(-x, "Context: "); + cx_ptr = cx_ptr & 15; + for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15)) + dprintf(-x, "%s/%d, [%s]\n ", cx_file[y], cx_line[y], + (cx_note[y][0]) ? cx_note[y] : ""); + dprintf(-x, "%s/%d [%s]\n\n", cx_file[cx_ptr], cx_line[cx_ptr], + (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : ""); + tell_dcc(-x); + dprintf(-x, "\n"); + debug_mem_to_dcc(-x); + killsock(x); + close(x); + putlog(LOG_MISC, "*", "* Wrote DEBUG"); + } +} +#endif /* DEBUG_CONTEXT */ + +static void got_bus(int z) +{ +#ifdef DEBUG_CONTEXT + write_debug(); +#endif + fatal("BUS ERROR -- CRASHING!", 1); +#ifdef SA_RESETHAND + kill(getpid(), SIGBUS); +#else + bg_send_quit(BG_ABORT); + exit(1); +#endif +} + +static void got_segv(int z) +{ +#ifdef DEBUG_CONTEXT + write_debug(); +#endif + fatal("SEGMENT VIOLATION -- CRASHING!", 1); +#ifdef SA_RESETHAND + kill(getpid(), SIGSEGV); +#else + bg_send_quit(BG_ABORT); + exit(1); +#endif +} + +static void got_fpe(int z) +{ +#ifdef DEBUG_CONTEXT + write_debug(); +#endif + fatal("FLOATING POINT ERROR -- CRASHING!", 0); +} + +static void got_term(int z) +{ + write_userfile(-1); + check_tcl_event("sigterm"); + if (die_on_sigterm) { + botnet_send_chat(-1, botnetnick, "ACK, I've been terminated!"); + fatal("TERMINATE SIGNAL -- SIGNING OFF", 0); + } else + putlog(LOG_MISC, "*", "RECEIVED TERMINATE SIGNAL (IGNORING)"); +} + +static void got_quit(int z) +{ + check_tcl_event("sigquit"); + putlog(LOG_MISC, "*", "RECEIVED QUIT SIGNAL (IGNORING)"); + return; +} + +static void got_hup(int z) +{ + write_userfile(-1); + check_tcl_event("sighup"); + if (die_on_sighup) { + fatal("HANGUP SIGNAL -- SIGNING OFF", 0); + } else + putlog(LOG_MISC, "*", "Received HUP signal: rehashing..."); + do_restart = -2; + return; +} + +/* A call to resolver (gethostbyname, etc) timed out + */ +static void got_alarm(int z) +{ + siglongjmp(alarmret, 1); + + /* -Never reached- */ +} + +/* Got ILL signal -- log context and continue + */ +static void got_ill(int z) +{ + check_tcl_event("sigill"); +#ifdef DEBUG_CONTEXT + putlog(LOG_MISC, "*", "* Context: %s/%d [%s]", cx_file[cx_ptr], + cx_line[cx_ptr], (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : ""); +#endif +} + +#ifdef DEBUG_CONTEXT +/* Context */ +void eggContext(const char *file, int line, const char *module) +{ + char x[31], *p; + + p = strrchr(file, '/'); + if (!module) { + strncpyz(x, p ? p + 1 : file, sizeof x); + } else + egg_snprintf(x, 31, "%s:%s", module, p ? p + 1 : file); + cx_ptr = ((cx_ptr + 1) & 15); + strcpy(cx_file[cx_ptr], x); + cx_line[cx_ptr] = line; + cx_note[cx_ptr][0] = 0; +} + +/* Called from the ContextNote macro. + */ +void eggContextNote(const char *file, int line, const char *module, + const char *note) +{ + char x[31], *p; + + p = strrchr(file, '/'); + if (!module) + strncpyz(x, p ? p + 1 : file, sizeof x); + else + egg_snprintf(x, 31, "%s:%s", module, p ? p + 1 : file); + cx_ptr = ((cx_ptr + 1) & 15); + strcpy(cx_file[cx_ptr], x); + cx_line[cx_ptr] = line; + strncpyz(cx_note[cx_ptr], note, sizeof cx_note[cx_ptr]); +} +#endif /* DEBUG_CONTEXT */ + +#ifdef DEBUG_ASSERT +/* Called from the Assert macro. + */ +void eggAssert(const char *file, int line, const char *module) +{ +#ifdef DEBUG_CONTEXT + write_debug(); +#endif + if (!module) + putlog(LOG_MISC, "*", "* In file %s, line %u", file, line); + else + putlog(LOG_MISC, "*", "* In file %s:%s, line %u", module, file, line); + fatal("ASSERT FAILED -- CRASHING!", 1); +} +#endif + +static void do_arg(char *s) +{ + char x[512], *z = x; + int i; + + if (s[0] == '-') + for (i = 1; i < strlen(s); i++) { + switch (s[i]) { + case 'n': + backgrd = 0; + break; + case 'c': + con_chan = 1; + term_z = 0; + break; + case 't': + con_chan = 0; + term_z = 1; + break; + case 'm': + make_userfile = 1; + break; + case 'v': + strncpyz(x, egg_version, sizeof x); + newsplit(&z); + newsplit(&z); + printf("%s\n", version); + if (z[0]) + printf(" (patches: %s)\n", z); + bg_send_quit(BG_ABORT); + exit(0); + break; /* this should never be reached */ + case 'h': + printf("\n%s\n\n", version); + printf(EGG_USAGE); + printf("\n"); + bg_send_quit(BG_ABORT); + exit(0); + break; /* this should never be reached */ + } + } else + strncpyz(configfile, s, sizeof configfile); +} + +void backup_userfile(void) +{ + char s[125]; + + putlog(LOG_MISC, "*", USERF_BACKUP); + egg_snprintf(s, sizeof s, "%s~bak", userfile); + copyfile(userfile, s); +} + +/* Timer info */ +static int lastmin = 99; +static time_t then; +static struct tm nowtm; + +/* Called once a second. + * + * Note: Try to not put any Context lines in here (guppy 21Mar2000). + */ +static void core_secondly() +{ + static int cnt = 0; + int miltime; + + do_check_timers(&utimer); /* Secondly timers */ + cnt++; + if (cnt >= 10) { /* Every 10 seconds */ + cnt = 0; + check_expired_dcc(); + if (con_chan && !backgrd) { + dprintf(DP_STDOUT, "\033[2J\033[1;1H"); + tell_verbose_status(DP_STDOUT); + do_module_report(DP_STDOUT, 0, "server"); + do_module_report(DP_STDOUT, 0, "channels"); + tell_mem_status_dcc(DP_STDOUT); + } + } + egg_memcpy(&nowtm, localtime(&now), sizeof(struct tm)); + if (nowtm.tm_min != lastmin) { + int i = 0; + + /* Once a minute */ + lastmin = (lastmin + 1) % 60; + call_hook(HOOK_MINUTELY); + check_expired_ignores(); + autolink_cycle(NULL); /* Attempt autolinks */ + /* In case for some reason more than 1 min has passed: */ + while (nowtm.tm_min != lastmin) { + /* Timer drift, dammit */ + debug2("timer: drift (lastmin=%d, now=%d)", lastmin, nowtm.tm_min); + i++; + lastmin = (lastmin + 1) % 60; + call_hook(HOOK_MINUTELY); + } + if (i > 1) + putlog(LOG_MISC, "*", "(!) timer drift -- spun %d minutes", i); + miltime = (nowtm.tm_hour * 100) + (nowtm.tm_min); + if (((int) (nowtm.tm_min / 5) * 5) == (nowtm.tm_min)) { /* 5 min */ + call_hook(HOOK_5MINUTELY); + check_botnet_pings(); + if (!quick_logs) { + flushlogs(); + check_logsize(); + } + if (!miltime) { /* At midnight */ + char s[25]; + int j; + + strncpyz(s, ctime(&now), sizeof s); + putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20); + call_hook(HOOK_BACKUP); + for (j = 0; j < max_logs; j++) { + if (logs[j].filename != NULL && logs[j].f != NULL) { + fclose(logs[j].f); + logs[j].f = NULL; + } + } + } + } + if (nowtm.tm_min == notify_users_at) + call_hook(HOOK_HOURLY); + /* These no longer need checking since they are all check vs minutely + * settings and we only get this far on the minute. + */ + if (miltime == switch_logfiles_at) { + call_hook(HOOK_DAILY); + if (!keep_all_logs) { + putlog(LOG_MISC, "*", MISC_LOGSWITCH); + for (i = 0; i < max_logs; i++) + if (logs[i].filename) { + char s[1024]; + + if (logs[i].f) { + fclose(logs[i].f); + logs[i].f = NULL; + } + egg_snprintf(s, sizeof s, "%s.yesterday", logs[i].filename); + unlink(s); + movefile(logs[i].filename, s); + } + } + } + } +} + +static void core_minutely() +{ + check_tcl_time(&nowtm); + do_check_timers(&timer); + if (quick_logs != 0) { + flushlogs(); + check_logsize(); + } +} + +static void core_hourly() +{ + write_userfile(-1); +} + +static void event_rehash() +{ + check_tcl_event("rehash"); +} + +static void event_prerehash() +{ + check_tcl_event("prerehash"); +} + +static void event_save() +{ + check_tcl_event("save"); +} + +static void event_logfile() +{ + check_tcl_event("logfile"); +} + +static void event_resettraffic() +{ + otraffic_irc += otraffic_irc_today; + itraffic_irc += itraffic_irc_today; + otraffic_bn += otraffic_bn_today; + itraffic_bn += itraffic_bn_today; + otraffic_dcc += otraffic_dcc_today; + itraffic_dcc += itraffic_dcc_today; + otraffic_unknown += otraffic_unknown_today; + itraffic_unknown += itraffic_unknown_today; + otraffic_trans += otraffic_trans_today; + itraffic_trans += itraffic_trans_today; + otraffic_irc_today = otraffic_bn_today = 0; + otraffic_dcc_today = otraffic_unknown_today = 0; + itraffic_irc_today = itraffic_bn_today = 0; + itraffic_dcc_today = itraffic_unknown_today = 0; + itraffic_trans_today = otraffic_trans_today = 0; +} + +static void event_loaded() +{ + check_tcl_event("loaded"); +} + +void kill_tcl(); +extern module_entry *module_list; +void restart_chons(); + +#ifdef STATIC +void check_static(char *, char *(*)()); + +#include "mod/static.h" +#endif +int init_mem(); +int init_dcc_max(); +int init_userent(); +int init_misc(); +int init_bots(); +int init_net(); +int init_modules(); +int init_tcl(int, char **); +int init_language(int); + +void patch(const char *str) +{ + char *p = strchr(egg_version, '+'); + + if (!p) + p = &egg_version[strlen(egg_version)]; + sprintf(p, "+%s", str); + egg_numver++; + sprintf(&egg_xtra[strlen(egg_xtra)], " %s", str); +} + +static inline void garbage_collect(void) +{ + static u_8bit_t run_cnt = 0; + + if (run_cnt == 3) + garbage_collect_tclhash(); + else + run_cnt++; +} + +int main(int argc, char **argv) +{ + int xx, i; + char buf[520], s[25]; + FILE *f; + struct sigaction sv; + struct chanset_t *chan; + +#ifndef ENABLE_STRIP + /* Make sure it can write core, if you make debug. Else it's pretty + * useless (dw) + */ + { + struct rlimit cdlim; + + cdlim.rlim_cur = RLIM_INFINITY; + cdlim.rlim_max = RLIM_INFINITY; + setrlimit(RLIMIT_CORE, &cdlim); + } +#endif + + /* Initialise context list */ + for (i = 0; i < 16; i++) + Context; + +#include "patch.h" + /* Version info! */ + egg_snprintf(ver, sizeof ver, "eggdrop v%s", egg_version); + egg_snprintf(version, sizeof version, + "Eggdrop v%s (C) 1997 Robey Pointer (C) 2008 Eggheads", + egg_version); + /* Now add on the patchlevel (for Tcl) */ + sprintf(&egg_version[strlen(egg_version)], " %u", egg_numver); + strcat(egg_version, egg_xtra); +#ifdef STOP_UAC + { + int nvpair[2]; + + nvpair[0] = SSIN_UACPROC; + nvpair[1] = UAC_NOPRINT; + setsysinfo(SSI_NVPAIRS, (char *) nvpair, 1, NULL, 0); + } +#endif + + /* Set up error traps: */ + sv.sa_handler = got_bus; + sigemptyset(&sv.sa_mask); +#ifdef SA_RESETHAND + sv.sa_flags = SA_RESETHAND; +#else + sv.sa_flags = 0; +#endif + sigaction(SIGBUS, &sv, NULL); + sv.sa_handler = got_segv; + sigaction(SIGSEGV, &sv, NULL); +#ifdef SA_RESETHAND + sv.sa_flags = 0; +#endif + sv.sa_handler = got_fpe; + sigaction(SIGFPE, &sv, NULL); + sv.sa_handler = got_term; + sigaction(SIGTERM, &sv, NULL); + sv.sa_handler = got_hup; + sigaction(SIGHUP, &sv, NULL); + sv.sa_handler = got_quit; + sigaction(SIGQUIT, &sv, NULL); + sv.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &sv, NULL); + sv.sa_handler = got_ill; + sigaction(SIGILL, &sv, NULL); + sv.sa_handler = got_alarm; + sigaction(SIGALRM, &sv, NULL); + + /* Initialize variables and stuff */ + now = time(NULL); + chanset = NULL; + egg_memcpy(&nowtm, localtime(&now), sizeof(struct tm)); + lastmin = nowtm.tm_min; + srandom((unsigned int) (now % (getpid() + getppid()))); + init_mem(); + init_language(1); + if (argc > 1) + for (i = 1; i < argc; i++) + do_arg(argv[i]); + printf("\n%s\n", version); + + /* Don't allow eggdrop to run as root */ + if (((int) getuid() == 0) || ((int) geteuid() == 0)) + fatal("ERROR: Eggdrop will not run as root!", 0); + + init_dcc_max(); + init_userent(); + init_misc(); + init_bots(); + init_net(); + init_modules(); + if (backgrd) + bg_prepare_split(); + init_tcl(argc, argv); + init_language(0); +#ifdef STATIC + link_statics(); +#endif + strncpyz(s, ctime(&now), sizeof s); + strcpy(&s[11], &s[20]); + putlog(LOG_ALL, "*", "--- Loading %s (%s)", ver, s); + chanprog(); + if (!encrypt_pass) { + printf(MOD_NOCRYPT); + bg_send_quit(BG_ABORT); + exit(1); + } + i = 0; + for (chan = chanset; chan; chan = chan->next) + i++; + putlog(LOG_MISC, "*", "=== %s: %d channels, %d users.", + botnetnick, i, count_users(userlist)); + cache_miss = 0; + cache_hit = 0; + if (!pid_file[0]) + egg_snprintf(pid_file, sizeof pid_file, "pid.%s", botnetnick); + + /* Check for pre-existing eggdrop! */ + f = fopen(pid_file, "r"); + if (f != NULL) { + fgets(s, 10, f); + xx = atoi(s); + kill(xx, SIGCHLD); /* Meaningless kill to determine if pid + * is used */ + if (errno != ESRCH) { + printf(EGG_RUNNING1, botnetnick); + printf(EGG_RUNNING2, pid_file); + bg_send_quit(BG_ABORT); + exit(1); + } + } + + /* Move into background? */ + if (backgrd) { +#ifndef CYGWIN_HACKS + bg_do_split(); + } else { /* !backgrd */ +#endif + xx = getpid(); + if (xx != 0) { + FILE *fp; + + /* Write pid to file */ + unlink(pid_file); + fp = fopen(pid_file, "w"); + if (fp != NULL) { + fprintf(fp, "%u\n", xx); + if (fflush(fp)) { + /* Let the bot live since this doesn't appear to be a botchk */ + printf(EGG_NOWRITE, pid_file); + fclose(fp); + unlink(pid_file); + } else + fclose(fp); + } else + printf(EGG_NOWRITE, pid_file); +#ifdef CYGWIN_HACKS + printf("Launched into the background (pid: %d)\n\n", xx); +#endif + } + } + + use_stderr = 0; /* Stop writing to stderr now */ + if (backgrd) { + /* Ok, try to disassociate from controlling terminal (finger cross) */ +#if defined(HAVE_SETPGID) && !defined(CYGWIN_HACKS) + setpgid(0, 0); +#endif + /* Tcl wants the stdin, stdout and stderr file handles kept open. */ + freopen("/dev/null", "r", stdin); + freopen("/dev/null", "w", stdout); + freopen("/dev/null", "w", stderr); +#ifdef CYGWIN_HACKS + FreeConsole(); +#endif + } + + /* Terminal emulating dcc chat */ + if (!backgrd && term_z) { + int n = new_dcc(&DCC_CHAT, sizeof(struct chat_info)); + + dcc[n].addr = iptolong(getmyip()); + dcc[n].sock = STDOUT; + dcc[n].timeval = now; + dcc[n].u.chat->con_flags = conmask; + dcc[n].u.chat->strip_flags = STRIP_ALL; + dcc[n].status = STAT_ECHO; + strcpy(dcc[n].nick, "HQ"); + strcpy(dcc[n].host, "llama@console"); + /* HACK: Workaround not to pass literal "HQ" as a non-const arg */ + dcc[n].user = get_user_by_handle(userlist, dcc[n].nick); + /* Make sure there's an innocuous HQ user if needed */ + if (!dcc[n].user) { + userlist = adduser(userlist, dcc[n].nick, "none", "-", USER_PARTY); + dcc[n].user = get_user_by_handle(userlist, dcc[n].nick); + } + setsock(STDOUT, 0); /* Entry in net table */ + dprintf(n, "\n### ENTERING DCC CHAT SIMULATION ###\n\n"); + dcc_chatter(n); + } + + then = now; + online_since = now; + autolink_cycle(NULL); /* Hurry and connect to tandem bots */ + add_help_reference("cmds1.help"); + add_help_reference("cmds2.help"); + add_help_reference("core.help"); + add_hook(HOOK_SECONDLY, (Function) core_secondly); + add_hook(HOOK_MINUTELY, (Function) core_minutely); + add_hook(HOOK_HOURLY, (Function) core_hourly); + add_hook(HOOK_REHASH, (Function) event_rehash); + add_hook(HOOK_PRE_REHASH, (Function) event_prerehash); + add_hook(HOOK_USERFILE, (Function) event_save); + add_hook(HOOK_BACKUP, (Function) backup_userfile); + add_hook(HOOK_DAILY, (Function) event_logfile); + add_hook(HOOK_DAILY, (Function) event_resettraffic); + add_hook(HOOK_LOADED, (Function) event_loaded); + + call_hook(HOOK_LOADED); + + debug0("main: entering loop"); + while (1) { + int socket_cleanup = 0; + +#ifdef USE_TCL_EVENTS + /* Process a single tcl event */ + Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT); +#endif /* USE_TCL_EVENTS */ + + /* Lets move some of this here, reducing the numer of actual + * calls to periodic_timers + */ + now = time(NULL); + random(); /* Woop, lets really jumble things */ + if (now != then) { /* Once a second */ + call_hook(HOOK_SECONDLY); + then = now; + } + + /* Only do this every so often. */ + if (!socket_cleanup) { + socket_cleanup = 5; + + /* Remove dead dcc entries. */ + dcc_remove_lost(); + + /* Check for server or dcc activity. */ + dequeue_sockets(); + } else + socket_cleanup--; + + /* Free unused structures. */ + garbage_collect(); + + xx = sockgets(buf, &i); + if (xx >= 0) { /* Non-error */ + int idx; + + for (idx = 0; idx < dcc_total; idx++) + if (dcc[idx].sock == xx) { + if (dcc[idx].type && dcc[idx].type->activity) { + /* Traffic stats */ + if (dcc[idx].type->name) { + if (!strncmp(dcc[idx].type->name, "BOT", 3)) + itraffic_bn_today += strlen(buf) + 1; + else if (!strcmp(dcc[idx].type->name, "SERVER")) + itraffic_irc_today += strlen(buf) + 1; + else if (!strncmp(dcc[idx].type->name, "CHAT", 4)) + itraffic_dcc_today += strlen(buf) + 1; + else if (!strncmp(dcc[idx].type->name, "FILES", 5)) + itraffic_dcc_today += strlen(buf) + 1; + else if (!strcmp(dcc[idx].type->name, "SEND")) + itraffic_trans_today += strlen(buf) + 1; + else if (!strncmp(dcc[idx].type->name, "GET", 3)) + itraffic_trans_today += strlen(buf) + 1; + else + itraffic_unknown_today += strlen(buf) + 1; + } + dcc[idx].type->activity(idx, buf, i); + } else + putlog(LOG_MISC, "*", + "!!! untrapped dcc activity: type %s, sock %d", + dcc[idx].type->name, dcc[idx].sock); + break; + } + } else if (xx == -1) { /* EOF from someone */ + int idx; + + if (i == STDOUT && !backgrd) + fatal("END OF FILE ON TERMINAL", 0); + for (idx = 0; idx < dcc_total; idx++) + if (dcc[idx].sock == i) { + if (dcc[idx].type && dcc[idx].type->eof) + dcc[idx].type->eof(idx); + else { + putlog(LOG_MISC, "*", + "*** ATTENTION: DEAD SOCKET (%d) OF TYPE %s UNTRAPPED", + i, dcc[idx].type ? dcc[idx].type->name : "*UNKNOWN*"); + killsock(i); + lostdcc(idx); + } + idx = dcc_total + 1; + } + if (idx == dcc_total) { + putlog(LOG_MISC, "*", + "(@) EOF socket %d, not a dcc socket, not anything.", i); + close(i); + killsock(i); + } + } else if (xx == -2 && errno != EINTR) { /* select() error */ + putlog(LOG_MISC, "*", "* Socket error #%d; recovering.", errno); + for (i = 0; i < dcc_total; i++) { + if ((fcntl(dcc[i].sock, F_GETFD, 0) == -1) && (errno == EBADF)) { + putlog(LOG_MISC, "*", + "DCC socket %d (type %d, name '%s') expired -- pfft", + dcc[i].sock, dcc[i].type, dcc[i].nick); + killsock(dcc[i].sock); + lostdcc(i); + i--; + } + } + } else if (xx == -3) { + call_hook(HOOK_IDLE); + socket_cleanup = 0; /* If we've been idle, cleanup & flush */ + } + + if (do_restart) { + if (do_restart == -2) + rehash(); + else { + /* Unload as many modules as possible */ + int f = 1; + module_entry *p; + Function startfunc; + char name[256]; + + /* oops, I guess we should call this event before tcl is restarted */ + check_tcl_event("prerestart"); + + while (f) { + f = 0; + for (p = module_list; p != NULL; p = p->next) { + dependancy *d = dependancy_list; + int ok = 1; + + while (ok && d) { + if (d->needed == p) + ok = 0; + d = d->next; + } + if (ok) { + strcpy(name, p->name); + if (module_unload(name, botnetnick) == NULL) { + f = 1; + break; + } + } + } + } + + /* Make sure we don't have any modules left hanging around other than + * "eggdrop" and the two that are supposed to be. + */ + for (f = 0, p = module_list; p; p = p->next) { + if (strcmp(p->name, "eggdrop") && strcmp(p->name, "encryption") && + strcmp(p->name, "uptime")) { + f++; + } + } + if (f != 0) { + putlog(LOG_MISC, "*", MOD_STAGNANT); + } + + flushlogs(); + kill_tcl(); + init_tcl(argc, argv); + init_language(0); + + /* this resets our modules which we didn't unload (encryption and uptime) */ + for (p = module_list; p; p = p->next) { + if (p->funcs) { + startfunc = p->funcs[MODCALL_START]; + startfunc(NULL); + } + } + + rehash(); + restart_chons(); + call_hook(HOOK_LOADED); + } + + do_restart = 0; + } + } +} --- eggdrop-1.6.19.orig/debian/watch +++ eggdrop-1.6.19/debian/watch @@ -0,0 +1,3 @@ +version=2 +ftp://ftp.eggheads.org/pub/eggdrop/source/1.6/eggdrop(.*)\.tar\.gz debian uupdate + --- eggdrop-1.6.19.orig/debian/eggdrop-data.install +++ eggdrop-1.6.19/debian/eggdrop-data.install @@ -0,0 +1,4 @@ +debian/tmp/usr/help/* usr/share/eggdrop/help/ +debian/tmp/usr/language/* usr/share/eggdrop/language/ +debian/tmp/usr/scripts/* usr/share/eggdrop/scripts/ +debian/tmp/usr/text/* usr/share/eggdrop/text/ --- eggdrop-1.6.19.orig/debian/changelog +++ eggdrop-1.6.19/debian/changelog @@ -0,0 +1,398 @@ +eggdrop (1.6.19-1.1+lenny1) stable-security; urgency=medium + + * Security: fix buffer overflow in case strlen(ctcpbuf) returns zero + (Closes: #528778). + Fixes: CVE-2007-2807 + + -- Sebastien Delafond Mon, 22 Jun 2009 12:54:48 +0200 + +eggdrop (1.6.19-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Use patch from Julian Mehnle to enforce building + egggrop with Tcl thread support. Thanks for the patch. (Closes: #487541) + + -- Marc 'HE' Brockschmidt Sat, 06 Sep 2008 21:19:08 +0200 + +eggdrop (1.6.19-1) unstable; urgency=low + + * New upstream release. + + * debian/control: + - bumped Standards-Version to 3.7.3; + - made "Homepage" a field in the source stanza; + - changed the capitalization of "Tcl" in the package description to make + lintian happy; + - bumped build-dependency on Tcl to 8.5, as per upstream recommendation + (Closes: #473035). + + * debian/copyright: + - added appropriate copyright notices. + + * debian/patches: + - 01version.patch: added; show the correct version number; + - 01_CVE-2007-2807_srvmsg.patch: applied upstream, dropped. + + -- Guilherme de S. Pastore Fri, 30 May 2008 16:20:00 -0300 + +eggdrop (1.6.18-1.1) unstable; urgency=high + + * Non-maintainer upload by secure testing team. + * Fix for CVE-2007-2807 (01_CVE-2007-2807_srvmsg.patch) (Closes: #427157). + + -- Nico Golde Sun, 12 Aug 2007 16:42:31 +0200 + +eggdrop (1.6.18-1) unstable; urgency=low + + * New upstream release (Closes: #369678). + - debian/patches/00conf_paths.patch: updated. + + * debian/control: + - updated maintainer address. + - replace ${Source-Version} with ${source:Version}. Yay binNMUs! + + * debian/copyright: updated FSF's address. + + -- Guilherme de S. Pastore Fri, 1 Sep 2006 18:21:45 -0300 + +eggdrop (1.6.17-3) unstable; urgency=medium + + * Rewrote long description + * 00conf_paths.patch: + - Change file paths in example configuration file + Thanks to Gustavo Noronha Silva + * Fixed mistake in README.Debian, once again due to the split up + Thanks to Martin Braure de Calignon (Closes: #273933) + + -- Guilherme de S. Pastore Tue, 19 Oct 2004 01:57:51 -0200 + +eggdrop (1.6.17-2) unstable; urgency=high + + * Added versioned Replaces: for eggdrop (>= 1.6.16-2). In other words, + for versions earlier to the split up, in order to allow smooth + upgrades (Closes: #271079) + + -- Guilherme de S. Pastore Sun, 12 Sep 2004 10:04:02 -0300 + +eggdrop (1.6.17-1) unstable; urgency=low + + * New upstream release + - debian/patches/eggdrop.1.diff incorporated upstream, removed. + + -- Guilherme de S. Pastore Wed, 25 Aug 2004 10:32:26 -0300 + +eggdrop (1.6.16-5) unstable; urgency=low + + * debian/control: + - Updated to Standards-Version 3.6.1.1 + * debian/copyright: + - Fixed lots of crazy alignment problems + * debian/rules: + - Included simple-patchsys.mk from CDBS + * debian/patches/eggdrop.1.diff: + - Fix error in manpage that prevented a line from being shown + + -- Guilherme de S. Pastore Tue, 27 Jul 2004 11:41:53 -0300 + +eggdrop (1.6.16-4) unstable; urgency=low + + * Fixed location of some files after split up + * Fixed debian/rules so build doesn't fail if -B is passed + to dpkg-buildpackage (Closes: #258418) + + -- Guilherme de S. Pastore Fri, 9 Jul 2004 10:55:48 -0300 + +eggdrop (1.6.16-3) unstable; urgency=low + + * Added Homepage to eggdrop's description + * Split eggdrop into eggdrop and eggdrop-data + * Changed paths on example configuration files + + -- Guilherme de S. Pastore Fri, 18 Jun 2004 09:30:35 -0300 + +eggdrop (1.6.16-2) unstable; urgency=high + + * Fixed typo on README.Debian + * Fixed hyphens in manual page + * Converted debian/rules to CDBS + * Set path to binary on example config file + * Changed LANGDIR on src/eggdrop.h (Closes: #254824) + + -- Guilherme de S. Pastore Thu, 17 Jun 2004 09:15:28 -0300 + +eggdrop (1.6.16-1) unstable; urgency=low + + * New upstream release + * Cleaned up debian/rules and debian/watch + * Compiled with HANDLEN 9 again (Closes: #241285) + + -- Guilherme de S. Pastore Thu, 3 Jun 2004 11:25:44 -0300 + +eggdrop (1.6.15-2) unstable; urgency=high + + * Applied official patch to fix share.mod security bug + + -- Guilherme de S. Pastore Fri, 16 Apr 2004 17:23:37 -0300 + +eggdrop (1.6.15-1) unstable; urgency=low + + * New maintainer + * Acknowledge NMU (Closes: #173371, #202199) + * debian/rules + - No longer exports DH_COMPAT (new policy) + - Changed destination of files (new policy) + - Cleaned up (unnecessary things ripped out) + - Changed binary filename from eggdrop-1.6.15 to eggdrop + - Now moves the files eggdrop's makefile misplaces to the correct + location (no more makefile patches) + * debian/copyright + - Extended copyright (GPL) information + - Updated "Upstream Authors" field, as requested by EggHeads + * debian/control + - Changed package's long description + - Updated Standards-Version to 3.6.1 + - Specified version of build dependency on debhelper + * Compiled eggdrop with HANDLEN 30 (Closes: #213704) + * Removed unused patches + * Updated README.Debian file + * Removed empty directory doc/html/chat + * Upstream changelog is now included in the package + + -- Guilherme de S. Pastore Fri, 19 Mar 2004 10:11:20 -0300 + +eggdrop (1.6.15-0.1) unstable; urgency=medium + + * NMU by Elrond , checked and uploaded + by Joshua Kwan + + * okayed by maintainer, see Bug#173371 + * New upstream release (Closes: #173371, #202199) + + many security related fixes. + + eggdrop.{simple,advanced,complete}.conf replaced by + one eggdrop.conf. + * Move eggdrop.conf.gz into doc/eggdrop/examples/. + Change README.Debian accordingly. + * Drop the whole Makefile patchery and move installed + files in debian/rules:install around. + Fixes: motd and banner should be in /usr/share/eggdrop/text/. (Even + configs from older versions expected those files there.) + * Move (unused) egp.patch into debian/patches/. + * Small other fixes. + * Bump Standards-Version to 3.5.6.0. + more complicated changes are warranted to bump the standards-version + any higher, hence they're not included in NMU + + -- Joshua Kwan Sat, 28 Feb 2004 22:49:28 -0800 + +eggdrop (1.6.10-1) unstable; urgency=low + + * New upstream release (Closes: #142075) + + -- Ian Eure Tue, 16 Apr 2002 13:51:01 -0700 + +eggdrop (1.6.8-2) unstable; urgency=low + + * Don't use utf8 conversion routines, our tcl doesn't have + them. (Closes: #131342) + + -- Ian Eure Mon, 28 Jan 2002 17:00:03 -0800 + +eggdrop (1.6.8-1) unstable; urgency=low + + * New upstream release + * Apply patch from CVS to fix SIGBUS crashes on sparcs. (Closes: #103635) + * Fix speeling error in description. (Closes: #124595) + + -- Ian Eure Mon, 28 Jan 2002 09:55:35 -0800 + +eggdrop (1.6.6-3) unstable; urgency=low + + * don't force use of gcc 3.0, just use the default. + + -- Ian Eure Sat, 15 Dec 2001 15:00:41 -0800 + +eggdrop (1.6.6-2) unstable; urgency=low + + * compile eggdrop with gcc 3.0; 2.95.x seems to have problems on + sparc. (closes: #103635) + + -- Ian Eure Wed, 12 Dec 2001 16:34:56 -0800 + +eggdrop (1.6.6-1) unstable; urgency=low + + * new upstream release + * removed ugly hack from 1.6.4-1 in src/mod/dns.mod/configure.in to get + libresolv linked in, since it seems to work once more. strange. + + -- Ian Eure Mon, 6 Aug 2001 20:25:35 -0700 + +eggdrop (1.6.4-2) unstable; urgency=low + + * applied patch to fix crash with unicode channel names. (closes: #99638) + + -- Ian Eure Sun, 1 Jul 2001 03:50:14 -0700 + +eggdrop (1.6.4-1) unstable; urgency=low + + * New upstream release + * remove broken test for res_init, since it's part of glibc. (closes: #94330) + + -- Ian Eure Sun, 29 Apr 2001 22:24:05 -0700 + +eggdrop (1.6.3-1) unstable; urgency=low + + * New upstream release + * removed dh_suidregister from debian/rules + * `INSTALL' isn't installed with the rest of the upstream docs. + + -- Ian Eure Fri, 9 Mar 2001 16:39:14 -0800 + +eggdrop (1.6.2-2) unstable; urgency=low + + * compiled against tcl8.3. (closes: #81082) + * fixed broken build. + + -- Ian Eure Wed, 14 Feb 2001 10:30:42 -0800 + +eggdrop (1.6.2-1) unstable; urgency=low + + * New upstream release + + -- Ian Eure Tue, 6 Feb 2001 13:38:42 -0800 + +eggdrop (1.6.1-4) unstable; urgency=low + + * fixed botscript path in botchk & autobotchk (closes: #79160) + * fixed misleading error messages in autobotchk (closes: #79161) + + -- Ian Eure Sun, 17 Dec 2000 22:07:44 -0800 + +eggdrop (1.6.1-3) unstable; urgency=low + + * added debhelper to Build-Depends. (closes: #78747) + * updated source url in copyright + + -- Ian Eure Mon, 4 Dec 2000 09:09:09 -0800 + +eggdrop (1.6.1-2) unstable; urgency=low + + * removed versions from Build-Depends, since tcl-dev and libz-dev + are Provide:'d. (closes: #78095) + + -- Ian Eure Mon, 27 Nov 2000 11:39:49 -0800 + +eggdrop (1.6.1-1) unstable; urgency=low + + * New upstream release + * fixed another typo in README.Debian + + -- Ian Eure Sat, 25 Nov 2000 12:23:06 -0800 + +eggdrop (1.6.0-2) unstable; urgency=low + + * fixed README.Debian to point to the correct eggdrop.simple.conf. + (closes: #77919) + * autobotchk looks for /usr/share/eggdrop/help & /usr/bin/eggdrop + instead of $dir/help & $dir/eggdrop. (closes: #77931) + + -- Ian Eure Fri, 24 Nov 2000 19:42:36 -0800 + +eggdrop (1.6.0-1) unstable; urgency=low + + * new upstream version. (closes: #57452) + * added Build-Depends (closes: #70292) + * new maintainer (closes: #76182, #75075, #68067) + * FHS compliance; binary modules are in /usr/lib/eggdrop/modules, + machine-independent data is in /usr/share/eggdrop + + -- Ian Eure Fri, 17 Nov 2000 11:43:49 -0800 + +eggdrop (1.3.28-2) unstable; urgency=low + + * Erm, let's try that again .. should actually work this time. + (Closes: #47779). + * Remove *.rej and *.orig files on clean + * Don't use /usr/doc /and/ /usr/share/doc. (closes: #46562) + + -- Edward Brocklesby Fri, 22 Oct 1999 19:24:11 +0100 + +eggdrop (1.3.28-1) unstable; urgency=low + + * New Upstream Version. + + -- Edward Brocklesby Mon, 27 Sep 1999 18:38:06 +0100 + +eggdrop (1.3.23-2) unstable; urgency=low + + * Eggdrop binary is executable again, closes: #31694, #31781. + * Improved lintianability. + + -- Johnie Ingram Mon, 1 Feb 1999 09:20:43 -0500 + +eggdrop (1.3.23-1) unstable; urgency=low + + * New upstream version. + + -- Johnie Ingram Mon, 4 Jan 1999 02:15:42 -0500 + +eggdrop (1.3.22-1) unstable; urgency=low + + * New upstream version. + * Added patches from Darren (#22930) to eggdrop.conf, which is now a + conffile (#22951). + + -- Johnie Ingram Sat, 14 Nov 1998 19:35:11 -0500 + +eggdrop (1.3.19-2) frozen unstable; urgency=low + + * Linked with the tcl8 which uses libncurses4. + + -- Johnie Ingram Sat, 14 Nov 1998 19:14:35 -0500 + +eggdrop (1.3.19-1) unstable; urgency=low + + * New upstream version. + * Fixed lintian errors. + * Corrected address of FSF in copyright file. + + -- Johnie Ingram Sun, 30 Aug 1998 01:47:39 -0400 + +eggdrop (1.3.18-1) unstable; urgency=low + + * New upstream version. + + -- Johnie Ingram Mon, 20 Jul 1998 13:50:37 -0400 + +eggdrop (1.3.14-2) unstable; urgency=low + + * New upstream version. + + -- Johnie Ingram Thu, 21 May 1998 14:06:10 -0400 + +eggdrop (1.3.13-1) unstable; urgency=low + + * New upstream version. + * Converted from debmake to debhelper packaging technology. + * Updated to Standards-Version 2.4.1.0. + + -- Johnie Ingram Sun, 19 Apr 1998 20:38:55 -0400 + +eggdrop (1.3.0-1) unstable; urgency=low + + * New upstream version (almost released it, but didn't). + + -- Johnie Ingram Wed, 12 Nov 1997 22:55:23 -0500 + +eggdrop (1.2.0-0) local; urgency=low + + * New upstream version (pristine source). + + -- Johnie Ingram Thu, 11 Sep 1997 12:47:44 -0400 + +eggdrop (1.1.5-1) local; urgency=low + + * New package (never uploaded). + + -- Johnie Ingram Wed, 9 Jul 1997 00:29:18 -0400 + + --- eggdrop-1.6.19.orig/debian/control +++ eggdrop-1.6.19/debian/control @@ -0,0 +1,33 @@ +Source: eggdrop +Section: net +Build-Depends: tcl8.5-dev, libz-dev, debhelper (>> 4.1.0), cdbs +Priority: extra +Maintainer: Guilherme de S. Pastore +Standards-Version: 3.7.3 +Homepage: http://www.eggheads.org/ + +Package: eggdrop +Architecture: any +Depends: ${shlibs:Depends}, eggdrop-data (= ${source:Version}) +Description: Advanced IRC Robot + Eggdrop is an IRC bot written in C, which sits on channels and takes + protective measures, such as preventing it from being taken over (in + the few ways that anything can), recognizing banned users to reject + them, recognizing privileged users to give them operator status, + punishing users for things like flooding, among innumerable others. + . + All of this is completely configurable, and can be disabled or enabled + as you wish in the configuration file. Also, it's very easy to expand + and customize with Tcl scripts and C modules, making it possible to + adapt Eggdrop to any special need you might have. + +Package: eggdrop-data +Architecture: all +Replaces: eggdrop (>= 1.6.16-2) +Description: Architecture independent files for eggdrop + This package contains all the files that eggdrop places on /usr/share. + These files are not specific to a single processor architecture once + the package is built, so a single package can serve all the archs + Debian supports. + . + This package is not useful at all if eggdrop is not installed. --- eggdrop-1.6.19.orig/debian/eggdrop-data.examples +++ eggdrop-1.6.19/debian/eggdrop-data.examples @@ -0,0 +1 @@ +eggdrop.conf --- eggdrop-1.6.19.orig/debian/eggdrop-data.docs +++ eggdrop-1.6.19/debian/eggdrop-data.docs @@ -0,0 +1,21 @@ +NEWS +README +doc/ABOUT +doc/AUTHORS +doc/BANS +doc/BOTNET +doc/BUG-REPORT +doc/CONTENTS +doc/FIRST-SCRIPT +doc/html +doc/KNOWN-PROBLEMS +doc/MODULES +doc/PARTYLINE +doc/PATCH-HOWTO +doc/settings +doc/tcl-commands.doc +doc/TEXT-SUBSTITUTIONS +doc/TRICKS +doc/UPDATES1.6 +doc/USERS +doc/WEIRD-MESSAGES --- eggdrop-1.6.19.orig/debian/README.Debian +++ eggdrop-1.6.19/debian/README.Debian @@ -0,0 +1,23 @@ +eggdrop for Debian +---------------------- + +Quick start: + +1. Create an account for the bot (not strictly necessary, + but recommended). +2. Copy /usr/share/doc/eggdrop-data/examples/eggdrop.conf.gz + to the bot's directory +3. Uncompress and edit the configuration file completely +4. Make the file executable (chmod +x eggdrop.conf) and + run it with -m ('./eggdrop.conf -m') +3. Follow the instructions for identifying yourself as + the bot owner +4. Remember not to use -m next time you run eggdrop + +When converting old eggdrop.conf files, make sure you specify an absolute path +to any scripts or help files it needs to load. You may symlink the scripts and +help directories in the bot's home directory as an alternative, if you wish. + +Eggdrop shouldn't (and won't) ever be run as super-user (root). + + -- Guilherme de S. Pastore , Thu Jun 17 09:29:43 2004 --- eggdrop-1.6.19.orig/debian/compat +++ eggdrop-1.6.19/debian/compat @@ -0,0 +1 @@ +4 --- eggdrop-1.6.19.orig/debian/rules +++ eggdrop-1.6.19/debian/rules @@ -0,0 +1,17 @@ +#!/usr/bin/make -f +# -*- mode: makefile; coding: utf-8 -*- + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/rules/simple-patchsys.mk + +DEB_CONFIGURE_EXTRA_FLAGS := --enable-tcl-threads +DEB_CONFIGURE_SCRIPT_ENV := +DEB_INSTALL_MANPAGES_eggdrop-data := doc/man1/eggdrop.1 +DEB_MAKE_INSTALL_TARGET := install prefix=$(DEB_DESTDIR)/usr + +configure/eggdrop:: + $(MAKE) config + +binary-post-install/eggdrop:: + cd debian/eggdrop/usr/bin && mv eggdrop-1.6.19 eggdrop --- eggdrop-1.6.19.orig/debian/eggdrop.links +++ eggdrop-1.6.19/debian/eggdrop.links @@ -0,0 +1 @@ +usr/share/doc/eggdrop-data usr/share/doc/eggdrop/upstream --- eggdrop-1.6.19.orig/debian/eggdrop.install +++ eggdrop-1.6.19/debian/eggdrop.install @@ -0,0 +1,2 @@ +debian/tmp/usr/eggdrop-1.6.19 usr/bin +debian/tmp/usr/modules-1.6.19/* usr/lib/eggdrop/modules/ --- eggdrop-1.6.19.orig/debian/copyright +++ eggdrop-1.6.19/debian/copyright @@ -0,0 +1,34 @@ +This package was debianized by Guilherme de S. Pastore on +Fri, 19 Mar 2004 10:11:20 -0300 + +It was downloaded from ftp://ftp.eggheads.org/pub/eggdrop/source/ + +Upstream Author: EggHeads Development Team + +Copyright: + +Copyright (C) 1997 Robey Pointer +Copyright (C) 1999 - 2008 Eggheads Development Team + +src/rfc1459.c: + * Copyright (C) 1990 Jarkko Oikarinen + + +License: + + This program is free software, which means you can redistribute it + and/or modify it under the terms of the GNU General Public License + (GPL) as published by the Free Software Foundation; either version + 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + (GPL) along with this program. If not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL file. --- eggdrop-1.6.19.orig/debian/patches/02_incompCVE-2007-2807.patch +++ eggdrop-1.6.19/debian/patches/02_incompCVE-2007-2807.patch @@ -0,0 +1,12 @@ +diff -Nurad eggdrop-1.6.19.orig/src/mod/server.mod/servmsg.c eggdrop-1.6.19/src/mod/server.mod/servmsg.c +--- eggdrop-1.6.19.orig/src/mod/server.mod/servmsg.c 2009-05-15 13:47:19.000000000 +0200 ++++ eggdrop-1.6.19/src/mod/server.mod/servmsg.c 2009-05-15 13:47:50.000000000 +0200 +@@ -490,7 +490,7 @@ + ctcp = ctcpbuf; + /* copy the part after the second : in front of it after + * the first :, this is temporary copied to ctcpbuf */ +- strncpy(p1 - 1, p + 1, strlen(ctcpbuf) - 1); ++ memmove(p1 - 1, p + 1, strlen(p + 1) + 1); + + if (!ignoring) + detect_flood(nick, uhost, from, --- eggdrop-1.6.19.orig/debian/patches/00conf_paths.patch +++ eggdrop-1.6.19/debian/patches/00conf_paths.patch @@ -0,0 +1,64 @@ +--- eggdrop.conf~ 2005-08-29 00:51:36.000000000 -0300 ++++ eggdrop.conf 2006-09-01 18:20:22.123109750 -0300 +@@ -1,4 +1,4 @@ +-#! /path/to/executable/eggdrop ++#!/usr/bin/eggdrop + # ^- This should contain a fully qualified path to your Eggdrop executable. + # + # $Id: eggdrop.conf,v 1.47 2005-08-29 03:51:36 wcc Exp $ +@@ -185,22 +185,22 @@ + + # Specify here where Eggdrop should look for help files. Don't modify this + # setting unless you know what you're doing! +-set help-path "help/" ++set help-path "/usr/share/eggdrop/help/" + + # Specify here where Eggdrop should look for text files. This is used for + # certain Tcl and DCC commands. +-set text-path "text/" ++set text-path "/usr/share/eggdrop/text/" + + # Set here a place to store temporary files. + set temp-path "/tmp" + + # The MOTD (Message Of The day) is displayed when people dcc chat or telnet + # to the bot. Look at doc/TEXT-SUBSTITUTIONS for options. +-set motd "text/motd" ++set motd "/usr/share/eggdrop/text/motd" + + # This banner will be displayed on telnet connections. Look at + # doc/TEXT-SUBSTITUTIONS for options. +-set telnet-banner "text/banner" ++set telnet-banner "/usr/share/eggdrop/text/banner" + + # This specifies what permissions the user, channel, and notes files should + # be set to. The octal values are the same as for the chmod system command. +@@ -419,7 +419,7 @@ + # If you run the bot from the compilation directory, you will want to set + # this to "". If you use 'make install' (like all good kiddies do ;), this + # is a fine default. Otherwise, use your head :) +-set mod-path "modules/" ++set mod-path "/usr/lib/eggdrop/modules/" + + + #### DNS MODULE #### +@@ -1336,15 +1336,15 @@ + # + # source scripts/script.tcl + +-source scripts/alltools.tcl +-source scripts/action.fix.tcl ++source /usr/share/eggdrop/scripts/alltools.tcl ++source /usr/share/eggdrop/scripts/action.fix.tcl + + # Use this script for Tcl and Eggdrop backwards compatibility. + # NOTE: This can also cause problems with some newer scripts. +-#source scripts/compat.tcl ++#source /usr/share/eggdrop/scripts/compat.tcl + + # This script provides many useful informational functions, like setting + # users' URLs, e-mail address, ICQ numbers, etc. You can modify it to add + # extra entries. +-source scripts/userinfo.tcl ++source /usr/share/eggdrop/scripts/userinfo.tcl + loadhelp userinfo.help --- eggdrop-1.6.19.orig/debian/patches/01version.patch +++ eggdrop-1.6.19/debian/patches/01version.patch @@ -0,0 +1,11 @@ +--- src/main.c 2008-02-16 19:41:03.000000000 -0200 ++++ src/main.c.new 2008-05-30 16:39:19.000000000 -0300 +@@ -91,7 +91,7 @@ + */ + + char egg_version[1024] = "1.6.19"; +-int egg_numver = 1061800; ++int egg_numver = 1061900; + + char notify_new[121] = ""; /* Person to send a note to for new users */ + int default_flags = 0; /* Default user flags */