Compare commits

..

38 Commits

Author SHA1 Message Date
Sam Dodrill 78f7194d41 tools/migrate-7: die if conflicting options 2015-02-21 15:29:57 -08:00
Sam Dodrill 23c50b1903 tools/migrate-7: use CC0
Thanks @nyuszika7h for pointing out how broken the global legal system
is for this to be an issue :( In a perfect world this commit wouldn't
need to exist. I wish this was that world.
2015-02-21 08:39:28 -08:00
Sam Dodrill bb119101bc Add gitignore 2015-02-21 08:39:06 -08:00
Sam Dodrill 4c62183317 tools: add skeleton to migrate-7 2015-02-21 08:36:18 -08:00
Sam Dodrill a5cfb65445 Fix linking with Atheme 2015-02-21 08:21:50 -08:00
Sam Dodrill 1393f6394e src/s_serv: don't require KNOCK 2015-02-21 08:21:50 -08:00
Sam Dodrill e09eade337 Make Atheme use new QAOHV capab 2015-02-21 08:21:50 -08:00
Sam Dodrill 1da821dcde Deny linking with non-qaohv servers
Also make the captab look pretty
2015-02-21 08:21:50 -08:00
Sam Dodrill 49790bbac5 testsuite/docker: leave leaf2 at older elemental
This will mean that leaf2 will be an incompatible server to test how the
change affects uneven servers.
2015-02-21 08:21:50 -08:00
Sam Dodrill fbfca84c1c Add container configs for testing qaohv mode 2015-02-21 08:21:50 -08:00
Sam Dodrill 04ad084e5e Update protocol modules 2015-02-21 08:21:50 -08:00
Sam Dodrill 09a8287d97 src/supported: fix admin mode being "&" now 2015-02-21 08:21:50 -08:00
Sam Dodrill 39f9e19cb6 Move quiet to +y
[BREAKING CHANGE]
2015-02-21 08:21:50 -08:00
Sam Dodrill 83cf65e493 Move admin char to "&"
[BREAKING CHANGE]

Still uses "!" in extensions/m_ojoin to allow forced joins to server
local channels.
2015-02-21 08:21:50 -08:00
Sam Dodrill a5a0b3e8d8 Replace owner mode as +q
[BREAKING CHANGE]

Currently this will not work reliably as quiet mode is not updated.
2015-02-21 08:21:50 -08:00
Sam Dodrill 76441b9232 Update version number, mark devel daemon as such 2015-02-21 08:21:50 -08:00
Sam Dodrill 417a320324 Remove m_olist
Operspy support for /list exists. Use that.
2015-02-21 08:18:47 -08:00
Sam Dodrill e1657f04ec addset -x for #travis op sinthetix 2015-02-21 08:18:47 -08:00
Sam Dodrill daac54878c modules/core/m_message: fix build 2015-02-21 08:18:16 -08:00
Sam Dodrill e7f3a5ad93 modules/core/m_message: don't apply local policy remotely
Closes #33
2015-02-21 08:18:16 -08:00
Sam Dodrill 9c83aac397 Add ability to disable channel mode +u
Closes #43
2015-02-21 08:18:16 -08:00
Sam Dodrill 0c372c65fc disable IRC notifications again 2015-02-21 08:17:04 -08:00
Sam Dodrill 8cff086fc5 Remove git history from docker builds 2015-02-20 23:21:28 -08:00
Sam Dodrill 48a3589d5e Merge branch 'master' of github.com:Elemental-IRCd/elemental-ircd 2015-02-20 23:21:07 -08:00
Sam Dodrill 7c4267175b ycm extra conf: fix paths for headers 2015-02-20 22:41:53 -08:00
Sam Dodrill aa4ebff4a5 Add YouCompleteMe semantic completion support 2015-02-20 22:41:42 -08:00
Sam Dodrill a3e2e47b86 Merge pull request #47 from Elemental-IRCd/doc/contributing/revision-2015-02-20
Update contributing guidelines
2015-02-20 11:14:42 -08:00
Sam Dodrill 88cd0168ad Merge branch 'testsuite-astyle-fixes'
Conflicts:
	.travis.yml

Closes #48
2015-02-20 11:12:46 -08:00
Sam Dodrill 874ca05045 Revert "remove IRC notifications from travis"
This reverts commit 0361eeeedf.
2015-02-20 00:35:50 -08:00
Sam Dodrill 2c0ee6900c Add travis tests for astyle 2015-02-20 00:33:55 -08:00
Sam Dodrill 9b969de641 testsuite/astyle: Add script to check coding style 2015-02-20 00:31:20 -08:00
Sam Dodrill cc0c8d338d Update contributing guidelines 2015-02-20 00:11:51 -08:00
Sam Dodrill 0361eeeedf remove IRC notifications fron travis 2015-02-16 00:52:59 -08:00
Sam Dodrill a6eb07553e Merge pull request #40 from Elemental-IRCd/fix/39/deprecated-entries-example-config
Remove deprecated settings from example configs

Thanks @YodaNetwork for finding this!
2015-02-16 00:51:49 -08:00
Sam Dodrill 62a511ab7b Remove deprecated settings from example configs
Ref #39
Ref #38
2015-02-16 00:48:32 -08:00
Sam Dodrill 3e6d026b38 Merge pull request #37 from Elemental-IRCd/staging/6.6.2
Staging/6.6.2
2014-12-16 08:26:52 -08:00
Sam Dodrill 100324f5c9 Elemental-ircd 6.6.2 2014-12-16 08:26:32 -08:00
Sam Dodrill 771cc10e92 Fix ban list add logic 2014-12-16 08:24:50 -08:00
109 changed files with 5336 additions and 541 deletions

1
.dockerignore Symbolic link
View File

@ -0,0 +1 @@
.gitignore

2
.gitignore vendored
View File

@ -40,3 +40,5 @@ tools/mkpasswd
tools/viconf tools/viconf
include/serno.h include/serno.h
libratbox/src/version.c.last libratbox/src/version.c.last
*.pyc
.git

View File

@ -5,8 +5,5 @@ compiler:
before-install: before-install:
- sudo apt-get update - sudo apt-get update
install: install:
- sudo apt-get install build-essential libssl-dev flex bison - sudo apt-get install build-essential libssl-dev flex bison astyle
script: "./configure && make" script: "(cd ./testsuite/astyle && ./check_style.sh) && ./configure && make"
notifications:
irc: "irc.yolo-swag.com#elemental-ircd"

118
.ycm_extra_conf.py Normal file
View File

@ -0,0 +1,118 @@
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-g',
'-g',
'-Iinclude',
'-Ilibratbox/include',
]
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
# NOTE: This is just for YouCompleteMe; it's highly likely that your project
# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
# ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
try:
final_flags.remove( '-stdlib=libc++' )
except ValueError:
pass
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}

View File

@ -1,20 +1,43 @@
# Contribution guidelines # Contribution guidelines
Please open contributions as either issue reports or pull requests. We will ask Please open contributions as either issue reports or pull requests. We will ask
that anything that requires testing outside our normally supported platforms be that anything that requires testing outside our normally supported platforms be
marked as such. marked as such.
As ircd is such an ancient project with varying code styles, please try to Style
follow the current coding style of the file you are in. If all else fails, -----
please use the [Linux Kernel](https://www.kernel.org/doc/Documentation/CodingStyle)
coding style.
Please run all code against the following `astyle` command before sending in Please run all code against the following `astyle` command before sending in
a pull request: a pull request:
```console ```console
$ astyle --style=linux --mode=c -n $file $ astyle --style=linux --mode=c -n $file
``` ```
It should be trivial to set up your text editor to do this for you. It should be trivial to set up your text editor to do this for you. If you use
vim, add this to your vim configuration:
```vimscript
" Lvimrc
" if .lvimrc exists in current or parent directory of the currently loaded file,
" load it as config
if filereadable('../.lvimrc')
source ../.lvimrc
endif
if filereadable('./.lvimrc')
source ./.lvimrc
endif
```
Otherwise please make sure the appropriate command is ran as part of your
editing process before you send a pull request. All pull requests that do not
follow the coding style will not be considered until they follow the coding
style.
Testing
-------
When testing Elemental, please be sure to test it on a network of at least
3 instances of elemental. Please also be sure to have one of these instances
run **without** the patch you are testing, to be able to show that there is
a difference.

4
NEWS
View File

@ -1,6 +1,10 @@
This is elemental-ircd 6.6.1, Copyright (c) 2014 elemental-ircd team. This is elemental-ircd 6.6.1, Copyright (c) 2014 elemental-ircd team.
See LICENSE for licensing details (GPL v2). See LICENSE for licensing details (GPL v2).
-- elemental-ircd 6.6.2
Fix ban logic
-- elemental-ircd 6.6.1 -- elemental-ircd 6.6.1
All code is now in the linux kernel coding style. Patches that do not All code is now in the linux kernel coding style. Patches that do not

View File

@ -1,5 +1,13 @@
# Elemental-IRCd # Elemental-IRCd
IMPORTANT
---------
This branch is **NOT PRODUCTION READY**, **WILL BREAK THINGS** and **SHOULD NOT
BE USED IF STABILITY OR PREDICTABLE BEHAVIOR IS AT ALL DESIRED**.
---
**Elemental-IRCd** is a high performance, lightweight, and scalable **Elemental-IRCd** is a high performance, lightweight, and scalable
IRC daemon. It is a fork of the now-defunct ShadowIRCD and seeks to continue in IRC daemon. It is a fork of the now-defunct ShadowIRCD and seeks to continue in
the direction ShadowIRCD was headed. the direction ShadowIRCD was headed.

View File

@ -152,11 +152,11 @@ list_bans(void)
for(j = 0; j < table.row_count; j++) { for(j = 0; j < table.row_count; j++) {
if(i == BANDB_KLINE) if(i == BANDB_KLINE)
snprintf(buf, sizeof(buf), "%c %s %s %s :%s", rb_snprintf(buf, sizeof(buf), "%c %s %s %s :%s",
bandb_letter[i], table.row[j][0], bandb_letter[i], table.row[j][0],
table.row[j][1], table.row[j][2], table.row[j][3]); table.row[j][1], table.row[j][2], table.row[j][3]);
else else
snprintf(buf, sizeof(buf), "%c %s %s :%s", rb_snprintf(buf, sizeof(buf), "%c %s %s :%s",
bandb_letter[i], table.row[j][0], bandb_letter[i], table.row[j][0],
table.row[j][2], table.row[j][3]); table.row[j][2], table.row[j][3]);
@ -277,7 +277,7 @@ static void
db_error_cb(const char *errstr) db_error_cb(const char *errstr)
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "! :%s", errstr); rb_snprintf(buf, sizeof(buf), "! :%s", errstr);
rb_helper_write(bandb_helper, buf); rb_helper_write(bandb_helper, buf);
rb_sleep(2 << 30, 0); rb_sleep(2 << 30, 0);
exit(1); exit(1);

View File

@ -226,7 +226,7 @@ main(int argc, char *argv[])
/* checking for our files to import or export */ /* checking for our files to import or export */
for(i = 0; i < LAST_BANDB_TYPE; i++) { for(i = 0; i < LAST_BANDB_TYPE; i++) {
snprintf(conf, sizeof(conf), "%s/%s.conf%s", rb_snprintf(conf, sizeof(conf), "%s/%s.conf%s",
etc, bandb_table[i], bandb_suffix[i]); etc, bandb_table[i], bandb_suffix[i]);
if(flag.import && flag.pretend == NO) if(flag.import && flag.pretend == NO)
@ -286,11 +286,11 @@ export_config(const char *conf, int id)
return; return;
if(strstr(conf, ".perm") != 0) if(strstr(conf, ".perm") != 0)
snprintf(sql, sizeof(sql), rb_snprintf(sql, sizeof(sql),
"SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 1 ORDER BY time", "SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 1 ORDER BY time",
bandb_table[id]); bandb_table[id]);
else else
snprintf(sql, sizeof(sql), rb_snprintf(sql, sizeof(sql),
"SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 0 ORDER BY time", "SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 0 ORDER BY time",
bandb_table[id]); bandb_table[id]);
@ -315,7 +315,7 @@ export_config(const char *conf, int id)
switch (id) { switch (id) {
case BANDB_DLINE: case BANDB_DLINE:
case BANDB_DLINE_PERM: case BANDB_DLINE_PERM:
snprintf(buf, sizeof(buf), rb_snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n", "\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask1],
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -325,7 +325,7 @@ export_config(const char *conf, int id)
case BANDB_XLINE: case BANDB_XLINE:
case BANDB_XLINE_PERM: case BANDB_XLINE_PERM:
snprintf(buf, sizeof(buf), rb_snprintf(buf, sizeof(buf),
"\"%s\",\"0\",\"%s\",\"%s\",%s\n", "\"%s\",\"0\",\"%s\",\"%s\",%s\n",
escape_quotes(table.row[j][mask1]), escape_quotes(table.row[j][mask1]),
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -334,7 +334,7 @@ export_config(const char *conf, int id)
case BANDB_RESV: case BANDB_RESV:
case BANDB_RESV_PERM: case BANDB_RESV_PERM:
snprintf(buf, sizeof(buf), rb_snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",%s\n", "\"%s\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask1],
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -343,7 +343,7 @@ export_config(const char *conf, int id)
default: /* Klines */ default: /* Klines */
snprintf(buf, sizeof(buf), rb_snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n", "\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask2], table.row[j][mask1], table.row[j][mask2],
mangle_reason(table.row[j][reason]), mangle_reason(table.row[j][reason]),
@ -476,9 +476,9 @@ import_config(const char *conf, int id)
/* append operreason_field to reason_field */ /* append operreason_field to reason_field */
if(!EmptyString(f_oreason)) if(!EmptyString(f_oreason))
snprintf(newreason, sizeof(newreason), "%s | %s", f_reason, f_oreason); rb_snprintf(newreason, sizeof(newreason), "%s | %s", f_reason, f_oreason);
else else
snprintf(newreason, sizeof(newreason), "%s", f_reason); rb_snprintf(newreason, sizeof(newreason), "%s", f_reason);
if(flag.pretend == NO) { if(flag.pretend == NO) {
if(flag.dupes_ok == NO) if(flag.dupes_ok == NO)
@ -811,7 +811,7 @@ bt_smalldate(const char *string)
lt = gmtime(&t); lt = gmtime(&t);
if(lt == NULL) if(lt == NULL)
return NULL; return NULL;
snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d", rb_snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d",
lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min); lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min);
return buf; return buf;
} }

View File

@ -45,7 +45,7 @@ mlog(const char *errstr, ...)
char buf[256]; char buf[256];
va_list ap; va_list ap;
va_start(ap, errstr); va_start(ap, errstr);
vsnprintf(buf, sizeof(buf), errstr, ap); rb_vsnprintf(buf, sizeof(buf), errstr, ap);
va_end(ap); va_end(ap);
error_cb(buf); error_cb(buf);
} else } else
@ -69,13 +69,13 @@ rsdb_init(rsdb_error_cb * ecb)
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath)); rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) { if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) {
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s", rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
sqlite3_errmsg(rb_bandb)); sqlite3_errmsg(rb_bandb));
mlog(errbuf); mlog(errbuf);
return -1; return -1;
} }
if(access(dbpath, W_OK)) { if(access(dbpath, W_OK)) {
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno)); rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
mlog(errbuf); mlog(errbuf);
return -1; return -1;
} }

18
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for elemental-ircd 6.6.1. # Generated by GNU Autoconf 2.69 for elemental-ircd 7.0-qaohv.
# #
# 2014 elemental-ircd Team # 2014 elemental-ircd Team
# #
@ -579,8 +579,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='elemental-ircd' PACKAGE_NAME='elemental-ircd'
PACKAGE_TARNAME='elemental-ircd' PACKAGE_TARNAME='elemental-ircd'
PACKAGE_VERSION='6.6.1' PACKAGE_VERSION='7.0-qaohv'
PACKAGE_STRING='elemental-ircd 6.6.1' PACKAGE_STRING='elemental-ircd 7.0-qaohv'
PACKAGE_BUGREPORT='' PACKAGE_BUGREPORT=''
PACKAGE_URL='' PACKAGE_URL=''
@ -1303,7 +1303,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # 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. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures elemental-ircd 6.6.1 to adapt to many kinds of systems. \`configure' configures elemental-ircd 7.0-qaohv to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1364,7 +1364,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of elemental-ircd 6.6.1:";; short | recursive ) echo "Configuration of elemental-ircd 7.0-qaohv:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1488,7 +1488,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
elemental-ircd configure 6.6.1 elemental-ircd configure 7.0-qaohv
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -2092,7 +2092,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by elemental-ircd $as_me 6.6.1, which was It was created by elemental-ircd $as_me 7.0-qaohv, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -10100,7 +10100,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by elemental-ircd $as_me 6.6.1, which was This file was extended by elemental-ircd $as_me 7.0-qaohv, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -10166,7 +10166,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
elemental-ircd config.status 6.6.1 elemental-ircd config.status 7.0-qaohv
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -10,7 +10,7 @@ AC_PREREQ(2.57)
dnl Sneaky way to get an Id tag into the configure script dnl Sneaky way to get an Id tag into the configure script
AC_COPYRIGHT([2014 elemental-ircd Team]) AC_COPYRIGHT([2014 elemental-ircd Team])
AC_INIT([elemental-ircd],[6.6.1]) AC_INIT([elemental-ircd],[7.0-qaohv])
AC_CONFIG_HEADER(include/setup.h) AC_CONFIG_HEADER(include/setup.h)

View File

@ -57,13 +57,6 @@ serverinfo {
helpurl = "http://www.mynet.net/help"; helpurl = "http://www.mynet.net/help";
hub = yes; hub = yes;
/* On multi-homed hosts you may need the following. These define
* the addresses we connect from to other servers. */
/* for IPv4 */
#vhost = "192.169.0.1";
/* for IPv6 */
#vhost6 = "3ffe:80e8:546::2";
/* ssl_private_key: our ssl private key */ /* ssl_private_key: our ssl private key */
ssl_private_key = "etc/ssl.key"; ssl_private_key = "etc/ssl.key";

View File

@ -159,16 +159,6 @@ serverinfo {
*/ */
hub = no; hub = no;
/* vhost: the IP to bind to when we connect outward to ipv4 servers.
* This should be an ipv4 IP only.
*/
#vhost = "192.169.0.1";
/* vhost6: the IP to bind to when we connect outward to ipv6 servers.
* This should be an ipv6 IP only.
*/
#vhost6 = "3ffe:80e8:546::2";
/* ssl_private_key: our ssl private key */ /* ssl_private_key: our ssl private key */
ssl_private_key = "etc/ssl.key"; ssl_private_key = "etc/ssl.key";

View File

@ -155,16 +155,6 @@ serverinfo {
*/ */
hub = no; hub = no;
/* vhost: the IP to bind to when we connect outward to ipv4 servers.
* This should be an ipv4 IP only.
*/
#vhost = "192.169.0.1";
/* vhost6: the IP to bind to when we connect outward to ipv6 servers.
* This should be an ipv6 IP only.
*/
#vhost6 = "3ffe:80e8:546::2";
/* ssl_private_key: our ssl private key */ /* ssl_private_key: our ssl private key */
ssl_private_key = "etc/ssl.key"; ssl_private_key = "etc/ssl.key";

View File

@ -67,7 +67,6 @@ SRCS = \
m_mkpasswd.c \ m_mkpasswd.c \
m_oaccept.c \ m_oaccept.c \
m_ojoin.c \ m_ojoin.c \
m_olist.c \
m_okick.c \ m_okick.c \
m_omode.c \ m_omode.c \
m_opme.c \ m_opme.c \

View File

@ -41,13 +41,13 @@ static int eb_extended(const char *data, struct Client *client_p,
if (data == NULL) if (data == NULL)
return EXTBAN_INVALID; return EXTBAN_INVALID;
snprintf(buf, BUFSIZE, "%s!%s@%s#%s", rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->host, client_p->info); client_p->name, client_p->username, client_p->host, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) { if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) {
snprintf(buf, BUFSIZE, "%s!%s@%s#%s", rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->orighost, client_p->info); client_p->name, client_p->username, client_p->orighost, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;

View File

@ -36,7 +36,7 @@ mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const cha
return 0; return 0;
} }
snprintf(text, sizeof(text), "O%s", source_p->id); rb_snprintf(text, sizeof(text), "O%s", source_p->id);
/* Provide a nice error message if you try to OACCEPT someone /* Provide a nice error message if you try to OACCEPT someone
* who you've already OACCEPTed. */ * who you've already OACCEPTed. */

View File

@ -101,7 +101,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s", sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name, source_p->name,
source_p->username, source_p->host, chptr->chname); source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s", sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +q %s",
me.name, chptr->chname, source_p->name); me.name, chptr->chname, source_p->name);
} else if(*parv[1] == '!' && ConfigChannel.use_admin) { } else if(*parv[1] == '!' && ConfigChannel.use_admin) {
add_user_to_channel(chptr, source_p, CHFL_ADMIN); add_user_to_channel(chptr, source_p, CHFL_ADMIN);

View File

@ -132,7 +132,7 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment); ":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
remove_user_from_channel(msptr); remove_user_from_channel(msptr);
snprintf(text, sizeof(text), "K%s", who->id); rb_snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */ /* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN) if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

View File

@ -1,149 +0,0 @@
/*
* ircd-ratbox: A slightly useful ircd.
* m_olist.c: List channels. olist is an oper only command
* that shows channels regardless of modes. This
* is kinda evil, and might be morally wrong, but
* somebody will likely need it.
*
* Copyright (C) 2002 by the past and present ircd coders, and others.
* Copyright (C) 2004 ircd-ratbox 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
*
*/
#include "stdinc.h"
#include "channel.h"
#include "client.h"
#include "ircd.h"
#include "numeric.h"
#include "logger.h"
#include "s_serv.h"
#include "send.h"
#include "whowas.h"
#include "match.h"
#include "hash.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
#include "s_newconf.h"
static int mo_olist(struct Client *, struct Client *, int parc, const char *parv[]);
#ifndef STATIC_MODULES
struct Message olist_msgtab = {
"OLIST", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_olist, 1}}
};
mapi_clist_av1 olist_clist[] = { &olist_msgtab, NULL };
DECLARE_MODULE_AV1(okick, NULL, NULL, olist_clist, NULL, NULL, "$Revision: 6 $");
#endif
static void list_all_channels(struct Client *source_p);
static void list_named_channel(struct Client *source_p, const char *name);
/*
** mo_olist
** parv[1] = channel
*/
static int
mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsOperSpy(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "oper_spy");
sendto_one(source_p, form_str(RPL_LISTEND),
me.name, source_p->name);
return 0;
}
/* If no arg, do all channels *whee*, else just one channel */
if(parc < 2 || EmptyString(parv[1]))
list_all_channels(source_p);
else
list_named_channel(source_p, parv[1]);
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
return 0;
}
/*
* list_all_channels
* inputs - pointer to client requesting list
* output - 0/1
* side effects - list all channels to source_p
*/
static void
list_all_channels(struct Client *source_p)
{
struct Channel *chptr;
rb_dlink_node *ptr;
report_operspy(source_p, "LIST", NULL);
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
RB_DLINK_FOREACH(ptr, global_channel_list.head) {
chptr = ptr->data;
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s",
me.name, source_p->name, chptr->chname,
rb_dlink_list_length(&chptr->members),
channel_modes(chptr, &me),
chptr->topic == NULL ? "" : chptr->topic);
}
return;
}
/*
* list_named_channel
* inputs - pointer to client requesting list
* output - 0/1
* side effects - list all channels to source_p
*/
static void
list_named_channel(struct Client *source_p, const char *name)
{
struct Channel *chptr;
char *p;
char *n = LOCAL_COPY(name);
if((p = strchr(n, ',')))
*p = '\0';
/* Put operspy notice before any output, but only if channel exists */
chptr = EmptyString(n) ? NULL : find_channel(n);
if(chptr != NULL)
report_operspy(source_p, "LIST", chptr->chname);
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
if(EmptyString(n))
return;
if(chptr == NULL)
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), n);
else
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s", me.name, source_p->name,
chptr->chname, rb_dlink_list_length(&chptr->members),
channel_modes(chptr, &me), chptr->topic ? chptr->topic : "");
}

