diff --git a/configure b/configure index 4935d86d..b5d115fa 100755 --- a/configure +++ b/configure @@ -1,14 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for charybdis 3.2.0. +# Generated by GNU Autoconf 2.64 for charybdis 3.3. # # $Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $ # -# # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software +# Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. @@ -528,8 +526,7 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -test -n "$DJDIR" || exec 7<&0 &1 +exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, @@ -551,8 +548,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='charybdis' PACKAGE_TARNAME='charybdis' -PACKAGE_VERSION='3.2.0' -PACKAGE_STRING='charybdis 3.2.0' +PACKAGE_VERSION='3.3' +PACKAGE_STRING='charybdis 3.3' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1265,7 +1262,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures charybdis 3.2.0 to adapt to many kinds of systems. +\`configure' configures charybdis 3.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1326,7 +1323,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of charybdis 3.2.0:";; + short | recursive ) echo "Configuration of charybdis 3.3:";; esac cat <<\_ACEOF @@ -1369,7 +1366,7 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor YACC The `Yet Another C Compiler' implementation to use. Defaults to @@ -1444,8 +1441,8 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -charybdis configure 3.2.0 -generated by GNU Autoconf 2.65 +charybdis configure 3.3 +generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1494,7 +1491,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval + return $ac_retval } # ac_fn_c_try_compile @@ -1531,7 +1528,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval + return $ac_retval } # ac_fn_c_try_cpp @@ -1660,7 +1657,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval + return $ac_retval } # ac_fn_c_try_run @@ -1737,7 +1734,7 @@ fi # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval + return $ac_retval } # ac_fn_c_try_link @@ -1969,7 +1966,7 @@ rm -f conftest.val fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval + return $ac_retval } # ac_fn_c_compute_int @@ -2043,8 +2040,8 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by charybdis $as_me 3.2.0, which was -generated by GNU Autoconf 2.65. Invocation command line was +It was created by charybdis $as_me 3.3, which was +generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -2297,7 +2294,7 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + if test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 @@ -2306,9 +2303,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in @@ -2718,30 +2715,32 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err fi - rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include int main () { +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -2803,10 +2802,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 @@ -2814,18 +2813,51 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" @@ -2858,72 +2890,13 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi -rm -f conftest conftest$ac_cv_exeext +rm -f conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : @@ -3972,8 +3945,8 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err fi - rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -9969,8 +9942,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by charybdis $as_me 3.2.0, which was -generated by GNU Autoconf 2.65. Invocation command line was +This file was extended by charybdis $as_me 3.3, which was +generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -10009,7 +9982,6 @@ Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -10029,11 +10001,10 @@ Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -charybdis config.status 3.2.0 -configured by $0, generated by GNU Autoconf 2.65, - with options \\"\$ac_cs_config\\" +charybdis config.status 3.3 +configured by $0, generated by GNU Autoconf 2.64, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation @@ -10069,8 +10040,6 @@ do ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) @@ -10260,7 +10229,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -10274,7 +10243,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p diff --git a/configure.ac b/configure.ac index 6daf3b7f..e32a0532 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ AC_PREREQ(2.57) dnl Sneaky way to get an Id tag into the configure script AC_COPYRIGHT([$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $]) -AC_INIT([charybdis],[3.2.0]) +AC_INIT([charybdis],[3.3]) AC_CONFIG_HEADER(include/setup.h) diff --git a/include/logger.h b/include/logger.h index 6efa0ca4..c7f7a6e5 100644 --- a/include/logger.h +++ b/include/logger.h @@ -61,7 +61,7 @@ extern void inotice(const char *fmt, ...) AFP(1, 2); extern void iwarn(const char *fmt, ...) AFP(1, 2); extern void ierror(const char *fmt, ...) AFP(1, 2); extern void report_operspy(struct Client *, const char *, const char *); -extern const char *smalldate(void); +extern const char *smalldate(time_t); extern void ilog_error(const char *); #endif diff --git a/include/numeric.h b/include/numeric.h index 92dc560f..16059b7d 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -349,6 +349,9 @@ extern const char *form_str(int); #define RPL_NOTESTLINE 726 #define RPL_TESTMASKGECOS 727 +#define RPL_QUIETLIST 728 +#define RPL_ENDOFQUIETLIST 729 + #define RPL_MONONLINE 730 #define RPL_MONOFFLINE 731 #define RPL_MONLIST 732 diff --git a/include/s_conf.h b/include/s_conf.h index 3f9d167b..949e4763 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -67,6 +67,7 @@ struct ConfItem char *user; /* user part of user@host */ int port; time_t hold; /* Hold action until this time (calendar time) */ + time_t created; /* Creation time (for klines etc) */ char *className; /* Name of class */ struct Class *c_class; /* Class of connection */ rb_patricia_node_t *pnode; /* Our patricia node */ @@ -324,6 +325,7 @@ extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr extern char *show_iline_prefix(struct Client *, struct ConfItem *, char *); extern void get_printable_conf(struct ConfItem *, char **, char **, char **, char **, int *, char **); +extern char *get_user_ban_reason(struct ConfItem *aconf); extern void get_printable_kline(struct Client *, struct ConfItem *, char **, char **, char **, char **); diff --git a/modules/m_dline.c b/modules/m_dline.c index 5ac171b7..912091c2 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -213,8 +213,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * { struct ConfItem *aconf; char *oper_reason; - char dlbuffer[IRCD_BUFSIZE]; - const char *current_date; struct rb_sockaddr_storage daddr; int t = AF_INET, ty, b; const char *creason; @@ -285,11 +283,12 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * } rb_set_time(); - current_date = smalldate(); aconf = make_conf(); aconf->status = CONF_DLINE; + aconf->created = rb_current_time(); aconf->host = rb_strdup(dlhost); + aconf->passwd = rb_strdup(reason); /* Look for an oper reason */ if((oper_reason = strchr(reason, '|')) != NULL) @@ -303,10 +302,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * if(tdline_time > 0) { - rb_snprintf(dlbuffer, sizeof(dlbuffer), - "Temporary D-line %d min. - %s (%s)", - (int) (tdline_time / 60), reason, current_date); - aconf->passwd = rb_strdup(dlbuffer); aconf->hold = rb_current_time() + tdline_time; add_temp_dline(aconf); @@ -335,8 +330,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * } else { - rb_snprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date); - aconf->passwd = rb_strdup(dlbuffer); add_conf_by_address(aconf->host, CONF_DLINE, NULL, NULL, aconf); bandb_add(BANDB_DLINE, source_p, aconf->host, NULL, diff --git a/modules/m_kline.c b/modules/m_kline.c index 44012edc..18dbdca7 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.c @@ -75,9 +75,9 @@ static int valid_wild_card(struct Client *source_p, const char *user, const char static void handle_remote_kline(struct Client *source_p, int tkline_time, const char *user, const char *host, const char *reason); static void apply_kline(struct Client *source_p, struct ConfItem *aconf, - const char *reason, const char *oper_reason, const char *current_date); + const char *reason, const char *oper_reason); static void apply_tkline(struct Client *source_p, struct ConfItem *aconf, - const char *, const char *, const char *, int); + const char *, const char *, int); static int already_placed_kline(struct Client *, const char *, const char *, int); static void handle_remote_unkline(struct Client *source_p, const char *user, const char *host); @@ -98,10 +98,8 @@ mo_kline(struct Client *client_p, struct Client *source_p, int parc, const char char def[] = "No Reason"; char user[USERLEN + 2]; char host[HOSTLEN + 2]; - char buffer[IRCD_BUFSIZE]; char *reason = def; char *oper_reason; - const char *current_date; const char *target_server = NULL; struct ConfItem *aconf; int tkline_time = 0; @@ -169,12 +167,13 @@ mo_kline(struct Client *client_p, struct Client *source_p, int parc, const char return 0; rb_set_time(); - current_date = smalldate(); aconf = make_conf(); aconf->status = CONF_KILL; + aconf->created = rb_current_time(); aconf->host = rb_strdup(host); aconf->user = rb_strdup(user); aconf->port = 0; + aconf->passwd = rb_strdup(reason); /* Look for an oper reason */ if((oper_reason = strchr(reason, '|')) != NULL) @@ -187,19 +186,9 @@ mo_kline(struct Client *client_p, struct Client *source_p, int parc, const char } if(tkline_time > 0) - { - rb_snprintf(buffer, sizeof(buffer), - "Temporary K-line %d min. - %s (%s)", - (int) (tkline_time / 60), reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_tkline(source_p, aconf, reason, oper_reason, current_date, tkline_time); - } + apply_tkline(source_p, aconf, reason, oper_reason, tkline_time); else - { - rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_kline(source_p, aconf, reason, oper_reason, current_date); - } + apply_kline(source_p, aconf, reason, oper_reason); if(ConfigFileEntry.kline_delay) { @@ -264,8 +253,6 @@ static void handle_remote_kline(struct Client *source_p, int tkline_time, const char *user, const char *host, const char *kreason) { - char buffer[BUFSIZE]; - const char *current_date; char *reason = LOCAL_COPY(kreason); struct ConfItem *aconf = NULL; char *oper_reason; @@ -285,8 +272,10 @@ handle_remote_kline(struct Client *source_p, int tkline_time, aconf = make_conf(); aconf->status = CONF_KILL; + aconf->created = rb_current_time(); aconf->user = rb_strdup(user); aconf->host = rb_strdup(host); + aconf->passwd = rb_strdup(reason); /* Look for an oper reason */ if((oper_reason = strchr(reason, '|')) != NULL) @@ -298,22 +287,10 @@ handle_remote_kline(struct Client *source_p, int tkline_time, aconf->spasswd = rb_strdup(oper_reason); } - current_date = smalldate(); - if(tkline_time > 0) - { - rb_snprintf(buffer, sizeof(buffer), - "Temporary K-line %d min. - %s (%s)", - (int) (tkline_time / 60), reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_tkline(source_p, aconf, reason, oper_reason, current_date, tkline_time); - } + apply_tkline(source_p, aconf, reason, oper_reason, tkline_time); else - { - rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_kline(source_p, aconf, reason, oper_reason, current_date); - } + apply_kline(source_p, aconf, reason, oper_reason); if(ConfigFileEntry.kline_delay) { @@ -480,7 +457,7 @@ handle_remote_unkline(struct Client *source_p, const char *user, const char *hos */ static void apply_kline(struct Client *source_p, struct ConfItem *aconf, - const char *reason, const char *oper_reason, const char *current_date) + const char *reason, const char *oper_reason) { add_conf_by_address(aconf->host, CONF_KILL, aconf->user, NULL, aconf); bandb_add(BANDB_KLINE, source_p, aconf->user, aconf->host, @@ -517,7 +494,7 @@ apply_kline(struct Client *source_p, struct ConfItem *aconf, */ static void apply_tkline(struct Client *source_p, struct ConfItem *aconf, - const char *reason, const char *oper_reason, const char *current_date, int tkline_time) + const char *reason, const char *oper_reason, int tkline_time) { aconf->hold = rb_current_time() + tkline_time; add_temp_kline(aconf); diff --git a/modules/m_resv.c b/modules/m_resv.c index 21de7f3d..16db1015 100644 --- a/modules/m_resv.c +++ b/modules/m_resv.c @@ -218,6 +218,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te aconf = make_conf(); aconf->status = CONF_RESV_CHANNEL; aconf->port = 0; + aconf->created = rb_current_time(); aconf->host = rb_strdup(name); aconf->passwd = rb_strdup(reason); add_to_resv_hash(aconf->host, aconf); @@ -281,6 +282,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te aconf = make_conf(); aconf->status = CONF_RESV_NICK; aconf->port = 0; + aconf->created = rb_current_time(); aconf->host = rb_strdup(name); aconf->passwd = rb_strdup(reason); rb_dlinkAddAlloc(aconf, &resv_conf_list); diff --git a/modules/m_xline.c b/modules/m_xline.c index 1ff86558..deb441f1 100644 --- a/modules/m_xline.c +++ b/modules/m_xline.c @@ -275,6 +275,7 @@ apply_xline(struct Client *source_p, const char *name, const char *reason, int t aconf = make_conf(); aconf->status = CONF_XLINE; + aconf->created = rb_current_time(); aconf->host = rb_strdup(name); aconf->passwd = rb_strdup(reason); collapse(aconf->host); diff --git a/src/chmode.c b/src/chmode.c index 9d67ed25..c9069f38 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -687,8 +687,8 @@ chm_ban(struct Client *source_p, struct Channel *chptr, case CHFL_QUIET: list = &chptr->quietlist; errorval = SM_ERR_RPL_Q; - rpl_list = RPL_BANLIST; - rpl_endlist = RPL_ENDOFBANLIST; + rpl_list = RPL_QUIETLIST; + rpl_endlist = RPL_ENDOFQUIETLIST; mems = ALL_MEMBERS; caps = 0; break; @@ -723,10 +723,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr, me.name, source_p->name, chptr->chname, banptr->banstr, banptr->who, banptr->when); } - if (mode_type == CHFL_QUIET) - sendto_one(source_p, ":%s %d %s %s :End of Channel Quiet List", me.name, rpl_endlist, source_p->name, chptr->chname); - else - sendto_one(source_p, form_str(rpl_endlist), me.name, source_p->name, chptr->chname); + sendto_one(source_p, form_str(rpl_endlist), me.name, source_p->name, chptr->chname); return; } diff --git a/src/client.c b/src/client.c index b3f33c3f..144e3288 100644 --- a/src/client.c +++ b/src/client.c @@ -418,10 +418,10 @@ notify_banned_client(struct Client *client_p, struct ConfItem *aconf, int ban) const char *reason = NULL; const char *exit_reason = conn_closed; - if(ConfigFileEntry.kline_with_reason && !EmptyString(aconf->passwd)) + if(ConfigFileEntry.kline_with_reason) { - reason = aconf->passwd; - exit_reason = aconf->passwd; + reason = get_user_ban_reason(aconf); + exit_reason = reason; } else { diff --git a/src/listener.c b/src/listener.c index 489aee7e..3b8a1fbc 100644 --- a/src/listener.c +++ b/src/listener.c @@ -480,6 +480,7 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi char buf[BUFSIZE]; struct ConfItem *aconf; static time_t last_oper_notice = 0; + int len; if(listener->ssl && (!ssl_ok || !get_ssld_count())) { @@ -519,7 +520,8 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi if(ConfigFileEntry.dline_with_reason) { - if (rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (int)(sizeof(buf)-1)) + len = rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf)); + if (len >= (int)(sizeof(buf)-1)) { buf[sizeof(buf) - 3] = '\r'; buf[sizeof(buf) - 2] = '\n'; diff --git a/src/logger.c b/src/logger.c index 53cd72be..bb3f0a64 100644 --- a/src/logger.c +++ b/src/logger.c @@ -180,7 +180,8 @@ ilog(ilogfile dest, const char *format, ...) rb_vsnprintf(buf, sizeof(buf), format, args); va_end(args); - rb_snprintf(buf2, sizeof(buf2), "%s %s\n", smalldate(), buf); + rb_snprintf(buf2, sizeof(buf2), "%s %s\n", + smalldate(rb_current_time()), buf); if(fputs(buf2, logfile) < 0) { @@ -266,11 +267,10 @@ report_operspy(struct Client *source_p, const char *token, const char *arg) } const char * -smalldate(void) +smalldate(time_t ltime) { static char buf[MAX_DATE_STRING]; struct tm *lt; - time_t ltime = rb_current_time(); lt = localtime(<ime); diff --git a/src/messages.tab b/src/messages.tab index e87ce9ca..fe95da81 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -749,8 +749,8 @@ static const char * replies[] = { /* 725 RPL_TESTLINE */ ":%s 725 %s %c %ld %s :%s", /* 726 RPL_NOTESTLINE */ ":%s 726 %s %s :No matches", /* 727 RPL_TESTMASKGECOS */ ":%s 727 %s %d %d %s!%s@%s %s :Local/remote clients match", -/* 728 */ NULL, -/* 729 */ NULL, +/* 728 RPL_QUIETLIST */ ":%s 728 %s %s q %s %s %lu", +/* 729 RPL_ENDOFQUIETLIST */ ":%s 729 %s %s q :End of Channel Quiet List", /* 730 RPL_MONONLINE */ ":%s 730 %s :%s", /* 731 RPL_MONOFFLINE */ ":%s 731 %s :%s", /* 732 RPL_MONLIST */ ":%s 732 %s :%s", @@ -761,8 +761,8 @@ static const char * replies[] = { /* 737 */ NULL, /* 738 */ NULL, /* 739 */ NULL, -/* 740 */ ":%s 740 %s :%s", -/* 741 */ ":%s 741 %s :End of CHALLENGE", +/* 740 RPL_RSACHALLENGE2*/ ":%s 740 %s :%s", +/* 741 RPL_ENDOFRSACHALLENGE2*/ ":%s 741 %s :End of CHALLENGE", /* 742 */ NULL, /* 743 */ NULL, /* 744 */ NULL, diff --git a/src/s_conf.c b/src/s_conf.c index 74eecc5b..9531e835 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -374,11 +374,10 @@ verify_access(struct Client *client_p, const char *username) else if(aconf->status & CONF_KILL) { if(ConfigFileEntry.kline_with_reason) - { sendto_one(client_p, form_str(ERR_YOUREBANNEDCREEP), - me.name, client_p->name, aconf->passwd); - } + me.name, client_p->name, + get_user_ban_reason(aconf)); add_reject(client_p, aconf->user, aconf->host); return (BANNED_CLIENT); } @@ -1055,6 +1054,33 @@ get_printable_conf(struct ConfItem *aconf, char **name, char **host, *port = (int) aconf->port; } +char * +get_user_ban_reason(struct ConfItem *aconf) +{ + static char reasonbuf[BUFSIZE]; + + if (aconf->flags & CONF_FLAGS_TEMPORARY && + (aconf->status == CONF_KILL || aconf->status == CONF_DLINE)) + rb_snprintf(reasonbuf, sizeof reasonbuf, + "Temporary %c-line %d min. - ", + aconf->status == CONF_DLINE ? 'D' : 'K', + (aconf->hold - aconf->created) / 60); + else + reasonbuf[0] = '\0'; + if (aconf->passwd) + rb_strlcat(reasonbuf, aconf->passwd, sizeof reasonbuf); + else + rb_strlcat(reasonbuf, "No Reason", sizeof reasonbuf); + if (aconf->created) + { + rb_strlcat(reasonbuf, " (", sizeof reasonbuf); + rb_strlcat(reasonbuf, smalldate(aconf->created), + sizeof reasonbuf); + rb_strlcat(reasonbuf, ")", sizeof reasonbuf); + } + return reasonbuf; +} + void get_printable_kline(struct Client *source_p, struct ConfItem *aconf, char **host, char **reason, @@ -1063,8 +1089,8 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf, static char null[] = ""; *host = EmptyString(aconf->host) ? null : aconf->host; - *reason = EmptyString(aconf->passwd) ? null : aconf->passwd; *user = EmptyString(aconf->user) ? null : aconf->user; + *reason = get_user_ban_reason(aconf); if(EmptyString(aconf->spasswd) || !IsOper(source_p)) *oper_reason = NULL;