View File

@ -118,17 +118,17 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
set_channel_mode(client_p, source_p->servptr, chptr, msptr, set_channel_mode(client_p, source_p->servptr, chptr, msptr,
parc - 2, parv + 2); parc - 2, parv + 2);
#else #else
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name)) { if (parc == 4 && !strcmp(parv[2], "+q") && !irccmp(parv[3], source_p->name)) {
/* Ownering themselves */ /* Ownering themselves */
if (!wasonchannel) { if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname); form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0; return 0;
} }
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s", sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +q %s",
me.name, parv[1], source_p->name); me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS, sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +y %s", ":%s TMODE %ld %s +q %s",
me.id, (long) chptr->channelts, parv[1], me.id, (long) chptr->channelts, parv[1],
source_p->id); source_p->id);
msptr->flags |= CHFL_OWNER; msptr->flags |= CHFL_OWNER;

View File

@ -172,9 +172,9 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
} }
if(underline) if(underline)
snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3)); rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
else else
snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3)); rb_snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
/* don't allow nicks to be empty after stripping /* don't allow nicks to be empty after stripping
* this prevents nastiness like fake factions, etc. */ * this prevents nastiness like fake factions, etc. */
@ -184,9 +184,9 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
} }
if(action) if(action)
snprintf(text2, sizeof(text2), "\1ACTION %s\1", text); rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
else else
snprintf(text2, sizeof(text2), "%s", text); rb_snprintf(text2, sizeof(text2), "%s", text);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", nick2, source_p->name, channel, text2, source_p->name); sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", nick2, source_p->name, channel, text2, source_p->name);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s", sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",

View File

@ -18,7 +18,7 @@
IRCDVar myIrcd[] = { IRCDVar myIrcd[] = {
{ {
"Elemental-IRCd 6.5", /* ircd name */ "Elemental-IRCd 7.0", /* ircd name */
"+oiS", /* nickserv mode */ "+oiS", /* nickserv mode */
"+oiS", /* chanserv mode */ "+oiS", /* chanserv mode */
"+oiS", /* memoserv mode */ "+oiS", /* memoserv mode */
@ -44,8 +44,8 @@ IRCDVar myIrcd[] = {
1, /* SVSNICK */ 1, /* SVSNICK */
1, /* Vhost */ 1, /* Vhost */
1, /* Has Owner */ 1, /* Has Owner */
"+y", /* Mode to set for an owner */ "+q", /* Mode to set for an owner */
"-y", /* Mode to unset for an owner */ "-q", /* Mode to unset for an owner */
"+a", /* Mode to set for chan admin */ "+a", /* Mode to set for chan admin */
"-a", /* Mode to unset for chan admin */ "-a", /* Mode to unset for chan admin */
NULL, /* Mode On Reg */ NULL, /* Mode On Reg */
@ -443,7 +443,7 @@ CUMode myCumodes[128] = {
{0}, /* n */ {0}, /* n */
{CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op},
{0}, /* p */ {0}, /* p */
{0}, /* q */ {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, /* q */
{0}, /* r */ {0}, /* r */
{0}, /* s */ {0}, /* s */
{0}, /* t */ {0}, /* t */
@ -451,7 +451,7 @@ CUMode myCumodes[128] = {
{CUS_VOICE, 0, NULL}, {CUS_VOICE, 0, NULL},
{0}, /* w */ {0}, /* w */
{0}, /* x */ {0}, /* x */
{CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, /* y */ {0}, /* y */
{0}, /* z */ {0}, /* z */
{0}, {0}, {0}, {0}, {0} {0}, {0}, {0}, {0}, {0}
}; };

View File

@ -301,8 +301,8 @@ class ProtoElemental : public Module
{ {
ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1)); ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '!', 3)); ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&', 3));
ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'y', '~', 4)); ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '~', 4));
/* Add user modes */ /* Add user modes */
ModeManager::AddUserMode(new UserMode("NOFORWARD", 'Q')); ModeManager::AddUserMode(new UserMode("NOFORWARD", 'Q'));
@ -311,7 +311,7 @@ class ProtoElemental : public Module
ModeManager::AddUserMode(new UserModeNoone("SSL", 'Z')); ModeManager::AddUserMode(new UserModeNoone("SSL", 'Z'));
/* b/e/I */ /* b/e/I */
ModeManager::AddChannelMode(new ChannelModeList("QUIET", 'q')); ModeManager::AddChannelMode(new ChannelModeList("QUIET", 'y'));
/* Add channel modes */ /* Add channel modes */
ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c')); ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));

View File

@ -14,12 +14,12 @@
#include "pmodule.h" #include "pmodule.h"
#include "protocol/shadowircd.h" #include "protocol/shadowircd.h"
DECLARE_MODULE_V1("protocol/elemental-ircd", true, _modinit, NULL, PACKAGE_STRING, "PonyChat Development Group <http://www.ponychat.net>"); DECLARE_MODULE_V1("protocol/elemental-ircd", true, _modinit, NULL, PACKAGE_STRING, "Elemental-IRCd Development Team http://github.com/elemental-ircd/elemental-ircd");
/* *INDENT-OFF* */ /* *INDENT-OFF* */
ircd_t elemental_ircd = { ircd_t elemental_ircd = {
"elemental-ircd", /* IRCd name */ "Elemental-IRCd 7.0", /* IRCd name */
"$$", /* TLD Prefix, used by Global. */ "$$", /* TLD Prefix, used by Global. */
true, /* Whether or not we use IRCNet/TS6 UID */ true, /* Whether or not we use IRCNet/TS6 UID */
false, /* Whether or not we use RCOMMAND */ false, /* Whether or not we use RCOMMAND */
@ -32,13 +32,13 @@ ircd_t elemental_ircd = {
CSTATUS_OWNER, /* Integer flag for owner channel flag. */ CSTATUS_OWNER, /* Integer flag for owner channel flag. */
CSTATUS_PROTECT, /* Integer flag for protect channel flag. */ CSTATUS_PROTECT, /* Integer flag for protect channel flag. */
CSTATUS_HALFOP, /* Integer flag for halfops. */ CSTATUS_HALFOP, /* Integer flag for halfops. */
"+y", /* Mode we set for owner. */ "+q", /* Mode we set for owner. */
"+a", /* Mode we set for protect. */ "+a", /* Mode we set for protect. */
"+h", /* Mode we set for halfops. */ "+h", /* Mode we set for halfops. */
PROTOCOL_SHADOWIRCD, /* Protocol type */ PROTOCOL_SHADOWIRCD, /* Protocol type */
CMODE_PERM, /* Permanent cmodes */ CMODE_PERM, /* Permanent cmodes */
CMODE_IMMUNE, /* Oper-immune cmode */ CMODE_IMMUNE, /* Oper-immune cmode */
"beIq", /* Ban-like cmodes */ "beIy", /* Ban-like cmodes */
'e', /* Except mchar */ 'e', /* Except mchar */
'I', /* Invex mchar */ 'I', /* Invex mchar */
IRCD_CIDR_BANS | IRCD_HOLDNICK /* Flags */ IRCD_CIDR_BANS | IRCD_HOLDNICK /* Flags */
@ -75,7 +75,7 @@ struct cmode_ elemental_mode_list[] = {
}; };
struct cmode_ elemental_status_mode_list[] = { struct cmode_ elemental_status_mode_list[] = {
{ 'y', CSTATUS_OWNER }, { 'q', CSTATUS_OWNER },
{ 'a', CSTATUS_PROTECT }, { 'a', CSTATUS_PROTECT },
{ 'o', CSTATUS_OP }, { 'o', CSTATUS_OP },
{ 'h', CSTATUS_HALFOP }, { 'h', CSTATUS_HALFOP },
@ -85,7 +85,7 @@ struct cmode_ elemental_status_mode_list[] = {
struct cmode_ elemental_prefix_mode_list[] = { struct cmode_ elemental_prefix_mode_list[] = {
{ '~', CSTATUS_OWNER }, { '~', CSTATUS_OWNER },
{ '!', CSTATUS_PROTECT }, { '&', CSTATUS_PROTECT },
{ '@', CSTATUS_OP }, { '@', CSTATUS_OP },
{ '%', CSTATUS_HALFOP }, { '%', CSTATUS_HALFOP },
{ '+', CSTATUS_VOICE }, { '+', CSTATUS_VOICE },
@ -100,12 +100,38 @@ struct cmode_ elemental_user_mode_list[] = {
{ '\0', 0 } { '\0', 0 }
}; };
/* *INDENT-ON* */ /* login to our uplink */
static unsigned int elemental_server_login(void)
{
int ret = 1;
if (!me.numeric) {
ircd->uses_uid = false;
ret = sts("PASS %s :TS", curr_uplink->send_pass);
} else if (strlen(me.numeric) == 3 && isdigit((unsigned char)*me.numeric)) {
ircd->uses_uid = true;
ret = sts("PASS %s TS 6 :%s", curr_uplink->send_pass, me.numeric);
} else {
slog(LG_ERROR, "Invalid numeric (SID) %s", me.numeric);
}
if (ret == 1)
return 1;
me.bursting = true;
sts("CAPAB :QS EX IE KLN UNKLN ENCAP TB SERVICES EUID EOPMOD MLOCK QAOHV");
sts("SERVER %s 1 :%s%s", me.name, me.hidden ? "(H) " : "", me.desc);
sts("SVINFO %d 3 0 :%lu", ircd->uses_uid ? 6 : 5,
(unsigned long)CURRTIME);
return 0;
}
void _modinit(module_t * m) void _modinit(module_t * m)
{ {
MODULE_TRY_REQUEST_DEPENDENCY(m, "protocol/charybdis"); MODULE_TRY_REQUEST_DEPENDENCY(m, "protocol/charybdis");
server_login = &elemental_server_login;
mode_list = elemental_mode_list; mode_list = elemental_mode_list;
user_mode_list = elemental_user_mode_list; user_mode_list = elemental_user_mode_list;
status_mode_list = elemental_status_mode_list; status_mode_list = elemental_status_mode_list;

View File

@ -72,13 +72,14 @@ struct Capability {
#define CAP_EOPMOD 0x100000 /* supports EOPMOD (ext +z + ext topic) */ #define CAP_EOPMOD 0x100000 /* supports EOPMOD (ext +z + ext topic) */
#define CAP_BAN 0x200000 /* supports propagated bans */ #define CAP_BAN 0x200000 /* supports propagated bans */
#define CAP_MLOCK 0x400000 /* supports MLOCK messages */ #define CAP_MLOCK 0x400000 /* supports MLOCK messages */
#define CAP_QAOHV 0x800000 /* uses +q for owner and +y for quiet */
#define CAP_MASK (CAP_QS | CAP_EX | CAP_CHW | \ #define CAP_MASK (CAP_QS | CAP_EX | CAP_CHW | \
CAP_IE | CAP_KLN | CAP_SERVICE |\ CAP_IE | CAP_KLN | CAP_SERVICE |\
CAP_CLUSTER | CAP_ENCAP | \ CAP_CLUSTER | CAP_ENCAP | \
CAP_ZIP | CAP_KNOCK | CAP_UNKLN | \ CAP_ZIP | CAP_KNOCK | CAP_UNKLN | \
CAP_RSFNC | CAP_SAVE | CAP_EUID | CAP_EOPMOD | \ CAP_RSFNC | CAP_SAVE | CAP_EUID | CAP_EOPMOD | \
CAP_BAN | CAP_MLOCK) CAP_BAN | CAP_MLOCK | CAP_QAOHV)
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
#define CAP_ZIP_SUPPORTED CAP_ZIP #define CAP_ZIP_SUPPORTED CAP_ZIP

View File

@ -38,9 +38,26 @@
/* /*
* rb_sprintf - optimized sprintf * rb_sprintf - optimized sprintf
*/ */
int sprintf_append(char *str, const char *format, ...); #ifdef __GNUC__
int snprintf_append(char *str, const size_t size, const char *, ...); int
int vsnprintf_append(char *str, const size_t size, const char *fmt, va_list args); rb_sprintf(char *str, const char *fmt, ...)
int vsprintf_append(char *str, const char *fmt, va_list args); __attribute((format(printf, 2, 3)));
int rb_snprintf(char *str, const size_t size, const char *, ...)
__attribute__ ((format(printf, 3, 4)));
int rb_sprintf_append(char *str, const char *format, ...) __attribute((format(printf, 2, 3)));
int rb_snprintf_append(char *str, size_t len, const char *format, ...)
__attribute__ ((format(printf, 3, 4)));
#else
int rb_sprintf(char *str, const char *format, ...);
int rb_snprintf(char *str, const size_t size, const char *, ...);
int rb_sprintf_append(char *str, const char *format, ...);
int rb_snprintf_append(char *str, const size_t size, const char *, ...);
#endif
int rb_vsnprintf(char *str, const size_t size, const char *fmt, va_list args);
int rb_vsprintf(char *str, const char *fmt, va_list args);
int rb_vsnprintf_append(char *str, const size_t size, const char *fmt, va_list args);
int rb_vsprintf_append(char *str, const char *fmt, va_list args);
#endif /* SPRINTF_IRC */ #endif /* SPRINTF_IRC */

View File

@ -1134,7 +1134,7 @@ inetntoa(const char *in)
* SOFTWARE. * SOFTWARE.
*/ */
#define SPRINTF(x) ((size_t)sprintf x) #define SPRINTF(x) ((size_t)rb_sprintf x)
/* /*
* WARNING: Don't even consider trying to compile this on a system where * WARNING: Don't even consider trying to compile this on a system where
@ -1513,7 +1513,7 @@ rb_inet_pton(int af, const char *src, void *dst)
/* Somebody might have passed as an IPv4 address this is sick but it works */ /* Somebody might have passed as an IPv4 address this is sick but it works */
if(inet_pton4(src, dst)) { if(inet_pton4(src, dst)) {
char tmp[HOSTIPLEN]; char tmp[HOSTIPLEN];
sprintf(tmp, "::ffff:%s", src); rb_sprintf(tmp, "::ffff:%s", src);
return (inet_pton6(tmp, dst)); return (inet_pton6(tmp, dst));
} else } else
return (inet_pton6(src, dst)); return (inet_pton6(src, dst));

View File

@ -454,7 +454,7 @@ rb_epoll_sched_event_timerfd(struct ev_entry *event, int when)
close(fd); close(fd);
return 0; return 0;
} }
snprintf(buf, sizeof(buf), "timerfd: %s", event->name); rb_snprintf(buf, sizeof(buf), "timerfd: %s", event->name);
F = rb_open(fd, RB_FD_UNKNOWN, buf); F = rb_open(fd, RB_FD_UNKNOWN, buf);
rb_set_nb(F); rb_set_nb(F);
event->comm_ptr = F; event->comm_ptr = F;

View File

@ -272,7 +272,7 @@ rb_dump_events(void (*func) (char *, void *), void *ptr)
struct ev_entry *ev; struct ev_entry *ev;
len = sizeof(buf); len = sizeof(buf);
snprintf(buf, len, "Last event to run: %s", last_event_ran); rb_snprintf(buf, len, "Last event to run: %s", last_event_ran);
func(buf, ptr); func(buf, ptr);
rb_strlcpy(buf, "Operation Next Execution", len); rb_strlcpy(buf, "Operation Next Execution", len);
@ -280,7 +280,7 @@ rb_dump_events(void (*func) (char *, void *), void *ptr)
RB_DLINK_FOREACH(dptr, event_list.head) { RB_DLINK_FOREACH(dptr, event_list.head) {
ev = dptr->data; ev = dptr->data;
snprintf(buf, len, "%-28s %-4ld seconds", ev->name, rb_snprintf(buf, len, "%-28s %-4ld seconds", ev->name,
ev->when - (long)rb_current_time()); ev->when - (long)rb_current_time());
func(buf, ptr); func(buf, ptr);
} }

View File

@ -529,7 +529,7 @@ rb_supports_ssl(void)
void void
rb_get_ssl_info(char *buf, size_t len) rb_get_ssl_info(char *buf, size_t len)
{ {
snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)", rb_snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)",
LIBGNUTLS_VERSION, gnutls_check_version(NULL)); LIBGNUTLS_VERSION, gnutls_check_version(NULL));
} }

View File

@ -116,19 +116,19 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb,
helper = rb_malloc(sizeof(rb_helper)); helper = rb_malloc(sizeof(rb_helper));
snprintf(buf, sizeof(buf), "%s helper - read", name); rb_snprintf(buf, sizeof(buf), "%s helper - read", name);
if(rb_pipe(&in_f[0], &in_f[1], buf) < 0) { if(rb_pipe(&in_f[0], &in_f[1], buf) < 0) {
rb_free(helper); rb_free(helper);
return NULL; return NULL;
} }
snprintf(buf, sizeof(buf), "%s helper - write", name); rb_snprintf(buf, sizeof(buf), "%s helper - write", name);
if(rb_pipe(&out_f[0], &out_f[1], buf) < 0) { if(rb_pipe(&out_f[0], &out_f[1], buf) < 0) {
rb_free(helper); rb_free(helper);
return NULL; return NULL;
} }
snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1])); rb_snprintf(fx, sizeof(fx), "%d", rb_get_fd(in_f[1]));
snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0])); rb_snprintf(fy, sizeof(fy), "%d", rb_get_fd(out_f[0]));
rb_set_nb(in_f[0]); rb_set_nb(in_f[0]);
rb_set_nb(in_f[1]); rb_set_nb(in_f[1]);
@ -139,7 +139,7 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb,
rb_setenv("OFD", fx, 1); rb_setenv("OFD", fx, 1);
rb_setenv("MAXFD", "256", 1); rb_setenv("MAXFD", "256", 1);
snprintf(buf, sizeof(buf), "-ircd %s daemon", name); rb_snprintf(buf, sizeof(buf), "-ircd %s daemon", name);
parv[0] = buf; parv[0] = buf;
parv[1] = NULL; parv[1] = NULL;

View File

@ -506,12 +506,12 @@ rb_linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args,
if(prefixfmt != NULL) { if(prefixfmt != NULL) {
va_start(prefix_args, prefixfmt); va_start(prefix_args, prefixfmt);
len = vsnprintf(bufline->buf, BUF_DATA_SIZE, prefixfmt, prefix_args); len = rb_vsnprintf(bufline->buf, BUF_DATA_SIZE, prefixfmt, prefix_args);
va_end(prefix_args); va_end(prefix_args);
} }
if(va_args != NULL) { if(va_args != NULL) {
len += vsnprintf((bufline->buf + len), (BUF_DATA_SIZE - len), format, *va_args); len += rb_vsnprintf((bufline->buf + len), (BUF_DATA_SIZE - len), format, *va_args);
} }
bufline->terminated = 1; bufline->terminated = 1;
@ -608,7 +608,7 @@ rb_linebuf_put(buf_head_t * bufhead, const char *format, ...)
if(rb_unlikely(format != NULL)) { if(rb_unlikely(format != NULL)) {
va_start(args, format); va_start(args, format);
len = vsnprintf(bufline->buf, BUF_DATA_SIZE, format, args); len = rb_vsnprintf(bufline->buf, BUF_DATA_SIZE, format, args);
va_end(args); va_end(args);
} }

View File

@ -170,7 +170,7 @@ rb_ssl_clear_handshake_count(rb_fde_t *F)
void void
rb_get_ssl_info(char *buf, size_t len) rb_get_ssl_info(char *buf, size_t len)
{ {
snprintf(buf, len, "Not compiled with SSL support"); rb_snprintf(buf, len, "Not compiled with SSL support");
} }
#endif /* !HAVE_OPENSSL */ #endif /* !HAVE_OPENSSL */

View File

@ -622,7 +622,7 @@ rb_supports_ssl(void)
void void
rb_get_ssl_info(char *buf, size_t len) rb_get_ssl_info(char *buf, size_t len)
{ {
snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx", rb_snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx",
SSLeay_version(SSLEAY_VERSION), SSLeay_version(SSLEAY_VERSION),
(long)OPENSSL_VERSION_NUMBER, SSLeay()); (long)OPENSSL_VERSION_NUMBER, SSLeay());
} }

View File

@ -74,7 +74,7 @@ prefix_toa2x(rb_prefix_t *prefix, char *buf, int buf_len, int with_len)
} }
inet_ntop(prefix->family, &prefix->add.sin, buf, buf_len); inet_ntop(prefix->family, &prefix->add.sin, buf, buf_len);
if(with_len) { if(with_len) {
snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen); rb_snprintf(tmp, sizeof(tmp), "/%d", prefix->bitlen);
strcat(buf, tmp); strcat(buf, tmp);
} }
return (buf); return (buf);

View File

@ -82,7 +82,7 @@ rb_ctime(const time_t t, char *buf, size_t len)
return (p); return (p);
} }
snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d", rb_snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d",
s_weekdays[tp->tm_wday], s_month[tp->tm_mon], s_weekdays[tp->tm_wday], s_month[tp->tm_mon],
tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_year + 1900); tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_year + 1900);
return (p); return (p);
@ -106,7 +106,7 @@ rb_date(const time_t t, char *buf, size_t len)
return (buf); return (buf);
} }
snprintf(buf, len, "%s %s %d %d -- %02u:%02u:%02u +00:00", rb_snprintf(buf, len, "%s %s %d %d -- %02u:%02u:%02u +00:00",
weekdays[gm->tm_wday], months[gm->tm_mon], gm->tm_mday, weekdays[gm->tm_wday], months[gm->tm_mon], gm->tm_mday,
gm->tm_year + 1900, gm->tm_hour, gm->tm_min, gm->tm_sec); gm->tm_year + 1900, gm->tm_hour, gm->tm_min, gm->tm_sec);
return (buf); return (buf);
@ -131,7 +131,7 @@ rb_lib_log(const char *format, ...)
if(rb_log == NULL) if(rb_log == NULL)
return; return;
va_start(args, format); va_start(args, format);
vsnprintf(errbuf, sizeof(errbuf), format, args); rb_vsnprintf(errbuf, sizeof(errbuf), format, args);
va_end(args); va_end(args);
rb_log(errbuf); rb_log(errbuf);
} }
@ -143,7 +143,7 @@ rb_lib_die(const char *format, ...)
if(rb_die == NULL) if(rb_die == NULL)
abort(); abort();
va_start(args, format); va_start(args, format);
vsnprintf(errbuf, sizeof(errbuf), format, args); rb_vsnprintf(errbuf, sizeof(errbuf), format, args);
va_end(args); va_end(args);
rb_die(errbuf); rb_die(errbuf);
} }
@ -155,7 +155,7 @@ rb_lib_restart(const char *format, ...)
if(rb_restart == NULL) if(rb_restart == NULL)
abort(); abort();
va_start(args, format); va_start(args, format);
vsnprintf(errbuf, sizeof(errbuf), format, args); rb_vsnprintf(errbuf, sizeof(errbuf), format, args);
va_end(args); va_end(args);
rb_restart(errbuf); rb_restart(errbuf);
} }
@ -184,7 +184,7 @@ rb_lib_version(void)
static char version_info[512]; static char version_info[512];
char ssl_info[512]; char ssl_info[512];
rb_get_ssl_info(ssl_info, sizeof(ssl_info)); rb_get_ssl_info(ssl_info, sizeof(ssl_info));
snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info); rb_snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info);
return version_info; return version_info;
} }

View File

@ -26,43 +26,606 @@
#include <libratbox_config.h> #include <libratbox_config.h>
#include <ratbox_lib.h> #include <ratbox_lib.h>
#include <string.h> static int
skip_atoi(const char **s)
/*
* vsprintf_append()
* appends sprintf formatted string to the end of the buffer
*/
int
vsprintf_append(char *str, const char *format, va_list ap)
{ {
size_t x = strlen(str); int i = 0;
return (vsprintf(str + x, format, ap) + x);
while(isdigit(**s))
i = i * 10 + *((*s)++) - '0';
return i;
}
/* Decimal conversion is by far the most typical, and is used
* for /proc and /sys data. This directly impacts e.g. top performance
* with many processes running. We optimize it for speed
* using code from
* http://www.cs.uiowa.edu/~jones/bcd/decimal.html
* (with permission from the author, Douglas W. Jones). */
/* Formats correctly any integer in [0,99999].
* Outputs from one to five digits depending on input.
* On i386 gcc 4.1.2 -O2: ~250 bytes of code. */
static char *
put_dec_trunc(char *buf, unsigned q)
{
unsigned d3, d2, d1, d0;
d1 = (q >> 4) & 0xf;
d2 = (q >> 8) & 0xf;
d3 = (q >> 12);
d0 = 6 * (d3 + d2 + d1) + (q & 0xf);
q = (d0 * 0xcd) >> 11;
d0 = d0 - 10 * q;
*buf++ = d0 + '0'; /* least significant digit */
d1 = q + 9 * d3 + 5 * d2 + d1;
if(d1 != 0) {
q = (d1 * 0xcd) >> 11;
d1 = d1 - 10 * q;
*buf++ = d1 + '0'; /* next digit */
d2 = q + 2 * d2;
if((d2 != 0) || (d3 != 0)) {
q = (d2 * 0xd) >> 7;
d2 = d2 - 10 * q;
*buf++ = d2 + '0'; /* next digit */
d3 = q + 4 * d3;
if(d3 != 0) {
q = (d3 * 0xcd) >> 11;
d3 = d3 - 10 * q;
*buf++ = d3 + '0'; /* next digit */
if(q != 0)
*buf++ = q + '0'; /* most sign. digit */
}
}
}
return buf;
}
/* Same with if's removed. Always emits five digits */
static char *
put_dec_full(char *buf, unsigned q)
{
/* BTW, if q is in [0,9999], 8-bit ints will be enough, */
/* but anyway, gcc produces better code with full-sized ints */
unsigned d3, d2, d1, d0;
d1 = (q >> 4) & 0xf;
d2 = (q >> 8) & 0xf;
d3 = (q >> 12);
/* Possible ways to approx. divide by 10 */
/* gcc -O2 replaces multiply with shifts and adds */
// (x * 0xcd) >> 11: 11001101 - shorter code than * 0x67 (on i386)
// (x * 0x67) >> 10: 1100111
// (x * 0x34) >> 9: 110100 - same
// (x * 0x1a) >> 8: 11010 - same
// (x * 0x0d) >> 7: 1101 - same, shortest code (on i386)
d0 = 6 * (d3 + d2 + d1) + (q & 0xf);
q = (d0 * 0xcd) >> 11;
d0 = d0 - 10 * q;
*buf++ = d0 + '0';
d1 = q + 9 * d3 + 5 * d2 + d1;
q = (d1 * 0xcd) >> 11;
d1 = d1 - 10 * q;
*buf++ = d1 + '0';
d2 = q + 2 * d2;
q = (d2 * 0xd) >> 7;
d2 = d2 - 10 * q;
*buf++ = d2 + '0';
d3 = q + 4 * d3;
q = (d3 * 0xcd) >> 11; /* - shorter code */
/* q = (d3 * 0x67) >> 10; - would also work */
d3 = d3 - 10 * q;
*buf++ = d3 + '0';
*buf++ = q + '0';
return buf;
}
static char *
put_dec(char *buf, unsigned long long int num)
{
while(1) {
unsigned rem;
if(num < 100000)
return put_dec_trunc(buf, num);
rem = num % 100000;
num = num / 100000;
buf = put_dec_full(buf, rem);
}
}
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed long */
#define PLUS 4 /* show plus */
#define SPACE 8 /* space if plus */
#define LEFT 16 /* left justified */
#define SPECIAL 32 /* 0x */
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
static size_t
number(char *const buf, const size_t size, size_t idx, unsigned long long int num, int base, int field_width, int precision,
int type)
{
char sign, tmp[66];
const char *digits;
/* we are called with base 8, 10 or 16, only, thus don't need "g..." */
static const char small_digits[] = "0123456789abcdefx"; /* "ghijklmnopqrstuvwxyz"; */
static const char large_digits[] = "0123456789ABCDEFX"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
int need_pfx = ((type & SPECIAL) && base != 10);
int i;
digits = (type & LARGE) ? large_digits : small_digits;
if(type & LEFT)
type &= ~ZEROPAD;
if(base < 2 || base > 36)
return idx;
sign = 0;
if(type & SIGN) {
if((signed long long int)num < 0) {
sign = '-';
num = -(signed long long int)num;
field_width--;
} else if(type & PLUS) {
sign = '+';
field_width--;
} else if(type & SPACE) {
sign = ' ';
field_width--;
}
}
if(need_pfx) {
field_width--;
if(base == 16)
field_width--;
}
/* generate full string in tmp[], in reverse order */
i = 0;
if(num == 0)
tmp[i++] = '0';
/* Generic code, for any base:
else do {
tmp[i++] = digits[do_div(num,base)];
} while (num != 0);
*/
else if(base != 10) {
/* 8 or 16 */
int mask = base - 1;
int shift = 3;
if(base == 16)
shift = 4;
do {
tmp[i++] = digits[((unsigned char)num) & mask];
num >>= shift;
} while(num);
} else {
/* base 10 */
i = put_dec(tmp, num) - tmp;
}
/* printing 100 using %2d gives "100", not "00" */
if(i > precision)
precision = i;
/* leading space padding */
field_width -= precision;
if(!(type & (ZEROPAD + LEFT))) {
while(--field_width >= 0) {
if(idx < size)
buf[idx] = ' ';
++idx;
}
}
/* sign */
if(sign) {
if(idx < size)
buf[idx] = sign;
++idx;
}
/* "0x" / "0" prefix */
if(need_pfx) {
if(idx < size)
buf[idx] = '0';
++idx;
if(base == 16) {
if(idx < size)
buf[idx] = digits[16]; /* for arbitrary base: digits[33]; */
++idx;
}
}
/* zero or space padding */
if(!(type & LEFT)) {
char c = (type & ZEROPAD) ? '0' : ' ';
while(--field_width >= 0) {
if(idx < size)
buf[idx] = c;
++idx;
}
}
/* hmm even more zero padding? */
while(i <= --precision) {
if(idx < size)
buf[idx] = '0';
++idx;
}
/* actual digits of result */
while(--i >= 0) {
if(idx < size)
buf[idx] = tmp[i];
++idx;
}
/* trailing space padding */
while(--field_width >= 0) {
if(idx < size)
buf[idx] = ' ';
++idx;
}
return idx;
}
/**
* vsnprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
* @size: The size of the buffer, including the trailing null space
* @fmt: The format string to use
* @args: Arguments for the format string
*
* The return value is the number of characters which would
* be generated for the given input, excluding the trailing
* '\0', as per ISO C99. If you want to have the exact
* number of characters written into @buf as return value
* (not including the trailing '\0'), use vscnprintf(). If the
* return is greater than or equal to @size, the resulting
* string is truncated.
*
* Call this function if you are already dealing with a va_list.
* You probably want snprintf() instead.
*/
int
rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
{
int len;
unsigned long long int num;
int i, base;
char c;
size_t idx;
const char *s;
int flags; /* flags to number() */
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
int qualifier; /* 'h', 'l', or 'L' for integer fields */
/* 'z' support added 23/7/1999 S.H. */
/* 'z' changed to 'Z' --davidm 1/25/99 */
/* 't' added for ptrdiff_t */
/* Reject out-of-range values early. Large positive sizes are
used for unknown buffer sizes. */
if(rb_unlikely(size > INT_MAX)) {
return 0;
}
idx = 0;
for(; *fmt; ++fmt) {
if(*fmt != '%') {
if(idx < size)
buf[idx] = *fmt;
++idx;
continue;
}
/* process flags */
flags = 0;
repeat:
++fmt; /* this also skips first '%' */
switch (*fmt) {
case '-':
flags |= LEFT;
goto repeat;
case '+':
flags |= PLUS;
goto repeat;
case ' ':
flags |= SPACE;
goto repeat;
case '#':
flags |= SPECIAL;
goto repeat;
case '0':
flags |= ZEROPAD;
goto repeat;
}
/* get field width */
field_width = -1;
if(isdigit(*fmt))
field_width = skip_atoi(&fmt);
else if(*fmt == '*') {
++fmt;
/* it's the next argument */
field_width = va_arg(args, int);
if(field_width < 0) {
field_width = -field_width;
flags |= LEFT;
}
}
/* get the precision */
precision = -1;
if(*fmt == '.') {
++fmt;
if(isdigit(*fmt))
precision = skip_atoi(&fmt);
else if(*fmt == '*') {
++fmt;
/* it's the next argument */
precision = va_arg(args, int);
}
if(precision < 0)
precision = 0;
}
/* get the conversion qualifier */
qualifier = -1;
if(*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
*fmt == 'Z' || *fmt == 'z' || *fmt == 't') {
qualifier = *fmt;
++fmt;
if(qualifier == 'l' && *fmt == 'l') {
qualifier = 'L';
++fmt;
}
}
/* default base */
base = 10;
switch (*fmt) {
case 'c':
if(!(flags & LEFT)) {
while(--field_width > 0) {
if(idx < size)
buf[idx] = ' ';
++idx;
}
}
c = (unsigned char)va_arg(args, int);
if(idx < size)
buf[idx] = c;
++idx;
while(--field_width > 0) {
if(idx < size)
buf[idx] = ' ';
++idx;
}
continue;
case 's':
s = va_arg(args, char *);
if(s == NULL) {
abort(); /* prefer blowing up vs corrupt data */
}
len = rb_strnlen(s, precision);
if(!(flags & LEFT)) {
while(len < field_width--) {
if(idx < size)
buf[idx] = ' ';
++idx;
}
}
for(i = 0; i < len; ++i) {
if(idx < size)
buf[idx] = *s;
++idx;
++s;
}
while(len < field_width--) {
if(idx < size)
buf[idx] = ' ';
++idx;
}
continue;
case 'p':
if(field_width == -1) {
field_width = 2 * sizeof(void *);
flags |= ZEROPAD;
}
idx = number(buf, size, idx,
(unsigned long)va_arg(args, void *),
16, field_width, precision, flags);
continue;
case 'n':
/* FIXME:
* What does C99 say about the overflow case here? */
if(qualifier == 'l') {
long *ip = va_arg(args, long *);
*ip = idx;
} else if(qualifier == 'Z' || qualifier == 'z') {
size_t *ip = va_arg(args, size_t *);
*ip = idx;
} else {
int *ip = va_arg(args, int *);
*ip = idx;
}
continue;
case '%':
if(idx < size)
buf[idx] = '%';
++idx;
continue;
/* integer number formats - set up the flags and "break" */
case 'o':
base = 8;
break;
case 'X':
flags |= LARGE;
case 'x':
base = 16;
break;
case 'd':
case 'i':
flags |= SIGN;
case 'u':
break;
default:
if(idx < size)
buf[idx] = '%';
++idx;
if(*fmt) {
if(idx < size)
buf[idx] = *fmt;
++idx;
} else {
--fmt;
}
continue;
}
if(qualifier == 'L')
num = va_arg(args, long long int);
else if(qualifier == 'l') {
num = va_arg(args, unsigned long);
if(flags & SIGN)
num = (signed long)num;
} else if(qualifier == 'Z' || qualifier == 'z') {
num = va_arg(args, size_t);
} else if(qualifier == 't') {
num = va_arg(args, ptrdiff_t);
} else if(qualifier == 'h') {
num = (unsigned short)va_arg(args, int);
if(flags & SIGN)
num = (signed short)num;
} else {
num = va_arg(args, unsigned int);
if(flags & SIGN)
num = (signed int)num;
}
idx = number(buf, size, idx, num, base, field_width, precision, flags);
}
if(size > 0) {
if(idx < size)
buf[idx] = '\0';
else
buf[size - 1] = '\0';
}
/* the trailing null byte doesn't count towards the total */
return idx;
}
/**
* snprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
* @size: The size of the buffer, including the trailing null space
* @fmt: The format string to use
* @...: Arguments for the format string
*
* The return value is the number of characters which would be
* generated for the given input, excluding the trailing null,
* as per ISO C99. If the return is greater than or equal to
* @size, the resulting string is truncated.
*/
int
rb_snprintf(char *buf, size_t size, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i = rb_vsnprintf(buf, size, fmt, args);
va_end(args);
return i;
}
/**
* vsprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
* @fmt: The format string to use
* @args: Arguments for the format string
*
* The function returns the number of characters written
* into @buf. Use vsnprintf() or vscnprintf() in order to avoid
* buffer overflows.
*
* Call this function if you are already dealing with a va_list.
* You probably want sprintf() instead.
*/
int
rb_vsprintf(char *buf, const char *fmt, va_list args)
{
return rb_vsnprintf(buf, INT_MAX, fmt, args);
}
/**
* sprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
* @fmt: The format string to use
* @...: Arguments for the format string
*
* The function returns the number of characters written
* into @buf. Use snprintf() or scnprintf() in order to avoid
* buffer overflows.
*/
int
rb_sprintf(char *buf, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i = rb_vsnprintf(buf, INT_MAX, fmt, args);
va_end(args);
return i;
} }
/* /*
* sprintf_append() * rb_vsprintf_append()
* appends sprintf formatted string to the end of the buffer
*/
int
rb_vsprintf_append(char *str, const char *format, va_list ap)
{
size_t x = strlen(str);
return (rb_vsprintf(str + x, format, ap) + x);
}
/*
* rb_sprintf_append()
* appends sprintf formatted string to the end of the buffer * appends sprintf formatted string to the end of the buffer
*/ */
int int
sprintf_append(char *str, const char *format, ...) rb_sprintf_append(char *str, const char *format, ...)
{ {
int x; int x;
va_list ap; va_list ap;
va_start(ap, format); va_start(ap, format);
x = vsprintf_append(str, format, ap); x = rb_vsprintf_append(str, format, ap);
va_end(ap); va_end(ap);
return (x); return (x);
} }
/* /*
* vsnprintf_append() * rb_vsnprintf_append()
* appends sprintf formatted string to the end of the buffer but not * appends sprintf formatted string to the end of the buffer but not
* exceeding len * exceeding len
*/ */
int int
vsnprintf_append(char *str, size_t len, const char *format, va_list ap) rb_vsnprintf_append(char *str, size_t len, const char *format, va_list ap)
{ {
size_t x; size_t x;
if(len == 0) if(len == 0)
@ -73,22 +636,22 @@ vsnprintf_append(char *str, size_t len, const char *format, va_list ap)
str[len - 1] = '\0'; str[len - 1] = '\0';
return len - 1; return len - 1;
} }
return (vsnprintf(str + x, len - x, format, ap) + x); return (rb_vsnprintf(str + x, len - x, format, ap) + x);
} }
/* /*
* snprintf_append() * rb_snprintf_append()
* appends snprintf formatted string to the end of the buffer but not * appends snprintf formatted string to the end of the buffer but not
* exceeding len * exceeding len
*/ */
int int
nprintf_append(char *str, size_t len, const char *format, ...) rb_snprintf_append(char *str, size_t len, const char *format, ...)
{ {
int x; int x;
va_list ap; va_list ap;
va_start(ap, format); va_start(ap, format);
x = vsnprintf_append(str, len, format, ap); x = rb_vsnprintf_append(str, len, format, ap);
va_end(ap); va_end(ap);
return (x); return (x);
} }

View File

@ -134,7 +134,7 @@ rb_setenv(const char *name, const char *value, int overwrite)
return -1; return -1;
len = strlen(name) + strlen(value) + 5; len = strlen(name) + strlen(value) + 5;
buf = rb_malloc(len); buf = rb_malloc(len);
snprintf(buf, len, "%s=%s", name, value); rb_snprintf(buf, len, "%s=%s", name, value);
len = putenv(buf); len = putenv(buf);
rb_free(buf); rb_free(buf);
return (len); return (len);

View File

@ -57,7 +57,7 @@ is_safe_error(const char *message)
if (!strncmp(message, "Closing Link: 127.0.0.1 (", 25)) if (!strncmp(message, "Closing Link: 127.0.0.1 (", 25))
return 1; return 1;
snprintf(prefix2, sizeof prefix2, rb_snprintf(prefix2, sizeof prefix2,
"Closing Link: 127.0.0.1 %s (", me.name); "Closing Link: 127.0.0.1 %s (", me.name);
if (!strncmp(message, prefix2, strlen(prefix2))) if (!strncmp(message, prefix2, strlen(prefix2)))
return 1; return 1;

View File

@ -494,7 +494,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
else else
modes = empty_modes; modes = empty_modes;
mlen_uid = sprintf(buf_uid, ":%s SJOIN %ld %s %s :", mlen_uid = rb_sprintf(buf_uid, ":%s SJOIN %ld %s %s :",
use_id(source_p), (long) chptr->channelts, parv[2], modes); use_id(source_p), (long) chptr->channelts, parv[2], modes);
ptr_uid = buf_uid + mlen_uid; ptr_uid = buf_uid + mlen_uid;
@ -521,7 +521,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
if(*s == '~') { if(*s == '~') {
fl |= CHFL_OWNER; fl |= CHFL_OWNER;
s++; s++;
} else if(*s == '!') { } else if(*s == '&') {
fl |= CHFL_ADMIN; fl |= CHFL_ADMIN;
s++; s++;
} else if(*s == '@') { } else if(*s == '@') {
@ -557,7 +557,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
len_nick++; len_nick++;
len_uid++; len_uid++;
} else if(fl & CHFL_ADMIN) { } else if(fl & CHFL_ADMIN) {
*ptr_uid++ = '!'; *ptr_uid++ = '&';
len_nick++; len_nick++;
len_uid++; len_uid++;
} }
@ -579,7 +579,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
} }
/* copy the nick to the two buffers */ /* copy the nick to the two buffers */
len = sprintf(ptr_uid, "%s ", use_id(target_p)); len = rb_sprintf(ptr_uid, "%s ", use_id(target_p));
ptr_uid += len; ptr_uid += len;
len_uid += len; len_uid += len;
@ -598,11 +598,11 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
* I would love to hear it - Taros */ * I would love to hear it - Taros */
if(fl & CHFL_OWNER) { if(fl & CHFL_OWNER) {
*mbuf++ = 'y'; *mbuf++ = 'q';
para[pargs++] = target_p->name; para[pargs++] = target_p->name;
if(fl & CHFL_ADMIN) { if(fl & CHFL_ADMIN) {
/* its possible the +y has filled up MAXMODEPARAMS, if so, start /* its possible the +q has filled up MAXMODEPARAMS, if so, start
* a new buffer * a new buffer
*/ */
if(pargs >= MAXMODEPARAMS) { if(pargs >= MAXMODEPARAMS) {
@ -622,7 +622,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
para[pargs++] = target_p->name; para[pargs++] = target_p->name;
} }
if(fl & CHFL_CHANOP) { if(fl & CHFL_CHANOP) {
/* its possible the +y has filled up MAXMODEPARAMS, if so, start /* its possible the +q has filled up MAXMODEPARAMS, if so, start
* a new buffer * a new buffer
*/ */
if(pargs >= MAXMODEPARAMS) { if(pargs >= MAXMODEPARAMS) {
@ -642,7 +642,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
para[pargs++] = target_p->name; para[pargs++] = target_p->name;
} }
if(fl & CHFL_HALFOP) { if(fl & CHFL_HALFOP) {
/* its possible the +y has filled up MAXMODEPARAMS, if so, start /* its possible the +q has filled up MAXMODEPARAMS, if so, start
* a new buffer * a new buffer
*/ */
if(pargs >= MAXMODEPARAMS) { if(pargs >= MAXMODEPARAMS) {
@ -662,7 +662,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
para[pargs++] = target_p->name; para[pargs++] = target_p->name;
} }
if(fl & CHFL_VOICE) { if(fl & CHFL_VOICE) {
/* its possible the +y has filled up MAXMODEPARAMS, if so, start /* its possible the +q has filled up MAXMODEPARAMS, if so, start
* a new buffer * a new buffer
*/ */
if(pargs >= MAXMODEPARAMS) { if(pargs >= MAXMODEPARAMS) {
@ -937,7 +937,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_DEL; dir = MODE_DEL;
} }
*mbuf++ = 'k'; *mbuf++ = 'k';
len = sprintf(pbuf, "%s ", oldmode->key); len = rb_sprintf(pbuf, "%s ", oldmode->key);
pbuf += len; pbuf += len;
} }
if(oldmode->join_num && !mode->join_num) { if(oldmode->join_num && !mode->join_num) {
@ -960,7 +960,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD; dir = MODE_ADD;
} }
*mbuf++ = 'l'; *mbuf++ = 'l';
len = sprintf(pbuf, "%d ", mode->limit); len = rb_sprintf(pbuf, "%d ", mode->limit);
pbuf += len; pbuf += len;
} }
if(mode->key[0] && strcmp(oldmode->key, mode->key)) { if(mode->key[0] && strcmp(oldmode->key, mode->key)) {
@ -969,7 +969,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD; dir = MODE_ADD;
} }
*mbuf++ = 'k'; *mbuf++ = 'k';
len = sprintf(pbuf, "%s ", mode->key); len = rb_sprintf(pbuf, "%s ", mode->key);
pbuf += len; pbuf += len;
} }
if(mode->join_num && (oldmode->join_num != mode->join_num || oldmode->join_time != mode->join_time)) { if(mode->join_num && (oldmode->join_num != mode->join_num || oldmode->join_time != mode->join_time)) {
@ -978,7 +978,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD; dir = MODE_ADD;
} }
*mbuf++ = 'j'; *mbuf++ = 'j';
len = sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time); len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
pbuf += len; pbuf += len;
} }
if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) && ConfigChannel.use_forward) { if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) && ConfigChannel.use_forward) {
@ -987,7 +987,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
dir = MODE_ADD; dir = MODE_ADD;
} }
*mbuf++ = 'f'; *mbuf++ = 'f';
len = sprintf(pbuf, "%s ", mode->forward); len = rb_sprintf(pbuf, "%s ", mode->forward);
pbuf += len; pbuf += len;
} }
*mbuf = '\0'; *mbuf = '\0';
@ -1025,7 +1025,7 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p)
if(is_owner(msptr)) { if(is_owner(msptr)) {
msptr->flags &= ~CHFL_ADMIN; msptr->flags &= ~CHFL_ADMIN;
lpara[count++] = msptr->client_p->name; lpara[count++] = msptr->client_p->name;
*mbuf++ = 'y'; *mbuf++ = 'q';
/* Make sure it fits if +h, +o, or +v are involved */ /* Make sure it fits if +h, +o, or +v are involved */
if(is_admin(msptr)) { if(is_admin(msptr)) {
@ -1393,7 +1393,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
pbuf = lparabuf; pbuf = lparabuf;
cur_len = mlen = sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname); cur_len = mlen = rb_sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname);
mbuf = lmodebuf + mlen; mbuf = lmodebuf + mlen;
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) {
@ -1417,7 +1417,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
*mbuf++ = c; *mbuf++ = c;
cur_len += plen; cur_len += plen;
pbuf += sprintf(pbuf, "%s ", banptr->banstr); pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr);
count++; count++;
free_ban(banptr); free_ban(banptr);

View File

@ -221,7 +221,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
use_id(source_p), chptr->chname, use_id(who), comment); use_id(source_p), chptr->chname, use_id(who), comment);
remove_user_from_channel(msptr); remove_user_from_channel(msptr);
snprintf(text, sizeof(text), "K%s", who->id); rb_snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */ /* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN) if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

View File

@ -140,7 +140,7 @@ mo_kill(struct Client *client_p, struct Client *source_p, int parc, const char *
target_p->flags |= FLAGS_KILLED; target_p->flags |= FLAGS_KILLED;
} }
sprintf(buf, "Killed (%s (%s))", source_p->name, reason); rb_sprintf(buf, "Killed (%s (%s))", source_p->name, reason);
exit_client(client_p, target_p, source_p, buf); exit_client(client_p, target_p, source_p, buf);
@ -247,7 +247,7 @@ ms_kill(struct Client *client_p, struct Client *source_p, int parc, const char *
/* FLAGS_KILLED prevents a quit being sent out */ /* FLAGS_KILLED prevents a quit being sent out */
target_p->flags |= FLAGS_KILLED; target_p->flags |= FLAGS_KILLED;
sprintf(buf, "Killed (%s %s)", source_p->name, reason); rb_sprintf(buf, "Killed (%s %s)", source_p->name, reason);
exit_client(client_p, target_p, source_p, buf); exit_client(client_p, target_p, source_p, buf);
@ -263,11 +263,11 @@ relay_kill(struct Client *one, struct Client *source_p,
char buffer[BUFSIZE]; char buffer[BUFSIZE];
if(MyClient(source_p)) if(MyClient(source_p))
snprintf(buffer, sizeof(buffer), rb_snprintf(buffer, sizeof(buffer),
"%s!%s!%s!%s (%s)", "%s!%s!%s!%s (%s)",
me.name, source_p->host, source_p->username, source_p->name, reason); me.name, source_p->host, source_p->username, source_p->name, reason);
else else
snprintf(buffer, sizeof(buffer), "%s %s", inpath, reason); rb_snprintf(buffer, sizeof(buffer), "%s %s", inpath, reason);
RB_DLINK_FOREACH(ptr, serv_list.head) { RB_DLINK_FOREACH(ptr, serv_list.head) {
client_p = ptr->data; client_p = ptr->data;

View File

@ -485,6 +485,10 @@ msg_channel(int p_or_n, const char *command,
rb_strlcpy(text2, text, BUFSIZE); rb_strlcpy(text2, text, BUFSIZE);
strip_unprintable(text2); strip_unprintable(text2);
if(!MyClient(source_p)) {
goto skip_NOCAPS_check;
}
// Don't count the "ACTION" part of action as part of the message --SnoFox // Don't count the "ACTION" part of action as part of the message --SnoFox
if (p_or_n != NOTICE && *text == '\001' && if (p_or_n != NOTICE && *text == '\001' &&
!strncasecmp(text + 1, "ACTION ", 7)) { !strncasecmp(text + 1, "ACTION ", 7)) {
@ -503,6 +507,7 @@ msg_channel(int p_or_n, const char *command,
return; return;
} }
} }
skip_NOCAPS_check:
if(chptr->mode.mode & MODE_NOCOLOR && (!ConfigChannel.exempt_cmode_c || !is_any_op(msptr))) { if(chptr->mode.mode & MODE_NOCOLOR && (!ConfigChannel.exempt_cmode_c || !is_any_op(msptr))) {
rb_strlcpy(text2, text, BUFSIZE); rb_strlcpy(text2, text, BUFSIZE);
@ -768,7 +773,7 @@ msg_client(int p_or_n, const char *command,
(IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) || (IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) ||
(IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]))) { (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]))) {
if (IsOper(source_p)) { if (IsOper(source_p)) {
snprintf(text3, sizeof(text3), "O%s", source_p->id); rb_snprintf(text3, sizeof(text3), "O%s", source_p->id);
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) { DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) {
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3)) { if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3)) {
oaccept = 1; oaccept = 1;

View File

@ -274,7 +274,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
mems = ONLY_CHANOPS; mems = ONLY_CHANOPS;
break; break;
case 'q': case 'y':
banlist = &chptr->quietlist; banlist = &chptr->quietlist;
mode_type = CHFL_QUIET; mode_type = CHFL_QUIET;
mems = ALL_MEMBERS; mems = ALL_MEMBERS;
@ -293,7 +293,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
fakesource_p = &me; fakesource_p = &me;
else else
fakesource_p = source_p; fakesource_p = source_p;
mlen = sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname); mlen = rb_sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname);
mbuf = modebuf + mlen; mbuf = modebuf + mlen;
pbuf = parabuf; pbuf = parabuf;
@ -337,7 +337,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
} }
*mbuf++ = parv[3][0]; *mbuf++ = parv[3][0];
arglen = sprintf(pbuf, "%s ", s); arglen = rb_sprintf(pbuf, "%s ", s);
pbuf += arglen; pbuf += arglen;
plen += arglen; plen += arglen;
modecount++; modecount++;

View File

@ -311,7 +311,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p
"with %d arguments (expecting 10)", client_p->name, parc); "with %d arguments (expecting 10)", client_p->name, parc);
ilog(L_SERVER, "Excess parameters (%d) for command 'UID' from %s.", ilog(L_SERVER, "Excess parameters (%d) for command 'UID' from %s.",
parc, client_p->name); parc, client_p->name);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Excess parameters (%d) to %s command, expecting %d", "Excess parameters (%d) to %s command, expecting %d",
parc, "UID", 10); parc, "UID", 10);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
@ -325,7 +325,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p
} }
if(!clean_uid(parv[8])) { if(!clean_uid(parv[8])) {
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Invalid UID %s for nick %s on %s", "Invalid UID %s for nick %s on %s",
parv[8], parv[1], source_p->name); parv[8], parv[1], source_p->name);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
@ -394,7 +394,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char *
"with %d arguments (expecting 12)", client_p->name, parc); "with %d arguments (expecting 12)", client_p->name, parc);
ilog(L_SERVER, "Excess parameters (%d) for command 'EUID' from %s.", ilog(L_SERVER, "Excess parameters (%d) for command 'EUID' from %s.",
parc, client_p->name); parc, client_p->name);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Excess parameters (%d) to %s command, expecting %d", "Excess parameters (%d) to %s command, expecting %d",
parc, "EUID", 12); parc, "EUID", 12);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
@ -408,7 +408,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char *
} }
if(!clean_uid(parv[8])) { if(!clean_uid(parv[8])) {
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Invalid UID %s for nick %s on %s", "Invalid UID %s for nick %s on %s",
parv[8], parv[1], source_p->name); parv[8], parv[1], source_p->name);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
@ -601,7 +601,7 @@ set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick)
strcpy(source_p->name, nick); strcpy(source_p->name, nick);
add_to_client_hash(nick, source_p); add_to_client_hash(nick, source_p);
snprintf(note, sizeof(note), "Nick: %s", nick); rb_snprintf(note, sizeof(note), "Nick: %s", nick);
rb_note(client_p->localClient->F, note); rb_note(client_p->localClient->F, note);
if(source_p->flags & FLAGS_SENTUSER) { if(source_p->flags & FLAGS_SENTUSER) {
@ -710,7 +710,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
rb_dlinkDestroy(ptr, &source_p->on_allow_list); rb_dlinkDestroy(ptr, &source_p->on_allow_list);
} }
snprintf(note, sizeof(note), "Nick: %s", nick); rb_snprintf(note, sizeof(note), "Nick: %s", nick);
rb_note(client_p->localClient->F, note); rb_note(client_p->localClient->F, note);
return; return;
@ -1158,7 +1158,7 @@ static void bad_nickname(struct Client *client_p, const char *nick)
ilog(L_SERVER, "Link %s cancelled, bad nickname %s sent (NICKLEN mismatch?)", ilog(L_SERVER, "Link %s cancelled, bad nickname %s sent (NICKLEN mismatch?)",
client_p->name, nick); client_p->name, nick);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Bad nickname introduced [%s]", nick); "Bad nickname introduced [%s]", nick);
exit_client(client_p, client_p, &me, squitreason); exit_client(client_p, client_p, &me, squitreason);
} }

View File

@ -65,7 +65,7 @@ m_quit(struct Client *client_p, struct Client *source_p, int parc, const char *p
strip_colour(comment); strip_colour(comment);
if(ConfigFileEntry.client_exit && comment[0]) { if(ConfigFileEntry.client_exit && comment[0]) {
snprintf(reason, sizeof(reason), "Quit: %s", comment); rb_snprintf(reason, sizeof(reason), "Quit: %s", comment);
comment = reason; comment = reason;
} }

View File

@ -113,7 +113,7 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
if (!(client_p->localClient->caps & cap->cap)) { if (!(client_p->localClient->caps & cap->cap)) {
char exitbuf[BUFSIZE]; char exitbuf[BUFSIZE];
snprintf(exitbuf, BUFSIZE, "Missing required CAPAB [%s]", cap->name); rb_snprintf(exitbuf, BUFSIZE, "Missing required CAPAB [%s]", cap->name);
exit_client(client_p, client_p, client_p, exitbuf); exit_client(client_p, client_p, client_p, exitbuf);
return 0; return 0;
@ -309,7 +309,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
ilog(L_SERVER, "Link %s cancelled, server %s already exists", ilog(L_SERVER, "Link %s cancelled, server %s already exists",
client_p->name, name); client_p->name, name);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Server %s already exists", "Server %s already exists",
name); name);
exit_client(client_p, client_p, &me, squitreason); exit_client(client_p, client_p, &me, squitreason);
@ -391,7 +391,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
ilog(L_SERVER, "Non-Hub link %s introduced %s.", ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, name); client_p->name, name);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s", "No matching hub_mask for %s",
name); name);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
@ -407,7 +407,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
ilog(L_SERVER, "Link %s introduced leafed server %s.", ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, name); client_p->name, name);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s", "Matching leaf_mask for %s",
name); name);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
@ -483,7 +483,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Link %s cancelled, server %s already exists", ilog(L_SERVER, "Link %s cancelled, server %s already exists",
client_p->name, parv[1]); client_p->name, parv[1]);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Server %s already exists", "Server %s already exists",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
@ -501,7 +501,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Link %s cancelled, SID %s for server %s already in use by %s", ilog(L_SERVER, "Link %s cancelled, SID %s for server %s already in use by %s",
client_p->name, parv[3], parv[1], target_p->name); client_p->name, parv[3], parv[1], target_p->name);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"SID %s for %s already in use by %s", "SID %s for %s already in use by %s",
parv[3], parv[1], target_p->name); parv[3], parv[1], target_p->name);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
@ -556,7 +556,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Non-Hub link %s introduced %s.", ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, parv[1]); client_p->name, parv[1]);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s", "No matching hub_mask for %s",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);
@ -571,7 +571,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
ilog(L_SERVER, "Link %s introduced leafed server %s.", ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, parv[1]); client_p->name, parv[1]);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s", "Matching leaf_mask for %s",
parv[1]); parv[1]);
exit_client(NULL, client_p, &me, squitreason); exit_client(NULL, client_p, &me, squitreason);

View File

@ -228,7 +228,7 @@ list_accepts(struct Client *source_p)
*nicks = '\0'; *nicks = '\0';
} }
len += snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name); len += rb_snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name);
count++; count++;
} }
} }

View File

@ -173,7 +173,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
int curlen, mlen; int curlen, mlen;
size_t i; size_t i;
mlen = sprintf(buf, ":%s CAP %s %s", mlen = rb_sprintf(buf, ":%s CAP %s %s",
me.name, me.name,
EmptyString(source_p->name) ? "*" : source_p->name, EmptyString(source_p->name) ? "*" : source_p->name,
subcmd); subcmd);
@ -237,7 +237,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
} }
} }
curlen = sprintf(p, "%s ", clicap_list[i].name); curlen = rb_sprintf(p, "%s ", clicap_list[i].name);
p += curlen; p += curlen;
buflen += curlen; buflen += curlen;
} }
@ -345,7 +345,7 @@ cap_req(struct Client *source_p, const char *arg)
if(EmptyString(arg)) if(EmptyString(arg))
return; return;
buflen = snprintf(buf, sizeof(buf), ":%s CAP %s ACK", buflen = rb_snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
me.name, EmptyString(source_p->name) ? "*" : source_p->name); me.name, EmptyString(source_p->name) ? "*" : source_p->name);
pbuf[0][0] = '\0'; pbuf[0][0] = '\0';

View File

@ -77,7 +77,7 @@ ms_encap(struct Client *client_p, struct Client *source_p, int parc, const char
if((size_t)(cur_len + len) >= sizeof(buffer)) if((size_t)(cur_len + len) >= sizeof(buffer))
return 0; return 0;
snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]); rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
cur_len += len; cur_len += len;
ptr += len; ptr += len;
} }
@ -86,9 +86,9 @@ ms_encap(struct Client *client_p, struct Client *source_p, int parc, const char
/* if its a command without parameters, dont prepend a ':' */ /* if its a command without parameters, dont prepend a ':' */
if(parc == 3) if(parc == 3)
snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]); rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s", parv[2]);
else else
snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]); rb_snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc-1]);
/* add a trailing \0 if it was too long */ /* add a trailing \0 if it was too long */
if((cur_len + len) >= BUFSIZE) if((cur_len + len) >= BUFSIZE)

View File

@ -652,7 +652,7 @@ static struct InfoStruct info_table[] = {
"use_owner", "use_owner",
OUTPUT_BOOLEAN_YN, OUTPUT_BOOLEAN_YN,
&ConfigChannel.use_owner, &ConfigChannel.use_owner,
"Enable chanmode +y (owner)", "Enable chanmode +q (owner)",
}, },
{ {
"use_except", "use_except",

View File

@ -75,7 +75,7 @@ m_ison(struct Client *client_p, struct Client *source_p, int parc, const char *p
current_insert_point2 = buf2; current_insert_point2 = buf2;
*buf2 = '\0'; *buf2 = '\0';
sprintf(buf, form_str(RPL_ISON), me.name, source_p->name); rb_sprintf(buf, form_str(RPL_ISON), me.name, source_p->name);
len = strlen(buf); len = strlen(buf);
current_insert_point = buf + len; current_insert_point = buf + len;

View File

@ -103,7 +103,7 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
} }
frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total; frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total;
snprintf(buf + USER_COL, BUFSIZE - USER_COL, rb_snprintf(buf + USER_COL, BUFSIZE - USER_COL,
" | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users), " | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users),
frac / 10, frac % 10); frac / 10, frac % 10);

View File

@ -86,9 +86,9 @@ add_monitor(struct Client *client_p, const char *nicks)
sendto_one(client_p, "%s", offbuf); sendto_one(client_p, "%s", offbuf);
if(p) if(p)
snprintf(buf, sizeof(buf), "%s,%s", name, p); rb_snprintf(buf, sizeof(buf), "%s,%s", name, p);
else else
snprintf(buf, sizeof(buf), "%s", name); rb_snprintf(buf, sizeof(buf), "%s", name);
sendto_one(client_p, form_str(ERR_MONLISTFULL), sendto_one(client_p, form_str(ERR_MONLISTFULL),
me.name, client_p->name, me.name, client_p->name,

View File

@ -128,7 +128,7 @@ names_global(struct Client *source_p)
chptr = ptr->data; chptr = ptr->data;
channel_member_names(chptr, source_p, 0); channel_member_names(chptr, source_p, 0);
} }
cur_len = mlen = sprintf(buf, form_str(RPL_NAMREPLY), cur_len = mlen = rb_sprintf(buf, form_str(RPL_NAMREPLY),
me.name, source_p->name, "*", "*"); me.name, source_p->name, "*", "*");
t = buf + mlen; t = buf + mlen;
@ -167,7 +167,7 @@ names_global(struct Client *source_p)
t = buf + mlen; t = buf + mlen;
} }
tlen = sprintf(t, "%s ", target_p->name); tlen = rb_sprintf(t, "%s ", target_p->name);
cur_len += tlen; cur_len += tlen;
t += tlen; t += tlen;
} }

View File

@ -82,7 +82,7 @@ ms_operspy(struct Client *client_p, struct Client *source_p,
if((size_t)(cur_len + len) >= sizeof(buffer)) if((size_t)(cur_len + len) >= sizeof(buffer))
return 0; return 0;
snprintf(ptr, sizeof(buffer) - cur_len, "%s ", rb_snprintf(ptr, sizeof(buffer) - cur_len, "%s ",
parv[i]); parv[i]);
ptr += len; ptr += len;
cur_len += len; cur_len += len;

View File

@ -123,7 +123,7 @@ do_restart(struct Client *source_p, const char *servername)
me.name, get_client_name(source_p, HIDE_IP)); me.name, get_client_name(source_p, HIDE_IP));
} }
sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP)); rb_sprintf(buf, "Server RESTART by %s", get_client_name(source_p, HIDE_IP));
restart(buf); restart(buf);
return 0; return 0;

View File

@ -218,7 +218,7 @@ scan_umodes(struct Client *client_p, struct Client *source_p, int parc,
continue; continue;
if (mask != NULL) { if (mask != NULL) {
snprintf(maskbuf, BUFSIZE, "%s!%s@%s", rb_snprintf(maskbuf, BUFSIZE, "%s!%s@%s",
target_p->name, target_p->username, target_p->host); target_p->name, target_p->username, target_p->host);
if (!match(mask, maskbuf)) if (!match(mask, maskbuf))

View File

@ -196,7 +196,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)", kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)",
me.name); me.name);
snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
me.name); me.name);
exit_client(NULL, exist_p, &me, buf); exit_client(NULL, exist_p, &me, buf);
} }
@ -234,7 +234,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
del_all_accepts(target_p); del_all_accepts(target_p);
snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); rb_snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
rb_note(target_p->localClient->F, note); rb_note(target_p->localClient->F, note);
return 0; return 0;
} }

View File

@ -201,7 +201,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)", kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)",
me.name); me.name);
snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))", rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
me.name); me.name);
exit_client(NULL, exist_p, &me, buf); exit_client(NULL, exist_p, &me, buf);
} else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) { } else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) {
@ -240,7 +240,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
send_signon(NULL, target_p, nick, user, host, rb_current_time(), login); send_signon(NULL, target_p, nick, user, host, rb_current_time(), login);
snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name); rb_snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
rb_note(target_p->localClient->F, note); rb_note(target_p->localClient->F, note);
} }

View File

@ -69,7 +69,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Link %s dropped, wrong TS protocol version (%s,%s)", "Link %s dropped, wrong TS protocol version (%s,%s)",
source_p->name, parv[1], parv[2]); source_p->name, parv[1], parv[2]);
snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)", rb_snprintf(squitreason, sizeof squitreason, "Incompatible TS version (%s,%s)",
parv[1], parv[2]); parv[1], parv[2]);
exit_client(source_p, source_p, source_p, squitreason); exit_client(source_p, source_p, source_p, squitreason);
return 0; return 0;
@ -92,7 +92,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char
"Link %s dropped, excessive TS delta" "Link %s dropped, excessive TS delta"
" (my TS=%ld, their TS=%ld, delta=%d)", " (my TS=%ld, their TS=%ld, delta=%d)",
log_client_name(source_p, SHOW_IP), (long) rb_current_time(), (long) theirtime, deltat); log_client_name(source_p, SHOW_IP), (long) rb_current_time(), (long) theirtime, deltat);
snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%d)", rb_snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%d)",
(long) rb_current_time(), (long) theirtime, deltat); (long) rb_current_time(), (long) theirtime, deltat);
disable_server_conf_autoconn(source_p->name); disable_server_conf_autoconn(source_p->name);
exit_client(source_p, source_p, source_p, squitreason); exit_client(source_p, source_p, source_p, squitreason);

View File

@ -123,7 +123,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
if(aconf && aconf->status & CONF_DLINE) { if(aconf && aconf->status & CONF_DLINE) {
get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason); get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason);
snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason, rb_snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason,
operreason ? "|" : "", operreason ? operreason : ""); operreason ? "|" : "", operreason ? operreason : "");
sendto_one(source_p, form_str(RPL_TESTLINE), sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, me.name, source_p->name,
@ -170,9 +170,9 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
if(aconf->status & CONF_KILL) { if(aconf->status & CONF_KILL) {
get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason); get_printable_kline(source_p, aconf, &phost, &reason, &puser, &operreason);
snprintf(buf, sizeof(buf), "%s@%s", rb_snprintf(buf, sizeof(buf), "%s@%s",
puser, phost); puser, phost);
snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason, rb_snprintf(reasonbuf, sizeof(reasonbuf), "%s%s%s", reason,
operreason ? "|" : "", operreason ? operreason : ""); operreason ? "|" : "", operreason ? operreason : "");
sendto_one(source_p, form_str(RPL_TESTLINE), sendto_one(source_p, form_str(RPL_TESTLINE),
me.name, source_p->name, me.name, source_p->name,

View File

@ -108,7 +108,7 @@ date(void)
if(minswest < 0) if(minswest < 0)
minswest = -minswest; minswest = -minswest;
sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u", rb_sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u",
weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday, weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday,
lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec, lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec,
plus, minswest / 60, minswest % 60); plus, minswest / 60, minswest % 60);

View File

@ -135,7 +135,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
} }
if(ConfigChannel.host_in_topic) if(ConfigChannel.host_in_topic)
sprintf(topic_info, "%s!%s@%s", rb_sprintf(topic_info, "%s!%s@%s",
source_p->name, source_p->username, source_p->host); source_p->name, source_p->username, source_p->host);
else else
rb_strlcpy(topic_info, source_p->name, sizeof(topic_info)); rb_strlcpy(topic_info, source_p->name, sizeof(topic_info));

View File

@ -69,7 +69,7 @@ mr_user(struct Client *client_p, struct Client *source_p, int parc, const char *
if((p = strchr(parv[1], '@'))) if((p = strchr(parv[1], '@')))
*p = '\0'; *p = '\0';
snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]); rb_snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]);
rb_free(source_p->localClient->fullcaps); rb_free(source_p->localClient->fullcaps);
source_p->localClient->fullcaps = rb_strdup(buf); source_p->localClient->fullcaps = rb_strdup(buf);

View File

@ -62,7 +62,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
int cur_len; int cur_len;
int rl; int rl;
cur_len = sprintf(buf, form_str(RPL_USERHOST), me.name, source_p->name, ""); cur_len = rb_sprintf(buf, form_str(RPL_USERHOST), me.name, source_p->name, "");
t = buf + cur_len; t = buf + cur_len;
for (i = 1; i <= 5; i++) { for (i = 1; i <= 5; i++) {
@ -77,14 +77,14 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
* is. Useful for things like NAT, and dynamic dial-up users. * is. Useful for things like NAT, and dynamic dial-up users.
*/ */
if(MyClient(target_p) && (target_p == source_p)) { if(MyClient(target_p) && (target_p == source_p)) {
rl = sprintf(response, "%s%s=%c%s@%s ", rl = rb_sprintf(response, "%s%s=%c%s@%s ",
target_p->name, target_p->name,
IsOper(target_p) ? "*" : "", IsOper(target_p) ? "*" : "",
(target_p->user->away) ? '-' : '+', (target_p->user->away) ? '-' : '+',
target_p->username, target_p->username,
target_p->sockhost); target_p->sockhost);
} else { } else {
rl = sprintf(response, "%s%s=%c%s@%s ", rl = rb_sprintf(response, "%s%s=%c%s@%s ",
target_p->name, target_p->name,
IsOper(target_p) ? "*" : "", IsOper(target_p) ? "*" : "",
(target_p->user->away) ? '-' : '+', (target_p->user->away) ? '-' : '+',
@ -92,7 +92,7 @@ m_userhost(struct Client *client_p, struct Client *source_p, int parc, const cha
} }
if((rl + cur_len) < (BUFSIZE - 10)) { if((rl + cur_len) < (BUFSIZE - 10)) {
sprintf(t, "%s", response); rb_sprintf(t, "%s", response);
t += rl; t += rl;
cur_len += rl; cur_len += rl;
} else } else

View File

@ -441,7 +441,7 @@ append_format(char *buf, size_t bufsize, size_t *pos, const char *fmt, ...)
max = *pos >= bufsize ? 0 : bufsize - *pos; max = *pos >= bufsize ? 0 : bufsize - *pos;
va_start(ap, fmt); va_start(ap, fmt);
result = vsnprintf(buf + *pos, max, fmt, ap); result = rb_vsnprintf(buf + *pos, max, fmt, ap);
va_end(ap); va_end(ap);
*pos += result; *pos += result;
} }
@ -465,7 +465,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
size_t pos; size_t pos;
const char *q; const char *q;
sprintf(status, "%c%s%s", rb_sprintf(status, "%c%s%s",
target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", msptr ? find_channel_status(msptr, fmt->fields || IsCapable(source_p, CLICAP_MULTI_PREFIX)) : ""); target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", msptr ? find_channel_status(msptr, fmt->fields || IsCapable(source_p, CLICAP_MULTI_PREFIX)) : "");
if (fmt->fields == 0) if (fmt->fields == 0)

View File

@ -187,7 +187,7 @@ do_whois(struct Client *client_p, struct Client *source_p, int parc, const char
if(operspy) { if(operspy) {
char buffer[BUFSIZE]; char buffer[BUFSIZE];
snprintf(buffer, sizeof(buffer), "%s!%s@%s %s", rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s %s",
target_p->name, target_p->username, target_p->name, target_p->username,
target_p->host, target_p->servptr->name); target_p->host, target_p->servptr->name);
report_operspy(source_p, "WHOIS", buffer); report_operspy(source_p, "WHOIS", buffer);
@ -244,7 +244,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
target_p->name, target_p->username, target_p->name, target_p->username,
target_p->host, target_p->info); target_p->host, target_p->info);
cur_len = mlen = sprintf(buf, form_str(RPL_WHOISCHANNELS), cur_len = mlen = rb_sprintf(buf, form_str(RPL_WHOISCHANNELS),
get_id(&me, source_p), get_id(source_p, source_p), get_id(&me, source_p), get_id(source_p, source_p),
target_p->name); target_p->name);
@ -276,7 +276,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
t = buf + mlen; t = buf + mlen;
} }
tlen = sprintf(t, "%s%s%s ", tlen = rb_sprintf(t, "%s%s%s ",
visible ? "" : "*", visible ? "" : "*",
find_channel_status(msptr, 1), find_channel_status(msptr, 1),
chptr->chname); chptr->chname);

View File

@ -83,11 +83,11 @@ start_bandb(void)
rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1); rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
if(bandb_path == NULL) { if(bandb_path == NULL) {
snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix); rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) { if(access(fullpath, X_OK) == -1) {
snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s", rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s",
ConfigFileEntry.dpath, suffix); ConfigFileEntry.dpath, suffix);
if(access(fullpath, X_OK) == -1) { if(access(fullpath, X_OK) == -1) {
ilog(L_MAIN, ilog(L_MAIN,
@ -122,16 +122,16 @@ bandb_add(bandb_type type, struct Client *source_p, const char *mask1,
static char buf[BUFSIZE]; static char buf[BUFSIZE];
snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1); rb_snprintf(buf, sizeof(buf), "%c %s ", bandb_add_letter[type], mask1);
if(!EmptyString(mask2)) if(!EmptyString(mask2))
snprintf_append(buf, sizeof(buf), "%s ", mask2); rb_snprintf_append(buf, sizeof(buf), "%s ", mask2);
snprintf_append(buf, sizeof(buf), "%s %ld %d :%s", rb_snprintf_append(buf, sizeof(buf), "%s %ld %d :%s",
get_oper_name(source_p), (long int)rb_current_time(), perm, reason); get_oper_name(source_p), (long int)rb_current_time(), perm, reason);
if(!EmptyString(oper_reason)) if(!EmptyString(oper_reason))
snprintf_append(buf, sizeof(buf), "|%s", oper_reason); rb_snprintf_append(buf, sizeof(buf), "|%s", oper_reason);
rb_helper_write(bandb_helper, "%s", buf); rb_helper_write(bandb_helper, "%s", buf);
} }
@ -150,10 +150,10 @@ bandb_del(bandb_type type, const char *mask1, const char *mask2)
buf[0] = '\0'; buf[0] = '\0';
snprintf_append(buf, sizeof(buf), "%c %s", bandb_del_letter[type], mask1); rb_snprintf_append(buf, sizeof(buf), "%c %s", bandb_del_letter[type], mask1);
if(!EmptyString(mask2)) if(!EmptyString(mask2))
snprintf_append(buf, sizeof(buf), " %s", mask2); rb_snprintf_append(buf, sizeof(buf), " %s", mask2);
rb_helper_write(bandb_helper, "%s", buf); rb_helper_write(bandb_helper, "%s", buf);
} }

View File

@ -121,7 +121,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr; ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr;
/* becomes 2.0.0.127.torbl.ahbl.org or whatever */ /* becomes 2.0.0.127.torbl.ahbl.org or whatever */
snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s", rb_snprintf(buf, sizeof buf, "%d.%d.%d.%d.%s",
(unsigned int) ip[3], (unsigned int) ip[3],
(unsigned int) ip[2], (unsigned int) ip[2],
(unsigned int) ip[1], (unsigned int) ip[1],
@ -147,8 +147,8 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client *
uint8_t hi = (ip[i] >> 4) & 0x0F; uint8_t hi = (ip[i] >> 4) & 0x0F;
uint8_t lo = ip[i] & 0x0F; uint8_t lo = ip[i] & 0x0F;
/* One part... (why 5? snprintf adds \0) */ /* One part... (why 5? rb_snprintf adds \0) */
snprintf(bufptr, 5, "%1x.%1x.", rb_snprintf(bufptr, 5, "%1x.%1x.",
(unsigned int) lo, /* Remember, backwards */ (unsigned int) lo, /* Remember, backwards */
(unsigned int) hi); (unsigned int) hi);

View File

@ -172,7 +172,7 @@ cache_links(void *unused)
/* if the below is ever modified, change LINKSLINELEN */ /* if the below is ever modified, change LINKSLINELEN */
links_line = rb_malloc(LINKSLINELEN); links_line = rb_malloc(LINKSLINELEN);
snprintf(links_line, LINKSLINELEN, "%s %s :1 %s", rb_snprintf(links_line, LINKSLINELEN, "%s %s :1 %s",
target_p->name, me.name, target_p->name, me.name,
target_p->info[0] ? target_p->info : target_p->info[0] ? target_p->info :
"(Unknown Location)"); "(Unknown Location)");
@ -241,7 +241,7 @@ load_help(void)
while((ldirent = readdir(helpfile_dir)) != NULL) { while((ldirent = readdir(helpfile_dir)) != NULL) {
if(ldirent->d_name[0] == '.') if(ldirent->d_name[0] == '.')
continue; continue;
snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name); rb_snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name);
cacheptr = cache_file(filename, ldirent->d_name, HELP_OPER); cacheptr = cache_file(filename, ldirent->d_name, HELP_OPER);
irc_dictionary_add(help_dict_oper, cacheptr->name, cacheptr); irc_dictionary_add(help_dict_oper, cacheptr->name, cacheptr);
} }
@ -255,7 +255,7 @@ load_help(void)
while((ldirent = readdir(helpfile_dir)) != NULL) { while((ldirent = readdir(helpfile_dir)) != NULL) {
if(ldirent->d_name[0] == '.') if(ldirent->d_name[0] == '.')
continue; continue;
snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name); rb_snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name);
#if defined(S_ISLNK) && defined(HAVE_LSTAT) #if defined(S_ISLNK) && defined(HAVE_LSTAT)
if(lstat(filename, &sb) < 0) if(lstat(filename, &sb) < 0)
@ -319,7 +319,7 @@ cache_user_motd(void)
local_tm = localtime(&sb.st_mtime); local_tm = localtime(&sb.st_mtime);
if(local_tm != NULL) { if(local_tm != NULL) {
snprintf(user_motd_changed, sizeof(user_motd_changed), rb_snprintf(user_motd_changed, sizeof(user_motd_changed),
"%d/%d/%d %d:%d", "%d/%d/%d %d:%d",
local_tm->tm_mday, local_tm->tm_mon + 1, local_tm->tm_mday, local_tm->tm_mon + 1,
1900 + local_tm->tm_year, local_tm->tm_hour, 1900 + local_tm->tm_year, local_tm->tm_hour,

View File

@ -188,8 +188,8 @@ find_channel_status(struct membership *msptr, int combine)
} }
if(is_admin(msptr)) { if(is_admin(msptr)) {
if(!combine) if(!combine)
return "!"; return "&";
*p++ = '!'; *p++ = '&';
} }
if(is_chanop(msptr)) { if(is_chanop(msptr)) {
@ -565,7 +565,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
if(ShowChannel(client_p, chptr)) { if(ShowChannel(client_p, chptr)) {
is_member = IsMember(client_p, chptr); is_member = IsMember(client_p, chptr);
cur_len = mlen = sprintf(lbuf, form_str(RPL_NAMREPLY), cur_len = mlen = rb_sprintf(lbuf, form_str(RPL_NAMREPLY),
me.name, client_p->name, me.name, client_p->name,
channel_pub_or_secret(chptr), chptr->chname); channel_pub_or_secret(chptr), chptr->chname);
@ -586,7 +586,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo
t = lbuf + mlen; t = lbuf + mlen;
} }
tlen = sprintf(t, "%s%s ", find_channel_status(msptr, stack), tlen = rb_sprintf(t, "%s%s ", find_channel_status(msptr, stack),
target_p->name); target_p->name);
cur_len += tlen; cur_len += tlen;
@ -648,8 +648,8 @@ is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr,
/* if the buffers havent been built, do it here */ /* if the buffers havent been built, do it here */
if(s == NULL) { if(s == NULL) {
sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); rb_sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host);
sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost); rb_sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost);
s = src_host; s = src_host;
s2 = src_iphost; s2 = src_iphost;
@ -657,13 +657,13 @@ is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr,
if(who->localClient->mangledhost != NULL) { if(who->localClient->mangledhost != NULL) {
/* if host mangling mode enabled, also check their real host */ /* if host mangling mode enabled, also check their real host */
if(!strcmp(who->host, who->localClient->mangledhost)) { if(!strcmp(who->host, who->localClient->mangledhost)) {
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost); rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost);
s3 = src_althost; s3 = src_althost;
} }
/* if host mangling mode not enabled and no other spoof, /* if host mangling mode not enabled and no other spoof,
* also check the mangled form of their host */ * also check the mangled form of their host */
else if (!IsDynSpoof(who)) { else if (!IsDynSpoof(who)) {
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost);
s3 = src_althost; s3 = src_althost;
} }
} }
@ -741,8 +741,8 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr,
/* if the buffers havent been built, do it here */ /* if the buffers havent been built, do it here */
if(s == NULL) { if(s == NULL) {
sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host); rb_sprintf(src_host, "%s!%s@%s", who->name, who->username, who->host);
sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost); rb_sprintf(src_iphost, "%s!%s@%s", who->name, who->username, who->sockhost);
s = src_host; s = src_host;
s2 = src_iphost; s2 = src_iphost;
@ -750,13 +750,13 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr,
if(who->localClient->mangledhost != NULL) { if(who->localClient->mangledhost != NULL) {
/* if host mangling mode enabled, also check their real host */ /* if host mangling mode enabled, also check their real host */
if(!strcmp(who->host, who->localClient->mangledhost)) { if(!strcmp(who->host, who->localClient->mangledhost)) {
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost); rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->orighost);
s3 = src_althost; s3 = src_althost;
} }
/* if host mangling mode not enabled and no other spoof, /* if host mangling mode not enabled and no other spoof,
* also check the mangled form of their host */ * also check the mangled form of their host */
else if (!IsDynSpoof(who)) { else if (!IsDynSpoof(who)) {
sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost); rb_sprintf(src_althost, "%s!%s@%s", who->name, who->username, who->localClient->mangledhost);
s3 = src_althost; s3 = src_althost;
} }
} }
@ -834,18 +834,18 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
s_assert(source_p->localClient != NULL); s_assert(source_p->localClient != NULL);
sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host); rb_sprintf(src_host, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
sprintf(src_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost); rb_sprintf(src_iphost, "%s!%s@%s", source_p->name, source_p->username, source_p->sockhost);
if(source_p->localClient->mangledhost != NULL) { if(source_p->localClient->mangledhost != NULL) {
/* if host mangling mode enabled, also check their real host */ /* if host mangling mode enabled, also check their real host */
if(!strcmp(source_p->host, source_p->localClient->mangledhost)) { if(!strcmp(source_p->host, source_p->localClient->mangledhost)) {
sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->orighost); rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->orighost);
use_althost = 1; use_althost = 1;
} }
/* if host mangling mode not enabled and no other spoof, /* if host mangling mode not enabled and no other spoof,
* also check the mangled form of their host */ * also check the mangled form of their host */
else if (!IsDynSpoof(source_p)) { else if (!IsDynSpoof(source_p)) {
sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost); rb_sprintf(src_althost, "%s!%s@%s", source_p->name, source_p->username, source_p->localClient->mangledhost);
use_althost = 1; use_althost = 1;
} }
} }
@ -853,7 +853,7 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN) if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
return (ERR_BANNEDFROMCHAN); return (ERR_BANNEDFROMCHAN);
snprintf(text, sizeof(text), "K%s", source_p->id); rb_snprintf(text, sizeof(text), "K%s", source_p->id);
DICTIONARY_FOREACH(md, &iter, chptr->metadata) { DICTIONARY_FOREACH(md, &iter, chptr->metadata) {
if(!strcmp(md->value, "KICKNOREJOIN") && !strcmp(md->name, text) && (md->timevalue + 2 > rb_current_time())) if(!strcmp(md->value, "KICKNOREJOIN") && !strcmp(md->name, text) && (md->timevalue + 2 > rb_current_time()))
@ -1036,8 +1036,8 @@ find_bannickchange_channel(struct Client *client_p)
if (!MyClient(client_p) || IsOverride(client_p)) if (!MyClient(client_p) || IsOverride(client_p))
return NULL; return NULL;
sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host); rb_sprintf(src_host, "%s!%s@%s", client_p->name, client_p->username, client_p->host);
sprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost); rb_sprintf(src_iphost, "%s!%s@%s", client_p->name, client_p->username, client_p->sockhost);
RB_DLINK_FOREACH(ptr, client_p->user->channel.head) { RB_DLINK_FOREACH(ptr, client_p->user->channel.head) {
msptr = ptr->data; msptr = ptr->data;
@ -1289,21 +1289,21 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf++ = 'l'; *mbuf++ = 'l';
if(!IsClient(client_p) || IsMember(client_p, chptr)) if(!IsClient(client_p) || IsMember(client_p, chptr))
pbuf += sprintf(pbuf, " %d", chptr->mode.limit); pbuf += rb_sprintf(pbuf, " %d", chptr->mode.limit);
} }
if(*chptr->mode.key) { if(*chptr->mode.key) {
*mbuf++ = 'k'; *mbuf++ = 'k';
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
pbuf += sprintf(pbuf, " %s", chptr->mode.key); pbuf += rb_sprintf(pbuf, " %s", chptr->mode.key);
} }
if(chptr->mode.join_num) { if(chptr->mode.join_num) {
*mbuf++ = 'j'; *mbuf++ = 'j';
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
pbuf += sprintf(pbuf, " %d:%d", chptr->mode.join_num, pbuf += rb_sprintf(pbuf, " %d:%d", chptr->mode.join_num,
chptr->mode.join_time); chptr->mode.join_time);
} }
@ -1311,7 +1311,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf++ = 'f'; *mbuf++ = 'f';
if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr))
pbuf += sprintf(pbuf, " %s", chptr->mode.forward); pbuf += rb_sprintf(pbuf, " %s", chptr->mode.forward);
} }
*mbuf = '\0'; *mbuf = '\0';
@ -1453,7 +1453,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
cap = chcap_combos[j].cap_yes; cap = chcap_combos[j].cap_yes;
nocap = chcap_combos[j].cap_no; nocap = chcap_combos[j].cap_no;
mbl = preflen = sprintf(modebuf, ":%s TMODE %ld %s ", mbl = preflen = rb_sprintf(modebuf, ":%s TMODE %ld %s ",
use_id(source_p), (long) chptr->channelts, use_id(source_p), (long) chptr->channelts,
chptr->chname); chptr->chname);
@ -1513,7 +1513,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
nc++; nc++;
if(arg != NULL) { if(arg != NULL) {
len = sprintf(pbuf, "%s ", arg); len = rb_sprintf(pbuf, "%s ", arg);
pbuf += len; pbuf += len;
pbl += len; pbl += len;
mc++; mc++;

View File

@ -140,14 +140,14 @@ construct_cflag_param_string(void)
{ {
*cflagsparaminfo = '\0'; *cflagsparaminfo = '\0';
snprintf(cflagsparaminfo, sizeof cflagsparaminfo, "%s%sb%s%s%s%sklov%s%s", rb_snprintf(cflagsparaminfo, sizeof cflagsparaminfo, "%s%sb%s%s%s%sklov%s%s",
ConfigChannel.use_owner ? "y" : "", ConfigChannel.use_owner ? "q" : "",
ConfigChannel.use_admin ? "a" : "", ConfigChannel.use_admin ? "a" : "",
ConfigChannel.use_except ? "e" : "", ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_forward ? "f" : "", ConfigChannel.use_forward ? "f" : "",
ConfigChannel.use_halfop ? "h" : "", ConfigChannel.use_halfop ? "h" : "",
strchr(ConfigChannel.disabledmodes, 'j') ? "" : "j", strchr(ConfigChannel.disabledmodes, 'j') ? "" : "j",
strchr(ConfigChannel.disabledmodes, 'q') ? "" : "q", strchr(ConfigChannel.disabledmodes, 'y') ? "" : "y",
ConfigChannel.use_invex ? "I" : ""); ConfigChannel.use_invex ? "I" : "");
} }
@ -219,7 +219,7 @@ get_channel_access(struct Client *source_p, struct membership *msptr)
/* check_bans_number() /* check_bans_number()
* *
* inputs - client, channel ban list * inputs - client, channel ban list
* outputs - 0 on ban being allowed, 1 on ban being disallowed * outputs - 1 on ban being allowed, 0 on ban being disallowed
* side effects - none * side effects - none
*/ */
int int
@ -227,10 +227,10 @@ check_bans_number(struct Client *source_p, struct Channel *chptr, rb_dlink_list
{ {
if (rb_dlink_list_length(list) >= (chptr->mode.mode & MODE_EXLIMIT ? if (rb_dlink_list_length(list) >= (chptr->mode.mode & MODE_EXLIMIT ?
ConfigChannel.max_bans_large : ConfigChannel.max_bans)) { ConfigChannel.max_bans_large : ConfigChannel.max_bans)) {
return 0; return 1;
} }
return 1; return 0;
} }
/* add_id() /* add_id()
@ -277,7 +277,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid,
if(IsPerson(source_p)) if(IsPerson(source_p))
sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host); rb_sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
else else
rb_strlcpy(who, source_p->name, sizeof(who)); rb_strlcpy(who, source_p->name, sizeof(who));
@ -383,7 +383,7 @@ pretty_mask(const char *idmask)
old_mask_pos = mask_pos; old_mask_pos = mask_pos;
if (*mask == '$') { if (*mask == '$') {
mask_pos += sprintf(mask_buf + mask_pos, "%s", mask) + 1; mask_pos += rb_sprintf(mask_buf + mask_pos, "%s", mask) + 1;
t = mask_buf + old_mask_pos + 1; t = mask_buf + old_mask_pos + 1;
if (*t == '!') if (*t == '!')
*t = '~'; *t = '~';
@ -440,7 +440,7 @@ pretty_mask(const char *idmask)
host[HOSTLEN] = '\0'; host[HOSTLEN] = '\0';
} }
mask_pos += sprintf(mask_buf + mask_pos, "%s!%s@%s", nick, user, host) + 1; mask_pos += rb_sprintf(mask_buf + mask_pos, "%s!%s@%s", nick, user, host) + 1;
/* restore mask, since we may need to use it again later */ /* restore mask, since we may need to use it again later */
if(at) if(at)
@ -1462,7 +1462,7 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0) if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0)
return; return;
sprintf(limitstr, "%d", limit); rb_sprintf(limitstr, "%d", limit);
mode_changes[mode_count].letter = c; mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD; mode_changes[mode_count].dir = MODE_ADD;
@ -1866,7 +1866,7 @@ struct ChannelMode chmode_table[256] = {
{chm_simple, MODE_NOPRIVMSGS }, /* n */ {chm_simple, MODE_NOPRIVMSGS }, /* n */
{chm_op, 0 }, /* o */ {chm_op, 0 }, /* o */
{chm_simple, MODE_PRIVATE }, /* p */ {chm_simple, MODE_PRIVATE }, /* p */
{chm_ban, CHFL_QUIET }, /* q */ {chm_owner, 0 }, /* q */
{chm_simple, MODE_REGONLY }, /* r */ {chm_simple, MODE_REGONLY }, /* r */
{chm_simple, MODE_SECRET }, /* s */ {chm_simple, MODE_SECRET }, /* s */
{chm_simple, MODE_TOPICLIMIT }, /* t */ {chm_simple, MODE_TOPICLIMIT }, /* t */
@ -1874,7 +1874,7 @@ struct ChannelMode chmode_table[256] = {
{chm_voice, 0 }, /* v */ {chm_voice, 0 }, /* v */
{chm_nosuch, 0 }, /* w */ {chm_nosuch, 0 }, /* w */
{chm_nosuch, 0 }, /* x */ {chm_nosuch, 0 }, /* x */
{chm_owner, 0 }, /* y */ {chm_ban, CHFL_QUIET }, /* y */
{chm_simple, MODE_OPMODERATE }, /* z */ {chm_simple, MODE_OPMODERATE }, /* z */
{chm_nosuch, 0 }, /* 0x7b */ {chm_nosuch, 0 }, /* 0x7b */
@ -2102,9 +2102,9 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
return; return;
if(IsServer(source_p)) if(IsServer(source_p))
sprintf(cmdbuf, ":%s MODE %s ", fakesource_p->name, chptr->chname); rb_sprintf(cmdbuf, ":%s MODE %s ", fakesource_p->name, chptr->chname);
else else
sprintf(cmdbuf, ":%s!%s@%s MODE %s ", rb_sprintf(cmdbuf, ":%s!%s@%s MODE %s ",
source_p->name, source_p->username, source_p->name, source_p->username,
source_p->host, chptr->chname); source_p->host, chptr->chname);
@ -2186,7 +2186,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
if(mode_changes[i].arg != NULL) { if(mode_changes[i].arg != NULL) {
paracount++; paracount++;
len = sprintf(pbuf, "%s ", mode_changes[i].arg); len = rb_sprintf(pbuf, "%s ", mode_changes[i].arg);
pbuf += len; pbuf += len;
paralen += len; paralen += len;
} }

View File

@ -329,7 +329,7 @@ check_pings_list(rb_dlink_list * list)
"No response from %s, closing link", "No response from %s, closing link",
log_client_name(client_p, HIDE_IP)); log_client_name(client_p, HIDE_IP));
} }
(void) snprintf(scratch, sizeof(scratch), (void) rb_snprintf(scratch, sizeof(scratch),
"Ping timeout: %d seconds", "Ping timeout: %d seconds",
(int) (rb_current_time() - client_p->localClient->lasttime)); (int) (rb_current_time() - client_p->localClient->lasttime));
@ -759,16 +759,16 @@ get_client_name(struct Client *client, int showip)
/* And finally, let's get the host information, ip or name */ /* And finally, let's get the host information, ip or name */
switch (showip) { switch (showip) {
case SHOW_IP: case SHOW_IP:
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
client->name, client->username, client->name, client->username,
client->sockhost); client->sockhost);
break; break;
case MASK_IP: case MASK_IP:
snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
client->name, client->username); client->name, client->username);
break; break;
default: default:
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
client->name, client->username, client->host); client->name, client->username, client->host);
} }
return nbuf; return nbuf;
@ -799,16 +799,16 @@ log_client_name(struct Client *target_p, int showip)
switch (showip) { switch (showip) {
case SHOW_IP: case SHOW_IP:
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name,
target_p->username, target_p->sockhost); target_p->username, target_p->sockhost);
break; break;
case MASK_IP: case MASK_IP:
snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
target_p->name, target_p->username); target_p->name, target_p->username);
default: default:
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name, rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", target_p->name,
target_p->username, target_p->host); target_p->username, target_p->host);
} }
@ -1064,7 +1064,7 @@ dead_link(struct Client *client_p, int sendqex)
if(sendqex) if(sendqex)
rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice)); rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice));
else else
snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno)); rb_snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno));
abt->client = client_p; abt->client = client_p;
SetIOError(client_p); SetIOError(client_p);
@ -1196,7 +1196,7 @@ exit_remote_server(struct Client *client_p, struct Client *source_p, struct Clie
strcat(comment1, source_p->name); strcat(comment1, source_p->name);
} }
if (IsPerson(from)) if (IsPerson(from))
snprintf(newcomment, sizeof(newcomment), "by %s: %s", rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s",
from->name, comment); from->name, comment);
if(source_p->serv != NULL) if(source_p->serv != NULL)
@ -1274,7 +1274,7 @@ exit_local_server(struct Client *client_p, struct Client *source_p, struct Clien
/* Always show source here, so the server notices show /* Always show source here, so the server notices show
* which side initiated the split -- jilles * which side initiated the split -- jilles
*/ */
snprintf(newcomment, sizeof(newcomment), "by %s: %s", rb_snprintf(newcomment, sizeof(newcomment), "by %s: %s",
from == source_p ? me.name : from->name, comment); from == source_p ? me.name : from->name, comment);
if (!IsIOError(source_p)) if (!IsIOError(source_p))
sendto_one(source_p, "SQUIT %s :%s", use_id(source_p), sendto_one(source_p, "SQUIT %s :%s", use_id(source_p),
@ -1824,7 +1824,7 @@ error_exit_client(struct Client *client_p, int error)
if(error == 0) if(error == 0)
rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg)); rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg));
else else
snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error)); rb_snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error));
exit_client(client_p, client_p, &me, errmsg); exit_client(client_p, client_p, &me, errmsg);
} }

View File

@ -825,15 +825,15 @@ void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line,
s_assert(dict != NULL); s_assert(dict != NULL);
if (dict->id != NULL) if (dict->id != NULL)
snprintf(str, sizeof str, "Dictionary stats for %s (%d)", rb_snprintf(str, sizeof str, "Dictionary stats for %s (%d)",
dict->id, dict->count); dict->id, dict->count);
else else
snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)", rb_snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
(void *)dict, dict->count); (void *)dict, dict->count);
cb(str, privdata); cb(str, privdata);
maxdepth = 0; maxdepth = 0;
sum = stats_recurse(dict->root, 0, &maxdepth); sum = stats_recurse(dict->root, 0, &maxdepth);
snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth); rb_snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth);
cb(str, privdata); cb(str, privdata);
return; return;
} }

View File

@ -377,7 +377,7 @@ write_pidfile(const char *filename)
if((fb = fopen(filename, "w"))) { if((fb = fopen(filename, "w"))) {
unsigned int pid = (unsigned int) getpid(); unsigned int pid = (unsigned int) getpid();
snprintf(buff, sizeof(buff), "%u\n", pid); rb_snprintf(buff, sizeof(buff), "%u\n", pid);
if((fputs(buff, fb) == -1)) { if((fputs(buff, fb) == -1)) {
ilog(L_MAIN, "Error writing %u to pid file %s (%s)", ilog(L_MAIN, "Error writing %u to pid file %s (%s)",
pid, filename, strerror(errno)); pid, filename, strerror(errno));

View File

@ -116,7 +116,7 @@ get_listener_name(const struct Listener *listener)
#endif #endif
port = ntohs(((const struct sockaddr_in *)&listener->addr)->sin_port); port = ntohs(((const struct sockaddr_in *)&listener->addr)->sin_port);
snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port); rb_snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port);
return buf; return buf;
} }
@ -484,7 +484,7 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi
ServerStats.is_ref++; ServerStats.is_ref++;
if(ConfigFileEntry.dline_with_reason) { if(ConfigFileEntry.dline_with_reason) {
len = snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf)); len = rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf));
if (len >= (int)(sizeof(buf)-1)) { if (len >= (int)(sizeof(buf)-1)) {
buf[sizeof(buf) - 3] = '\r'; buf[sizeof(buf) - 3] = '\r';
buf[sizeof(buf) - 2] = '\n'; buf[sizeof(buf) - 2] = '\n';

View File

@ -80,7 +80,7 @@ verify_logfile_access(const char *filename)
rb_free(d); rb_free(d);
if(access(dirname, F_OK) == -1) { if(access(dirname, F_OK) == -1) {
snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - parent directory %s does not exist", filename, dirname); rb_snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - parent directory %s does not exist", filename, dirname);
if(testing_conf || server_state_foreground) if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf);
@ -89,7 +89,7 @@ verify_logfile_access(const char *filename)
if(access(filename, F_OK) == -1) { if(access(filename, F_OK) == -1) {
if(access(dirname, W_OK) == -1) { if(access(dirname, W_OK) == -1) {
snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - access to parent directory %s failed: %s", rb_snprintf(buf, sizeof(buf), "WARNING: Unable to access logfile %s - access to parent directory %s failed: %s",
filename, dirname, strerror(errno)); filename, dirname, strerror(errno));
if(testing_conf || server_state_foreground) if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
@ -99,7 +99,7 @@ verify_logfile_access(const char *filename)
} }
if(access(filename, W_OK) == -1) { if(access(filename, W_OK) == -1) {
snprintf(buf, sizeof(buf), "WARNING: Access denied for logfile %s: %s", filename, strerror(errno)); rb_snprintf(buf, sizeof(buf), "WARNING: Access denied for logfile %s: %s", filename, strerror(errno));
if(testing_conf || server_state_foreground) if(testing_conf || server_state_foreground)
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", buf);
@ -165,10 +165,10 @@ ilog(ilogfile dest, const char *format, ...)
return; return;
va_start(args, format); va_start(args, format);
vsnprintf(buf, sizeof(buf), format, args); rb_vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
snprintf(buf2, sizeof(buf2), "%s %s\n", rb_snprintf(buf2, sizeof(buf2), "%s %s\n",
smalldate(rb_current_time()), buf); smalldate(rb_current_time()), buf);
if(fputs(buf2, logfile) < 0) { if(fputs(buf2, logfile) < 0) {
@ -196,7 +196,7 @@ inotice(const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vsnprintf(buf, sizeof(buf), format, args); rb_vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
_iprint("notice", buf); _iprint("notice", buf);
@ -211,7 +211,7 @@ iwarn(const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vsnprintf(buf, sizeof(buf), format, args); rb_vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
_iprint("warning", buf); _iprint("warning", buf);
@ -226,7 +226,7 @@ ierror(const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vsnprintf(buf, sizeof(buf), format, args); rb_vsnprintf(buf, sizeof(buf), format, args);
va_end(args); va_end(args);
_iprint("error", buf); _iprint("error", buf);
@ -261,7 +261,7 @@ smalldate(time_t ltime)
lt = localtime(&ltime); lt = localtime(&ltime);
snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d", rb_snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d",
lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_year + 1900, lt->tm_mon + 1,
lt->tm_mday, lt->tm_hour, lt->tm_min); lt->tm_mday, lt->tm_hour, lt->tm_min);

View File

@ -749,8 +749,8 @@ static const char * replies[] = {
/* 725 RPL_TESTLINE */ ":%s 725 %s %c %ld %s :%s", /* 725 RPL_TESTLINE */ ":%s 725 %s %c %ld %s :%s",
/* 726 RPL_NOTESTLINE */ ":%s 726 %s %s :No matches", /* 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", /* 727 RPL_TESTMASKGECOS */ ":%s 727 %s %d %d %s!%s@%s %s :Local/remote clients match",
/* 728 RPL_QUIETLIST */ ":%s 728 %s %s q %s %s %lu", /* 728 RPL_QUIETLIST */ ":%s 728 %s %s y %s %s %lu",
/* 729 RPL_ENDOFQUIETLIST */ ":%s 729 %s %s q :End of Channel Quiet List", /* 729 RPL_ENDOFQUIETLIST */ ":%s 729 %s %s y :End of Channel Quiet List",
/* 730 RPL_MONONLINE */ ":%s 730 %s :%s", /* 730 RPL_MONONLINE */ ":%s 730 %s :%s",
/* 731 RPL_MONOFFLINE */ ":%s 731 %s :%s", /* 731 RPL_MONOFFLINE */ ":%s 731 %s :%s",
/* 732 RPL_MONLIST */ ":%s 732 %s :%s", /* 732 RPL_MONLIST */ ":%s 732 %s :%s",

View File

@ -248,7 +248,7 @@ load_all_modules(int warn)
while ((ldirent = readdir(system_module_dir)) != NULL) { while ((ldirent = readdir(system_module_dir)) != NULL) {
len = strlen(ldirent->d_name); len = strlen(ldirent->d_name);
if((len > 3) && !strcmp(ldirent->d_name+len-3, SHARED_SUFFIX)) { if((len > 3) && !strcmp(ldirent->d_name+len-3, SHARED_SUFFIX)) {
(void) snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); (void) rb_snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name);
(void) load_a_module(module_fq_name, warn, 0); (void) load_a_module(module_fq_name, warn, 0);
} }
@ -270,7 +270,7 @@ load_core_modules(int warn)
for (i = 0; core_module_table[i]; i++) { for (i = 0; core_module_table[i]; i++) {
snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, rb_snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH,
core_module_table[i], SHARED_SUFFIX); core_module_table[i], SHARED_SUFFIX);
if(load_a_module(module_name, warn, 1) == -1) { if(load_a_module(module_name, warn, 1) == -1) {
@ -303,7 +303,7 @@ load_one_module(const char *path, int coremodule)
RB_DLINK_FOREACH(pathst, mod_paths.head) { RB_DLINK_FOREACH(pathst, mod_paths.head) {
mpath = pathst->data; mpath = pathst->data;
snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path); rb_snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path);
if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) { if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) {
if(stat(modpath, &statbuf) == 0) { if(stat(modpath, &statbuf) == 0) {
if(S_ISREG(statbuf.st_mode)) { if(S_ISREG(statbuf.st_mode)) {

View File

@ -99,7 +99,7 @@ monitor_signon(struct Client *client_p)
if(monptr == NULL) if(monptr == NULL)
return; return;
snprintf(buf, sizeof(buf), "%s!%s@%s", client_p->name, client_p->username, client_p->host); rb_snprintf(buf, sizeof(buf), "%s!%s@%s", client_p->name, client_p->username, client_p->host);
sendto_monitor(monptr, form_str(RPL_MONONLINE), me.name, "*", buf); sendto_monitor(monptr, form_str(RPL_MONONLINE), me.name, "*", buf);
} }

View File

@ -1814,7 +1814,7 @@ conf_report_error(const char *fmt, ...)
char msg[IRCD_BUFSIZE + 1] = { 0 }; char msg[IRCD_BUFSIZE + 1] = { 0 };
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); rb_vsnprintf(msg, IRCD_BUFSIZE, fmt, ap);
va_end(ap); va_end(ap);
if (testing_conf) { if (testing_conf) {

View File

@ -330,7 +330,7 @@ handle_command(struct Message *mptr, struct Client *client_p,
ilog(L_SERVER, ilog(L_SERVER,
"Insufficient parameters (%d < %d) for command '%s' from %s.", "Insufficient parameters (%d < %d) for command '%s' from %s.",
i, ehandler.min_para, mptr->cmd, client_p->name); i, ehandler.min_para, mptr->cmd, client_p->name);
snprintf(squitreason, sizeof squitreason, rb_snprintf(squitreason, sizeof squitreason,
"Insufficient parameters (%d < %d) for command '%s'", "Insufficient parameters (%d < %d) for command '%s'",
i, ehandler.min_para, mptr->cmd); i, ehandler.min_para, mptr->cmd);
exit_client(client_p, client_p, client_p, squitreason); exit_client(client_p, client_p, client_p, squitreason);
@ -567,10 +567,10 @@ do_numeric(char numeric[], struct Client *client_p, struct Client *source_p, int
int i; int i;
int tl; /* current length of presently being built string in t */ int tl; /* current length of presently being built string in t */
for (i = 2; i < (parc - 1); i++) { for (i = 2; i < (parc - 1); i++) {
tl = sprintf(t, " %s", parv[i]); tl = rb_sprintf(t, " %s", parv[i]);
t += tl; t += tl;
} }
sprintf(t, " :%s", parv[parc - 1]); rb_sprintf(t, " :%s", parv[parc - 1]);
} }
if((target_p = find_client(parv[1])) != NULL) { if((target_p = find_client(parv[1])) != NULL) {

View File

@ -444,7 +444,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr; const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr;
cp = (const unsigned char *)&v4->sin_addr.s_addr; cp = (const unsigned char *)&v4->sin_addr.s_addr;
sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]), rb_sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]),
(unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0])); (unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0]));
} }
#ifdef RB_IPV6 #ifdef RB_IPV6

View File

@ -76,7 +76,7 @@ server_reboot(void)
execv(SPATH, (void *)myargv); execv(SPATH, (void *)myargv);
/* use this if execv of SPATH fails */ /* use this if execv of SPATH fails */
snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath); rb_snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath);
execv(path, (void *)myargv); execv(path, (void *)myargv);
exit(-1); exit(-1);

View File

@ -503,7 +503,7 @@ auth_connect_callback(rb_fde_t *F, int error, void *data)
return; return;
} }
snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", rb_snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n",
auth->rport, auth->lport); auth->rport, auth->lport);
if(rb_write(auth->F, authbuf, strlen(authbuf)) != strlen(authbuf)) { if(rb_write(auth->F, authbuf, strlen(authbuf)) != strlen(authbuf)) {

View File

@ -947,8 +947,8 @@ validate_conf(void)
cflag_orphan('Q'); cflag_orphan('Q');
continue; continue;
} }
if(*dm == 'q') { if(*dm == 'y') {
cflag_orphan('q'); cflag_orphan('y');
continue; continue;
} }
if(*dm == 'I') { if(*dm == 'I') {
@ -1002,6 +1002,9 @@ validate_conf(void)
cflag_orphan('M'); cflag_orphan('M');
continue; continue;
} }
if(*dm == 'u') {
cflag_orphan('u');
}
} }
} }
construct_cflag_param_string(); construct_cflag_param_string();
@ -1310,13 +1313,13 @@ get_oper_name(struct Client *client_p)
static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5]; static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
if(MyOper(client_p)) { if(MyOper(client_p)) {
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
client_p->name, client_p->username, client_p->name, client_p->username,
client_p->host, client_p->localClient->opername); client_p->host, client_p->localClient->opername);
return buffer; return buffer;
} }
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
client_p->name, client_p->username, client_p->name, client_p->username,
client_p->host, client_p->servptr->name); client_p->host, client_p->servptr->name);
return buffer; return buffer;
@ -1360,7 +1363,7 @@ get_user_ban_reason(struct ConfItem *aconf)
if (aconf->flags & CONF_FLAGS_TEMPORARY && if (aconf->flags & CONF_FLAGS_TEMPORARY &&
(aconf->status == CONF_KILL || aconf->status == CONF_DLINE)) (aconf->status == CONF_KILL || aconf->status == CONF_DLINE))
snprintf(reasonbuf, sizeof reasonbuf, rb_snprintf(reasonbuf, sizeof reasonbuf,
"Temporary %c-line %d min. - ", "Temporary %c-line %d min. - ",
aconf->status == CONF_DLINE ? 'D' : 'K', aconf->status == CONF_DLINE ? 'D' : 'K',
(int)((aconf->hold - aconf->created) / 60)); (int)((aconf->hold - aconf->created) / 60));
@ -1394,7 +1397,7 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
if(!IsOper(source_p)) if(!IsOper(source_p))
*oper_reason = NULL; *oper_reason = NULL;
else { else {
snprintf(operreasonbuf, sizeof operreasonbuf, "%s%s(%s)", rb_snprintf(operreasonbuf, sizeof operreasonbuf, "%s%s(%s)",
EmptyString(aconf->spasswd) ? "" : aconf->spasswd, EmptyString(aconf->spasswd) ? "" : aconf->spasswd,
EmptyString(aconf->spasswd) ? "" : " ", EmptyString(aconf->spasswd) ? "" : " ",
aconf->info.oper); aconf->info.oper);

View File

@ -193,7 +193,7 @@ propagate_generic(struct Client *source_p, const char *command,
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vsnprintf(buffer, sizeof(buffer), format, args); rb_vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args); va_end(args);
sendto_match_servs(source_p, target, cap, NOCAPS, sendto_match_servs(source_p, target, cap, NOCAPS,
@ -214,7 +214,7 @@ cluster_generic(struct Client *source_p, const char *command,
rb_dlink_node *ptr; rb_dlink_node *ptr;
va_start(args, format); va_start(args, format);
vsnprintf(buffer, sizeof(buffer), format, args); rb_vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args); va_end(args);
RB_DLINK_FOREACH(ptr, cluster_conf_list.head) { RB_DLINK_FOREACH(ptr, cluster_conf_list.head) {

View File

@ -29,8 +29,6 @@
#include <openssl/rsa.h> #include <openssl/rsa.h>
#endif #endif
#include <rb_snprintf.h>
#include "s_serv.h" #include "s_serv.h"
#include "class.h" #include "class.h"
#include "client.h" #include "client.h"
@ -73,26 +71,27 @@ static char buf[BUFSIZE];
* extra argument to "PASS" takes care of checking that. -orabidoo * extra argument to "PASS" takes care of checking that. -orabidoo
*/ */
struct Capability captab[] = { struct Capability captab[] = {
/* name cap */ /*name cap required?*/
{ "QS", CAP_QS }, { "QS", CAP_QS, 1 },
{ "EX", CAP_EX }, { "EX", CAP_EX, 1 },
{ "CHW", CAP_CHW}, { "CHW", CAP_CHW, 0 },
{ "IE", CAP_IE}, { "IE", CAP_IE, 0 },
{ "KLN", CAP_KLN}, { "KLN", CAP_KLN, 0 },
{ "KNOCK", CAP_KNOCK}, { "KNOCK", CAP_KNOCK, 0 },
{ "ZIP", CAP_ZIP}, { "ZIP", CAP_ZIP, 0 },
{ "TB", CAP_TB}, { "TB", CAP_TB, 1 },
{ "UNKLN", CAP_UNKLN}, { "UNKLN", CAP_UNKLN, 0 },
{ "CLUSTER", CAP_CLUSTER}, { "CLUSTER",CAP_CLUSTER, 0 },
{ "ENCAP", CAP_ENCAP }, { "ENCAP", CAP_ENCAP, 1 },
{ "SERVICES", CAP_SERVICE }, { "SERVICES",CAP_SERVICE, 1 },
{ "RSFNC", CAP_RSFNC }, { "RSFNC", CAP_RSFNC, 0 },
{ "SAVE", CAP_SAVE }, { "SAVE", CAP_SAVE, 0 },
{ "EUID", CAP_EUID }, { "EUID", CAP_EUID, 1 },
{ "EOPMOD", CAP_EOPMOD }, { "EOPMOD", CAP_EOPMOD, 0 },
{ "BAN", CAP_BAN }, { "BAN", CAP_BAN, 0 },
{ "MLOCK", CAP_MLOCK }, { "MLOCK", CAP_MLOCK, 1 },
{0, 0} { "QAOHV", CAP_QAOHV, 0 },
{ 0, 0, 0 }
}; };
static CNCB serv_connect_callback; static CNCB serv_connect_callback;
@ -377,7 +376,7 @@ send_capabilities(struct Client *client_p, int cap_can_send)
for (cap = captab; cap->name; ++cap) { for (cap = captab; cap->name; ++cap) {
if(cap->cap & cap_can_send) { if(cap->cap & cap_can_send) {
tl = sprintf(t, "%s ", cap->name); tl = rb_sprintf(t, "%s ", cap->name);
t += tl; t += tl;
} }
} }
@ -472,8 +471,8 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
int mlen; int mlen;
int cur_len; int cur_len;
cur_len = mlen = sprintf(buf, ":%s BMASK %ld %s %c :", cur_len = mlen = rb_sprintf(buf, ":%s BMASK %ld %s %c :",
me.id, (long) chptr->channelts, chptr->chname, flag); me.id, (long) chptr->channelts, chptr->chname, flag);
t = buf + mlen; t = buf + mlen;
RB_DLINK_FOREACH(ptr, list->head) { RB_DLINK_FOREACH(ptr, list->head) {
@ -496,7 +495,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
t = buf + mlen; t = buf + mlen;
} }
sprintf(t, "%s ", banptr->banstr); rb_sprintf(t, "%s ", banptr->banstr);
t += tlen; t += tlen;
cur_len += tlen; cur_len += tlen;
} }
@ -600,9 +599,9 @@ burst_TS6(struct Client *client_p)
if(*chptr->chname != '#') if(*chptr->chname != '#')
continue; continue;
cur_len = mlen = sprintf(buf, ":%s SJOIN %ld %s %s :", me.id, cur_len = mlen = rb_sprintf(buf, ":%s SJOIN %ld %s %s :", me.id,
(long) chptr->channelts, chptr->chname, (long) chptr->channelts, chptr->chname,
channel_modes(chptr, client_p)); channel_modes(chptr, client_p));
t = buf + mlen; t = buf + mlen;
@ -628,8 +627,8 @@ burst_TS6(struct Client *client_p)
t = buf + mlen; t = buf + mlen;
} }
sprintf(t, "%s%s ", find_channel_status(msptr, 1), rb_sprintf(t, "%s%s ", find_channel_status(msptr, 1),
use_id(msptr->client_p)); use_id(msptr->client_p));
cur_len += tlen; cur_len += tlen;
t += tlen; t += tlen;
@ -660,7 +659,7 @@ burst_TS6(struct Client *client_p)
burst_modes_TS6(client_p, chptr, &chptr->invexlist, 'I'); burst_modes_TS6(client_p, chptr, &chptr->invexlist, 'I');
if(rb_dlink_list_length(&chptr->quietlist) > 0) if(rb_dlink_list_length(&chptr->quietlist) > 0)
burst_modes_TS6(client_p, chptr, &chptr->quietlist, 'q'); burst_modes_TS6(client_p, chptr, &chptr->quietlist, 'y');
if(IsCapable(client_p, CAP_TB) && chptr->topic != NULL) if(IsCapable(client_p, CAP_TB) && chptr->topic != NULL)
sendto_one(client_p, ":%s TB %s %ld %s%s:%s", sendto_one(client_p, ":%s TB %s %ld %s%s:%s",
@ -706,7 +705,7 @@ show_capabilities(struct Client *target_p)
for (cap = captab; cap->cap; ++cap) { for (cap = captab; cap->cap; ++cap) {
if(cap->cap & target_p->serv->caps) if(cap->cap & target_p->serv->caps)
snprintf_append(msgbuf, sizeof(msgbuf), " %s", cap->name); rb_snprintf_append(msgbuf, sizeof(msgbuf), " %s", cap->name);
} }
return msgbuf + 1; return msgbuf + 1;
@ -841,7 +840,7 @@ server_estab(struct Client *client_p)
hdata.target = client_p; hdata.target = client_p;
call_hook(h_server_introduced, &hdata); call_hook(h_server_introduced, &hdata);
snprintf(note, sizeof(note), "Server: %s", client_p->name); rb_snprintf(note, sizeof(note), "Server: %s", client_p->name);
rb_note(client_p->localClient->F, note); rb_note(client_p->localClient->F, note);
/* /*
@ -1109,7 +1108,7 @@ serv_connect(struct server_conf *server_p, struct Client *by)
return 0; return 0;
} }
snprintf(note, sizeof note, "Server: %s", server_p->name); rb_snprintf(note, sizeof note, "Server: %s", server_p->name);
rb_note(F, note); rb_note(F, note);
/* Create a local client */ /* Create a local client */

View File

@ -295,7 +295,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1); rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
add_to_client_hash(source_p->name, source_p); add_to_client_hash(source_p->name, source_p);
snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name); rb_snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name);
rb_note(source_p->localClient->F, note); rb_note(source_p->localClient->F, note);
} }
@ -469,7 +469,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
ServerStats.is_ref++; ServerStats.is_ref++;
sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains " sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains "
"only alphanumeric characters."); "only alphanumeric characters.");
sprintf(tmpstr2, "Invalid username [%s]", source_p->username); rb_sprintf(tmpstr2, "Invalid username [%s]", source_p->username);
exit_client(client_p, source_p, &me, tmpstr2); exit_client(client_p, source_p, &me, tmpstr2);
return (CLIENT_EXITED); return (CLIENT_EXITED);
} }
@ -1435,7 +1435,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
mptr = mode; mptr = mode;
if(is_owner(mscptr)) { if(is_owner(mscptr)) {
*mptr++ = 'y'; *mptr++ = 'q';
strcat(modeval, nick); strcat(modeval, nick);
strcat(modeval, " "); strcat(modeval, " ");
} }

View File

@ -460,7 +460,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
current_serial++; current_serial++;
va_start(args, pattern); va_start(args, pattern);
vsnprintf(buf, sizeof(buf), pattern, args); rb_vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
if(IsServer(source_p)) if(IsServer(source_p))
@ -881,7 +881,7 @@ sendto_match_butone(struct Client *one, struct Client *source_p,
rb_linebuf_newbuf(&rb_linebuf_id); rb_linebuf_newbuf(&rb_linebuf_id);
va_start(args, pattern); va_start(args, pattern);
vsnprintf(buf, sizeof(buf), pattern, args); rb_vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
if(IsServer(source_p)) if(IsServer(source_p))
@ -946,7 +946,7 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
rb_linebuf_newbuf(&rb_linebuf_id); rb_linebuf_newbuf(&rb_linebuf_id);
va_start(args, pattern); va_start(args, pattern);
vsnprintf(buf, sizeof(buf), pattern, args); rb_vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL,
@ -1082,7 +1082,7 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...)
if (level & L_NETWIDE && ConfigFileEntry.global_snotices) { if (level & L_NETWIDE && ConfigFileEntry.global_snotices) {
/* rather a lot of copying around, oh well -- jilles */ /* rather a lot of copying around, oh well -- jilles */
va_start(args, pattern); va_start(args, pattern);
vsnprintf(buf, sizeof(buf), pattern, args); rb_vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&linebuf, pattern, NULL, rb_linebuf_putmsg(&linebuf, pattern, NULL,
":%s NOTICE * :*** Notice -- %s", me.name, buf); ":%s NOTICE * :*** Notice -- %s", me.name, buf);
@ -1094,7 +1094,7 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...)
} else if (remote_rehash_oper_p != NULL) { } else if (remote_rehash_oper_p != NULL) {
/* rather a lot of copying around, oh well -- jilles */ /* rather a lot of copying around, oh well -- jilles */
va_start(args, pattern); va_start(args, pattern);
vsnprintf(buf, sizeof(buf), pattern, args); rb_vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&linebuf, pattern, NULL, rb_linebuf_putmsg(&linebuf, pattern, NULL,
":%s NOTICE * :*** Notice -- %s", me.name, buf); ":%s NOTICE * :*** Notice -- %s", me.name, buf);
@ -1252,7 +1252,7 @@ kill_client_serv_butone(struct Client *one, struct Client *target_p, const char
rb_linebuf_newbuf(&rb_linebuf_id); rb_linebuf_newbuf(&rb_linebuf_id);
va_start(args, pattern); va_start(args, pattern);
vsnprintf(buf, sizeof(buf), pattern, args); rb_vsnprintf(buf, sizeof(buf), pattern, args);
va_end(args); va_end(args);
rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s KILL %s :%s", rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s KILL %s :%s",

View File

@ -252,10 +252,10 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
last_spin = rb_current_time(); last_spin = rb_current_time();
if(ssld_path == NULL) { if(ssld_path == NULL) {
snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix); rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix);
if(access(fullpath, X_OK) == -1) { if(access(fullpath, X_OK) == -1) {
snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s", rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s",
ConfigFileEntry.dpath, suffix); ConfigFileEntry.dpath, suffix);
if(access(fullpath, X_OK) == -1) { if(access(fullpath, X_OK) == -1) {
ilog(L_MAIN, ilog(L_MAIN,
@ -279,15 +279,15 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
rb_set_buffers(F1, READBUF_SIZE); rb_set_buffers(F1, READBUF_SIZE);
rb_set_buffers(F2, READBUF_SIZE); rb_set_buffers(F2, READBUF_SIZE);
snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2)); rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2));
rb_setenv("CTL_FD", fdarg, 1); rb_setenv("CTL_FD", fdarg, 1);
if(rb_pipe(&P1, &P2, "SSL/TLS pipe") == -1) { if(rb_pipe(&P1, &P2, "SSL/TLS pipe") == -1) {
ilog(L_MAIN, "Unable to create ssld - rb_pipe failed: %s", strerror(errno)); ilog(L_MAIN, "Unable to create ssld - rb_pipe failed: %s", strerror(errno));
return started; return started;
} }
snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1)); rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1));
rb_setenv("CTL_PIPE", fdarg, 1); rb_setenv("CTL_PIPE", fdarg, 1);
snprintf(s_pid, sizeof(s_pid), "%d", (int)getpid()); rb_snprintf(s_pid, sizeof(s_pid), "%d", (int)getpid());
rb_setenv("CTL_PPID", s_pid, 1); rb_setenv("CTL_PPID", s_pid, 1);
#ifdef _WIN32 #ifdef _WIN32
SetHandleInformation((HANDLE) rb_get_fd(F2), HANDLE_FLAG_INHERIT, 1); SetHandleInformation((HANDLE) rb_get_fd(F2), HANDLE_FLAG_INHERIT, 1);
@ -404,7 +404,7 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
rb_free(client_p->certfp); rb_free(client_p->certfp);
certfp_string = rb_malloc(RB_SSL_CERTFP_LEN * 2 + 1); certfp_string = rb_malloc(RB_SSL_CERTFP_LEN * 2 + 1);
for(i = 0; i < RB_SSL_CERTFP_LEN; i++) for(i = 0; i < RB_SSL_CERTFP_LEN; i++)
snprintf(certfp_string + 2 * i, 3, "%02x", rb_snprintf(certfp_string + 2 * i, 3, "%02x",
certfp[i]); certfp[i]);
client_p->certfp = certfp_string; client_p->certfp = certfp_string;
} }
@ -580,7 +580,7 @@ send_new_ssl_certs_one(ssl_ctl_t * ctl, const char *ssl_cert, const char *ssl_pr
len, sizeof(tmpbuf)); len, sizeof(tmpbuf));
return; return;
} }
len = snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c", nul, ssl_cert, nul, len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c", nul, ssl_cert, nul,
ssl_private_key, nul, ssl_dh_params, nul); ssl_private_key, nul, ssl_dh_params, nul);
ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len); ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len);
} }
@ -608,7 +608,7 @@ send_init_prng(ssl_ctl_t * ctl, prng_seed_t seedtype, const char *path)
return; return;
} }
len = snprintf(tmpbuf, sizeof(tmpbuf), "I%c%s%c", seed, s, nul); len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "I%c%s%c", seed, s, nul);
ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len); ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len);
} }

View File

@ -190,7 +190,7 @@ const char *
isupport_intptr(const void *ptr) isupport_intptr(const void *ptr)
{ {
static char buf[15]; static char buf[15];
snprintf(buf, sizeof buf, "%d", *(const int *)ptr); rb_snprintf(buf, sizeof buf, "%d", *(const int *)ptr);
return buf; return buf;
} }
@ -219,10 +219,10 @@ isupport_chanmodes(const void *ptr)
{ {
static char result[80]; static char result[80];
snprintf(result, sizeof result, "%s%sb%s,k,%sl%s,%s", rb_snprintf(result, sizeof result, "%s%sb%s,k,%sl%s,%s",
ConfigChannel.use_except ? "e" : "", ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "", ConfigChannel.use_invex ? "I" : "",
strchr(ConfigChannel.disabledmodes, 'q') ? "" : "q", strchr(ConfigChannel.disabledmodes, 'y') ? "" : "y",
ConfigChannel.use_forward ? "f" : "", ConfigChannel.use_forward ? "f" : "",
strchr(ConfigChannel.disabledmodes, 'j') ? "" : "j", strchr(ConfigChannel.disabledmodes, 'j') ? "" : "j",
cflagsbuf); cflagsbuf);
@ -240,7 +240,7 @@ isupport_chanlimit(const void *ptr)
{ {
static char result[30]; static char result[30];
snprintf(result, sizeof result, "%s:%i", rb_snprintf(result, sizeof result, "%s:%i",
ConfigChannel.use_local_channels ? "&#" : "#", ConfigChannel.use_local_channels ? "&#" : "#",
ConfigChannel.max_chans_per_user); ConfigChannel.max_chans_per_user);
return result; return result;
@ -251,12 +251,12 @@ isupport_prefix(const void *ptr)
{ {
static char result[13]; static char result[13];
snprintf(result, sizeof result, "(%s%so%sv)%s%s@%s+", rb_snprintf(result, sizeof result, "(%s%so%sv)%s%s@%s+",
ConfigChannel.use_owner ? "y" : "", ConfigChannel.use_owner ? "q" : "",
ConfigChannel.use_admin ? "a" : "", ConfigChannel.use_admin ? "a" : "",
ConfigChannel.use_halfop ? "h" : "", ConfigChannel.use_halfop ? "h" : "",
ConfigChannel.use_owner ? "~" : "", ConfigChannel.use_owner ? "~" : "",
ConfigChannel.use_admin ? "!" : "", ConfigChannel.use_admin ? "&" : "",
ConfigChannel.use_halfop ? "%" : ""); ConfigChannel.use_halfop ? "%" : "");
return result; return result;
} }
@ -266,7 +266,7 @@ isupport_maxlist(const void *ptr)
{ {
static char result[30]; static char result[30];
snprintf(result, sizeof result, "bq%s%s:%i", rb_snprintf(result, sizeof result, "bq%s%s:%i",
ConfigChannel.use_except ? "e" : "", ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "", ConfigChannel.use_invex ? "I" : "",
ConfigChannel.max_bans); ConfigChannel.max_bans);
@ -278,7 +278,7 @@ isupport_targmax(const void *ptr)
{ {
static char result[200]; static char result[200];
snprintf(result, sizeof result, "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:%d,NOTICE:%d,ACCEPT:,MONITOR:", rb_snprintf(result, sizeof result, "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:%d,NOTICE:%d,ACCEPT:,MONITOR:",
ConfigFileEntry.max_targets, ConfigFileEntry.max_targets,
ConfigFileEntry.max_targets); ConfigFileEntry.max_targets);
return result; return result;
@ -293,7 +293,7 @@ isupport_extban(const void *ptr)
p = get_extban_string(); p = get_extban_string();
if (EmptyString(p)) if (EmptyString(p))
return NULL; return NULL;
snprintf(result, sizeof result, "$,%s", p); rb_snprintf(result, sizeof result, "$,%s", p);
return result; return result;
} }
@ -305,7 +305,7 @@ isupport_ownermode(const void *ptr)
if(!ConfigChannel.use_owner) if(!ConfigChannel.use_owner)
return NULL; return NULL;
snprintf(result, sizeof result, "y"); rb_snprintf(result, sizeof result, "q");
return result; return result;
} }

View File

@ -267,7 +267,7 @@ close_conn(conn_t * conn, int wait_plain, const char *fmt, ...)
rb_setselect(conn->plain_fd, RB_SELECT_READ, conn_plain_read_shutdown_cb, conn); rb_setselect(conn->plain_fd, RB_SELECT_READ, conn_plain_read_shutdown_cb, conn);
rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL); rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL);
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(reason, sizeof(reason), fmt, ap); rb_vsnprintf(reason, sizeof(reason), fmt, ap);
va_end(ap); va_end(ap);
buf[0] = 'D'; buf[0] = 'D';
@ -758,7 +758,7 @@ process_stats(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb)
if(conn == NULL) if(conn == NULL)
return; return;
snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata, rb_snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata,
conn->plain_out, conn->mod_in, conn->plain_in, conn->mod_out); conn->plain_out, conn->mod_in, conn->plain_in, conn->mod_out);
conn->plain_out = 0; conn->plain_out = 0;
conn->plain_in = 0; conn->plain_in = 0;

66
testsuite/astyle/check_style.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash -e
set -x
cd ../..
for file in $(find **/*.c)
do
if [[ $file = "bandb/sqlite3.c" ]]
then
continue
fi
if [[ $file = "src/lex.yy.c" ]]
then
continue
fi
if [[ $file = "src/y.tab.c" ]]
then
continue
fi
if [[ $file = "tools/convertilines.c" ]]
then
continue
fi
if [[ $file = "tools/convertklines.c" ]]
then
continue
fi
if [[ $file = "tools/mkpasswd.c" ]]
then
continue
fi
if [[ $file = "tools/viconf.c" ]]
then
continue
fi
if [[ $file = "unsupported/make_override_immune.c" ]]
then
continue
fi
if [[ $file = "unsupported/m_clearchan.c" ]]
then
continue
fi
if [[ $file = "unsupported/sno_channeljoin.c" ]]
then
continue
fi
if [[ $(astyle --style=linux --mode=c -n $file 2>&1 | cut -f1 -d' ') = "Unchanged" ]]
then
echo "$file passed coding standards"
else
echo "$file is not at coding standards."
exit 1
fi
done

View File

@ -0,0 +1,3 @@
FROM elemental:7.0-qaohv
ADD ircd.conf /home/ircd/run/etc/ircd.conf

View File

@ -0,0 +1,585 @@
/* doc/example.conf - brief example configuration file
*
* Copyright (C) 2000-2002 Hybrid Development Team
* Copyright (C) 2002-2005 ircd-ratbox development team
* Copyright (C) 2005-2006 charybdis development team
*
* $Id: example.conf 3582 2007-11-17 21:55:48Z jilles $
*
* See reference.conf for more information.
*/
/* Extensions */
#loadmodule "extensions/chm_adminonly.so";
loadmodule "extensions/chm_operonly.so";
#loadmodule "extensions/chm_sslonly.so";
#loadmodule "extensions/chm_operonly_compat.so";
#loadmodule "extensions/chm_quietunreg_compat.so";
#loadmodule "extensions/chm_sslonly_compat.so";
#loadmodule "extensions/createauthonly.so";
loadmodule "extensions/extb_account.so";
loadmodule "extensions/extb_canjoin.so";
loadmodule "extensions/extb_channel.so";
loadmodule "extensions/extb_extgecos.so";
loadmodule "extensions/extb_oper.so";
loadmodule "extensions/extb_realname.so";
#loadmodule "extensions/extb_server.so";
#loadmodule "extensions/extb_ssl.so";
#loadmodule "extensions/hurt.so";
loadmodule "extensions/ip_cloaking.so";
#loadmodule "extensions/m_findforwards.so";
loadmodule "extensions/m_identify.so";
loadmodule "extensions/m_mkpasswd.so";
loadmodule "extensions/m_webirc.so";
#loadmodule "extensions/m_cycle.so";
#loadmodule "extensions/m_oaccept.so";
#loadmodule "extensions/m_opme.so";
#loadmodule "extensions/m_ojoin.so";
#loadmodule "extensions/m_omode.so";
#loadmodule "extensions/m_olist.so";
#loadmodule "extensions/m_okick.so";
#loadmodule "extensions/m_force.so";
#loadmodule "extensions/m_roleplay.so";
#loadmodule "extensions/no_oper_invis.so";
loadmodule "extensions/sno_farconnect.so";
loadmodule "extensions/sno_globalkline.so";
loadmodule "extensions/sno_globaloper.so";
#loadmodule "extensions/sno_whois.so";
serverinfo {
name = "rarity.shadownet.int";
sid = "47G";
description = "Rarity >_<";
network_name = "ShadowNET";
network_desc = "Help I need muffin";
helpchan = "#help";
helpurl = "http://www.mynet.net/help";
hub = yes;
/* On multi-homed hosts you may need the following. These define
* the addresses we connect from to other servers. */
/* for IPv4 */
#vhost = "192.169.0.1";
/* for IPv6 */
#vhost6 = "3ffe:80e8:546::2";
/* ssl_private_key: our ssl private key */
ssl_private_key = "etc/ssl.key";
/* ssl_cert: certificate for our ssl server */
ssl_cert = "etc/ssl.cert";
/* ssl_dh_params: DH parameters, generate with openssl dhparam -out dh.pem 1024 */
ssl_dh_params = "etc/dh.pem";
/* ssld_count: number of ssld processes you want to start, if you
* have a really busy server, using N-1 where N is the number of
* cpu/cpu cores you have might be useful. A number greater than one
* can also be useful in case of bugs in ssld and because ssld needs
* two file descriptors per SSL connection.
*/
ssld_count = 1;
/* default max clients: the default maximum number of clients
* allowed to connect. This can be changed once ircd has started by
* issuing:
* /quote set maxclients <limit>
*/
default_max_clients = 1024;
};
admin {
name = "Lazy admin (lazya)";
description = "AthemeNET client server";
email = "nobody@127.0.0.1";
};
log {
fname_userlog = "logs/userlog";
#fname_fuserlog = "logs/fuserlog";
fname_operlog = "logs/operlog";
#fname_foperlog = "logs/foperlog";
fname_serverlog = "logs/serverlog";
#fname_klinelog = "logs/klinelog";
fname_killlog = "logs/killlog";
fname_operspylog = "logs/operspylog";
#fname_ioerrorlog = "logs/ioerror";
};
/* class {} blocks MUST be specified before anything that uses them. That
* means they must be defined before auth {} and before connect {}.
*/
class "users" {
ping_time = 2 minutes;
number_per_ident = 10;
number_per_ip = 10;
number_per_ip_global = 50;
cidr_ipv4_bitlen = 24;
cidr_ipv6_bitlen = 64;
number_per_cidr = 200;
max_number = 3000;
sendq = 400 kbytes;
};
class "opers" {
ping_time = 5 minutes;
number_per_ip = 10;
max_number = 1000;
sendq = 1 megabyte;
};
class "server" {
ping_time = 5 minutes;
connectfreq = 5 minutes;
max_number = 1;
sendq = 4 megabytes;
};
listen {
/* If you want to listen on a specific IP only, specify host.
* host definitions apply only to the following port line.
*/
#host = "192.169.0.1";
port = 5000, 6665 .. 6669;
sslport = 6697;
/* Listen on IPv6 (if you used host= above). */
#host = "3ffe:1234:a:b:c::d";
#port = 5000, 6665 .. 6669;
#sslport = 9999;
};
connect "services.int" {
host = "*";
send_password = "dev";
accept_password = "dev";
port = 6667;
flags = topicburst;
class = "server";
};
connect "tetra.int" {
host = "*";
send_password = "dev";
accept_password = "dev";
port = 6667;
flags = topicburst;
class = "server";
};
connect "ardreth.shadownet.int" {
host = "*";
send_password = "dev";
accept_password = "dev";
port = 6667;
flags = topicburst;
class = "server";
};
connect "janus.shadownet.int" {
host = "*";
send_password = "dev";
accept_password = "dev";
port = 6667;
class = "server";
hub_mask = "*";
};
/* auth {}: allow users to connect to the ircd (OLD I:)
* auth {} blocks MUST be specified in order of precedence. The first one
* that matches a user will be used. So place spoofs first, then specials,
* then general access, then restricted.
*/
auth {
/* user: the user@host allowed to connect. Multiple IPv4/IPv6 user
* lines are permitted per auth block. This is matched against the
* hostname and IP address (using :: shortening for IPv6 and
* prepending a 0 if it starts with a colon) and can also use CIDR
* masks.
*/
user = "*@172.16.0.0/12";
user = "*test@123D:B567:*";
/* auth_user: The username (authenticated via SASL or PASS) allowed
* to connect. You are able to put multiple auth_user lines. If people
* are authenticating via SASL in this way, it is recommended to comment
* out the password option below. You will also *NEED* to specify a user
* line above auth_user, this can safely be "*@*", however.
*/
auth_user = "jilles";
auth_user = "jdhore";
/* password: an optional password that is required to use this block.
* By default this is not encrypted, specify the flag "encrypted" in
* flags = ...; below if it is.
*/
password = "letmein";
/* spoof: fake the users user@host to be be this. You may either
* specify a host or a user@host to spoof to. This is free-form,
* just do everyone a favour and dont abuse it. (OLD I: = flag)
*/
spoof = "I.still.hate.packets";
/* autojoin: Channel (or channels, comma-seperated) to join users
* in this auth block to on connect. Note that this won't join
* the user through any bans or otherwise restrictive chmodes.
*/
autojoin = "#shadowircd,#test";
/* autojoin_opers : Channel (or channels, comma-seperated) to join
* opers to on oper-up.
*/
autojoin_opers = "#opers,#help";
/* Possible flags in auth:
*
* encrypted | password is encrypted with mkpasswd
* spoof_notice | give a notice when spoofing hosts
* exceed_limit (old > flag) | allow user to exceed class user limits
* kline_exempt (old ^ flag) | exempt this user from k/g/xlines&dnsbls
* dnsbl_exempt | exempt this user from dnsbls
* spambot_exempt | exempt this user from spambot checks
* shide_exempt | exempt this user from serverhiding
* jupe_exempt | exempt this user from generating
* warnings joining juped channels
* resv_exempt | exempt this user from resvs
* flood_exempt | exempt this user from flood limits
* USE WITH CAUTION.
* no_tilde (old - flag) | don't prefix ~ to username if no ident
* need_ident (old + flag) | require ident for user in this class
* need_ssl | require SSL/TLS for user in this class
* need_sasl | require SASL id for user in this class
*/
flags = kline_exempt, exceed_limit;
/* class: the class the user is placed in */
class = "opers";
};
/* Example WEBIRC authblock */
auth {
/* user: webirc@IP.OF.YOUR.WEBIRC . the webirc@ part is required */
user = "webirc@192.168.1.1";
/* password: password the webirc client sends in the WEBIRC command.
* You can use a encrypted password here (see above auth block).
*/
password = "<password>";
/* spoof: This is required to keep it what it is currently if you
* want the webirc client to show the users' real host as their
* host on IRC.
*/
spoof = "webirc.";
class = "users";
};
auth {
user = "*@*";
class = "users";
};
/* privset {} blocks MUST be specified before anything that uses them. That
* means they must be defined before operator {}.
*/
privset "local_op" {
privs = oper:local_kill, oper:operwall;
};
privset "server_bot" {
extends = "local_op";
privs = oper:kline, oper:remoteban, snomask:nick_changes;
};
privset "global_op" {
extends = "local_op";
privs = oper:global_kill, oper:routing, oper:kline, oper:unkline, oper:xline,
oper:resv, oper:mass_notice, oper:remoteban;
};
privset "admin" {
extends = "global_op";
privs = oper:admin, oper:die, oper:rehash, oper:spy, oper:override;
};
operator "god" {
/* name: the name of the oper must go above */
/* user: the user@host required for this operator. CIDR *is*
* supported now. auth{} spoofs work here, other spoofs do not.
* multiple user="" lines are supported.
*/
user = "*@*";
/* password: the password required to oper. Unless ~encrypted is
* contained in flags = ...; this will need to be encrypted using
* mkpasswd, MD5 is supported
*/
password = "test";
/* rsa key: the public key for this oper when using Challenge.
* A password should not be defined when this is used, see
* doc/challenge.txt for more information.
*/
#rsa_public_key_file = "/usr/local/ircd/etc/oper.pub";
/* umodes: the specific umodes this oper gets when they oper.
* If this is specified an oper will not be given oper_umodes
* These are described above oper_only_umodes in general {};
*/
#umodes = locops, servnotice, operwall, wallop;
/* fingerprint: if specified, the oper's client certificate
* fingerprint will be checked against the specified fingerprint
* below.
*/
#fingerprint = "c77106576abf7f9f90cca0f63874a60f2e40a64b";
/* snomask: specific server notice mask on oper up.
* If this is specified an oper will not be given oper_snomask.
*/
snomask = "+ZbFcfkrsuy";
/* vhost: defines the vhost that this oper will get on oper up.
* this must be a valid hostmask. If this is specified the oper
* will not be given default_operhost.
*/
vhost = "is.an.oper";
/* swhois: defines an additional line that will be displayed
* whenever someone does /whois on the oper in question.
*/
swhois = "is wearing pants.";
/* operstring: defines a custom operstring for this oper,
* which will be shown in whois instead of default_operstring
* or default_adminstring.
*/
operstring = "is a lazy IRC Operator";
/* flags: misc options for the operator. You may prefix an option
* with ~ to disable it, e.g. ~encrypted.
*
* Default flags are encrypted.
*
* Available options:
*
* encrypted: the password above is encrypted [DEFAULT]
* need_ssl: must be using SSL/TLS to oper up
*/
flags = ~encrypted;
/* privset: privileges set to grant */
privset = "admin";
};
service {
name = "services.int";
};
service {
name = "tetra.int";
};
cluster {
name = "*";
flags = kline, tkline, unkline, xline, txline, unxline, resv, tresv, unresv;
};
shared {
oper = "*@*", "*";
flags = all;
};
/* exempt {}: IPs that are exempt from Dlines and rejectcache. (OLD d:) */
exempt {
ip = "127.0.0.1";
};
channel {
disabledmodes = "G";
autochanmodes = "nt";
admin_on_channel_create = no;
exemptchanops = "NTc";
use_halfop = yes;
use_admin = yes;
use_knock = yes;
use_local_channels = yes;
knock_delay = 5 minutes;
knock_delay_channel = 1 minute;
max_chans_per_user = 15;
max_bans = 100;
max_bans_large = 500;
default_split_user_count = 0;
default_split_server_count = 0;
no_create_on_split = no;
no_join_on_split = no;
burst_topicwho = yes;
kick_on_split_riding = no;
only_ascii_channels = no;
cycle_host_change = yes;
host_in_topic = yes;
resv_forcepart = yes;
channel_target_change = yes;
};
serverhide {
flatten_links = yes;
links_delay = 5 minutes;
hidden = no;
disable_hidden = no;
};
alias "NickServ" {
target = "NickServ";
};
alias "ChanServ" {
target = "ChanServ";
};
alias "OperServ" {
target = "OperServ";
};
alias "MemoServ" {
target = "MemoServ";
};
alias "HostServ" {
target = "HostServ";
};
alias "BotServ" {
target = "BotServ";
};
alias "InfoServ" {
target = "InfoServ";
};
alias "GroupServ" {
target = "GroupServ";
};
alias "NS" {
target = "NickServ";
};
alias "CS" {
target = "ChanServ";
};
alias "OS" {
target = "OperServ";
};
alias "MS" {
target = "MemoServ";
};
alias "HS" {
target = "HostServ";
};
alias "BS" {
target = "BotServ";
};
alias "IS" {
target = "InfoServ";
};
alias "GS" {
target = "GroupServ";
};
general {
hide_error_messages = opers;
hide_spoof_ips = yes;
/*
* default umodes: umodes to set upon connection
* If you have enabled the ip_cloaking extension, and you wish for
* incoming clients to be cloaked upon connection, +x must be in
* the umode string below.
*/
default_umodes = "+ix";
default_operstring = "is an IRC Operator";
default_adminstring = "is a Server Administrator";
default_operhost = "yolo-swag.com";
#static_quit = "I like turtles!";
servicestring = "is a Network Service";
disable_fake_channels = no;
hide_channel_below_users = 3;
tkline_expire_notices = no;
default_floodcount = 10;
failed_oper_notice = yes;
dots_in_ident=2;
min_nonwildcard = 4;
min_nonwildcard_simple = 3;
max_accept = 100;
max_monitor = 100;
anti_nick_flood = yes;
max_nick_time = 20 seconds;
max_nick_changes = 5;
anti_spam_exit_message_time = 5 minutes;
use_part_messages = yes;
ts_warn_delta = 30 seconds;
ts_max_delta = 5 minutes;
client_exit = yes;
collision_fnc = yes;
global_snotices = yes;
dline_with_reason = yes;
kline_delay = 0 seconds;
kline_with_reason = yes;
kline_reason = "K-Lined";
identify_service = "NickServ@services.int";
identify_command = "IDENTIFY";
non_redundant_klines = yes;
warn_no_nline = yes;
use_propagated_bans = yes;
stats_e_disabled = no;
stats_c_oper_only=no;
stats_h_oper_only=no;
stats_y_oper_only=no;
stats_o_oper_only=yes;
stats_P_oper_only=no;
stats_i_oper_only=masked;
stats_k_oper_only=masked;
map_oper_only = no;
operspy_admin_only = no;
operspy_dont_care_user_info = no;
secret_channels_in_whois = no;
caller_id_wait = 1 minute;
pace_wait_simple = 1 second;
pace_wait = 10 seconds;
short_motd = no;
ping_cookie = no;
connect_timeout = 30 seconds;
default_ident_timeout = 5;
disable_auth = yes;
no_oper_flood = yes;
true_no_oper_flood = no;
max_targets = 4;
client_flood = 20;
use_whois_actually = no;
oper_only_umodes = operwall, locops, servnotice;
oper_umodes = locops, servnotice, operwall, wallop;
oper_snomask = "+s";
burst_away = yes;
nick_delay = 0 seconds; # 15 minutes if you want to enable this
reject_ban_time = 1 minute;
reject_after_count = 3;
reject_duration = 5 minutes;
throttle_duration = 60;
throttle_count = 5000;
expire_override_time = 5 minutes;
};
modules {
path = "modules";
path = "modules/autoload";
};

View File

@ -0,0 +1,3 @@
FROM elemental:7.0-qaohv
ADD ircd.conf /home/ircd/run/etc/ircd.conf

Some files were not shown because too many files have changed in this diff Show More