Compare commits

...

48 Commits

Author SHA1 Message Date
Sam Dodrill a99df1c02c do another go of rb_.*printf removal 2014-12-15 21:07:22 -08:00
Sam Dodrill 1ac5b0570e replace rb_snprintf with system snprintf 2014-12-15 20:39:52 -08:00
Sam Dodrill 63a50eaabc naiive s/rb_sprintf/sprintf/g 2014-12-15 20:34:55 -08:00
Sam Dodrill ee03711af4 Merge pull request #34 from Elemental-IRCd/staging/6.6.1
Elemental-IRCd 6.6.1
2014-12-13 15:59:15 -08:00
Sam Dodrill e862c03515 src/newconf: add ability to disable UMODE_HIDECHANS
As requested by a staff member of an IRC network using elemental.
2014-12-10 14:33:25 -08:00
Sam Dodrill 7cfa92c570 Elemental-IRCd 6.6.1 2014-12-08 09:21:04 -08:00
Sam Dodrill eda8b64bd6 Manually merge feat/show-ip-on-iline-cloak
Conflicts:
    src/s_user.c

Spoofed host IP addresses are now broadcast.

This is 2014, we are not EFNet.
2014-12-08 09:18:30 -08:00
Sam Dodrill 8ea110ad78 Merge pull request #35 from KJCracks/master
Fixed Anope protocol module
2014-12-06 10:23:51 -08:00
Terence Tan 79a3bf79ae Update elemental-ircd.cpp 2014-12-06 20:13:37 +08:00
Sam Dodrill 05b16194a3 Merge pull request #22 from Hamcha/master
Allow compilation for targets without EGD (ie LibreSSL)
2014-11-21 04:30:48 +00:00
Sam Dodrill cf6fdf5e76 Merge pull request #32 from Elemental-IRCd/fix/chmode/separate-length-limits
src/chmode: treat invex/ban/quiet/exception discretely
2014-11-21 04:30:29 +00:00
Sam Dodrill 5ba9c76d22 src/chmode: treat invex/ban/quiet/exception discretely
Also prevents unneeded O(n) check of all kinds of list-bans to see if
the list has overflowed and prevents hard-coding of list-like channel
modes in the daemon to allow for future expansion.
2014-10-27 16:07:27 -07:00
Hamcha dd021e6449 Fallback only if EGD is selected 2014-10-12 01:05:06 +02:00
Hamcha bd91ef662b Fixed conding style (tab->spaces) 2014-10-12 01:02:17 +02:00
Sam Dodrill 219934c7ce Add lvimrc to automatically format code to the desired style
Users of other editors are encouraged to do something similar to this.
2014-09-16 20:27:24 -07:00
Sam Dodrill 1bb06bb3d0 Merge pull request #29 from Elemental-IRCd/doc/contributing
CONTRIBUTING: clarify style requirements
2014-09-15 15:47:16 -07:00
Sam Dodrill cb1ff884a1 CONTRIBUTING: clarify style requirements 2014-09-15 14:26:14 -07:00
Sam Dodrill bfac4f3498 Dockerfile: make docker image thinner 2014-09-08 10:58:01 -07:00
Sam Dodrill 095d9fdd1a Dockerfile: change to use deis/init 2014-08-09 21:54:07 -07:00
Apple Dash 7d3966bc9b m_away: Fix potential weird behavior with an empty return 2014-08-09 18:53:18 -04:00
Hamcha b1bd65b6ab Fix conflicts with PR #24
Conflicts:
	libratbox/src/openssl.c
2014-08-08 14:10:34 +02:00
Sam Dodrill 46bf689e52 Merge pull request #23 from Elemental-IRCd/chore/contributing-document
Add contirbution guidelines
2014-08-06 18:14:04 -07:00
Sam Dodrill 22db314d25 Merge pull request #24 from Elemental-IRCd/chore/restyle-code
Change all code to a consistent style
2014-08-06 18:13:29 -07:00
Sam Dodrill 9890a48cd9 Change all code to a consistent style
We use the Linux Kernel format now.
2014-08-03 10:38:55 -07:00
Sam Dodrill 4c0924c242 Add contirbution guidelines 2014-08-03 09:57:53 -07:00
Hamcha 0cea0c17d2 Allow compilation for targets without EGD (ie LibreSSL) 2014-08-03 12:30:51 +02:00
Sam Dodrill 027b2310ca Add irc notifications for travis 2014-08-02 22:35:57 -07:00
Sam Dodrill 923cda96ff Add travis support 2014-08-02 22:25:37 -07:00
Sam Dodrill 13221ce579 Merge pull request #21 from Elemental-IRCd/feat/dockerfile
Add Dockerfile
2014-08-02 22:05:50 -07:00
Sam Dodrill 379a56e808 Add Dockerfile
This is so people can base their projects on elemental-ircd.
2014-08-02 22:02:59 -07:00
Sam Dodrill e12b8a2631 Elemental-IRCd 6.6 2014-08-01 18:27:50 -07:00
Sam Dodrill 4810e6a8d4 Merge branch 'staging/elemental-6.6' 2014-08-01 18:24:31 -07:00
Jilles Tjoelker 0ae1f793d9 libratbox: Fix undefined behaviour advancing pointer beyond end of array.
The C standard does not allow constructing pointers beyond one past the end
of an array. Therefore, if size is an unsigned type (size_t), then
buf + size is never less than buf.

Clang on 32-bit took advantage of the undefined behaviour, causing
segfaults.

(cherry picked from commit fab79c5d25423884fc4f5e0a56d97cb59b618196)
2014-08-01 18:23:59 -07:00
Rylee Fowler e0489d0eec atheme module: remove trailing whitespace 2014-08-01 18:23:59 -07:00
AppleDash 4d07bf5c59 ./Config: Remove unneeded code and handle ^D 2014-08-01 18:23:58 -07:00
AppleDash 47130005ae ./Config: Somewhat rewrote script, improved nicklen prompting and interrupt handling. 2014-08-01 18:23:58 -07:00
Rylee Fowler 26005c6f48 fix spelling typo (s/propegate/propagate/g) 2014-08-01 18:23:58 -07:00
Sam Dodrill 6a55b37bd9 example conf: add tor blacklist 2014-08-01 18:23:58 -07:00
Apple Dash e05337fa2e include/cache.h: Add support for bigmatix. 2014-08-01 18:23:58 -07:00
Sam Dodrill 3c7006c286 example conf: add tor blacklist 2014-06-11 11:44:20 -07:00
Sam Dodrill fb096745d8 Fix autotools build system 2014-06-09 16:10:15 -07:00
Sam Dodrill fdd6c2721a Merge pull request #10 from AppleDash/master
include/cache.h: Add support for wider motds
2014-06-02 07:40:24 -07:00
Apple Dash 263bc51300 include/cache.h: Add support for bigmatix. 2014-06-02 10:35:51 -04:00
Sam Dodrill 990a42b71b Staging for Elemental-IRCd 6.6 release 2014-06-01 16:09:24 -07:00
Sam Dodrill 19d656a29b Fix buffer overflow in introduce_client and burst_TS6
If the client being introduced has more than 10 user modes send_umode()
will overflow ubuf

tracks Adam-/charybdis@9744d53ec9
2014-06-01 15:59:00 -07:00
Sam Dodrill d726cc83a2 Add UMODE +I to hide channels in WHOIS line
Does not hide channels from IRC operators.
2014-06-01 15:52:10 -07:00
Sam Dodrill 8036a22c25 Show remote server IP addresses 2014-06-01 15:20:37 -07:00
Sam Dodrill 050ea2b809 Add channel mode +u to hide banlists
Banlists are silently hidden from all non-halfops or up. Bans still may
be seen as normally. This mode is entirely opt-in.
2014-05-28 19:36:14 -07:00
282 changed files with 46294 additions and 49725 deletions

2
.lvimrc Normal file
View File

@ -0,0 +1,2 @@
au BufWritePost *.c execute 'silent !astyle --style=linux --mode=c -n' shellescape(expand('%'), 1) ' >/dev/null'
au BufWritePost *.h execute 'silent !astyle --style=linux --mode=c -n' shellescape(expand('%'), 1) ' >/dev/null'

12
.travis.yml Normal file
View File

@ -0,0 +1,12 @@
language: c
compiler:
- gcc
before-install:
- sudo apt-get update
install:
- sudo apt-get install build-essential libssl-dev flex bison
script: "./configure && make"
notifications:
irc: "irc.yolo-swag.com#elemental-ircd"

20
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,20 @@
# Contribution guidelines
Please open contributions as either issue reports or pull requests. We will ask
that anything that requires testing outside our normally supported platforms be
marked as such.
As ircd is such an ancient project with varying code styles, please try to
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
a pull request:
```console
$ astyle --style=linux --mode=c -n $file
```
It should be trivial to set up your text editor to do this for you.

15
CREDITS
View File

@ -1,14 +1,23 @@
$Id: CREDITS 3133 2007-01-21 15:38:16Z jilles $
elemental-ircd is a fork of the ShadowIRCD project created to meet
Elemental-IRCd is a fork of the now-defunct ShadowIRCD project.
The Elemental-IRCd team is listed below in nick-alphabetical order:
Xena, Sam Dodrill <shadowh511 -at- gmail.com>
Some Elemental-IRCd features are modeled after or direct ports of
code from Charybdis.
ponychat-ircd is a fork of the ShadowIRCD project created to meet
PonyChat's needs and keep the now-defunct ShadowIRCD project's goals
alive.
The elemental-ircd team is listed in nick-alphabetical order:
The ponychat-ircd team is listed in nick-alphabetical order:
aji, Alex Iadicico <alex -at- ajitek.net>
lyska, Sam Dodrill <shadowh511 -at- gmail.com>>
Kabaka, Kyle Johnson <kabaka -at- ponychat.net>
Xe, Sam Dodrill <shadowh511 -at- gmail.com>
ShadowIRCd 6 is a modern restart of the old ShadowIRCd project
based on Charybdis with a few additional features to make it appeal

71
Config
View File

@ -8,21 +8,10 @@ This software is under GPL.
from os import system
def promptUser(prompt, default):
inp = raw_input("%s [%s]> " % (prompt, default))
if inp == "":
return default
else:
return inp
def promptYesNo(prompt, default=True):
inp = False if promptUser(prompt, "Y") == "N" else True
return inp
configflags = ["./configure"]
system("clear")
try:
raw_input = raw_input
except NameError:
raw_input = input
art = """
_______ __ __ __ _______ ______ ______ __
@ -35,49 +24,62 @@ Welcome to the Elemental-IRCd Configuration script. This script will help you ch
best compile flags for your installation of Elemental-IRCd.
"""
class Configure():
def promptUser(self, prompt, default):
inp = raw_input("%s [%s]> " % (prompt, default))
if inp == "":
return default
return inp
def promptYesNo(self, prompt, defult=True):
inp = False if self.promptUser(prompt, "Y") == "N" else True
return inp
def go(self):
configflags = ["./configure"]
print(art)
print(welcome)
print("Please specify where you would like to install Elemental-IRCd.")
installloc = promptUser("Install location?", "$HOME/ircd")
installloc = self.promptUser("Install location?", "$HOME/ircd")
print("")
print("Please specify the maximum nickname length. This must be the same across")
print("all servers in your network or you risk desyncs. The maximum is 50.")
nicklen = 100
while nicklen > 51:
if nicklen != 100:
print "Error: you must choose a value under 50."
nicklen = 0
nicklen_valid = False
while not nicklen_valid:
try:
nicklen = int(self.promptUser("Maximum nickname length?", "31"))
if nicklen < 51:
nicklen_valid = True
except ValueError:
nicklen_valid = False
nicklen = int(promptUser("Maximum nickname length?", "31"))
if not nicklen_valid:
print("Error: you must choose an integer value under 50.")
print("")
print("Would you like to disable small network support? This increases the size")
print("of a few buffers in the code and can increase performance on large networks.")
smallnet = promptYesNo("Small network? (Y/N)")
smallnet = self.promptYesNo("Small network? (Y/N)")
configflags.append("--prefix=%s" % installloc)
configflags.append("--with-nicklen=%s" % nicklen)
if not smallnet:
configflags.append("--enable-small-net")
else:
configflags.append("--disable-small-net")
print("\nThat should be it for now. Running %s" % " ".join(configflags))
raw_input("Press enter to continue... ")
system(" ".join(configflags))
print(art)
print("""
Next, run make and make install. Then copy %s/etc/example.conf to
Next, run `make` and `make install`. Then copy %s/etc/example.conf to
%s/etc/ircd.conf and read through the example configuration completely to make
sure your install is tailored to your needs. After that, run %s/bin/ircd
and start to connect clients and servers as you need.
@ -85,8 +87,13 @@ and start to connect clients and servers as you need.
If you have any problems, please check the documentation in the doc/ folder
of the source repository. If problems persist please stop by #elemental-ircd
on irc.yolo-swag.com and ask. Running Elemental-IRCd in insane conditions may
make support either very difficult or at most impossible.""" %\
(installloc, installloc, installloc))
make support either very difficult or at most impossible.""" % (installloc, installloc, installloc))
system("clear")
c = Configure()
try:
c.go()
except (KeyboardInterrupt, EOFError):
print("\nInterrupted, exiting!")
# vim: set ts=4 sw=4 tw=0 et

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM flitter/init
MAINTAINER Xena <xena@yolo-swag.com>
# Update base system
RUN apt-get update && apt-get upgrade -yq && \
apt-get -yq install build-essential autoconf libssl-dev flex bison && \
adduser --system --home /home/ircd ircd && \
mkdir /home/ircd/src && \
chmod 777 /home/ircd/src
ADD . /home/ircd/src
RUN cd /home/ircd/src; ./configure --prefix=/home/ircd/run ; make ; make install
ADD doc/example.conf /home/ircd/run/etc/ircd.conf
ADD extra/runit/ /etc/service/ircd/
RUN chmod -R 777 /home/ircd/run
EXPOSE 6667
ENTRYPOINT /sbin/my_init

56
NEWS
View File

@ -1,6 +1,60 @@
This is elemental-ircd 6.5, Copyright (c) 2013 elemental-ircd team.
This is elemental-ircd 6.6.1, Copyright (c) 2014 elemental-ircd team.
See LICENSE for licensing details (GPL v2).
-- elemental-ircd 6.6.1
All code is now in the linux kernel coding style. Patches that do not
follow this coding style are at risk of being rejected. It is suggested
that your editor be set up to automatically style your code in the
desired format. A vim resource file is provided in the repository root.
additions
- automatic code styling for vim
- Dockerfile and nightly docker builds
- show cloaked I:Line vhost IP address remotely
bugfixes
- all channel lists have their own limit instead of sharing one.
5ba9c76d224afac877d9500d6ac1eb8f2bddd076
- fix potential undefined behavior with m_away
7d3966bc9bd9e9ab7833b4ecb0751671bdd085e7
- fix Anope 2.0 protocol module
79a3bf79ae66c43470c4bed25c33053b13a032d1
-- elemental-ircd 6.6
additions
- add OWNER=y to 005
- add autoconfigure script like unrealircd
- add channel mode +u to hide banlists unless users have halfop or up
- add modules for services packages
- add quotes around PART reason
- add umode +I to hide channels line from WHOIS
- make end-user /OPER failures much more generic
- make flooding SNOTEs global
- show own modes in whois
- show remote server IP addresses
- update helpfiles to have much more up to date information
bugfixes
- don't strip unicode in strip_unprintable
- fix extended-join for remote users
- fix null reference in away-notify
- make genssl.sh generate ten year certs
- merge some upstream charybdis patches
removals
- remove away-notify
- remove AHBL from default configs
- remove m_post SNOTEs because of an upstream change
The official channel for Elemental-IRCd is now #elemental-ircd on
irc.yolo-swag.com.
-- elemental-ircd 6.5.1
Rename to Elemental-IRCd
-- ponychat-ircd 6.5
additions

View File

@ -1,22 +1,6 @@
# TODO
## elemental-ircd 6.5.2
- [ ] Fix `extended-join` not triggering for users on other servers
- [x] Patch `m_sasl`, http://seclists.org/fulldisclosure/2014/Mar/320
- [x] Fix null reference in `src/channel.c`
- [x] Add basic autoconfiguration script
- [x] Add modules for services packages
- [x] Make end user oper failures more generic
- [x] Add `OWNER=` to `005`
- [x] Show own modes in a `WHOIS`
- [x] Remove AHBL blacklists from default configs
- [x] Remove `SNOTE`s in `m_post`
- [x] Make flooding `SNOTE`s global
- [x] Add quotes around `PART` reason
- [x] Disable `away-notify` for now
## elemental-ircd 6.6
## elemental-ircd 6.7
- [ ] Finish websocket support
- [x] Configuration for websocket ports

View File

@ -40,8 +40,7 @@
#define COMMIT_INTERVAL 3 /* seconds */
typedef enum
{
typedef enum {
BANDB_KLINE,
BANDB_DLINE,
BANDB_XLINE,
@ -81,12 +80,10 @@ parse_ban(bandb_type type, char *parv[], int parc)
const char *perm = NULL;
int para = 1;
if(type == BANDB_KLINE)
{
if(type == BANDB_KLINE) {
if(parc != 7)
return;
}
else if(parc != 6)
} else if(parc != 6)
return;
mask1 = parv[para++];
@ -99,8 +96,7 @@ parse_ban(bandb_type type, char *parv[], int parc)
perm = parv[para++];
reason = parv[para++];
if(!in_transaction)
{
if(!in_transaction) {
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
@ -118,12 +114,10 @@ parse_unban(bandb_type type, char *parv[], int parc)
const char *mask1 = NULL;
const char *mask2 = NULL;
if(type == BANDB_KLINE)
{
if(type == BANDB_KLINE) {
if(parc != 3)
return;
}
else if(parc != 2)
} else if(parc != 2)
return;
mask1 = parv[1];
@ -131,8 +125,7 @@ parse_unban(bandb_type type, char *parv[], int parc)
if(type == BANDB_KLINE)
mask2 = parv[2];
if(!in_transaction)
{
if(!in_transaction) {
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
@ -153,19 +146,17 @@ list_bans(void)
/* schedule a clear of anything already pending */
rb_helper_write_queue(bandb_helper, "C");
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec_fetch(&table, "SELECT mask1,mask2,oper,reason FROM %s WHERE 1",
bandb_table[i]);
for(j = 0; j < table.row_count; j++)
{
for(j = 0; j < table.row_count; j++) {
if(i == BANDB_KLINE)
rb_snprintf(buf, sizeof(buf), "%c %s %s %s :%s",
snprintf(buf, sizeof(buf), "%c %s %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][1], table.row[j][2], table.row[j][3]);
else
rb_snprintf(buf, sizeof(buf), "%c %s %s :%s",
snprintf(buf, sizeof(buf), "%c %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][2], table.row[j][3]);
@ -187,15 +178,13 @@ parse_request(rb_helper *helper)
int len;
while((len = rb_helper_read(helper, readbuf, sizeof(readbuf))) > 0)
{
while((len = rb_helper_read(helper, readbuf, sizeof(readbuf))) > 0) {
parc = rb_string_to_array(readbuf, parv, MAXPARA);
if(parc < 1)
continue;
switch (parv[0][0])
{
switch (parv[0][0]) {
case 'K':
parse_ban(BANDB_KLINE, parv, parc);
break;
@ -288,7 +277,7 @@ static void
db_error_cb(const char *errstr)
{
char buf[256];
rb_snprintf(buf, sizeof(buf), "! :%s", errstr);
snprintf(buf, sizeof(buf), "! :%s", errstr);
rb_helper_write(bandb_helper, buf);
rb_sleep(2 << 30, 0);
exit(1);
@ -299,8 +288,7 @@ main(int argc, char *argv[])
{
setup_signals();
bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256, 256); /* XXX fix me */
if(bandb_helper == NULL)
{
if(bandb_helper == NULL) {
fprintf(stderr,
"This is ircd-ratbox bandb. You aren't supposed to run me directly. Maybe you want bantool?\n");
fprintf(stderr,
@ -321,8 +309,7 @@ check_schema(void)
struct rsdb_table table;
int i;
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec_fetch(&table,
"SELECT name FROM sqlite_master WHERE type='table' AND name='%s'",
bandb_table[i]);

View File

@ -51,8 +51,7 @@
#define BT_VERSION "0.4.1"
typedef enum
{
typedef enum {
BANDB_KLINE,
BANDB_KLINE_PERM,
BANDB_DLINE,
@ -84,8 +83,7 @@ static char me[PATH_MAX];
/* *INDENT-OFF* */
/* report counters */
struct counter
{
struct counter {
unsigned int klines;
unsigned int dlines;
unsigned int xlines;
@ -94,8 +92,7 @@ struct counter
} count = {0, 0, 0, 0, 0};
/* flags set by command line options */
struct flags
{
struct flags {
int none;
int export;
int import;
@ -140,10 +137,8 @@ main(int argc, char *argv[])
rb_strlcpy(me, argv[0], sizeof(me));
while((opt = getopt(argc, argv, "hieuspvwd")) != -1)
{
switch (opt)
{
while((opt = getopt(argc, argv, "hieuspvwd")) != -1) {
switch (opt) {
case 'h':
print_help(EXIT_SUCCESS);
break;
@ -185,8 +180,7 @@ main(int argc, char *argv[])
print_help(EXIT_FAILURE);
if((flag.import && flag.export) || (flag.export && flag.wipe)
|| (flag.verify && flag.pretend) || (flag.export && flag.pretend))
{
|| (flag.verify && flag.pretend) || (flag.export && flag.pretend)) {
fprintf(stderr, "* Error: Conflicting flags.\n");
if(flag.export && flag.pretend)
fprintf(stderr, "* There is nothing to 'pretend' when exporting.\n");
@ -204,10 +198,8 @@ main(int argc, char *argv[])
"* ircd-ratbox bantool v.%s ($Id: bantool.c 26164 2008-10-26 19:52:43Z androsyn $)\n",
BT_VERSION);
if(flag.pretend == NO)
{
if(rsdb_init(db_error_cb) == -1)
{
if(flag.pretend == NO) {
if(rsdb_init(db_error_cb) == -1) {
fprintf(stderr, "* Error: Unable to open database\n");
exit(EXIT_FAILURE);
}
@ -216,8 +208,7 @@ main(int argc, char *argv[])
if(flag.vacuum)
db_reclaim_slack();
if(flag.import && flag.wipe)
{
if(flag.import && flag.wipe) {
flag.dupes_ok = YES; /* dont check for dupes if we are wiping the db clean */
for(i = 0; i < 3; i++)
fprintf(stdout,
@ -234,9 +225,8 @@ main(int argc, char *argv[])
fprintf(stdout, "* Allowing duplicate bans...\n");
/* checking for our files to import or export */
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
rb_snprintf(conf, sizeof(conf), "%s/%s.conf%s",
for(i = 0; i < LAST_BANDB_TYPE; i++) {
snprintf(conf, sizeof(conf), "%s/%s.conf%s",
etc, bandb_table[i], bandb_suffix[i]);
if(flag.import && flag.pretend == NO)
@ -252,8 +242,7 @@ main(int argc, char *argv[])
rsdb_transaction(RSDB_TRANS_END);
}
if(flag.import)
{
if(flag.import) {
if(count.error && flag.verbose)
fprintf(stderr, "* I was unable to locate %i config files to import.\n",
count.error);
@ -297,17 +286,16 @@ export_config(const char *conf, int id)
return;
if(strstr(conf, ".perm") != 0)
rb_snprintf(sql, sizeof(sql),
snprintf(sql, sizeof(sql),
"SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 1 ORDER BY time",
bandb_table[id]);
else
rb_snprintf(sql, sizeof(sql),
snprintf(sql, sizeof(sql),
"SELECT DISTINCT mask1,mask2,reason,oper,time FROM %s WHERE perm = 0 ORDER BY time",
bandb_table[id]);
rsdb_exec_fetch(&table, sql);
if(table.row_count <= 0)
{
if(table.row_count <= 0) {
rsdb_exec_fetch_end(&table);
return;
}
@ -316,21 +304,18 @@ export_config(const char *conf, int id)
fprintf(stdout, "* checking for %s: ", conf); /* debug */
/* open config for reading, or skip to the next */
if(!(fd = fopen(conf, "w")))
{
if(!(fd = fopen(conf, "w"))) {
if(flag.verbose)
fprintf(stdout, "\tmissing.\n");
count.error++;
return;
}
for(j = 0; j < table.row_count; j++)
{
switch (id)
{
for(j = 0; j < table.row_count; j++) {
switch (id) {
case BANDB_DLINE:
case BANDB_DLINE_PERM:
rb_snprintf(buf, sizeof(buf),
snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1],
mangle_reason(table.row[j][reason]),
@ -340,7 +325,7 @@ export_config(const char *conf, int id)
case BANDB_XLINE:
case BANDB_XLINE_PERM:
rb_snprintf(buf, sizeof(buf),
snprintf(buf, sizeof(buf),
"\"%s\",\"0\",\"%s\",\"%s\",%s\n",
escape_quotes(table.row[j][mask1]),
mangle_reason(table.row[j][reason]),
@ -349,7 +334,7 @@ export_config(const char *conf, int id)
case BANDB_RESV:
case BANDB_RESV_PERM:
rb_snprintf(buf, sizeof(buf),
snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",%s\n",
table.row[j][mask1],
mangle_reason(table.row[j][reason]),
@ -358,7 +343,7 @@ export_config(const char *conf, int id)
default: /* Klines */
rb_snprintf(buf, sizeof(buf),
snprintf(buf, sizeof(buf),
"\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%s\",%s\n",
table.row[j][mask1], table.row[j][mask2],
mangle_reason(table.row[j][reason]),
@ -401,8 +386,7 @@ import_config(const char *conf, int id)
fprintf(stdout, "* checking for %s: ", conf); /* debug */
/* open config for reading, or skip to the next */
if(!(fd = fopen(conf, "r")))
{
if(!(fd = fopen(conf, "r"))) {
if(flag.verbose)
fprintf(stdout, "%*s", strlen(bandb_suffix[id]) > 0 ? 10 : 15,
"missing.\n");
@ -421,8 +405,7 @@ import_config(const char *conf, int id)
* dline
* "194.158.192.0/19","laptop scammers","","2005/3/17 05.33","stevoo!stevoo@efnet.port80.se{stevoo}",1111033988
*/
while(fgets(line, sizeof(line), fd))
{
while(fgets(line, sizeof(line), fd)) {
if((p = strpbrk(line, "\r\n")) != NULL)
*p = '\0';
@ -436,8 +419,7 @@ import_config(const char *conf, int id)
continue;
/* mask2 */
switch (id)
{
switch (id) {
case BANDB_XLINE:
case BANDB_XLINE_PERM:
f_mask1 = escape_quotes(clean_gecos_field(f_mask1));
@ -463,8 +445,7 @@ import_config(const char *conf, int id)
continue;
/* oper comment */
switch (id)
{
switch (id) {
case BANDB_KLINE:
case BANDB_KLINE_PERM:
case BANDB_DLINE:
@ -483,10 +464,8 @@ import_config(const char *conf, int id)
f_oper = "unknown";
/* meh */
if(id == BANDB_KLINE || id == BANDB_KLINE_PERM)
{
if(strstr(f_mask1, "!") != NULL)
{
if(id == BANDB_KLINE || id == BANDB_KLINE_PERM) {
if(strstr(f_mask1, "!") != NULL) {
fprintf(stderr,
"* SKIPPING INVALID KLINE %s@%s set by %s\n",
f_mask1, f_mask2, f_oper);
@ -497,12 +476,11 @@ import_config(const char *conf, int id)
/* append operreason_field to reason_field */
if(!EmptyString(f_oreason))
rb_snprintf(newreason, sizeof(newreason), "%s | %s", f_reason, f_oreason);
snprintf(newreason, sizeof(newreason), "%s | %s", f_reason, f_oreason);
else
rb_snprintf(newreason, sizeof(newreason), "%s", f_reason);
snprintf(newreason, sizeof(newreason), "%s", f_reason);
if(flag.pretend == NO)
{
if(flag.pretend == NO) {
if(flag.dupes_ok == NO)
drop_dupes(f_mask1, f_mask2, bandb_table[id]);
@ -521,8 +499,7 @@ import_config(const char *conf, int id)
i++;
}
switch (bandb_letter[id])
{
switch (bandb_letter[id]) {
case 'K':
count.klines += i;
break;
@ -574,27 +551,20 @@ getfield(char *newline)
end = strchr(line, ',');
while(1)
{
while(1) {
/* no trailing , - last field */
if(end == NULL)
{
if(end == NULL) {
end = line + strlen(line);
line = NULL;
if(*end == '"')
{
if(*end == '"') {
*end = '\0';
return field;
}
else
} else
return NULL;
}
else
{
} else {
/* look for a ", to mark the end of a field.. */
if(*(end - 1) == '"')
{
if(*(end - 1) == '"') {
line = end + 1;
end--;
*end = '\0';
@ -622,10 +592,8 @@ strip_quotes(const char *string)
if(string == NULL)
return NULL;
while(*string)
{
if(*string != '"')
{
while(*string) {
if(*string != '"') {
*str++ = *string;
}
string++;
@ -646,15 +614,11 @@ escape_quotes(const char *string)
if(string == NULL)
return NULL;
while(*string)
{
if(*string == '"')
{
while(*string) {
if(*string == '"') {
*str++ = '\\';
*str++ = '"';
}
else
{
} else {
*str++ = *string;
}
string++;
@ -673,10 +637,8 @@ mangle_reason(const char *string)
if(string == NULL)
return NULL;
while(*string)
{
switch (*string)
{
while(*string) {
switch (*string) {
case '"':
*str = '\'';
break;
@ -707,14 +669,11 @@ clean_gecos_field(const char *gecos)
if(gecos == NULL)
return NULL;
while(*gecos)
{
if(*gecos == ' ')
{
while(*gecos) {
if(*gecos == ' ') {
*str++ = '\\';
*str++ = 's';
}
else
} else
*str++ = *gecos;
gecos++;
}
@ -744,10 +703,8 @@ check_schema(void)
NULL
};
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
if(!table_exists(bandb_table[i]))
{
for(i = 0; i < LAST_BANDB_TYPE; i++) {
if(!table_exists(bandb_table[i])) {
rsdb_exec(NULL,
"CREATE TABLE %s (mask1 TEXT, mask2 TEXT, oper TEXT, time INTEGER, perm INTEGER, reason TEXT)",
bandb_table[i]);
@ -757,10 +714,8 @@ check_schema(void)
* i can't think of any better way to do this, other then attempt to
* force the creation of column that may, or may not already exist. --dubkat
*/
else
{
for(j = 0; columns[j] != NULL; j++)
{
else {
for(j = 0; columns[j] != NULL; j++) {
if(!strcmp(columns[j], "time") && !strcmp(columns[j], "perm"))
rb_strlcpy(type, "INTEGER", sizeof(type));
else
@ -817,8 +772,7 @@ wipe_schema(void)
{
int i;
rsdb_transaction(RSDB_TRANS_START);
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec(NULL, "DROP TABLE %s", bandb_table[i]);
i++; /* double increment to skip over .perm */
}
@ -857,7 +811,7 @@ bt_smalldate(const char *string)
lt = gmtime(&t);
if(lt == NULL)
return NULL;
rb_snprintf(buf, sizeof(buf), "%d/%d/%d %02d.%02d",
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);
return buf;
}

View File

@ -6,15 +6,13 @@ typedef void rsdb_error_cb(const char *);
typedef int (*rsdb_callback) (int, const char **);
typedef enum rsdb_transtype
{
typedef enum rsdb_transtype {
RSDB_TRANS_START,
RSDB_TRANS_END
}
rsdb_transtype;
struct rsdb_table
{
struct rsdb_table {
char ***row;
int row_count;
int col_count;

View File

@ -278,10 +278,8 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
int written = 0; /* bytes written so far */
int maxbytes = bytes - 1;
while((ch = *format++) && (written < maxbytes))
{
if(ch == '%')
{
while((ch = *format++) && (written < maxbytes)) {
if(ch == '%') {
/*
* Advance past the %
*/
@ -291,12 +289,10 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
* Put the most common cases first - %s %d etc
*/
if(ch == 's')
{
if(ch == 's') {
const char *str = va_arg(args, const char *);
while((*dest = *str))
{
while((*dest = *str)) {
++dest;
++str;
@ -307,8 +303,7 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
continue;
}
if(ch == 'd')
{
if(ch == 'd') {
int num = va_arg(args, int);
int quotient;
const char *str;
@ -317,15 +312,13 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
/*
* We have to special-case "0" unfortunately
*/
if(num == 0)
{
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
if(num < 0)
{
if(num < 0) {
*dest++ = '-';
if(++written >= maxbytes)
continue;
@ -333,8 +326,7 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
num = -num;
}
do
{
do {
quotient = num / TABLE_MAX;
/*
@ -369,13 +361,11 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
while((*digitptr = *str)) {
++digitptr;
++str;
}
}
while((num = quotient) != 0);
} while((num = quotient) != 0);
/*
* If the last quotient was a 1 or 2 digit number, there
@ -385,8 +375,7 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
@ -395,8 +384,7 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
continue;
} /* if (ch == 'd') */
if(ch == 'c')
{
if(ch == 'c') {
*dest++ = va_arg(args, int);
++written;
@ -404,22 +392,19 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
continue;
} /* if (ch == 'c') */
if(ch == 'u')
{
if(ch == 'u') {
unsigned int num = va_arg(args, unsigned int);
unsigned int quotient;
const char *str;
char *digitptr = TempBuffer;
if(num == 0)
{
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
do
{
do {
quotient = num / TABLE_MAX;
/*
@ -428,19 +413,16 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
while((*digitptr = *str)) {
++digitptr;
++str;
}
}
while((num = quotient) != 0);
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
@ -449,8 +431,7 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
continue;
} /* if (ch == 'u') */
if(ch == 'Q')
{
if(ch == 'Q') {
const char *arg = va_arg(args, const char *);
if(arg == NULL)
@ -458,8 +439,7 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
const char *str = rsdb_quote(arg);
while((*dest = *str))
{
while((*dest = *str)) {
++dest;
++str;
@ -470,10 +450,8 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
continue;
}
if(ch == 'l')
{
if(*format == 'u')
{
if(ch == 'l') {
if(*format == 'u') {
unsigned long num = va_arg(args, unsigned long);
unsigned long quotient;
const char *str;
@ -481,15 +459,13 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
++format;
if(num == 0)
{
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
do
{
do {
quotient = num / TABLE_MAX;
/*
@ -498,29 +474,24 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
while((*digitptr = *str)) {
++digitptr;
++str;
}
}
while((num = quotient) != 0);
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
}
else
/* if (*format == 'u') */ if(*format == 'd')
{
} else
/* if (*format == 'u') */ if(*format == 'd') {
long num = va_arg(args, long);
long quotient;
const char *str;
@ -528,15 +499,13 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
++format;
if(num == 0)
{
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
if(num < 0)
{
if(num < 0) {
*dest++ = '-';
if(++written >= maxbytes)
continue;
@ -544,34 +513,28 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
num = -num;
}
do
{
do {
quotient = num / TABLE_MAX;
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
while((*digitptr = *str)) {
++digitptr;
++str;
}
}
while((num = quotient) != 0);
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
}
else /* if (*format == 'd') */
{
} else { /* if (*format == 'd') */
/* XXX error */
exit(1);
}
@ -579,8 +542,7 @@ rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
} /* if (ch == 'l') */
if(ch != '%')
{
if(ch != '%') {
/* XXX error */
exit(1);
} /* if (ch != '%') */

View File

@ -41,16 +41,14 @@ rsdb_error_cb *error_cb;
static void
mlog(const char *errstr, ...)
{
if(error_cb != NULL)
{
if(error_cb != NULL) {
char buf[256];
va_list ap;
va_start(ap, errstr);
rb_vsnprintf(buf, sizeof(buf), errstr, ap);
vsnprintf(buf, sizeof(buf), errstr, ap);
va_end(ap);
error_cb(buf);
}
else
} else
exit(1);
}
@ -70,16 +68,14 @@ rsdb_init(rsdb_error_cb * ecb)
else
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK)
{
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) {
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
sqlite3_errmsg(rb_bandb));
mlog(errbuf);
return -1;
}
if(access(dbpath, W_OK))
{
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
if(access(dbpath, W_OK)) {
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
mlog(errbuf);
return -1;
}
@ -103,8 +99,7 @@ rsdb_quote(const char *src)
if(strlen(src) >= (sizeof(buf) / 2))
return NULL;
while(*src)
{
while(*src) {
if(*src == '\'')
*p++ = '\'';
@ -136,18 +131,14 @@ rsdb_exec(rsdb_callback cb, const char *format, ...)
i = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if(i >= sizeof(buf))
{
if(i >= sizeof(buf)) {
mlog("fatal error: length problem with compiling sql");
}
if((i = sqlite3_exec(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg)))
{
switch (i)
{
if((i = sqlite3_exec(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg))) {
switch (i) {
case SQLITE_BUSY:
for(j = 0; j < 5; j++)
{
for(j = 0; j < 5; j++) {
rb_sleep(0, 500000);
if(!sqlite3_exec
(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg))
@ -180,26 +171,21 @@ rsdb_exec_fetch(struct rsdb_table *table, const char *format, ...)
retval = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if(retval >= sizeof(buf))
{
if(retval >= sizeof(buf)) {
mlog("fatal error: length problem with compiling sql");
}
if((retval =
sqlite3_get_table(rb_bandb, buf, &data, &table->row_count, &table->col_count, &errmsg)))
{
sqlite3_get_table(rb_bandb, buf, &data, &table->row_count, &table->col_count, &errmsg))) {
int success = 0;
switch (retval)
{
switch (retval) {
case SQLITE_BUSY:
for(i = 0; i < 5; i++)
{
for(i = 0; i < 5; i++) {
rb_sleep(0, 500000);
if(!sqlite3_get_table
(rb_bandb, buf, &data, &table->row_count, &table->col_count,
&errmsg))
{
&errmsg)) {
success++;
break;
}
@ -220,8 +206,7 @@ rsdb_exec_fetch(struct rsdb_table *table, const char *format, ...)
/* we need to be able to free data afterward */
table->arg = data;
if(table->row_count == 0)
{
if(table->row_count == 0) {
table->row = NULL;
return;
}
@ -229,12 +214,10 @@ rsdb_exec_fetch(struct rsdb_table *table, const char *format, ...)
/* sqlite puts the column names as the first row */
pos = table->col_count;
table->row = rb_malloc(sizeof(char **) * table->row_count);
for(i = 0; i < table->row_count; i++)
{
for(i = 0; i < table->row_count; i++) {
table->row[i] = rb_malloc(sizeof(char *) * table->col_count);
for(j = 0; j < table->col_count; j++)
{
for(j = 0; j < table->col_count; j++) {
table->row[i][j] = data[pos++];
}
}
@ -245,8 +228,7 @@ rsdb_exec_fetch_end(struct rsdb_table *table)
{
int i;
for(i = 0; i < table->row_count; i++)
{
for(i = 0; i < table->row_count; i++) {
rb_free(table->row[i]);
}
rb_free(table->row);

18
configure vendored
View File

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

View File

@ -3,6 +3,7 @@
* Copyright (C) 2000-2002 Hybrid Development Team
* Copyright (C) 2002-2005 ircd-ratbox development team
* Copyright (C) 2005-2006 charybdis development team
* Copyright (C) 2014 Elemental-IRCd development team
*
* $Id: example.conf 3582 2007-11-17 21:55:48Z jilles $
*
@ -47,10 +48,10 @@ loadmodule "extensions/sno_globaloper.so";
#loadmodule "extensions/sno_whois.so";
serverinfo {
name = "hades.arpa";
name = "hostname.domain.tld";
sid = "42X";
description = "shadowircd test server";
network_name = "AthemeNET";
description = "elemental-ircd test server";
network_name = "ShadowNET";
network_desc = "Your IRC network.";
helpchan = "#help";
helpurl = "http://www.mynet.net/help";
@ -90,7 +91,7 @@ serverinfo {
admin {
name = "Lazy admin (lazya)";
description = "AthemeNET client server";
description = "ShadowNET client server";
email = "nobody@127.0.0.1";
};
@ -139,7 +140,8 @@ listen {
/* defer_accept: wait for clients to send IRC handshake data before
* accepting them. if you intend to use software which depends on the
* server replying first, such as BOPM, you should disable this feature.
* otherwise, you probably want to leave it on.
* otherwise, you probably want to leave it on. Disabling this will not
* update on a rehash.
*/
defer_accept = yes;
@ -425,7 +427,7 @@ serverhide {
* They are used in pairs of one host/rejection reason.
*
* These settings should be adequate for most networks, and are (presently)
* required for use on AthemeNet.
* required for use on ShadowNet.
*
* Word to the wise: Do not use blacklists like SPEWS for blocking IRC
* connections.
@ -446,6 +448,9 @@ blacklist {
host = "dnsbl.dronebl.org";
reject_reason = "${nick}, your IP (${ip}) is listed in DroneBL. For assistance, see http://dronebl.org/lookup_branded.do?ip=${ip}&network=${network-name}";
host = "torexit.dan.me.uk";
reject_reason = "${nick}, your IP (${ip}) is listed as a TOR exit node. In order to protect ${network-name} from TOR-based abuse, we are not allowing TOR exit nodes to connect to our network.";
};
alias "NickServ" {
@ -526,7 +531,7 @@ general {
default_operstring = "is an IRC Operator";
default_adminstring = "is a Server Administrator";
default_operhost = "staff.testnet.net";
#default_operhost = "staff.testnet.net";
#static_quit = "I like turtles!";
servicestring = "is a Network Service";
disable_fake_channels = no;

View File

@ -1,2 +1,2 @@
This is ShadowIRCd MOTD. You might replace it, but if not, your friends will
laugh at you.
This is the Elemental-IRCd MOTD. You can use this if you like;
but if you do, your teacher may send you to magic kindergarten.

View File

@ -53,6 +53,7 @@ SRCS = \
force_user_invis.c \
hurt.c \
ip_cloaking.c \
ip_cloaking-5.c \
sno_farconnect.c \
sno_globalkline.c \
sno_globaloper.c \

View File

@ -31,8 +31,7 @@ h_can_create_channel_authenticated(hook_data_client_approval *data)
{
struct Client *source_p = data->client;
if (!IsOper(source_p))
{
if (!IsOper(source_p)) {
sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
data->approved = ERR_NEEDREGGEDNICK;
}

View File

@ -159,12 +159,9 @@ DECLARE_MODULE_AV1(
static int
munreg_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are unregistered and sent no parameters");
}
else
{
} else {
sendto_one_notice(source_p, ":You are unregistered and sent parameter: %s", parv[1]);
}
@ -181,12 +178,9 @@ munreg_test(struct Client *client_p, struct Client *source_p, int parc, const ch
static int
mclient_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are a normal user, and sent no parameters");
}
else
{
} else {
sendto_one_notice(source_p, ":You are a normal user, and send parameters: %s", parv[1]);
}
@ -203,12 +197,9 @@ mclient_test(struct Client *client_p, struct Client *source_p, int parc, const c
static int
mrclient_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are a remote client, and sent no parameters");
}
else
{
} else {
sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]);
}
return 0;
@ -221,12 +212,9 @@ mrclient_test(struct Client *client_p, struct Client *source_p, int parc, const
static int
mserver_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are a server, and sent no parameters");
}
else
{
} else {
sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]);
}
return 0;
@ -239,12 +227,9 @@ mserver_test(struct Client *client_p, struct Client *source_p, int parc, const c
static int
moper_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
if(parc < 2) {
sendto_one_notice(source_p, ":You are an operator, and sent no parameters");
}
else
{
} else {
sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]);
}
return 0;

View File

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

View File

@ -156,8 +156,7 @@ modfini(void)
rb_event_delete(hurt_expire_ev);
rb_event_delete(hurt_check_ev);
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head)
{
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
}
}
@ -207,23 +206,18 @@ mo_hurt(struct Client *client_p, struct Client *source_p,
}
/* Is this a client? */
if (strchr(ip, '.') == NULL && strchr(ip, ':') == NULL)
{
if (strchr(ip, '.') == NULL && strchr(ip, ':') == NULL) {
target_p = find_named_person(ip);
if (target_p == NULL)
{
if (target_p == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), ip);
return 0;
}
ip = target_p->orighost;
}
else
{
} else {
if (!strncmp(ip, "*@", 2))
ip += 2;
if (strchr(ip, '!') || strchr(ip, '@'))
{
if (strchr(ip, '!') || strchr(ip, '@')) {
sendto_one_notice(source_p, ":Invalid HURT mask [%s]",
ip);
return 0;
@ -302,18 +296,15 @@ mo_heal(struct Client *client_p, struct Client *source_p,
{
struct Client *target_p;
if (!IsOperUnkline(source_p))
{
if (!IsOperUnkline(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "unkline");
return 0;
}
if (nick_is_valid(parv[1]))
{
if (nick_is_valid(parv[1])) {
target_p = find_named_person(parv[1]);
if (target_p == NULL)
{
if (target_p == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
@ -325,11 +316,8 @@ mo_heal(struct Client *client_p, struct Client *source_p,
get_id(source_p, target_p),
target_p->servptr->name,
get_id(target_p, target_p));
}
else if (strchr(parv[1], '.'))
{
if (hurt_find_exact(parv[1]) == NULL)
{
} else if (strchr(parv[1], '.')) {
if (hurt_find_exact(parv[1]) == NULL) {
sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]);
return 0;
}
@ -338,9 +326,7 @@ mo_heal(struct Client *client_p, struct Client *source_p,
get_oper_name(source_p), parv[1]);
sendto_server(NULL, NULL, NOCAPS, NOCAPS, ":%s ENCAP * HEAL %s",
source_p->name, parv[1]);
}
else
{
} else {
sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]);
return 0;
}
@ -361,22 +347,18 @@ me_heal(struct Client *client_p, struct Client *source_p,
if (parc < 2)
return 0;
if (nick_is_valid(parv[1]))
{
if (nick_is_valid(parv[1])) {
target_p = find_person(parv[1]);
if (target_p != NULL && MyConnect(target_p))
heal_nick(source_p, target_p);
}
else if (strchr(parv[1], '.')) /* host or mask to remove ban for */
{
} else if (strchr(parv[1], '.')) { /* host or mask to remove ban for */
if (hurt_find_exact(parv[1]) == NULL)
return 0;
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
}
else
} else
return 0;
return 0;
@ -395,13 +377,11 @@ hurt_check_event(void *arg)
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
client_p = ptr->data;
if (!EmptyString(client_p->user->suser))
{
if (!EmptyString(client_p->user->suser)) {
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
sendto_one_notice(client_p, ":HURT restriction removed for this session");
client_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
}
else if (client_p->localClient->receiveM > hurt_state.cutoff)
} else if (client_p->localClient->receiveM > hurt_state.cutoff)
exit_client(NULL, client_p, &me, hurt_state.exit_reason);
}
}
@ -414,12 +394,10 @@ hurt_expire_event(void *unused)
rb_dlink_node *ptr, *next_ptr;
hurt_t *hurt;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_confs.head)
{
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
if (hurt->expire <= rb_current_time())
{
if (hurt->expire <= rb_current_time()) {
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
}
@ -450,8 +428,7 @@ new_local_user_hook(struct Client *source_p)
IsExemptKline(source_p))
return;
if (hurt_find(source_p->sockhost) || hurt_find(source_p->orighost))
{
if (hurt_find(source_p->sockhost) || hurt_find(source_p->orighost)) {
source_p->localClient->target_last = rb_current_time() + 600; /* don't ask --nenolod */
SetTGChange(source_p);
rb_dlinkAddAlloc(source_p, &hurt_state.hurt_clients);
@ -476,11 +453,9 @@ doing_stats_hook(hook_data_int *hdata)
return;
if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p))
return;
if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p))
{
if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p)) {
hurt = hurt_find(source_p->sockhost);
if (hurt != NULL)
{
if (hurt != NULL) {
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
@ -488,8 +463,7 @@ doing_stats_hook(hook_data_int *hdata)
}
hurt = hurt_find(source_p->orighost);
if (hurt != NULL)
{
if (hurt != NULL) {
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
@ -498,8 +472,7 @@ doing_stats_hook(hook_data_int *hdata)
return;
}
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
@ -577,8 +550,7 @@ hurt_find_exact(const char *ip)
rb_dlink_node *ptr;
hurt_t *hurt;
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
if (!strcasecmp(ip, hurt->ip))
@ -594,8 +566,7 @@ hurt_find(const char *ip)
rb_dlink_node *ptr;
hurt_t *hurt;
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
if (match(hurt->ip, ip))
@ -618,17 +589,14 @@ hurt_remove(const char *ip)
static int
heal_nick(struct Client *source_p, struct Client *target_p)
{
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients))
{
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients)) {
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s used HEAL on %s",
get_oper_name(source_p), get_client_name(target_p, HIDE_IP));
sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator");
sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name);
target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
return 1;
}
else
{
} else {
sendto_one_notice(source_p, ":%s was not hurt", target_p->name);
return 0;
}

160
extensions/ip_cloaking-5.c Normal file
View File

@ -0,0 +1,160 @@
/*
* Charybdis: an advanced ircd
* ip_cloaking.c: provide user hostname cloaking
*
* Written originally by nenolod, altered to use FNV by Elizabeth in 2008
* altered some more by groente
*/
#include <openssl/hmac.h>
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
#include "hash.h"
#include "s_conf.h"
#include "s_user.h"
#include "s_serv.h"
#include "numeric.h"
#include "newconf.h"
char *secretsalt = "32qwnqoWI@DpMd&w";
static void
conf_set_secretsalt(void *data)
{
secretsalt = rb_strdup(data);
}
static int
_modinit(void)
{
/* add the usermode to the available slot */
user_modes['x'] = find_umode_slot();
construct_umodebuf();
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
return 0;
}
static void
_moddeinit(void)
{
/* disable the umode and remove it from the available list */
user_modes['x'] = 0;
construct_umodebuf();
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
}
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $");
static void
distribute_hostchange(struct Client *client_p, char *newhost)
{
if (newhost != client_p->orighost)
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
newhost);
else
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
newhost);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else
ClearDynSpoof(client_p);
}
static void
do_host_cloak(const char *inbuf, char *outbuf)
{
unsigned char *hash;
char buf[3];
char output[HOSTLEN+1];
int i;
hash = HMAC(EVP_sha256(), secretsalt, strlen(secretsalt), (unsigned char*)inbuf, strlen(inbuf), NULL, NULL);
output[0]=0;
for (i = 0; i < 32; i++) {
sprintf(buf, "%.2x", hash[i]);
strcat(output,buf);
}
rb_strlcpy(outbuf,output,HOSTLEN+1);
}
static void
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
if (!MyClient(source_p))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
if (source_p->umodes & user_modes['h']) {
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost))) {
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->localClient->mangledhost);
} else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
source_p->host);
} else if (!(source_p->umodes & user_modes['x'])) {
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->orighost);
}
}
}
static void
check_new_user(void *vdata)
{
struct Client *source_p = (void *)vdata;
if (IsIPSpoof(source_p)) {
source_p->umodes &= ~user_modes['x'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1);
do_host_cloak(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x']) {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
}

View File

@ -84,8 +84,7 @@ do_host_cloak_ip(const char *inbuf, char *outbuf)
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
if (strchr(outbuf, ':'))
{
if (strchr(outbuf, ':')) {
ipv6 = 1;
/* Damn you IPv6...
@ -99,14 +98,11 @@ do_host_cloak_ip(const char *inbuf, char *outbuf)
for (tptr = outbuf; *tptr != '\0'; tptr++)
if (*tptr == ':')
totalcount++;
}
else if (!strchr(outbuf, '.'))
} else if (!strchr(outbuf, '.'))
return;
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
if (*tptr == ':' || *tptr == '.')
{
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (*tptr == ':' || *tptr == '.') {
sepcount++;
continue;
}
@ -136,8 +132,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf)
*
* numbers are not changed at this time, only letters.
*/
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (*tptr == '.')
break;
@ -151,8 +146,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf)
}
/* pass 2: scramble each number in the address */
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (isdigit(*tptr))
*tptr = '0' + (*tptr + accum) % 10;
@ -173,26 +167,19 @@ check_umode_change(void *vdata)
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
if (source_p->umodes & user_modes['x'])
{
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost)))
{
if (source_p->umodes & user_modes['x']) {
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost))) {
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost))
{
if (strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->localClient->mangledhost);
}
else /* not really nice, but we need to send this numeric here */
} else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
source_p->host);
}
else if (!(source_p->umodes & user_modes['x']))
{
} else if (!(source_p->umodes & user_modes['x'])) {
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost))
{
!strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->orighost);
}
}
@ -203,8 +190,7 @@ check_new_user(void *vdata)
{
struct Client *source_p = (void *)vdata;
if (IsIPSpoof(source_p))
{
if (IsIPSpoof(source_p)) {
source_p->umodes &= ~user_modes['x'];
return;
}
@ -215,8 +201,7 @@ check_new_user(void *vdata)
do_host_cloak_host(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x'])
{
if (source_p->umodes & user_modes['x']) {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);

View File

@ -14,7 +14,8 @@ static int mclient_42(struct Client *client_p, struct Client *source_p, int parc
struct Message hgtg_msgtab = {
"42", 0, 0, 0, MFLG_SLOW,
{ mg_ignore, {mclient_42, 0}, mg_ignore, mg_ignore, mg_ignore, {mclient_42, 0}
{
mg_ignore, {mclient_42, 0}, mg_ignore, mg_ignore, mg_ignore, {mclient_42, 0}
}
};

View File

@ -58,8 +58,7 @@ DECLARE_MODULE_AV1(adminwall, NULL, NULL, adminwall_clist, NULL, NULL, "$Revisio
static int
mo_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsAdmin(source_p))
{
if(!IsAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "adminwall");
return 0;

View File

@ -46,17 +46,14 @@ m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
while(name)
{
if((chptr = find_channel(name)) == NULL)
{
while(name) {
if((chptr = find_channel(name)) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL)
{
if(msptr == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
return 0;
}
@ -67,16 +64,13 @@ m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *
if((is_any_op(msptr) || !MyConnect(source_p) ||
((can_send(chptr, source_p, msptr) > 0 &&
(source_p->localClient->firsttime +
ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time()))))
{
ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :Cycling", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :Cycling",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
else
{
} else {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",

View File

@ -62,39 +62,31 @@ m_findforwards(struct Client *client_p, struct Client *source_p, int parc, const
*p = '\0';
/* Allow ircops to search for forwards to nonexistent channels */
if(!IsOper(source_p))
{
if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL)
{
if(!IsOper(source_p)) {
if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
}
if(!is_any_op(msptr))
{
if(!is_any_op(msptr)) {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]);
return 0;
}
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "FINDFORWARDS");
return 0;
}
else
} else
last_used = rb_current_time();
}
RB_DLINK_FOREACH(ptr, global_channel_list.head)
{
RB_DLINK_FOREACH(ptr, global_channel_list.head) {
chptr = ptr->data;
if(chptr->mode.forward && !irccmp(chptr->mode.forward, parv[1]))
{
if(p + strlen(chptr->chname) >= end - 13)
{
if(chptr->mode.forward && !irccmp(chptr->mode.forward, parv[1])) {
if(p + strlen(chptr->chname) >= end - 13) {
strcpy(p, "<truncated> ");
p += 12;
break;

View File

@ -74,8 +74,7 @@ mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const c
char sjmode;
char *newch;
if(!IsOperAdmin(source_p))
{
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
@ -86,8 +85,7 @@ mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const c
/* if target_p is not existant, print message
* to source_p and bail - scuzzy
*/
if((target_p = find_client(parv[1])) == NULL)
{
if((target_p = find_client(parv[1])) == NULL) {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, parv[1]);
return 0;
}
@ -106,20 +104,15 @@ mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const c
source_p->name, source_p->username, source_p->host);
/* select our modes from parv[2] if they exist... (chanop) */
if(*parv[2] == '@')
{
if(*parv[2] == '@') {
type = CHFL_CHANOP;
mode = 'o';
sjmode = '@';
}
else if(*parv[2] == '+')
{
} else if(*parv[2] == '+') {
type = CHFL_VOICE;
mode = 'v';
sjmode = '+';
}
else
{
} else {
type = CHFL_PEON;
mode = sjmode = '\0';
}
@ -127,10 +120,8 @@ mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const c
if(mode != '\0')
parv[2]++;
if((chptr = find_channel(parv[2])) != NULL)
{
if(IsMember(target_p, chptr))
{
if((chptr = find_channel(parv[2])) != NULL) {
if(IsMember(target_p, chptr)) {
/* debugging is fun... */
sendto_one_notice(source_p, ":*** Notice -- %s is already in %s",
target_p->name, chptr->chname);
@ -152,8 +143,7 @@ mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const c
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s",
me.name, chptr->chname, mode, target_p->name);
if(chptr->topic != NULL)
{
if(chptr->topic != NULL) {
sendto_one(target_p, form_str(RPL_TOPIC), me.name,
target_p->name, chptr->chname, chptr->topic);
sendto_one(target_p, form_str(RPL_TOPICWHOTIME),
@ -162,28 +152,23 @@ mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const c
}
channel_member_names(chptr, target_p, 1);
}
else
{
} else {
newch = LOCAL_COPY(parv[2]);
if(!check_channel_name(newch))
{
if(!check_channel_name(newch)) {
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
/* channel name must begin with & or # */
if(!IsChannelName(newch))
{
if(!IsChannelName(newch)) {
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
/* newch can't be longer than CHANNELLEN */
if(strlen(newch) > CHANNELLEN)
{
if(strlen(newch) > CHANNELLEN) {
sendto_one_notice(source_p, ":Channel name is too long");
return 0;
}

View File

@ -65,11 +65,11 @@ DECLARE_MODULE_AV1(identify, NULL, NULL, identify_clist, NULL, NULL, "$Revision:
char *reconstruct_parv(int parc, const char *parv[])
{
static char tmpbuf[BUFSIZE]; int i;
static char tmpbuf[BUFSIZE];
int i;
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (i = 1; i < parc; i++)
{
for (i = 1; i < parc; i++) {
rb_strlcat(tmpbuf, " ", BUFSIZE);
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
}
@ -81,19 +81,15 @@ static int m_identify(struct Client *client_p, struct Client *source_p, int parc
const char *nick;
struct Client *target_p;
if (parc < 2 || EmptyString(parv[1]))
{
if (parc < 2 || EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0;
}
nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK;
if ((target_p = find_named_person(nick)) && IsService(target_p))
{
if ((target_p = find_named_person(nick)) && IsService(target_p)) {
sendto_one(target_p, ":%s PRIVMSG %s :IDENTIFY %s", get_id(source_p, target_p), get_id(target_p, target_p), reconstruct_parv(parc - 1, &parv[1]));
}
else
{
} else {
sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick);
}
return 0;

View File

@ -50,8 +50,7 @@ m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const cha
const char *hashtype;
const char hashdefault[] = "SHA512";
if(EmptyString(parv[1]))
{
if(EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
@ -61,13 +60,11 @@ m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const cha
else
hashtype = parv[2];
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
return 0;
}
else
} else
last_used = rb_current_time();
if(!irccmp(hashtype, "SHA256"))
@ -76,8 +73,7 @@ m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const cha
salt = make_sha512_salt(16);
else if(!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else
{
else {
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
@ -98,8 +94,7 @@ mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const ch
const char *hashtype;
const char hashdefault[] = "SHA512";
if(EmptyString(parv[1]))
{
if(EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
@ -115,8 +110,7 @@ mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const ch
salt = make_sha512_salt(16);
else if(!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else
{
else {
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
@ -130,8 +124,7 @@ char *
make_md5_salt(int length)
{
static char salt[21];
if(length > 16)
{
if(length > 16) {
printf("MD5 salt length too long\n");
exit(0);
}
@ -148,8 +141,7 @@ char *
make_sha256_salt(int length)
{
static char salt[21];
if(length > 16)
{
if(length > 16) {
printf("SHA256 salt length too long\n");
exit(0);
}
@ -166,8 +158,7 @@ char *
make_sha512_salt(int length)
{
static char salt[21];
if(length > 16)
{
if(length > 16) {
printf("SHA512 salt length too long\n");
exit(0);
}
@ -185,8 +176,7 @@ generate_poor_salt(char *salt, int length)
{
int i;
srand(time(NULL));
for(i = 0; i < length; i++)
{
for(i = 0; i < length; i++) {
salt[i] = saltChars[rand() % 64];
}
return (salt);
@ -197,19 +187,16 @@ generate_random_salt(char *salt, int length)
{
char *buf;
int fd, i;
if((fd = open("/dev/random", O_RDONLY)) < 0)
{
if((fd = open("/dev/random", O_RDONLY)) < 0) {
return (generate_poor_salt(salt, length));
}
buf = calloc(1, length);
if(read(fd, buf, length) != length)
{
if(read(fd, buf, length) != length) {
free(buf);
return (generate_poor_salt(salt, length));
}
for(i = 0; i < length; i++)
{
for(i = 0; i < length; i++) {
salt[i] = saltChars[abs(buf[i]) % 64];
}
free(buf);

View File

@ -25,27 +25,23 @@ mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const cha
struct Client *target_p;
char text[10];
if(!(target_p = find_client(parv[1])))
{
if(!(target_p = find_client(parv[1]))) {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
}
/* If we don't check for this, and some idiot tries to OACCEPT a server... */
if(!IsPerson(target_p))
{
if(!IsPerson(target_p)) {
sendto_one_notice(source_p, ":That is a server, not a user. What are you doing?");
return 0;
}
rb_snprintf(text, sizeof(text), "O%s", source_p->id);
snprintf(text, sizeof(text), "O%s", source_p->id);
/* Provide a nice error message if you try to OACCEPT someone
* who you've already OACCEPTed. */
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
{
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))
{
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) {
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text)) {
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
return 0;
}

View File

@ -58,27 +58,23 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
int move_me = 0;
/* admins only */
if(!IsOperAdmin(source_p))
{
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '!' || *parv[1] == '~')
{
if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '!' || *parv[1] == '~') {
parv[1]++;
move_me = 1;
}
if((chptr = find_channel(parv[1])) == NULL)
{
if((chptr = find_channel(parv[1])) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
if(IsMember(source_p, chptr))
{
if(IsMember(source_p, chptr)) {
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
return 0;
}
@ -97,8 +93,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
me.name, parv[1],
source_p->name, source_p->username, source_p->host);
if(*parv[1] == '~' && ConfigChannel.use_owner)
{
if(*parv[1] == '~' && ConfigChannel.use_owner) {
add_user_to_channel(chptr, source_p, CHFL_OWNER);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :~%s",
@ -108,9 +103,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
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);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :!%s",
@ -121,9 +114,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
me.name, chptr->chname, source_p->name);
}
else if(*parv[1] == '@')
{
} else if(*parv[1] == '@') {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :@%s",
@ -134,9 +125,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, chptr->chname, source_p->name);
}
else if(*parv[1] == '%' && ConfigChannel.use_halfop)
{
} else if(*parv[1] == '%' && ConfigChannel.use_halfop) {
add_user_to_channel(chptr, source_p, CHFL_HALFOP);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :%s%s",
@ -146,9 +135,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
me.name, chptr->chname, source_p->name);
}
else if(*parv[1] == '+')
{
} else if(*parv[1] == '+') {
add_user_to_channel(chptr, source_p, CHFL_VOICE);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :+%s",
@ -158,9 +145,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +v %s",
me.name, chptr->chname, source_p->name);
}
else
{
} else {
add_user_to_channel(chptr, source_p, CHFL_PEON);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s JOIN %ld %s +",
@ -171,8 +156,7 @@ mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char
}
/* send the topic... */
if(chptr->topic != NULL)
{
if(chptr->topic != NULL) {
sendto_one(source_p, form_str(RPL_TOPIC), me.name,
source_p->name, chptr->chname, chptr->topic);
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name,

View File

@ -70,8 +70,7 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
char text[10];
static char buf[BUFSIZE];
if(*parv[2] == '\0')
{
if(*parv[2] == '\0') {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK");
return 0;
}
@ -90,8 +89,7 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
name = LOCAL_COPY(parv[1]);
chptr = find_channel(name);
if(!chptr)
{
if(!chptr) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
@ -100,19 +98,16 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
if((p = strchr(parv[2], ',')))
*p = '\0';
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
if(!(who = find_chasing(source_p, user, &chasing)))
{
if(!(who = find_chasing(source_p, user, &chasing))) {
return 0;
}
if((target_p = find_client(user)) == NULL)
{
if((target_p = find_client(user)) == NULL) {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, user);
return 0;
}
if((msptr = find_channel_membership(chptr, target_p)) == NULL)
{
if((msptr = find_channel_membership(chptr, target_p)) == NULL) {
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
me.name, source_p->name, parv[1], parv[2]);
return 0;
@ -137,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);
remove_user_from_channel(msptr);
rb_snprintf(text, sizeof(text), "K%s", who->id);
snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

View File

@ -66,8 +66,7 @@ static void list_named_channel(struct Client *source_p, const char *name);
static int
mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsOperSpy(source_p))
{
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),
@ -101,8 +100,7 @@ list_all_channels(struct Client *source_p)
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)
{
RB_DLINK_FOREACH(ptr, global_channel_list.head) {
chptr = ptr->data;
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s",

View File

@ -66,15 +66,13 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
int wasonchannel;
/* admins only */
if(!IsOperAdmin(source_p))
{
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
/* Now, try to find the channel in question */
if(!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1]))
{
if(!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1])) {
sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), parv[1]);
return 0;
@ -82,8 +80,7 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
chptr = find_channel(parv[1]);
if(chptr == NULL)
{
if(chptr == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
@ -93,15 +90,13 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
msptr = find_channel_membership(chptr, source_p);
wasonchannel = msptr != NULL;
if (is_any_op(msptr))
{
if (is_any_op(msptr)) {
sendto_one_notice(source_p, ":Use a normal MODE you idiot");
return 0;
}
params[0] = '\0';
for (i = 2; i < parc; i++)
{
for (i = 2; i < parc; i++) {
if (i != 2)
rb_strlcat(params, " ", sizeof params);
rb_strlcat(params, parv[i], sizeof params);
@ -123,11 +118,9 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
set_channel_mode(client_p, source_p->servptr, chptr, msptr,
parc - 2, parv + 2);
#else
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name))
{
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name)) {
/* Ownering themselves */
if (!wasonchannel)
{
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
@ -139,12 +132,9 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_OWNER;
}
else if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name))
{
} else if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name)) {
/* Admining themselves */
if (!wasonchannel)
{
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
@ -156,12 +146,9 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_ADMIN;
}
else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name))
{
} else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name)) {
/* Opping themselves */
if (!wasonchannel)
{
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
@ -173,12 +160,9 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_CHANOP;
}
else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name))
{
} else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name)) {
/* Halfopping themselves */
if (!wasonchannel)
{
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
@ -190,17 +174,14 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_HALFOP;
}
else if (ConfigChannel.use_owner)
{
} else if (ConfigChannel.use_owner) {
/* I hope this is correct.
* -- Kabaka */
/* Hack it so set_channel_mode() will accept */
if (wasonchannel)
msptr->flags |= CHFL_OWNER;
else
{
else {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
@ -210,14 +191,11 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
msptr->flags &= ~CHFL_OWNER;
else
remove_user_from_channel(msptr);
}
else if (ConfigChannel.use_admin)
{
} else if (ConfigChannel.use_admin) {
/* Hack it so set_channel_mode() will accept */
if (wasonchannel)
msptr->flags |= CHFL_ADMIN;
else
{
else {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
@ -230,15 +208,12 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
msptr->flags &= ~CHFL_ADMIN;
else
remove_user_from_channel(msptr);
}
else
{
} else {
/* CHFL_ADMIN is only useful if admin is enabled
* so hack it with op if it is not. */
if (wasonchannel)
msptr->flags |= CHFL_CHANOP;
else
{
else {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}

View File

@ -58,25 +58,21 @@ mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *
rb_dlink_node *ptr;
/* admins only */
if(!IsOperAdmin(source_p))
{
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
if((chptr = find_channel(parv[1])) == NULL)
{
if((chptr = find_channel(parv[1])) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
RB_DLINK_FOREACH(ptr, chptr->members.head)
{
RB_DLINK_FOREACH(ptr, chptr->members.head) {
msptr = ptr->data;
if(is_chanop(msptr) || is_admin(msptr) || is_owner(msptr))
{
if(is_chanop(msptr) || is_admin(msptr) || is_owner(msptr)) {
sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
return 0;
}
@ -96,8 +92,7 @@ mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *
parv[1], get_oper_name(source_p));
/* dont send stuff for local channels remotely. */
if(*chptr->chname != '&')
{
if(*chptr->chname != '&') {
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
me.name, parv[1], source_p->name, source_p->username, source_p->host);

View File

@ -139,27 +139,23 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
char *nick3 = rb_strdup(nick);
char text2[BUFSIZE];
if((chptr = find_channel(channel)) == NULL)
{
if((chptr = find_channel(channel)) == NULL) {
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), channel);
return 0;
}
if(!(msptr = find_channel_membership(chptr, source_p)))
{
if(!(msptr = find_channel_membership(chptr, source_p))) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), chptr->chname);
return 0;
}
if(!(chptr->mode.mode & chmode_flags['N']))
{
if(!(chptr->mode.mode & chmode_flags['N'])) {
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
return 0;
}
if(!can_send(chptr, source_p, msptr))
{
if(!can_send(chptr, source_p, msptr)) {
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
return 0;
}
@ -169,30 +165,28 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
return 0;
/* enforce target change on roleplay commands */
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr))
{
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr)) {
sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, chptr->chname);
return 0;
}
if(underline)
rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
else
rb_snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
/* don't allow nicks to be empty after stripping
* this prevents nastiness like fake factions, etc. */
if(EmptyString(nick3))
{
if(EmptyString(nick3)) {
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
return 0;
}
if(action)
rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
else
rb_snprintf(text2, sizeof(text2), "%s", text);
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_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",

View File

@ -69,8 +69,7 @@ static const char *expand_xline(const char *mask)
return NULL;
p = mask;
q = buf;
while (*p != '\0')
{
while (*p != '\0') {
if (*p == ' ')
*q++ = '\\', *q++ = 's';
else
@ -89,20 +88,17 @@ static int mo_sendbans(struct Client *client_p, struct Client *source_p, int par
const char *target, *mask2;
struct Client *server_p;
if (!IsOperRemoteBan(source_p))
{
if (!IsOperRemoteBan(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban");
return 0;
}
if (!IsOperXline(source_p))
{
if (!IsOperXline(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "xline");
return 0;
}
if (!IsOperResv(source_p))
{
if (!IsOperResv(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "resv");
return 0;
@ -110,16 +106,14 @@ static int mo_sendbans(struct Client *client_p, struct Client *source_p, int par
target = parv[1];
count = 0;
RB_DLINK_FOREACH(ptr, global_serv_list.head)
{
RB_DLINK_FOREACH(ptr, global_serv_list.head) {
server_p = ptr->data;
if (IsMe(server_p))
continue;
if (match(target, server_p->name))
count++;
}
if (count == 0)
{
if (count == 0) {
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), target);
return 0;
@ -130,8 +124,7 @@ static int mo_sendbans(struct Client *client_p, struct Client *source_p, int par
source_p->name, source_p->username, source_p->host,
target);
RB_DLINK_FOREACH(ptr, resv_conf_list.head)
{
RB_DLINK_FOREACH(ptr, resv_conf_list.head) {
aconf = ptr->data;
if (aconf->hold)
continue;
@ -141,8 +134,7 @@ static int mo_sendbans(struct Client *client_p, struct Client *source_p, int par
target, aconf->host, aconf->passwd);
}
HASH_WALK(i, R_MAX, ptr, resvTable)
{
HASH_WALK(i, R_MAX, ptr, resvTable) {
aconf = ptr->data;
if (aconf->hold)
continue;
@ -153,14 +145,12 @@ static int mo_sendbans(struct Client *client_p, struct Client *source_p, int par
}
HASH_WALK_END
RB_DLINK_FOREACH(ptr, xline_conf_list.head)
{
RB_DLINK_FOREACH(ptr, xline_conf_list.head) {
aconf = ptr->data;
if (aconf->hold)
continue;
mask2 = expand_xline(aconf->host);
if (mask2 == NULL)
{
if (mask2 == NULL) {
sendto_one_notice(source_p, ":Skipping xline [%s]",
aconf->host);
continue;

View File

@ -77,8 +77,7 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
struct ConfItem *aconf;
const char *encr;
if (!strchr(parv[4], '.') && !strchr(parv[4], ':'))
{
if (!strchr(parv[4], '.') && !strchr(parv[4], ':')) {
sendto_one(source_p, "NOTICE * :Invalid IP");
return 0;
}
@ -90,14 +89,12 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
client_p->localClient->ip.ss_family, NULL);
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
return 0;
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
{
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc.")) {
/* XXX */
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
return 0;
}
if (EmptyString(aconf->passwd))
{
if (EmptyString(aconf->passwd)) {
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
return 0;
}
@ -109,8 +106,7 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
else
encr = parv[1];
if (strcmp(encr, aconf->passwd))
{
if (strcmp(encr, aconf->passwd)) {
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
return 0;
}
@ -127,10 +123,8 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
/* Check dlines now, klines will be checked on registration */
if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip,
source_p->localClient->ip.ss_family)))
{
if(!(aconf->status & CONF_EXEMPTDLINE))
{
source_p->localClient->ip.ss_family))) {
if(!(aconf->status & CONF_EXEMPTDLINE)) {
exit_client(client_p, source_p, &me, "D-lined");
return 0;
}

View File

@ -26,8 +26,7 @@ h_nl_umode_changed(hook_data_umode_changed *hdata)
{
struct Client *source_p = hdata->client;
if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS)
{
if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS) {
source_p->umodes &= ~UMODE_LOCOPS;
}
}

View File

@ -29,8 +29,7 @@ h_noi_umode_changed(hook_data_umode_changed *hdata)
struct Client *source_p = hdata->client;
if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) &&
IsInvisible(source_p))
{
IsInvisible(source_p)) {
ClearInvisible(source_p);
/* If they tried /umode +i, complain; do not complain
* if they opered up while invisible -- jilles */

View File

@ -34,27 +34,20 @@ h_gla_client_exit(hook_data_client_exit *hdata)
if (MyConnect(source_p) || !IsClient(source_p))
return;
if (!strcmp(hdata->comment, "Bad user info"))
{
if (!strcmp(hdata->comment, "Bad user info")) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"XLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (ConfigFileEntry.kline_reason != NULL &&
!strcmp(hdata->comment, ConfigFileEntry.kline_reason))
{
} else if (ConfigFileEntry.kline_reason != NULL &&
!strcmp(hdata->comment, ConfigFileEntry.kline_reason)) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
{
} else if (!strncmp(hdata->comment, "Temporary K-line ", 17)) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
{
} else if (!strncmp(hdata->comment, "Temporary D-line ", 17)) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);

View File

@ -52,8 +52,7 @@ show_whois(hook_data_client *data)
IsOper(target_p) &&
#endif
(source_p != target_p) &&
(target_p->snomask & snomask_modes['W']))
{
(target_p->snomask & snomask_modes['W'])) {
sendto_one_notice(target_p,
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
source_p->name,

View File

@ -41,8 +41,7 @@ show_stats(hook_data_int *data)
{
char statchar = (char) data->arg2;
if(statchar == 'L' || statchar == 'l')
{
if(statchar == 'L' || statchar == 'l') {
const char *name = data->arg1;
if(!EmptyString(name))
@ -58,9 +57,7 @@ show_stats(hook_data_int *data)
statchar, data->client->name,
data->client->username,
data->client->host, data->client->servptr->name);
}
else
{
} else {
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS %c requested by %s (%s@%s) [%s]",
statchar, data->client->name, data->client->username,

3
extra/runit/run Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
setuser ircd /home/ircd/run/bin/ircd -foreground

View File

@ -17,7 +17,8 @@
#include "version.h"
IRCDVar myIrcd[] = {
{"Elemental-IRCd 6.5", /* ircd name */
{
"Elemental-IRCd 6.5", /* ircd name */
"+oiS", /* nickserv mode */
"+oiS", /* chanserv mode */
"+oiS", /* memoserv mode */
@ -145,7 +146,8 @@ IRCDCAPAB myIrcdcap[] = {
0, /* TLKEXT */
0, /* DODKEY */
0, /* DOZIP */
0, 0, 0}
0, 0, 0
}
};
/*******************************************************************/
@ -780,44 +782,82 @@ void moduleAddIRCDMsgs(void)
TS6SID = sstrdup(Numeric);
}
m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("402", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m);
m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
m = createMessage("TMODE", anope_event_tmode); addCoreMessage(IRCD,m);
m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
m = createMessage("BMASK", anope_event_bmask); addCoreMessage(IRCD,m);
m = createMessage("UID", anope_event_nick); addCoreMessage(IRCD,m);
m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m);
m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m);
m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m);
m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
m = createMessage("TB", anope_event_tburst); addCoreMessage(IRCD,m);
m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
m = createMessage("SVSMODE", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m);
m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m);
m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m);
m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
m = createMessage("421", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("ENCAP", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("SID", anope_event_sid); addCoreMessage(IRCD,m);
m = createMessage("EUID", anope_event_euid); addCoreMessage(IRCD,m);
m = createMessage("401", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("402", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("436", anope_event_436);
addCoreMessage(IRCD,m);
m = createMessage("AWAY", anope_event_away);
addCoreMessage(IRCD,m);
m = createMessage("INVITE", anope_event_invite);
addCoreMessage(IRCD,m);
m = createMessage("JOIN", anope_event_join);
addCoreMessage(IRCD,m);
m = createMessage("KICK", anope_event_kick);
addCoreMessage(IRCD,m);
m = createMessage("KILL", anope_event_kill);
addCoreMessage(IRCD,m);
m = createMessage("MODE", anope_event_mode);
addCoreMessage(IRCD,m);
m = createMessage("TMODE", anope_event_tmode);
addCoreMessage(IRCD,m);
m = createMessage("MOTD", anope_event_motd);
addCoreMessage(IRCD,m);
m = createMessage("NICK", anope_event_nick);
addCoreMessage(IRCD,m);
m = createMessage("BMASK", anope_event_bmask);
addCoreMessage(IRCD,m);
m = createMessage("UID", anope_event_nick);
addCoreMessage(IRCD,m);
m = createMessage("NOTICE", anope_event_notice);
addCoreMessage(IRCD,m);
m = createMessage("PART", anope_event_part);
addCoreMessage(IRCD,m);
m = createMessage("PASS", anope_event_pass);
addCoreMessage(IRCD,m);
m = createMessage("PING", anope_event_ping);
addCoreMessage(IRCD,m);
m = createMessage("PRIVMSG", anope_event_privmsg);
addCoreMessage(IRCD,m);
m = createMessage("QUIT", anope_event_quit);
addCoreMessage(IRCD,m);
m = createMessage("SERVER", anope_event_server);
addCoreMessage(IRCD,m);
m = createMessage("SQUIT", anope_event_squit);
addCoreMessage(IRCD,m);
m = createMessage("TOPIC", anope_event_topic);
addCoreMessage(IRCD,m);
m = createMessage("TB", anope_event_tburst);
addCoreMessage(IRCD,m);
m = createMessage("USER", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("WALLOPS", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("WHOIS", anope_event_whois);
addCoreMessage(IRCD,m);
m = createMessage("SVSMODE", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("SVSNICK", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("CAPAB", anope_event_capab);
addCoreMessage(IRCD,m);
m = createMessage("SJOIN", anope_event_sjoin);
addCoreMessage(IRCD,m);
m = createMessage("SVINFO", anope_event_svinfo);
addCoreMessage(IRCD,m);
m = createMessage("ADMIN", anope_event_admin);
addCoreMessage(IRCD,m);
m = createMessage("ERROR", anope_event_error);
addCoreMessage(IRCD,m);
m = createMessage("421", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("ENCAP", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("SID", anope_event_sid);
addCoreMessage(IRCD,m);
m = createMessage("EUID", anope_event_euid);
addCoreMessage(IRCD,m);
}
/* *INDENT-ON* */

View File

@ -12,8 +12,8 @@
#include "module.h"
#include "modules/cs_mode.h"
#include "modules/sasl.h"
static bool sasl = true;
static Anope::string UplinkSID;
static ServiceReference<IRCDProto> ratbox("IRCDProto", "ratbox");
@ -141,6 +141,18 @@ class ElementalProto : public IRCDProto
{
this->SendVhost(u, "", u->host);
}
void SendSASLMessage(const SASL::Message &message) anope_override
{
Server *s = Server::Find(message.target.substr(0, 3));
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : message.target.substr(0, 3)) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext));
}
void SendSVSLogin(const Anope::string &uid, const Anope::string &acc) anope_override
{
Server *s = Server::Find(uid.substr(0, 3));
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * * * " << acc;
}
};
@ -175,84 +187,18 @@ struct IRCDMessageEncap : IRCDMessage
* termination: 'A' for abort, 'F' for authentication failure, 'S' for
* authentication success).
*
* Elemental only accepts messages from SASL agents; these must have umode +S
* Charybdis only accepts messages from SASL agents; these must have umode +S
*/
if (params[1] == "SASL" && sasl && params.size() == 6)
if (params[1] == "SASL" && SASL::sasl && params.size() >= 6)
{
class ElementalSASLIdentifyRequest : public IdentifyRequest
{
Anope::string uid;
MessageSource msource;
SASL::Message m;
m.source = params[2];
m.target = params[3];
m.type = params[4];
m.data = params[5];
m.ext = params.size() > 6 ? params[6] : "";
public:
ElementalSASLIdentifyRequest(Module *m, MessageSource &source_, const Anope::string &id, const Anope::string &acc, const Anope::string &pass) : IdentifyRequest(m, acc, pass), uid(id), msource(source_) { }
void OnSuccess() anope_override
{
BotInfo *NickServ = Config->GetClient("NickServ");
if (!NickServ)
return;
/* SVSLOGIN
* parameters: target, new nick, new username, new visible hostname, new login name
* Sent after successful SASL authentication.
* The target is a UID, typically an unregistered one.
* Any of the "new" parameters can be '*' to leave the corresponding field
* unchanged. The new login name can be '0' to log the user out.
* If the UID is registered on the network, a SIGNON with the changes will be
* broadcast, otherwise the changes will be stored, to be used when registration
* completes.
*/
UplinkSocket::Message(Me) << "ENCAP " << msource.GetName() << " SVSLOGIN " << this->uid << " * * * " << this->GetAccount();
UplinkSocket::Message(Me) << "ENCAP " << msource.GetName() << " SASL " << NickServ->GetUID() << " " << this->uid << " D S";
}
void OnFail() anope_override
{
BotInfo *NickServ = Config->GetClient("NickServ");
if (!NickServ)
return;
UplinkSocket::Message(Me) << "ENCAP " << msource.GetName() << " SASL " << NickServ->GetUID() << " " << this->uid << " " << " D F";
Log(NickServ) << "A user failed to identify for account " << this->GetAccount() << " using SASL";
}
};
if (params[4] == "S")
{
BotInfo *NickServ = Config->GetClient("NickServ");
if (!NickServ)
return;
if (params[5] == "PLAIN")
UplinkSocket::Message(Me) << "ENCAP " << source.GetName() << " SASL " << NickServ->GetUID() << " " << params[2] << " C +";
else
UplinkSocket::Message(Me) << "ENCAP " << source.GetName() << " SASL " << NickServ->GetUID() << " " << params[2] << " D F";
}
else if (params[4] == "C")
{
Anope::string decoded;
Anope::B64Decode(params[5], decoded);
size_t p = decoded.find('\0');
if (p == Anope::string::npos)
return;
decoded = decoded.substr(p + 1);
p = decoded.find('\0');
if (p == Anope::string::npos)
return;
Anope::string acc = decoded.substr(0, p),
pass = decoded.substr(p + 1);
if (acc.empty() || pass.empty())
return;
IdentifyRequest *req = new ElementalSASLIdentifyRequest(this->owner, source, params[2], acc, pass);
FOREACH_MOD(OnCheckAuthentication, (NULL, req));
req->Dispatch();
}
SASL::sasl->ProcessMessage(m);
}
}
};
@ -280,7 +226,7 @@ struct IRCDMessageEUID : IRCDMessage
if (params[9] != "*")
na = NickAlias::Find(params[9]);
new User(params[0], params[4], params[8], params[5], params[6], source.GetServer(), params[10], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime, params[3], params[7], na ? *na->nc : NULL);
User::OnIntroduce(params[0], params[4], params[8], params[5], params[6], source.GetServer(), params[10], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime, params[3], params[7], na ? *na->nc : NULL);
}
};
@ -353,6 +299,11 @@ class ProtoElemental : public Module
void AddModes()
{
ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '!', 3));
ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'y', '~', 4));
/* Add user modes */
ModeManager::AddUserMode(new UserMode("NOFORWARD", 'Q'));
ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
@ -373,13 +324,6 @@ class ProtoElemental : public Module
ModeManager::AddChannelMode(new ChannelMode("PERM", 'P'));
ModeManager::AddChannelMode(new ChannelMode("NOFORWARD", 'Q'));
ModeManager::AddChannelMode(new ChannelMode("OPMODERATED", 'z'));
/* Add status modes */
ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2);
ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '!', 3));
ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'y', '~', 4));
}
public:
@ -425,7 +369,6 @@ class ProtoElemental : public Module
void OnReload(Configuration::Conf *conf) anope_override
{
use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock");
sasl = conf->GetModule(this)->Get<bool>("sasl");
}
void OnChannelSync(Channel *c) anope_override

View File

@ -26,6 +26,8 @@ NO PARAMETERS:
weakens +i control.
+z - Op moderated. Messages blocked by +m, +b and +q are instead
sent to ops.
+u - Hidden ban/quiet list. Ban/quiet lists may only be seen
by halfops or higher.
* +L - Large ban list. Increase maximum number of +beIq entries.
* +P - Permanent. Channel does not disappear when empty.
+F - Free target. Anyone may set forwards to this (otherwise

View File

@ -25,4 +25,6 @@ User modes: (* designates that the umode is oper only)
+G - "soft caller id" mode - same as +g but automatically allows
anyone who's in a common channel with you to message you.
+V - Prevents you from receiving invites.
+I - Prevents non-opers from seeing your channel list in
a whois query.
+Z - Is connected via SSL (set only on connection).

View File

@ -24,6 +24,8 @@ NO PARAMETERS:
change nick.
+g - Free invite. Everyone may invite users. Significantly
weakens +i control.
+u - Hidden ban/quiet lists. Ban/quiet lists are hidden from all
channel members that are not a halfop or higher.
+z - Op moderated. Messages blocked by +m, +b and +q are instead
sent to ops.
* +L - Large ban list. Increase maximum number of +beIq entries.

View File

@ -14,6 +14,8 @@ User modes: (? designates that the umode is provided by an extension
+B - Marks you as a bot in /whois.
+C - Prevents you from receiving CTCPs other than ACTION.
+D - Deaf - ignores all channel messages.
+I - Prevents non-opers from seeing your channel list in
a whois query.
+Q - Prevents you from being affected by channel forwarding.
+R - Prevents non accept unidentified users from messaging you.
+G - "soft caller id" mode - same as +g but automatically allows

View File

@ -3,8 +3,7 @@
void init_bandb(void);
typedef enum
{
typedef enum {
BANDB_KLINE,
BANDB_DLINE,
BANDB_XLINE,

View File

@ -3,7 +3,8 @@
#define HELP_MAX 100
#define CACHELINELEN 81
/* Adjusted to allow wider MOTD */
#define CACHELINELEN 513
#define CACHEFILELEN 30
/* two servernames, a gecos, three spaces, ":1", '\0' */
#define LINKSLINELEN (HOSTLEN + HOSTLEN + REALLEN + 6)
@ -13,15 +14,13 @@
struct Client;
struct cachefile
{
struct cachefile {
char name[CACHEFILELEN];
rb_dlink_list contents;
int flags;
};
struct cacheline
{
struct cacheline {
char data[CACHELINELEN];
rb_dlink_node linenode;
};

View File

@ -35,8 +35,7 @@
struct Client;
/* mode structure for channels */
struct Mode
{
struct Mode {
unsigned int mode;
int limit;
char key[KEYLEN];
@ -46,8 +45,7 @@ struct Mode
};
/* channel structure */
struct Channel
{
struct Channel {
rb_dlink_node node;
struct Mode mode;
char *mode_lock;
@ -79,8 +77,7 @@ struct Channel
char *chname;
};
struct membership
{
struct membership {
rb_dlink_node channode;
rb_dlink_node locchannode;
rb_dlink_node usernode;
@ -93,22 +90,19 @@ struct membership
};
#define BANLEN 195
struct Ban
{
struct Ban {
char *banstr;
char *who;
time_t when;
rb_dlink_node node;
};
struct mode_letter
{
struct mode_letter {
int mode;
char letter;
};
struct ChModeChange
{
struct ChModeChange {
char letter;
const char *arg;
const char *id;
@ -120,8 +114,7 @@ struct ChModeChange
struct Client *client;
};
struct ChCapCombo
{
struct ChCapCombo {
int count;
int cap_yes;
int cap_no;
@ -131,8 +124,7 @@ typedef void (*ChannelModeFunc)(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
struct ChannelMode
{
struct ChannelMode {
ChannelModeFunc set_func;
long mode_type;
};
@ -191,6 +183,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
#define MODE_NOREJOIN 0x200000 /* Block rejoin immediately after kick */
#define MODE_NOREPEAT 0x400000 /* Block repeat messages */
#define MODE_NOOPERKICK 0x800000 /* disallow kicking opers */
#define MODE_HIDEBANS 0x1000000 /* disallow non-chanops from seeing ban/quiet lists */
#define CHFL_BAN 0x10000000 /* ban channel flag */
#define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */
@ -309,9 +302,9 @@ extern void user_join(struct Client * client_p, struct Client * source_p, const
extern void do_join_0(struct Client *client_p, struct Client *source_p);
extern int check_channel_name_loc(struct Client *source_p, const char *name);
extern struct Metadata *channel_metadata_add(struct Channel *target, const char *name, const char *value, int propegate);
extern struct Metadata *channel_metadata_add(struct Channel *target, const char *name, const char *value, int propagate);
extern struct Metadata *channel_metadata_time_add(struct Channel *target, const char *name, time_t timevalue, const char *value);
extern void channel_metadata_delete(struct Channel *target, const char *name, int propegate);
extern void channel_metadata_delete(struct Channel *target, const char *name, int propagate);
extern struct Metadata *channel_metadata_find(struct Channel *target, const char *name);
extern void channel_metadata_clear(struct Channel *target);

View File

@ -30,8 +30,7 @@ struct ConfItem;
struct Client;
struct _patricia_tree_t;
struct Class
{
struct Class {
struct Class *next;
char *class_name;
int max_total;

View File

@ -76,8 +76,7 @@ struct scache_entry;
/*
* Client structures
*/
struct User
{
struct User {
rb_dlink_list channel; /* chain of channel pointer blocks */
rb_dlink_list invited; /* chain of invite pointer blocks */
char *away; /* pointer to away message */
@ -88,8 +87,7 @@ struct User
char suser[NICKLEN+1];
};
struct Server
{
struct Server {
struct User *user; /* who activated this connection */
char by[NICKLEN];
rb_dlink_list servers;
@ -99,8 +97,7 @@ struct Server
struct scache_entry *nameinfo;
};
struct ZipStats
{
struct ZipStats {
unsigned long long in;
unsigned long long in_wire;
unsigned long long out;
@ -109,8 +106,7 @@ struct ZipStats
double out_ratio;
};
struct Client
{
struct Client {
rb_dlink_node node;
rb_dlink_node lnode;
struct User *user; /* ...defined, if this is a User */
@ -170,8 +166,7 @@ struct Client
char *certfp; /* client certificate fingerprint */
};
struct LocalUser
{
struct LocalUser {
rb_dlink_node tnode; /* This is the node for the local list type the client is on*/
/*
* The following fields are allocated only for local clients
@ -286,8 +281,7 @@ struct LocalUser
struct ev_entry *override_timeout_event;
};
struct PreClient
{
struct PreClient {
char spoofnick[NICKLEN + 1];
char spoofuser[USERLEN + 1];
char spoofhost[HOSTLEN + 1];
@ -302,8 +296,7 @@ struct PreClient
struct rb_sockaddr_storage lip; /* address of our side of the connection */
};
struct ListClient
{
struct ListClient {
unsigned int hash_indice;
unsigned int users_min, users_max;
time_t created_min, created_max, topic_min, topic_max;
@ -426,6 +419,7 @@ struct ListClient
#define UMODE_NOINVITE 0x0800 /* block invites */
#define UMODE_BOT 0x8000 /* mark as a bot in whois */
#define UMODE_SCALLERID 0x40000 /* soft caller id */
#define UMODE_HIDECHANS 0x80000 /* hide channels in whois */
/* user information flags, only settable by remote mode or local oper */
#define UMODE_OPER 0x1000 /* Operator */
@ -615,8 +609,8 @@ extern char *generate_uid(void);
void allocate_away(struct Client *);
void free_away(struct Client *);
extern struct Metadata *user_metadata_add(struct Client *target, const char *name, const char *value, int propegate);
extern void user_metadata_delete(struct Client *target, const char *name, int propegate);
extern struct Metadata *user_metadata_add(struct Client *target, const char *name, const char *value, int propagate);
extern void user_metadata_delete(struct Client *target, const char *name, int propagate);
extern struct Metadata *user_metadata_find(struct Client *target, const char *name);
extern void user_metadata_clear(struct Client *target);

View File

@ -6,8 +6,7 @@
#ifndef INCLUDED_HOOK_H
#define INCLUDED_HOOK_H
typedef struct
{
typedef struct {
char *name;
rb_dlink_list hooks;
} hook;
@ -36,64 +35,55 @@ void add_hook(const char *name, hookfn fn);
void remove_hook(const char *name, hookfn fn);
void call_hook(int id, void *arg);
typedef struct
{
typedef struct {
struct Client *client;
const void *arg1;
const void *arg2;
} hook_data;
typedef struct
{
typedef struct {
struct Client *client;
const void *arg1;
int arg2;
} hook_data_int;
typedef struct
{
typedef struct {
struct Client *client;
struct Client *target;
} hook_data_client;
typedef struct
{
typedef struct {
struct Client *client;
struct Channel *chptr;
int approved;
} hook_data_channel;
typedef struct
{
typedef struct {
struct Client *client;
struct Channel *chptr;
char *key;
} hook_data_channel_activity;
typedef struct
{
typedef struct {
struct Client *client;
struct Channel *chptr;
struct Client *target;
int approved;
} hook_data_channel_approval;
typedef struct
{
typedef struct {
struct Client *client;
int approved;
} hook_data_client_approval;
typedef struct
{
typedef struct {
struct Client *local_link; /* local client originating this, or NULL */
struct Client *target; /* dying client */
struct Client *from; /* causing client (could be &me or target) */
const char *comment;
} hook_data_client_exit;
typedef struct
{
typedef struct {
struct Client *client;
unsigned int oldumodes;
unsigned int oldsnomask;

View File

@ -26,8 +26,7 @@
#ifndef INCLUDE_hostmask_h
#define INCLUDE_hostmask_h 1
enum
{
enum {
HM_HOST,
HM_IPV4
#ifdef RB_IPV6
@ -70,15 +69,12 @@ int match_ipv4(struct sockaddr *, struct sockaddr *, int);
extern struct AddressRec *atable[ATABLE_SIZE];
struct AddressRec
{
struct AddressRec {
/* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */
int masktype;
union
{
struct
{
union {
struct {
/* Pointer into ConfItem... -A1kmm */
struct rb_sockaddr_storage addr;
int bits;

View File

@ -36,16 +36,13 @@ strip_colour(char *string)
/* c is source, c2 is target */
for(; c && *c; c++)
switch (*c)
{
switch (*c) {
case 3:
if(isdigit(c[1]))
{
if(isdigit(c[1])) {
c++;
if(isdigit(c[1]))
c++;
if(c[1] == ',' && isdigit(c[2]))
{
if(c[1] == ',' && isdigit(c[2])) {
c += 2;
if(isdigit(c[1]))
c++;
@ -87,16 +84,13 @@ strip_unprintable(char *string)
/* c is source, c2 is target */
for(; c && *c; c++)
switch (*c)
{
switch (*c) {
case 3:
if(isdigit(c[1]))
{
if(isdigit(c[1])) {
c++;
if(isdigit(c[1]))
c++;
if(c[1] == ',' && isdigit(c[2]))
{
if(c[1] == ',' && isdigit(c[2])) {
c += 2;
if(isdigit(c[1]))
c++;

View File

@ -29,16 +29,14 @@ struct Dictionary; /* defined in src/dictionary.c */
typedef int (*DCF)(const char *a, const char *b);
struct DictionaryElement
{
struct DictionaryElement {
struct DictionaryElement *left, *right, *prev, *next;
void *data;
const char *key;
int position;
};
struct DictionaryIter
{
struct DictionaryIter {
struct DictionaryElement *cur, *next;
};

View File

@ -31,8 +31,7 @@
struct Client;
struct rb_dlink_list;
struct SetOptions
{
struct SetOptions {
int maxclients; /* max clients allowed */
int autoconn; /* autoconn enabled for all servers? */
@ -47,15 +46,13 @@ struct SetOptions
char adminstring[REALLEN];
};
struct Metadata
{
struct Metadata {
const char *name;
const char *value;
time_t timevalue;
};
struct Counter
{
struct Counter {
int oper; /* Opers */
int total; /* total clients */
int invisi; /* invisible clients */

View File

@ -26,8 +26,7 @@
#ifndef __GETOPT_H_INCLUDED__
#define __GETOPT_H_INCLUDED__
struct lgetopt
{
struct lgetopt {
const char *opt; /* name of the argument */
void *argloc; /* where we store the argument to it (-option argument) */
enum

View File

@ -37,8 +37,7 @@
#include <dlfcn.h>
struct ircd_symbol
{
struct ircd_symbol {
char *sym; /* name of symbol to be bound to ptr */
void *ptr; /* ptr to symbol in library */
};

View File

@ -30,8 +30,7 @@
struct Client;
struct Listener
{
struct Listener {
struct Listener *next; /* list node pointer */
const char *name; /* listener name */
rb_fde_t *F; /* file descriptor */

View File

@ -35,8 +35,7 @@
#include "ircd_defs.h"
typedef enum ilogfile
{
typedef enum ilogfile {
L_MAIN,
L_USER,
L_FUSER,

View File

@ -28,8 +28,7 @@
#include "config.h"
typedef struct Information
{
typedef struct Information {
const char *name; /* name of item */
const char *strvalue; /* value of item if it's a boolean */
int intvalue; /* value of item if it's an integer */
@ -64,11 +63,15 @@ Info MyInformation[] = {
#endif /* UH PATH */
#ifdef SOMAXCONN
{"RATBOX_SOMAXCONN", "", SOMAXCONN,
"Maximum Queue Length of Pending Connections"},
{
"RATBOX_SOMAXCONN", "", SOMAXCONN,
"Maximum Queue Length of Pending Connections"
},
#else
{"RATBOX_SOMAXCONN", "", RATBOX_SOMAXCONN,
"Maximum Queue Length of Pending Connections"},
{
"RATBOX_SOMAXCONN", "", RATBOX_SOMAXCONN,
"Maximum Queue Length of Pending Connections"
},
#endif /* SOMAXCONN */
#ifdef RB_IPV6
@ -77,11 +80,15 @@ Info MyInformation[] = {
{"IPV6", "OFF", 0, "IPv6 Support"},
#endif
{"JOIN_LEAVE_COUNT_EXPIRE_TIME", "", JOIN_LEAVE_COUNT_EXPIRE_TIME,
"Anti SpamBot Parameter"},
{
"JOIN_LEAVE_COUNT_EXPIRE_TIME", "", JOIN_LEAVE_COUNT_EXPIRE_TIME,
"Anti SpamBot Parameter"
},
{"KILLCHASETIMELIMIT", "", KILLCHASETIMELIMIT,
"Nick Change Tracker for KILL"},
{
"KILLCHASETIMELIMIT", "", KILLCHASETIMELIMIT,
"Nick Change Tracker for KILL"
},
#ifdef LPATH
{"LPATH", LPATH, 0, "Path to Log File"},
@ -91,11 +98,15 @@ Info MyInformation[] = {
{"MAX_BUFFER", "", MAX_BUFFER, "Maximum Buffer Connections Allowed"},
{"MAX_JOIN_LEAVE_COUNT", "", MAX_JOIN_LEAVE_COUNT,
"Anti SpamBot Parameter"},
{
"MAX_JOIN_LEAVE_COUNT", "", MAX_JOIN_LEAVE_COUNT,
"Anti SpamBot Parameter"
},
{"MIN_JOIN_LEAVE_TIME", "", MIN_JOIN_LEAVE_TIME,
"Anti SpamBot Parameter"},
{
"MIN_JOIN_LEAVE_TIME", "", MIN_JOIN_LEAVE_TIME,
"Anti SpamBot Parameter"
},
#ifdef MPATH
{"MPATH", MPATH, 0, "Path to MOTD File"},
@ -103,8 +114,10 @@ Info MyInformation[] = {
{"MPATH", "NONE", 0, "Path to MOTD File"},
#endif /* MPATH */
{"NICKNAMEHISTORYLENGTH", "", NICKNAMEHISTORYLENGTH,
"Size of WHOWAS Array"},
{
"NICKNAMEHISTORYLENGTH", "", NICKNAMEHISTORYLENGTH,
"Size of WHOWAS Array"
},
#ifdef OPATH
{"OPATH", OPATH, 0, "Path to Operator MOTD File"},
@ -112,8 +125,10 @@ Info MyInformation[] = {
{"OPATH", "NONE", 0, "Path to Operator MOTD File"},
#endif /* OPATH */
{"OPER_SPAM_COUNTDOWN", "", OPER_SPAM_COUNTDOWN,
"Anti SpamBot Parameter"},
{
"OPER_SPAM_COUNTDOWN", "", OPER_SPAM_COUNTDOWN,
"Anti SpamBot Parameter"
},
#ifdef HAVE_LIBCRYPTO
{"HAVE_LIBCRYPTO", "ON", 0, "Enable OpenSSL CHALLENGE Support"},
@ -141,10 +156,14 @@ Info MyInformation[] = {
{"SPATH", "NONE", 0, "Path to Server Executable"},
#endif /* SPATH */
{"TS_MAX_DELTA_DEFAULT", "", TS_MAX_DELTA_DEFAULT,
"Maximum Allowed TS Delta from another Server"},
{"TS_WARN_DELTA_DEFAULT", "", TS_WARN_DELTA_DEFAULT,
"Maximum TS Delta before Sending Warning"},
{
"TS_MAX_DELTA_DEFAULT", "", TS_MAX_DELTA_DEFAULT,
"Maximum Allowed TS Delta from another Server"
},
{
"TS_WARN_DELTA_DEFAULT", "", TS_WARN_DELTA_DEFAULT,
"Maximum TS Delta before Sending Warning"
},
#ifdef USE_IODEBUG_HOOKS
{"USE_IODEBUG_HOOKS", "YES", 0, "IO Debugging support"},
#else

View File

@ -41,8 +41,7 @@
#include "msg.h"
#include "hook.h"
struct module
{
struct module {
char *name;
const char *version;
void *address;
@ -51,8 +50,7 @@ struct module
void * mapi_header; /* actually struct mapi_mheader_av<mapi_version> */
};
struct module_path
{
struct module_path {
char path[MAXPATHLEN];
};
@ -65,20 +63,17 @@ struct module_path
typedef struct Message* mapi_clist_av1;
typedef struct
{
typedef struct {
const char * hapi_name;
int * hapi_id;
} mapi_hlist_av1;
typedef struct
{
typedef struct {
const char * hapi_name;
hookfn fn;
} mapi_hfn_list_av1;
struct mapi_mheader_av1
{
struct mapi_mheader_av1 {
int mapi_version; /* Module API version */
int (*mapi_register) (void); /* Register function;
ret -1 = failure (unload) */

View File

@ -11,8 +11,7 @@
struct rb_bh;
struct monitor
{
struct monitor {
struct monitor *hnext;
char name[NICKLEN];
rb_dlink_list users;

View File

@ -31,8 +31,7 @@
struct Client;
/* MessageHandler */
typedef enum HandlerType
{
typedef enum HandlerType {
UNREGISTERED_HANDLER,
CLIENT_HANDLER,
RCLIENT_HANDLER,
@ -50,15 +49,13 @@ HandlerType;
*/
typedef int (*MessageHandler) (struct Client *, struct Client *, int, const char *[]);
struct MessageEntry
{
struct MessageEntry {
MessageHandler handler;
int min_para;
};
/* Message table structure */
struct Message
{
struct Message {
const char *cmd;
unsigned int count; /* number of times command used */
unsigned int rcount; /* number of times command used by server */

View File

@ -5,8 +5,7 @@
#ifndef _NEWCONF_H_INCLUDED
#define _NEWCONF_H_INCLUDED
struct ConfEntry
{
struct ConfEntry {
const char *cf_name;
int cf_type;
void (*cf_func) (void *);
@ -14,8 +13,7 @@ struct ConfEntry
void *cf_arg;
};
struct TopConf
{
struct TopConf {
const char *tc_name;
int (*tc_sfunc) (struct TopConf *);
int (*tc_efunc) (struct TopConf *);
@ -37,12 +35,10 @@ struct TopConf
#define CF_FLIST 0x1000
#define CF_MFLAG 0xFF00
typedef struct conf_parm_t_stru
{
typedef struct conf_parm_t_stru {
struct conf_parm_t_stru *next;
int type;
union
{
union {
char *string;
int number;
struct conf_parm_t_stru *list;

View File

@ -18,14 +18,12 @@
*/
#define IRCD_MAXNS 10
struct DNSReply
{
struct DNSReply {
char *h_name;
struct rb_sockaddr_storage addr;
};
struct DNSQuery
{
struct DNSQuery {
void *ptr; /* pointer used by callback to identify request */
void (*callback)(void* vptr, struct DNSReply *reply); /* callback to call */
};

View File

@ -34,8 +34,7 @@
#define RRFIXEDSZ 10
#define HFIXEDSZ 12
typedef struct
{
typedef struct {
unsigned id :16; /* query identification number */
#ifdef WORDS_BIGENDIAN
/* fields in third byte */

View File

@ -43,8 +43,7 @@ struct hostent;
/* used by new parser */
/* yacc/lex love globals!!! */
struct ip_value
{
struct ip_value {
struct rb_sockaddr_storage ip;
int ip_mask;
int type;
@ -53,13 +52,11 @@ struct ip_value
extern FILE *conf_fbfile_in;
extern char conf_line_in[256];
struct ConfItem
{
struct ConfItem {
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
unsigned int flags;
int clients; /* Number of *LOCAL* clients using this */
union
{
union {
char *name; /* IRC name, nick, server name, or original u@h */
const char *oper;
} info;
@ -137,8 +134,7 @@ struct ConfItem
/* flag definitions for opers now in client.h */
struct config_file_entry
{
struct config_file_entry {
const char *dpath; /* DPATH if set from command line */
const char *configfile;
@ -236,8 +232,7 @@ struct config_file_entry
int away_interval;
};
struct config_channel_entry
{
struct config_channel_entry {
char * autochanmodes;
char * exemptchanops;
char * disabledmodes;
@ -276,16 +271,14 @@ struct config_channel_entry
int exempt_cmode_K;
};
struct config_server_hide
{
struct config_server_hide {
int flatten_links;
int links_delay;
int hidden;
int disable_hidden;
};
struct server_info
{
struct server_info {
char *name;
char sid[4];
char *description;
@ -310,15 +303,13 @@ struct server_info
int ssld_count;
};
struct admin_info
{
struct admin_info {
char *name;
char *description;
char *email;
};
struct alias_entry
{
struct alias_entry {
char *name;
char *target;
int flags; /* reserved for later use */
@ -339,8 +330,7 @@ extern rb_dlink_list service_list;
extern rb_dlink_list prop_bans;
typedef enum temp_list
{
typedef enum temp_list {
TEMP_MIN,
TEMP_HOUR,
TEMP_DAY,

View File

@ -59,8 +59,7 @@ extern void init_s_newconf(void);
extern void clear_s_newconf(void);
extern void clear_s_newconf_bans(void);
typedef struct
{
typedef struct {
char *ip;
time_t expiry;
rb_patricia_node_t *pnode;
@ -71,8 +70,7 @@ void add_tgchange(const char *host);
tgchange *find_tgchange(const char *host);
/* shared/cluster/hub/leaf confs */
struct remote_conf
{
struct remote_conf {
char *username;
char *host;
char *server;
@ -107,8 +105,7 @@ struct remote_conf
#define CONF_HUB 0x0001
#define CONF_LEAF 0x0002
struct oper_conf
{
struct oper_conf {
char *name;
char *username;
char *host;
@ -181,8 +178,7 @@ extern struct oper_conf *find_oper_conf(const char *username, const char *host,
extern const char *get_oper_privs(int flags);
struct server_conf
{
struct server_conf {
char *name;
char *host;
char *passwd;
@ -240,8 +236,7 @@ extern int valid_wild_card_simple(const char *);
extern int clean_resv_nick(const char *);
time_t valid_temp_time(const char *p);
struct nd_entry
{
struct nd_entry {
char name[NICKLEN+1];
time_t expire;
rb_dlink_node lnode; /* node in ll */

View File

@ -46,8 +46,7 @@ struct server_conf;
struct Channel;
/* Capabilities */
struct Capability
{
struct Capability {
const char *name; /* name of capability */
unsigned int cap; /* mask value */
unsigned int required; /* 1 if required, 0 if not */

View File

@ -39,8 +39,7 @@ struct Client;
/*
* statistics structures
*/
struct ServerStatistics
{
struct ServerStatistics {
unsigned int is_cl; /* number of client connections */
unsigned int is_sv; /* number of server connections */
unsigned int is_ni; /* connection but no idea who it was */

View File

@ -240,7 +240,7 @@
/* Directory where binaries the IRCd itself spawns live */
#undef PKGLIBEXECDIR
/* Directory in which to store state, such as band database */
/* Directory in which to store state, such as ban database */
#undef PKGLOCALSTATEDIR
/* Directory to store pidfile in. */

View File

@ -45,8 +45,7 @@ struct Client;
also removed away information. *tough*
- Dianora
*/
struct Whowas
{
struct Whowas {
int hashv;
char name[NICKLEN + 1];
char username[USERLEN + 1];

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -16,6 +15,51 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -35,12 +79,12 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/libratbox.pc.in \
$(top_srcdir)/configure \
$(top_srcdir)/include/libratbox_config.h.in COPYING ChangeLog \
INSTALL TODO config.guess config.sub depcomp install-sh \
ltmain.sh missing
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(top_srcdir)/include/libratbox_config.h.in \
$(srcdir)/libratbox.pc.in COPYING ChangeLog INSTALL README \
TODO compile config.guess config.sub depcomp install-sh \
missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
@ -52,15 +96,33 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/libratbox_config.h
CONFIG_CLEAN_FILES = libratbox.pc
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -82,23 +144,53 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@ -126,11 +218,15 @@ am__relativize = \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
@ -266,7 +362,7 @@ pkgconfig_DATA = libratbox.pc
all: all-recursive
.SUFFIXES:
am--refresh:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
@ -302,10 +398,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
include/libratbox_config.h: include/stamp-h1
@if test ! -f $@; then \
rm -f include/stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) include/stamp-h1; \
else :; fi
@test -f $@ || rm -f include/stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) include/stamp-h1
include/stamp-h1: $(top_srcdir)/include/libratbox_config.h.in $(top_builddir)/config.status
@rm -f include/stamp-h1
@ -330,8 +424,11 @@ distclean-libtool:
-rm -f libtool config.lt
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@ -345,27 +442,28 @@ uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@ -380,57 +478,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@ -446,12 +499,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@ -463,15 +511,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@ -480,9 +524,31 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
@ -518,13 +584,10 @@ distdir: $(DISTFILES)
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
@ -553,36 +616,42 @@ distdir: $(DISTFILES)
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
$(am__post_remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
@ -593,8 +662,8 @@ distcheck: dist
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
@ -604,17 +673,19 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
&& ../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
@ -637,13 +708,21 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
@ -677,10 +756,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
@ -762,25 +846,24 @@ ps-am:
uninstall-am: uninstall-pkgconfigDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgconfigDATA install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-generic \
distclean-hdr distclean-libtool distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-pkgconfigDATA \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-pkgconfigDATA
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-pkgconfigDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.

985
libratbox/aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

347
libratbox/compile Executable file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

808
libratbox/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -68,8 +68,7 @@
#else
#define RB_UIO_MAXIOV 16
#endif
struct conndata
{
struct conndata {
/* We don't need the host here ? */
struct rb_sockaddr_storage S;
struct rb_sockaddr_storage hostaddr;
@ -79,8 +78,7 @@ struct conndata
/* We'd also add the retry count here when we get to that -- adrian */
};
struct acceptdata
{
struct acceptdata {
struct rb_sockaddr_storage S;
rb_socklen_t addrlen;
ACCB *callback;
@ -95,8 +93,7 @@ struct acceptdata
#define ClearFDOpen(F) (F->flags &= ~FLAG_OPEN)
struct _fde
{
struct _fde {
/* New-school stuff, again pretty much ripped from squid */
/*
* Yes, this gives us only one pending read and one pending write per
@ -123,8 +120,7 @@ struct _fde
typedef void (*comm_event_cb_t) (void *);
#ifdef USE_TIMER_CREATE
typedef struct timer_data
{
typedef struct timer_data {
timer_t td_timer_id;
comm_event_cb_t td_cb;
void *td_udata;
@ -148,8 +144,7 @@ rb_find_fd(int fd)
if(hlist->head == NULL)
return NULL;
RB_DLINK_FOREACH(ptr, hlist->head)
{
RB_DLINK_FOREACH(ptr, hlist->head) {
rb_fde_t *F = ptr->data;
if(F->fd == fd)
return F;

View File

@ -22,8 +22,7 @@
*
*/
struct ev_entry
{
struct ev_entry {
rb_dlink_node node;
EVH *func;
void *arg;

View File

@ -60,6 +60,9 @@
/* Define to 1 if you have the `gmtime_r' function. */
#undef HAVE_GMTIME_R
/* Has GnuTLS */
#undef HAVE_GNUTLS
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

View File

@ -48,8 +48,7 @@ typedef void ACCB(rb_fde_t *, int status, struct sockaddr *addr, rb_socklen_t le
/* callback for pre-accept callback */
typedef int ACPRE(rb_fde_t *, struct sockaddr *addr, rb_socklen_t len, void *);
enum
{
enum {
RB_OK,
RB_ERR_BIND,
RB_ERR_DNS,
@ -78,8 +77,7 @@ enum
#define RB_RW_SSL_NEED_WRITE -4 /* SSL Needs write */
struct rb_iovec
{
struct rb_iovec {
void *iov_base;
size_t iov_len;
};
@ -154,8 +152,7 @@ uint8_t rb_get_type(rb_fde_t *F);
const char *rb_get_iotype(void);
typedef enum
{
typedef enum {
RB_PRNG_EGD,
RB_PRNG_FILE,
#ifdef _WIN32

View File

@ -41,8 +41,7 @@ struct _buf_head;
/* How big we want a buffer - 510 data bytes, plus space for a '\0' */
#define BUF_DATA_SIZE 511
typedef struct _buf_line
{
typedef struct _buf_line {
char buf[BUF_DATA_SIZE + 2];
uint8_t terminated; /* Whether we've terminated the buffer */
uint8_t raw; /* Whether this linebuf may hold 8-bit data */
@ -50,8 +49,7 @@ typedef struct _buf_line
int refcount; /* how many linked lists are we in? */
} buf_line_t;
typedef struct _buf_head
{
typedef struct _buf_head {
rb_dlink_list list; /* the actual dlink list */
int len; /* length of all the data */
int alloclen; /* Actual allocated data length */

View File

@ -29,13 +29,11 @@
#define MAXLINE 1024
#define BIT_TEST(f, b) ((f) & (b))
typedef struct _rb_prefix_t
{
typedef struct _rb_prefix_t {
unsigned short family; /* AF_INET | AF_INET6 */
unsigned short bitlen; /* same as mask? */
int ref_count; /* reference count */
union
{
union {
struct in_addr sin;
#ifdef RB_IPV6
struct in6_addr sin6;
@ -46,8 +44,7 @@ typedef struct _rb_prefix_t
rb_prefix_t;
typedef struct _rb_patricia_node_t
{
typedef struct _rb_patricia_node_t {
unsigned int bit; /* flag if this node used */
rb_prefix_t *prefix; /* who we are in patricia tree */
struct _rb_patricia_node_t *l, *r; /* left and right children */
@ -56,8 +53,7 @@ typedef struct _rb_patricia_node_t
}
rb_patricia_node_t;
typedef struct _rb_patricia_tree_t
{
typedef struct _rb_patricia_tree_t {
rb_patricia_node_t *head;
unsigned int maxbits; /* for IP, 32 bit addresses */
int num_active_node; /* for debug purpose */

View File

@ -38,26 +38,9 @@
/*
* rb_sprintf - optimized sprintf
*/
#ifdef __GNUC__
int
rb_sprintf(char *str, const char *fmt, ...)
__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);
int sprintf_append(char *str, const char *format, ...);
int snprintf_append(char *str, const size_t size, const char *, ...);
int vsnprintf_append(char *str, const size_t size, const char *fmt, va_list args);
int vsprintf_append(char *str, const char *fmt, va_list args);
#endif /* SPRINTF_IRC */

View File

@ -44,16 +44,14 @@ int rb_string_to_array(char *string, char **parv, int maxpara);
typedef struct _rb_dlink_node rb_dlink_node;
typedef struct _rb_dlink_list rb_dlink_list;
struct _rb_dlink_node
{
struct _rb_dlink_node {
void *data;
rb_dlink_node *prev;
rb_dlink_node *next;
};
struct _rb_dlink_list
{
struct _rb_dlink_list {
rb_dlink_node *head;
rb_dlink_node *tail;
unsigned long length;
@ -161,12 +159,9 @@ rb_dlinkAddBefore(rb_dlink_node *b, void *data, rb_dlink_node *m, rb_dlink_list
assert(list != NULL);
/* Shortcut - if its the first one, call rb_dlinkAdd only */
if(b == list->head)
{
if(b == list->head) {
rb_dlinkAdd(data, m, list);
}
else
{
} else {
m->data = data;
b->prev->next = m;
m->prev = b->prev;
@ -251,8 +246,7 @@ rb_dlinkFindDelete(void *data, rb_dlink_list *list)
rb_dlink_node *m;
assert(list != NULL);
assert(data != NULL);
RB_DLINK_FOREACH(m, list->head)
{
RB_DLINK_FOREACH(m, list->head) {
if(m->data != data)
continue;
@ -282,8 +276,7 @@ rb_dlinkFindDestroy(void *data, rb_dlink_list *list)
assert(data != NULL);
ptr = rb_dlinkFindDelete(data, list);
if(ptr != NULL)
{
if(ptr != NULL) {
rb_free_rb_dlink_node(ptr);
return 1;
}
@ -304,8 +297,7 @@ rb_dlinkFind(void *data, rb_dlink_list *list)
assert(list != NULL);
assert(data != NULL);
RB_DLINK_FOREACH(ptr, list->head)
{
RB_DLINK_FOREACH(ptr, list->head) {
if(ptr->data == data)
return (ptr);
}
@ -324,8 +316,7 @@ rb_dlinkMoveList(rb_dlink_list *from, rb_dlink_list *to)
return;
/* case two, nothing in to list */
if(to->head == NULL)
{
if(to->head == NULL) {
to->head = from->head;
to->tail = from->tail;
from->head = from->tail = NULL;

95
libratbox/ltmain.sh Executable file → Normal file
View File

@ -1,9 +1,9 @@
# libtool (GNU libtool) 2.4
# libtool (GNU libtool) 2.4.2
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@ -41,6 +41,7 @@
# --quiet, --silent don't print informational messages
# --no-quiet, --no-silent
# print informational messages (default)
# --no-warn don't display warning messages
# --tag=TAG use configuration variables from tag TAG
# -v, --verbose print more informational messages than default
# --no-verbose don't print the extra informational messages
@ -69,7 +70,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
# automake: $automake_version
# autoconf: $autoconf_version
#
@ -79,9 +80,9 @@
PROGRAM=libtool
PACKAGE=libtool
VERSION=2.4
VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1"
TIMESTAMP=""
package_revision=1.3293
package_revision=1.3337
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@ -136,15 +137,10 @@ progpath="$0"
: ${CP="cp -f"}
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
: ${EGREP="grep -E"}
: ${FGREP="grep -F"}
: ${GREP="grep"}
: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
: ${SED="sed"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
@ -387,7 +383,7 @@ case $progpath in
;;
*)
save_IFS="$IFS"
IFS=:
IFS=${PATH_SEPARATOR-:}
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
@ -771,8 +767,8 @@ func_help ()
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
p
d
}
@ -1052,6 +1048,7 @@ opt_finish=false
opt_help=false
opt_help_all=false
opt_silent=:
opt_warning=:
opt_verbose=:
opt_silent=false
opt_verbose=false
@ -1118,6 +1115,10 @@ esac
;;
--no-silent|--no-quiet)
opt_silent=false
func_append preserve_args " $opt"
;;
--no-warning|--no-warn)
opt_warning=false
func_append preserve_args " $opt"
;;
--no-verbose)
@ -2059,7 +2060,7 @@ func_mode_compile ()
*.[cCFSifmso] | \
*.ada | *.adb | *.ads | *.asm | \
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
*.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
*.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
func_xform "$libobj"
libobj=$func_xform_result
;;
@ -3201,11 +3202,13 @@ func_mode_install ()
# Set up the ranlib parameters.
oldlib="$destdir/$name"
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
if test -n "$stripme" && test -n "$old_striplib"; then
func_show_eval "$old_striplib $oldlib" 'exit $?'
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
fi
# Do each command in the postinstall commands.
@ -3470,7 +3473,7 @@ static const void *lt_preloaded_setup() {
# linked before any other PIC object. But we must not use
# pic_flag when linking with -static. The problem exists in
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
*-*-hpux*)
pic_flag_for_symtable=" $pic_flag" ;;
@ -3982,6 +3985,8 @@ func_exec_program_core ()
# launches target application with the remaining arguments.
func_exec_program ()
{
case \" \$* \" in
*\\ --lt-*)
for lt_wr_arg
do
case \$lt_wr_arg in
@ -3989,7 +3994,8 @@ func_exec_program ()
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
esac
shift
done
done ;;
esac
func_exec_program_core \${1+\"\$@\"}
}
@ -5057,9 +5063,15 @@ void lt_dump_script (FILE* f)
{
EOF
func_emit_wrapper yes |
$SED -e 's/\([\\"]\)/\\\1/g' \
-e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
$SED -n -e '
s/^\(.\{79\}\)\(..*\)/\1\
\2/
h
s/\([\\"]\)/\\\1/g
s/$/\\n/
s/\([^\n]*\).*/ fputs ("\1", f);/p
g
D'
cat <<"EOF"
}
EOF
@ -5643,7 +5655,8 @@ func_mode_link ()
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
@ -6111,7 +6124,10 @@ func_mode_link ()
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
link)
libs="$deplibs %DEPLIBS%"
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
;;
esac
fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then
@ -6147,7 +6163,8 @@ func_mode_link ()
lib=
found=no
case $deplib in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
@ -6430,9 +6447,6 @@ func_mode_link ()
# It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library"
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
@ -6443,6 +6457,9 @@ func_mode_link ()
fi
func_append tmp_libs " $deplib"
done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
continue
fi # $pass = conv
@ -6831,7 +6848,7 @@ func_mode_link ()
test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
add_dir="-L$absdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
@ -7316,6 +7333,7 @@ func_mode_link ()
# which has an extra 1 added just for fun
#
case $version_type in
# correct linux to gnu/linux during the next big refactor
darwin|linux|osf|windows|none)
func_arith $number_major + $number_minor
current=$func_arith_result
@ -7334,6 +7352,9 @@ func_mode_link ()
revision="$number_minor"
lt_irix_increment=no
;;
*)
func_fatal_configuration "$modename: unknown library version type \`$version_type'"
;;
esac
;;
no)
@ -7432,7 +7453,7 @@ func_mode_link ()
versuffix="$major.$revision"
;;
linux)
linux) # correct to gnu/linux during the next big refactor
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
@ -8020,6 +8041,11 @@ EOF
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
# Remove ${wl} instances when linking with ld.
# FIXME: should test the right _cmds variable.
case $archive_cmds in
*\$LD\ *) wl= ;;
esac
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
@ -8050,7 +8076,7 @@ EOF
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
*) func_apped perm_rpath " $libdir" ;;
*) func_append perm_rpath " $libdir" ;;
esac
fi
done
@ -8058,11 +8084,7 @@ EOF
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
if test -n "$hardcode_libdir_flag_spec_ld"; then
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
else
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
fi
eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
fi
if test -n "$runpath_var" && test -n "$perm_rpath"; then
# We should set the runpath_var.
@ -9152,6 +9174,8 @@ EOF
esac
done
fi
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
eval cmds=\"$old_archive_cmds\"
func_len " $cmds"
@ -9261,7 +9285,8 @@ EOF
*.la)
func_basename "$deplib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
func_resolve_sysroot "$deplib"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -18,6 +17,51 @@
# $Id: Makefile.am 26046 2008-09-09 16:37:30Z androsyn $
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -37,7 +81,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
@ -68,6 +113,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libratbox_la_DEPENDENCIES =
@ -77,30 +128,78 @@ am_libratbox_la_OBJECTS = unix.lo win32.lo crypt.lo balloc.lo \
devpoll.lo epoll.lo poll.lo ports.lo sigio.lo select.lo \
kqueue.lo rawbuf.lo patricia.lo arc4random.lo version.lo
libratbox_la_OBJECTS = $(am_libratbox_la_OBJECTS)
libratbox_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libratbox_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libratbox_la_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libratbox_la_SOURCES)
DIST_SOURCES = $(libratbox_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
@ -298,9 +397,9 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@ -308,6 +407,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@ -323,14 +424,17 @@ uninstall-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libratbox.la: $(libratbox_la_OBJECTS) $(libratbox_la_DEPENDENCIES)
$(libratbox_la_LINK) -rpath $(libdir) $(libratbox_la_OBJECTS) $(libratbox_la_LIBADD) $(LIBS)
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libratbox.la: $(libratbox_la_OBJECTS) $(libratbox_la_DEPENDENCIES) $(EXTRA_libratbox_la_DEPENDENCIES)
$(AM_V_CCLD)$(libratbox_la_LINK) -rpath $(libdir) $(libratbox_la_OBJECTS) $(libratbox_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -366,25 +470,25 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@ -392,26 +496,15 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@ -423,15 +516,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@ -440,6 +529,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@ -493,10 +597,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
@ -582,19 +691,19 @@ uninstall-am: uninstall-libLTLIBRARIES
.MAKE: all check install install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libLTLIBRARIES install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libLTLIBRARIES
tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
version.c: version.c.SH ../CREDITS

View File

@ -40,8 +40,7 @@
struct arc4_stream
{
struct arc4_stream {
uint8_t i;
uint8_t j;
uint8_t s[256];
@ -75,8 +74,7 @@ arc4_addrandom(struct arc4_stream *as, uint8_t *dat, int datlen)
uint8_t si;
as->i--;
for(n = 0; n < 256; n++)
{
for(n = 0; n < 256; n++) {
as->i = (as->i + 1);
si = as->s[as->i];
as->j = (as->j + si + dat[n % datlen]);
@ -111,7 +109,8 @@ arc4_stir(struct arc4_stream *as)
struct rusage buf;
getrusage(RUSAGE_SELF, &buf);
arc4_addrandom(as, (void *)&buf, sizeof(buf));
memset(&buf, 0, sizeof(buf))}
memset(&buf, 0, sizeof(buf))
}
#endif
#if !defined(_WIN32)
@ -119,8 +118,7 @@ arc4_stir(struct arc4_stream *as)
uint8_t rnd[128];
int fd;
fd = open("/dev/urandom", O_RDONLY);
if(fd != -1)
{
if(fd != -1) {
read(fd, rnd, sizeof(rnd));
close(fd);
arc4_addrandom(as, (void *)rnd, sizeof(rnd));
@ -131,19 +129,16 @@ arc4_stir(struct arc4_stream *as)
#else
{
LARGE_INTEGER performanceCount;
if(QueryPerformanceCounter(&performanceCount))
{
if(QueryPerformanceCounter(&performanceCount)) {
arc4_addrandom(as, (void *)&performanceCount, sizeof(performanceCount));
}
lib = LoadLibrary("ADVAPI32.DLL");
if(lib)
{
if(lib) {
uint8_t rnd[128];
BOOLEAN(APIENTRY * pfn) (void *, ULONG) =
(BOOLEAN(APIENTRY *) (void *, ULONG))GetProcAddress(lib,
"SystemFunction036");
if(pfn)
{
if(pfn) {
if(pfn(rnd, sizeof(rnd)) == TRUE)
arc4_addrandom(as, (void *)rnd, sizeof(rnd));
memset(&rnd, 0, sizeof(rnd));
@ -192,8 +187,7 @@ arc4_getword(struct arc4_stream *as)
void
arc4random_stir(void)
{
if(!rs_initialized)
{
if(!rs_initialized) {
arc4_init(&rs);
rs_initialized = 1;
}

View File

@ -73,8 +73,7 @@
static uintptr_t offset_pad;
/* status information for an allocated block in heap */
struct rb_heap_block
{
struct rb_heap_block {
size_t alloc_size;
rb_dlink_node node;
unsigned long free_count;
@ -83,8 +82,7 @@ struct rb_heap_block
typedef struct rb_heap_block rb_heap_block;
/* information for the root node of the heap */
struct rb_bh
{
struct rb_bh {
rb_dlink_node hlist;
size_t elemSize; /* Size of each element to be stored */
unsigned long elemsPerBlock; /* Number of elements per block */
@ -152,8 +150,7 @@ rb_init_bh(void)
* fix your shit
*/
#ifdef __sparc__
if((offset_pad % __alignof__(long long)) != 0)
{
if((offset_pad % __alignof__(long long)) != 0) {
offset_pad += __alignof__(long long);
offset_pad &= ~(__alignof__(long long) - 1);
}
@ -207,8 +204,7 @@ static void
rb_bh_gc_event(void *unused)
{
rb_dlink_node *ptr;
RB_DLINK_FOREACH(ptr, heap_lists->head)
{
RB_DLINK_FOREACH(ptr, heap_lists->head) {
rb_bh_gc(ptr->data);
}
}
@ -237,14 +233,12 @@ newblock(rb_bh *bh)
b->alloc_size = bh->elemsPerBlock * bh->elemSize;
b->elems = get_block(b->alloc_size);
if(rb_unlikely(b->elems == NULL))
{
if(rb_unlikely(b->elems == NULL)) {
return (1);
}
offset = (uintptr_t)b->elems;
/* Setup our blocks now */
for(i = 0; i < bh->elemsPerBlock; i++, offset += bh->elemSize)
{
for(i = 0; i < bh->elemsPerBlock; i++, offset += bh->elemSize) {
*((void **)offset) = b;
node = (void *)(offset + offset_pad);
rb_dlinkAdd((void *)offset, node, &bh->free_list);
@ -278,8 +272,7 @@ rb_bh_create(size_t elemsize, int elemsperblock, const char *desc)
lrb_assert(elemsize >= sizeof(rb_dlink_node));
/* Catch idiotic requests up front */
if((elemsize == 0) || (elemsperblock <= 0))
{
if((elemsize == 0) || (elemsperblock <= 0)) {
rb_bh_fail("Attempting to rb_bh_create idiotic sizes");
}
@ -290,8 +283,7 @@ rb_bh_create(size_t elemsize, int elemsperblock, const char *desc)
bh = rb_malloc(sizeof(rb_bh));
#ifndef NOBALLOC
elemsize += offset_pad;
if((elemsize % sizeof(void *)) != 0)
{
if((elemsize % sizeof(void *)) != 0) {
/* Pad to even pointer boundary */
elemsize += sizeof(void *);
elemsize &= ~(sizeof(void *) - 1);
@ -305,8 +297,7 @@ rb_bh_create(size_t elemsize, int elemsperblock, const char *desc)
#ifndef NOBALLOC
/* Be sure our malloc was successful */
if(newblock(bh))
{
if(newblock(bh)) {
if(bh != NULL)
free(bh);
rb_lib_log("newblock() failed");
@ -314,8 +305,7 @@ rb_bh_create(size_t elemsize, int elemsperblock, const char *desc)
}
#endif /* !NOBALLOC */
if(bh == NULL)
{
if(bh == NULL) {
rb_bh_fail("bh == NULL when it shouldn't be");
}
rb_dlinkAdd(bh, &bh->hlist, heap_lists);
@ -343,26 +333,22 @@ rb_bh_alloc(rb_bh *bh)
void *ptr;
#endif
lrb_assert(bh != NULL);
if(rb_unlikely(bh == NULL))
{
if(rb_unlikely(bh == NULL)) {
rb_bh_fail("Cannot allocate if bh == NULL");
}
#ifdef NOBALLOC
return (rb_malloc(bh->elemSize));
#else
if(bh->free_list.head == NULL)
{
if(bh->free_list.head == NULL) {
/* Allocate new block and assign */
/* newblock returns 1 if unsuccessful, 0 if not */
if(rb_unlikely(newblock(bh)))
{
if(rb_unlikely(newblock(bh))) {
rb_lib_log("newblock() failed");
rb_outofmemory(); /* Well that didn't work either...bail */
}
if(bh->free_list.head == NULL)
{
if(bh->free_list.head == NULL) {
rb_lib_log("out of memory after newblock()...");
rb_outofmemory();
}
@ -400,14 +386,12 @@ rb_bh_free(rb_bh *bh, void *ptr)
lrb_assert(bh != NULL);
lrb_assert(ptr != NULL);
if(rb_unlikely(bh == NULL))
{
if(rb_unlikely(bh == NULL)) {
rb_lib_log("balloc.c:rb_bhFree() bh == NULL");
return (1);
}
if(rb_unlikely(ptr == NULL))
{
if(rb_unlikely(ptr == NULL)) {
rb_lib_log("balloc.rb_bhFree() ptr == NULL");
return (1);
}
@ -420,8 +404,7 @@ rb_bh_free(rb_bh *bh, void *ptr)
/* XXX */
if(rb_unlikely
(!((uintptr_t)ptr >= (uintptr_t)block->elems
&& (uintptr_t)ptr < (uintptr_t)block->elems + (uintptr_t)block->alloc_size)))
{
&& (uintptr_t)ptr < (uintptr_t)block->elems + (uintptr_t)block->alloc_size))) {
rb_bh_fail("rb_bh_free() bogus pointer");
}
block->free_count++;
@ -453,8 +436,7 @@ rb_bh_destroy(rb_bh *bh)
return (1);
#ifndef NOBALLOC
RB_DLINK_FOREACH_SAFE(ptr, next, bh->block_list.head)
{
RB_DLINK_FOREACH_SAFE(ptr, next, bh->block_list.head) {
b = ptr->data;
free_block(b->elems, b->alloc_size);
rb_free(b);
@ -474,8 +456,7 @@ rb_bh_usage(rb_bh *bh, size_t *bused, size_t *bfree, size_t *bmemusage, const ch
#ifndef NOBALLOC
size_t used, freem, memusage;
if(bh == NULL)
{
if(bh == NULL) {
return;
}
@ -514,8 +495,7 @@ rb_bh_usage_all(rb_bh_usage_cb *cb, void *data)
if(cb == NULL)
return;
RB_DLINK_FOREACH(ptr, heap_lists->head)
{
RB_DLINK_FOREACH(ptr, heap_lists->head) {
bh = (rb_bh *)ptr->data;
freem = rb_dlink_list_length(&bh->free_list);
used = (rb_dlink_list_length(&bh->block_list) * bh->elemsPerBlock) - freem;
@ -535,8 +515,7 @@ rb_bh_total_usage(size_t *total_alloc, size_t *total_used)
size_t total_memory = 0, used_memory = 0, used, freem;
rb_bh *bh;
RB_DLINK_FOREACH(ptr, heap_lists->head)
{
RB_DLINK_FOREACH(ptr, heap_lists->head) {
bh = (rb_bh *)ptr->data;
freem = rb_dlink_list_length(&bh->free_list);
used = (rb_dlink_list_length(&bh->block_list) * bh->elemsPerBlock) - freem;
@ -559,32 +538,27 @@ rb_bh_gc(rb_bh *bh)
unsigned long i;
uintptr_t offset;
if(bh == NULL)
{
if(bh == NULL) {
/* somebody is smoking some craq..(probably lee, but don't tell him that) */
return (1);
}
if((rb_dlink_list_length(&bh->free_list) < bh->elemsPerBlock)
|| rb_dlink_list_length(&bh->block_list) == 1)
{
|| rb_dlink_list_length(&bh->block_list) == 1) {
/* There couldn't possibly be an entire free block. Return. */
return (0);
}
RB_DLINK_FOREACH_SAFE(ptr, next, bh->block_list.head)
{
RB_DLINK_FOREACH_SAFE(ptr, next, bh->block_list.head) {
b = ptr->data;
if(rb_dlink_list_length(&bh->block_list) == 1)
return (0);
if(b->free_count == bh->elemsPerBlock)
{
if(b->free_count == bh->elemsPerBlock) {
/* i'm seriously going to hell for this.. */
offset = (uintptr_t)b->elems;
for(i = 0; i < bh->elemsPerBlock; i++, offset += (uintptr_t)bh->elemSize)
{
for(i = 0; i < bh->elemsPerBlock; i++, offset += (uintptr_t)bh->elemSize) {
rb_dlinkDelete((rb_dlink_node *)(offset + offset_pad),
&bh->free_list);
}

File diff suppressed because it is too large Load Diff

View File

@ -41,10 +41,8 @@ rb_crypt(const char *key, const char *salt)
{
/* First, check if we are supposed to be using a replacement
* hash instead of DES... */
if(salt[0] == '$' && (salt[2] == '$' || salt[3] == '$'))
{
switch(salt[1])
{
if(salt[0] == '$' && (salt[2] == '$' || salt[3] == '$')) {
switch(salt[1]) {
case '1':
return rb_md5_crypt(key, salt);
break;
@ -62,8 +60,7 @@ rb_crypt(const char *key, const char *salt)
return NULL;
break;
};
}
else
} else
return rb_des_crypt(key, salt);
}
@ -209,42 +206,50 @@ static const uint8_t sbox[8][64] = {
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13},
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
},
{
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9},
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
},
{
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12},
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
},
{
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14},
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
},
{
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3},
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
},
{
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13},
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
},
{
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12},
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
},
{
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
}
};
static const uint8_t pbox[32] = {
@ -305,8 +310,7 @@ rb_des_init(void)
* Invert the S-boxes, reordering the input bits.
*/
for(i = 0; i < 8; i++)
for(j = 0; j < 64; j++)
{
for(j = 0; j < 64; j++) {
b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
u_sbox[i][j] = sbox[i][b];
}
@ -326,8 +330,7 @@ rb_des_init(void)
* Set up the initial & final permutations into a useful form, and
* initialise the inverted key permutation.
*/
for(i = 0; i < 64; i++)
{
for(i = 0; i < 64; i++) {
init_perm[final_perm[i] = IP[i] - 1] = (uint8_t)i;
inv_key_perm[i] = 255;
}
@ -336,8 +339,7 @@ rb_des_init(void)
* Invert the key permutation and initialise the inverted key
* compression permutation.
*/
for(i = 0; i < 56; i++)
{
for(i = 0; i < 56; i++) {
inv_key_perm[key_perm[i] - 1] = (uint8_t)i;
inv_comp_perm[i] = 255;
}
@ -345,8 +347,7 @@ rb_des_init(void)
/*
* Invert the key compression permutation.
*/
for(i = 0; i < 48; i++)
{
for(i = 0; i < 48; i++) {
inv_comp_perm[comp_perm[i] - 1] = (uint8_t)i;
}
@ -354,19 +355,15 @@ rb_des_init(void)
* Set up the OR-mask arrays for the initial and final permutations,
* and for the key initial and compression permutations.
*/
for(k = 0; k < 8; k++)
{
for(i = 0; i < 256; i++)
{
for(k = 0; k < 8; k++) {
for(i = 0; i < 256; i++) {
*(il = &ip_maskl[k][i]) = 0L;
*(ir = &ip_maskr[k][i]) = 0L;
*(fl = &fp_maskl[k][i]) = 0L;
*(fr = &fp_maskr[k][i]) = 0L;
for(j = 0; j < 8; j++)
{
for(j = 0; j < 8; j++) {
inbit = 8 * k + j;
if(i & bits8[j])
{
if(i & bits8[j]) {
if((obit = init_perm[inbit]) < 32)
*il |= bits32[obit];
else
@ -378,15 +375,12 @@ rb_des_init(void)
}
}
}
for(i = 0; i < 128; i++)
{
for(i = 0; i < 128; i++) {
*(il = &key_perm_maskl[k][i]) = 0L;
*(ir = &key_perm_maskr[k][i]) = 0L;
for(j = 0; j < 7; j++)
{
for(j = 0; j < 7; j++) {
inbit = 8 * k + j;
if(i & bits8[j + 1])
{
if(i & bits8[j + 1]) {
if((obit = inv_key_perm[inbit]) == 255)
continue;
if(obit < 28)
@ -397,11 +391,9 @@ rb_des_init(void)
}
*(il = &comp_maskl[k][i]) = 0L;
*(ir = &comp_maskr[k][i]) = 0L;
for(j = 0; j < 7; j++)
{
for(j = 0; j < 7; j++) {
inbit = 7 * k + j;
if(i & bits8[j + 1])
{
if(i & bits8[j + 1]) {
if((obit = inv_comp_perm[inbit]) == 255)
continue;
if(obit < 24)
@ -421,11 +413,9 @@ rb_des_init(void)
un_pbox[pbox[i] - 1] = (uint8_t)i;
for(b = 0; b < 4; b++)
for(i = 0; i < 256; i++)
{
for(i = 0; i < 256; i++) {
*(p = &psbox[b][i]) = 0L;
for(j = 0; j < 8; j++)
{
for(j = 0; j < 8; j++) {
if(i & bits8[j])
*p |= bits32[un_pbox[8 * b + j]];
}
@ -448,8 +438,7 @@ rb_setup_salt(long salt)
saltbits = 0L;
saltbit = 1;
obit = 0x800000;
for(i = 0; i < 24; i++)
{
for(i = 0; i < 24; i++) {
if(salt & saltbit)
saltbits |= obit;
saltbit <<= 1;
@ -468,8 +457,7 @@ rb_des_setkey(const char *key)
rawkey0 = ntohl(*(const uint32_t *)key);
rawkey1 = ntohl(*(const uint32_t *)(key + 4));
if((rawkey0 | rawkey1) && rawkey0 == old_rawkey0 && rawkey1 == old_rawkey1)
{
if((rawkey0 | rawkey1) && rawkey0 == old_rawkey0 && rawkey1 == old_rawkey1) {
/*
* Already setup for this key.
* This optimisation fails on a zero key (which is weak and
@ -504,8 +492,7 @@ rb_des_setkey(const char *key)
* Rotate subkeys and do compression permutation.
*/
shifts = 0;
for(round = 0; round < 16; round++)
{
for(round = 0; round < 16; round++) {
uint32_t t0, t1;
shifts += key_shifts[round];
@ -544,20 +531,15 @@ rb_do_des(uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out, int co
uint32_t f, r48l, r48r;
int round;
if(count == 0)
{
if(count == 0) {
return (1);
}
else if(count > 0)
{
} else if(count > 0) {
/*
* Encrypting
*/
kl1 = en_keysl;
kr1 = en_keysr;
}
else
{
} else {
/*
* Decrypting
*/
@ -584,16 +566,14 @@ rb_do_des(uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out, int co
| ip_maskr[5][(r_in >> 16) & 0xff]
| ip_maskr[6][(r_in >> 8) & 0xff] | ip_maskr[7][r_in & 0xff];
while(count--)
{
while(count--) {
/*
* Do each round.
*/
kl = kl1;
kr = kr1;
round = 16;
while(round--)
{
while(round--) {
/*
* Expand R to 48 bits (simulate the E-box).
*/
@ -665,8 +645,7 @@ rb_des_crypt(const char *key, const char *setting)
* and padding with zeros.
*/
q = (uint8_t *)keybuf;
while(q - (uint8_t *)keybuf - 8)
{
while(q - (uint8_t *)keybuf - 8) {
*q++ = *key << 1;
if(*(q - 1))
key++;
@ -907,8 +886,7 @@ MD5Update (context, in, inputLen)
MD5Transform (context->state, &input[i]);
idx = 0;
}
else
} else
i = 0;
/* Buffer remaining input */
@ -1163,17 +1141,23 @@ rb_md5_crypt(const char *pw, const char *salt)
p = passwd + strlen(passwd);
l = (final[ 0]<<16) | (final[ 6]<<8) | final[12];
_crypt_to64(p, l, 4); p += 4;
_crypt_to64(p, l, 4);
p += 4;
l = (final[ 1]<<16) | (final[ 7]<<8) | final[13];
_crypt_to64(p, l, 4); p += 4;
_crypt_to64(p, l, 4);
p += 4;
l = (final[ 2]<<16) | (final[ 8]<<8) | final[14];
_crypt_to64(p, l, 4); p += 4;
_crypt_to64(p, l, 4);
p += 4;
l = (final[ 3]<<16) | (final[ 9]<<8) | final[15];
_crypt_to64(p, l, 4); p += 4;
_crypt_to64(p, l, 4);
p += 4;
l = (final[ 4]<<16) | (final[10]<<8) | final[ 5];
_crypt_to64(p, l, 4); p += 4;
_crypt_to64(p, l, 4);
p += 4;
l = final[11];
_crypt_to64(p, l, 2); p += 2;
_crypt_to64(p, l, 2);
p += 2;
*p = '\0';
/* Don't leave anything around in vm they could use. */
@ -1187,8 +1171,7 @@ rb_md5_crypt(const char *pw, const char *salt)
Released into the Public Domain by Ulrich Drepper <drepper@redhat.com>. */
/* Structure to save state of computation between the single steps. */
struct sha256_ctx
{
struct sha256_ctx {
uint32_t H[8];
uint32_t total[2];
@ -1253,8 +1236,7 @@ static void rb_sha256_process_block(const void *buffer, size_t len, struct sha25
/* Process all bytes in the buffer with 64 bytes in each round of
the loop. */
while (nwords > 0)
{
while (nwords > 0) {
uint32_t W[64];
uint32_t a_save = a;
uint32_t b_save = b;
@ -1279,8 +1261,7 @@ static void rb_sha256_process_block(const void *buffer, size_t len, struct sha25
#define SHA256_CYCLIC(w, s) ((w >> s) | (w << (32 - s)))
/* Compute the message schedule according to FIPS 180-2:6.2.2 step 2. */
for (t = 0; t < 16; ++t)
{
for (t = 0; t < 16; ++t) {
W[t] = SHA256_SWAP(*words);
++words;
}
@ -1288,8 +1269,7 @@ static void rb_sha256_process_block(const void *buffer, size_t len, struct sha25
W[t] = SHA256_R1(W[t - 2]) + W[t - 7] + SHA256_R0(W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.2.2 step 3. */
for (t = 0; t < 64; ++t)
{
for (t = 0; t < 64; ++t) {
uint32_t T1 = h + SHA256_S1(e) + SHA256_Ch(e, f, g) + SHA256_K[t] + W[t];
uint32_t T2 = SHA256_S0(a) + SHA256_Maj(a, b, c);
h = g;
@ -1387,16 +1367,14 @@ static void rb_sha256_process_bytes(const void *buffer, size_t len, struct sha25
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
if (ctx->buflen != 0)
{
if (ctx->buflen != 0) {
size_t left_over = ctx->buflen;
size_t add = 128 - left_over > len ? len : 128 - left_over;
memcpy(&ctx->buffer[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 64)
{
if (ctx->buflen > 64) {
rb_sha256_process_block(ctx->buffer, ctx->buflen & ~63, ctx);
ctx->buflen &= 63;
@ -1409,8 +1387,7 @@ static void rb_sha256_process_bytes(const void *buffer, size_t len, struct sha25
}
/* Process available complete blocks. */
if (len >= 64)
{
if (len >= 64) {
/* To check alignment gcc has an appropriate operator. Other
compilers don't. */
#if __GNUC__ >= 2
@ -1419,14 +1396,12 @@ static void rb_sha256_process_bytes(const void *buffer, size_t len, struct sha25
# define SHA256_UNALIGNED_P(p) (((uintptr_t) p) % sizeof (uint32_t) != 0)
#endif
if (SHA256_UNALIGNED_P(buffer))
while (len > 64)
{
while (len > 64) {
rb_sha256_process_block(memcpy(ctx->buffer, buffer, 64), 64, ctx);
buffer = (const char *)buffer + 64;
len -= 64;
}
else
{
else {
rb_sha256_process_block(buffer, len & ~63, ctx);
buffer = (const char *)buffer + (len & ~63);
len &= 63;
@ -1434,14 +1409,12 @@ static void rb_sha256_process_bytes(const void *buffer, size_t len, struct sha25
}
/* Move remaining bytes into internal buffer. */
if (len > 0)
{
if (len > 0) {
size_t left_over = ctx->buflen;
memcpy(&ctx->buffer[left_over], buffer, len);
left_over += len;
if (left_over >= 64)
{
if (left_over >= 64) {
rb_sha256_process_block(ctx->buffer, 64, ctx);
left_over -= 64;
memcpy(ctx->buffer, &ctx->buffer[64], left_over);
@ -1491,13 +1464,11 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
/* Skip salt prefix. */
salt += sizeof(sha256_salt_prefix) - 1;
if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0)
{
if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0) {
const char *num = salt + sizeof(sha256_rounds_prefix) - 1;
char *endp;
unsigned long int srounds = strtoul(num, &endp, 10);
if (*endp == '$')
{
if (*endp == '$') {
salt = endp + 1;
rounds = MAX(SHA256_ROUNDS_MIN, MIN(srounds, SHA256_ROUNDS_MAX));
rounds_custom = 1;
@ -1507,16 +1478,14 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
salt_len = MIN(strcspn(salt, "$"), SHA256_SALT_LEN_MAX);
key_len = strlen(key);
if ((key - (char *)0) % __alignof__(uint32_t) != 0)
{
if ((key - (char *)0) % __alignof__(uint32_t) != 0) {
char *tmp = (char *)alloca(key_len + __alignof__(uint32_t));
key = copied_key =
memcpy(tmp + __alignof__(uint32_t)
- (tmp - (char *)0) % __alignof__(uint32_t), key, key_len);
}
if ((salt - (char *)0) % __alignof__(uint32_t) != 0)
{
if ((salt - (char *)0) % __alignof__(uint32_t) != 0) {
char *tmp = (char *)alloca(salt_len + __alignof__(uint32_t));
salt = copied_salt =
memcpy(tmp + __alignof__(uint32_t)
@ -1580,8 +1549,7 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
/* Create byte sequence P. */
cp = p_bytes = alloca(key_len);
for (cnt = key_len; cnt >= 32; cnt -= 32)
{
for (cnt = key_len; cnt >= 32; cnt -= 32) {
memcpy(cp, temp_result, 32);
cp += 32;
}
@ -1599,8 +1567,7 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
/* Create byte sequence S. */
cp = s_bytes = alloca(salt_len);
for (cnt = salt_len; cnt >= 32; cnt -= 32)
{
for (cnt = salt_len; cnt >= 32; cnt -= 32) {
memcpy(cp, temp_result, 32);
cp += 32;
}
@ -1608,8 +1575,7 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
/* Repeatedly run the collected hash value through SHA256 to burn
CPU cycles. */
for (cnt = 0; cnt < rounds; ++cnt)
{
for (cnt = 0; cnt < rounds; ++cnt) {
/* New context. */
rb_sha256_init_ctx(&ctx);
@ -1645,8 +1611,7 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
cp = buffer + MAX(0, buflen);
buflen -= sizeof(sha256_salt_prefix) - 1;
if (rounds_custom)
{
if (rounds_custom) {
int n = snprintf(cp, MAX(0, buflen), "%s%zu$",
sha256_rounds_prefix, rounds);
cp += n;
@ -1659,8 +1624,7 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
cp += salt_len;
buflen -= MIN((size_t) MAX(0, buflen), salt_len);
if (buflen > 0)
{
if (buflen > 0) {
*cp++ = '$';
--buflen;
}
@ -1676,12 +1640,10 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer,
b64_from_24bit(alt_result[18], alt_result[28], alt_result[8], 4);
b64_from_24bit(alt_result[9], alt_result[19], alt_result[29], 4);
b64_from_24bit(0, alt_result[31], alt_result[30], 3);
if (buflen <= 0)
{
if (buflen <= 0) {
errno = ERANGE;
buffer = NULL;
}
else
} else
*cp = '\0'; /* Terminate the string. */
/* Clear the buffer for the intermediate result so that people
@ -1728,8 +1690,7 @@ static char *rb_sha256_crypt(const char *key, const char *salt)
}
/* Structure to save state of computation between the single steps. */
struct sha512_ctx
{
struct sha512_ctx {
uint64_t H[8];
uint64_t total[2];
@ -1827,8 +1788,7 @@ static void rb_sha512_process_block(const void *buffer, size_t len, struct sha51
/* Process all bytes in the buffer with 128 bytes in each round of
the loop. */
while (nwords > 0)
{
while (nwords > 0) {
uint64_t W[80];
uint64_t a_save = a;
uint64_t b_save = b;
@ -1853,8 +1813,7 @@ static void rb_sha512_process_block(const void *buffer, size_t len, struct sha51
#define SHA512_CYCLIC(w, s) ((w >> s) | (w << (64 - s)))
/* Compute the message schedule according to FIPS 180-2:6.3.2 step 2. */
for (t = 0; t < 16; ++t)
{
for (t = 0; t < 16; ++t) {
W[t] = SHA512_SWAP(*words);
++words;
}
@ -1862,8 +1821,7 @@ static void rb_sha512_process_block(const void *buffer, size_t len, struct sha51
W[t] = SHA512_R1(W[t - 2]) + W[t - 7] + SHA512_R0(W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.3.2 step 3. */
for (t = 0; t < 80; ++t)
{
for (t = 0; t < 80; ++t) {
uint64_t T1 = h + SHA512_S1(e) + SHA512_Ch(e, f, g) + SHA512_K[t] + W[t];
uint64_t T2 = SHA512_S0(a) + SHA512_Maj(a, b, c);
h = g;
@ -1961,16 +1919,14 @@ static void rb_sha512_process_bytes(const void *buffer, size_t len, struct sha51
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
if (ctx->buflen != 0)
{
if (ctx->buflen != 0) {
size_t left_over = ctx->buflen;
size_t add = 256 - left_over > len ? len : 256 - left_over;
memcpy(&ctx->buffer[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 128)
{
if (ctx->buflen > 128) {
rb_sha512_process_block(ctx->buffer, ctx->buflen & ~127, ctx);
ctx->buflen &= 127;
@ -1983,8 +1939,7 @@ static void rb_sha512_process_bytes(const void *buffer, size_t len, struct sha51
}
/* Process available complete blocks. */
if (len >= 128)
{
if (len >= 128) {
#if !_STRING_ARCH_unaligned
/* To check alignment gcc has an appropriate operator. Other
compilers don't. */
@ -1994,8 +1949,7 @@ static void rb_sha512_process_bytes(const void *buffer, size_t len, struct sha51
# define SHA512_UNALIGNED_P(p) (((uintptr_t) p) % sizeof (uint64_t) != 0)
# endif
if (SHA512_UNALIGNED_P(buffer))
while (len > 128)
{
while (len > 128) {
rb_sha512_process_block(memcpy(ctx->buffer, buffer, 128), 128, ctx);
buffer = (const char *)buffer + 128;
len -= 128;
@ -2010,14 +1964,12 @@ static void rb_sha512_process_bytes(const void *buffer, size_t len, struct sha51
}
/* Move remaining bytes into internal buffer. */
if (len > 0)
{
if (len > 0) {
size_t left_over = ctx->buflen;
memcpy(&ctx->buffer[left_over], buffer, len);
left_over += len;
if (left_over >= 128)
{
if (left_over >= 128) {
rb_sha512_process_block(ctx->buffer, 128, ctx);
left_over -= 128;
memcpy(ctx->buffer, &ctx->buffer[128], left_over);
@ -2067,13 +2019,11 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
/* Skip salt prefix. */
salt += sizeof(sha512_salt_prefix) - 1;
if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0)
{
if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) {
const char *num = salt + sizeof(sha512_rounds_prefix) - 1;
char *endp;
unsigned long int srounds = strtoul(num, &endp, 10);
if (*endp == '$')
{
if (*endp == '$') {
salt = endp + 1;
rounds = MAX(SHA512_ROUNDS_MIN, MIN(srounds, SHA512_ROUNDS_MAX));
rounds_custom = 1;
@ -2083,16 +2033,14 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
salt_len = MIN(strcspn(salt, "$"), SHA512_SALT_LEN_MAX);
key_len = strlen(key);
if ((key - (char *)0) % __alignof__(uint64_t) != 0)
{
if ((key - (char *)0) % __alignof__(uint64_t) != 0) {
char *tmp = (char *)alloca(key_len + __alignof__(uint64_t));
key = copied_key =
memcpy(tmp + __alignof__(uint64_t)
- (tmp - (char *)0) % __alignof__(uint64_t), key, key_len);
}
if ((salt - (char *)0) % __alignof__(uint64_t) != 0)
{
if ((salt - (char *)0) % __alignof__(uint64_t) != 0) {
char *tmp = (char *)alloca(salt_len + __alignof__(uint64_t));
salt = copied_salt =
memcpy(tmp + __alignof__(uint64_t)
@ -2156,8 +2104,7 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
/* Create byte sequence P. */
cp = p_bytes = alloca(key_len);
for (cnt = key_len; cnt >= 64; cnt -= 64)
{
for (cnt = key_len; cnt >= 64; cnt -= 64) {
memcpy(cp, temp_result, 64);
cp += 64;
}
@ -2175,8 +2122,7 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
/* Create byte sequence S. */
cp = s_bytes = alloca(salt_len);
for (cnt = salt_len; cnt >= 64; cnt -= 64)
{
for (cnt = salt_len; cnt >= 64; cnt -= 64) {
memcpy(cp, temp_result, 64);
cp += 64;
}
@ -2184,8 +2130,7 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
/* Repeatedly run the collected hash value through SHA512 to burn
CPU cycles. */
for (cnt = 0; cnt < rounds; ++cnt)
{
for (cnt = 0; cnt < rounds; ++cnt) {
/* New context. */
rb_sha512_init_ctx(&ctx);
@ -2221,8 +2166,7 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
cp = buffer + MAX(0, buflen);
buflen -= sizeof(sha512_salt_prefix) - 1;
if (rounds_custom)
{
if (rounds_custom) {
int n = snprintf(cp, MAX(0, buflen), "%s%zu$",
sha512_rounds_prefix, rounds);
cp += n;
@ -2235,8 +2179,7 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
cp = buffer + salt_len;
buflen -= MIN((size_t) MAX(0, buflen), salt_len);
if (buflen > 0)
{
if (buflen > 0) {
*cp++ = '$';
--buflen;
}
@ -2264,12 +2207,10 @@ static char *rb_sha512_crypt_r(const char *key, const char *salt, char *buffer,
b64_from_24bit(alt_result[62], alt_result[20], alt_result[41], 4);
b64_from_24bit(0, 0, alt_result[63], 2);
if (buflen <= 0)
{
if (buflen <= 0) {
errno = ERANGE;
buffer = NULL;
}
else
} else
*cp = '\0'; /* Terminate the string. */
/* Clear the buffer for the intermediate result so that people
@ -2305,8 +2246,7 @@ static char *rb_sha512_crypt(const char *key, const char *salt)
int needed = (sizeof(sha512_salt_prefix) - 1
+ sizeof(sha512_rounds_prefix) + 9 + 1 + strlen(salt) + 1 + 86 + 1);
if (buflen < needed)
{
if (buflen < needed) {
char *new_buffer = (char *)realloc(buffer, needed);
if (new_buffer == NULL)
return NULL;
@ -2411,14 +2351,22 @@ Blowfish_encipher(blf_ctx *c, uint32_t *xl, uint32_t *xr)
Xr = *xr;
Xl ^= p[0];
BLFRND(s, p, Xr, Xl, 1); BLFRND(s, p, Xl, Xr, 2);
BLFRND(s, p, Xr, Xl, 3); BLFRND(s, p, Xl, Xr, 4);
BLFRND(s, p, Xr, Xl, 5); BLFRND(s, p, Xl, Xr, 6);
BLFRND(s, p, Xr, Xl, 7); BLFRND(s, p, Xl, Xr, 8);
BLFRND(s, p, Xr, Xl, 9); BLFRND(s, p, Xl, Xr, 10);
BLFRND(s, p, Xr, Xl, 11); BLFRND(s, p, Xl, Xr, 12);
BLFRND(s, p, Xr, Xl, 13); BLFRND(s, p, Xl, Xr, 14);
BLFRND(s, p, Xr, Xl, 15); BLFRND(s, p, Xl, Xr, 16);
BLFRND(s, p, Xr, Xl, 1);
BLFRND(s, p, Xl, Xr, 2);
BLFRND(s, p, Xr, Xl, 3);
BLFRND(s, p, Xl, Xr, 4);
BLFRND(s, p, Xr, Xl, 5);
BLFRND(s, p, Xl, Xr, 6);
BLFRND(s, p, Xr, Xl, 7);
BLFRND(s, p, Xl, Xr, 8);
BLFRND(s, p, Xr, Xl, 9);
BLFRND(s, p, Xl, Xr, 10);
BLFRND(s, p, Xr, Xl, 11);
BLFRND(s, p, Xl, Xr, 12);
BLFRND(s, p, Xr, Xl, 13);
BLFRND(s, p, Xl, Xr, 14);
BLFRND(s, p, Xr, Xl, 15);
BLFRND(s, p, Xl, Xr, 16);
*xl = Xr ^ p[17];
*xr = Xl;
@ -2497,7 +2445,8 @@ Blowfish_initstate(blf_ctx *c)
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a},
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a
},
{
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
@ -2562,7 +2511,8 @@ Blowfish_initstate(blf_ctx *c)
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7},
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7
},
{
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
@ -2627,7 +2577,8 @@ Blowfish_initstate(blf_ctx *c)
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0},
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0
},
{
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
@ -2692,7 +2643,8 @@ Blowfish_initstate(blf_ctx *c)
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6
}
},
{
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
@ -2700,7 +2652,8 @@ Blowfish_initstate(blf_ctx *c)
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
0x9216d5d9, 0x8979fb1b
} };
}
};
*c = bf_initstate;
@ -2857,8 +2810,7 @@ static char error[] = ":";
static const uint8_t Base64Code[] =
"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
static const uint8_t index_64[128] =
{
static const uint8_t index_64[128] = {
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
@ -2933,8 +2885,7 @@ rb_blowfish_crypt(const char *key, const char *salt)
/* If it starts with the magic string, then skip that */
if(!strncmp(salt, magic, strlen(magic))) {
salt += strlen(magic);
}
else if (*salt == '$') {
} else if (*salt == '$') {
/* Discard "$" identifier */
salt++;

View File

@ -78,8 +78,7 @@ devpoll_update_events(rb_fde_t *F, short filter, PF * handler)
int cur_mask = fdmask[fd];
PF *cur_handler;
fdmask[fd] = 0;
switch (filter)
{
switch (filter) {
case RB_SELECT_READ:
cur_handler = F->read_handler;
if(handler)
@ -109,19 +108,16 @@ devpoll_update_events(rb_fde_t *F, short filter, PF * handler)
update_required++;
if(cur_mask != fdmask[fd])
update_required++;
if(update_required)
{
if(update_required) {
/*
* Ok, we can call devpoll_write_update() here now to re-build the
* fd struct. If we end up with nothing on this fd, it won't write
* anything.
*/
if(fdmask[fd])
{
if(fdmask[fd]) {
devpoll_write_update(fd, POLLREMOVE);
devpoll_write_update(fd, fdmask[fd]);
}
else
} else
devpoll_write_update(fd, POLLREMOVE);
}
}
@ -144,8 +140,7 @@ int
rb_init_netio_devpoll(void)
{
dpfd = open("/dev/poll", O_RDWR);
if(dpfd < 0)
{
if(dpfd < 0) {
return errno;
}
maxfd = getdtablesize() - 2; /* This makes more sense than HARD_FDLIMIT */
@ -165,14 +160,12 @@ rb_setselect_devpoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_
{
lrb_assert(IsFDOpen(F));
if(type & RB_SELECT_READ)
{
if(type & RB_SELECT_READ) {
devpoll_update_events(F, RB_SELECT_READ, handler);
F->read_handler = handler;
F->read_data = client_data;
}
if(type & RB_SELECT_WRITE)
{
if(type & RB_SELECT_WRITE) {
devpoll_update_events(F, RB_SELECT_WRITE, handler);
F->write_handler = handler;
F->write_data = client_data;
@ -201,10 +194,8 @@ rb_select_devpoll(long delay)
struct pollfd pollfds[maxfd];
struct dvpoll dopoll;
do
{
for(;;)
{
do {
for(;;) {
dopoll.dp_timeout = delay;
dopoll.dp_nfds = maxfd;
dopoll.dp_fds = &pollfds[0];
@ -221,17 +212,14 @@ rb_select_devpoll(long delay)
if(num == 0)
continue;
for(i = 0; i < num; i++)
{
for(i = 0; i < num; i++) {
int fd = dopoll.dp_fds[i].fd;
PF *hdl = NULL;
rb_fde_t *F = rb_find_fd(fd);
if((dopoll.dp_fds[i].revents & (POLLRDNORM | POLLIN | POLLHUP |
POLLERR))
&& (dopoll.dp_fds[i].events & (POLLRDNORM | POLLIN)))
{
if((hdl = F->read_handler) != NULL)
{
&& (dopoll.dp_fds[i].events & (POLLRDNORM | POLLIN))) {
if((hdl = F->read_handler) != NULL) {
F->read_handler = NULL;
hdl(F, F->read_data);
/*
@ -248,10 +236,8 @@ rb_select_devpoll(long delay)
continue; /* Read handler closed us..go on to do something more useful */
if((dopoll.dp_fds[i].revents & (POLLWRNORM | POLLOUT | POLLHUP |
POLLERR))
&& (dopoll.dp_fds[i].events & (POLLWRNORM | POLLOUT)))
{
if((hdl = F->write_handler) != NULL)
{
&& (dopoll.dp_fds[i].events & (POLLWRNORM | POLLOUT))) {
if((hdl = F->write_handler) != NULL) {
F->write_handler = NULL;
hdl(F, F->write_data);
/* See above similar code in the read case */
@ -262,8 +248,7 @@ rb_select_devpoll(long delay)
}
}
return RB_OK;
}
while(0);
} while(0);
/* XXX Get here, we broke! */
return 0;
}

View File

@ -47,8 +47,7 @@
#endif
#define RTSIGNAL SIGRTMIN
struct epoll_info
{
struct epoll_info {
int ep;
struct epoll_event *pfd;
int pfd_size;
@ -72,8 +71,7 @@ rb_init_netio_epoll(void)
ep_info = rb_malloc(sizeof(struct epoll_info));
ep_info->pfd_size = getdtablesize();
ep_info->ep = epoll_create(ep_info->pfd_size);
if(ep_info->ep < 0)
{
if(ep_info->ep < 0) {
return -1;
}
rb_open(ep_info->ep, RB_FD_UNKNOWN, "epoll file descriptor");
@ -105,8 +103,7 @@ rb_setselect_epoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_da
lrb_assert(IsFDOpen(F));
/* Update the list, even though we're not using it .. */
if(type & RB_SELECT_READ)
{
if(type & RB_SELECT_READ) {
if(handler != NULL)
F->pflags |= EPOLLIN;
else
@ -115,8 +112,7 @@ rb_setselect_epoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_da
F->read_data = client_data;
}
if(type & RB_SELECT_WRITE)
{
if(type & RB_SELECT_WRITE) {
if(handler != NULL)
F->pflags |= EPOLLOUT;
else
@ -143,8 +139,7 @@ rb_setselect_epoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_da
if(op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD)
ep_event.events |= EPOLLET;
if(epoll_ctl(ep_info->ep, op, F->fd, &ep_event) != 0)
{
if(epoll_ctl(ep_info->ep, op, F->fd, &ep_event) != 0) {
rb_lib_log("rb_setselect_epoll(): epoll_ctl failed: %s", strerror(errno));
abort();
}
@ -182,34 +177,29 @@ rb_select_epoll(long delay)
if(num <= 0)
return RB_OK;
for(i = 0; i < num; i++)
{
for(i = 0; i < num; i++) {
PF *hdl;
rb_fde_t *F = ep_info->pfd[i].data.ptr;
old_flags = F->pflags;
if(ep_info->pfd[i].events & (EPOLLIN | EPOLLHUP | EPOLLERR))
{
if(ep_info->pfd[i].events & (EPOLLIN | EPOLLHUP | EPOLLERR)) {
hdl = F->read_handler;
data = F->read_data;
F->read_handler = NULL;
F->read_data = NULL;
if(hdl)
{
if(hdl) {
hdl(F, data);
}
}
if(!IsFDOpen(F))
continue;
if(ep_info->pfd[i].events & (EPOLLOUT | EPOLLHUP | EPOLLERR))
{
if(ep_info->pfd[i].events & (EPOLLOUT | EPOLLHUP | EPOLLERR)) {
hdl = F->write_handler;
data = F->write_data;
F->write_handler = NULL;
F->write_data = NULL;
if(hdl)
{
if(hdl) {
hdl(F, data);
}
}
@ -224,8 +214,7 @@ rb_select_epoll(long delay)
if(F->write_handler != NULL)
flags |= EPOLLOUT;
if(old_flags != flags)
{
if(old_flags != flags) {
if(flags == 0)
op = EPOLL_CTL_DEL;
else
@ -235,8 +224,7 @@ rb_select_epoll(long delay)
if(op == EPOLL_CTL_MOD || op == EPOLL_CTL_ADD)
ep_event.events |= EPOLLET;
if(epoll_ctl(ep_info->ep, op, F->fd, &ep_event) != 0)
{
if(epoll_ctl(ep_info->ep, op, F->fd, &ep_event) != 0) {
rb_lib_log("rb_select_epoll(): epoll_ctl failed: %s",
strerror(errno));
}
@ -263,15 +251,13 @@ rb_epoll_supports_event(void)
return 0;
/* Check for openvz..it has a broken timerfd.. */
if(stat("/proc/user_beancounters", &st) == 0)
{
if(stat("/proc/user_beancounters", &st) == 0) {
can_do_event = -1;
return 0;
}
#ifdef USE_TIMERFD_CREATE
if((fd = timerfd_create(CLOCK_REALTIME, 0)) >= 0)
{
if((fd = timerfd_create(CLOCK_REALTIME, 0)) >= 0) {
close(fd);
can_do_event = 1;
can_do_timerfd = 1;
@ -281,16 +267,14 @@ rb_epoll_supports_event(void)
ev.sigev_signo = SIGVTALRM;
ev.sigev_notify = SIGEV_SIGNAL;
if(timer_create(CLOCK_REALTIME, &ev, &timer) != 0)
{
if(timer_create(CLOCK_REALTIME, &ev, &timer) != 0) {
can_do_event = -1;
return 0;
}
timer_delete(timer);
sigemptyset(&set);
fd = signalfd(-1, &set, 0);
if(fd < 0)
{
if(fd < 0) {
can_do_event = -1;
return 0;
}
@ -301,8 +285,7 @@ rb_epoll_supports_event(void)
/* bleh..work around a glibc header bug on 32bit systems */
struct our_signalfd_siginfo
{
struct our_signalfd_siginfo {
uint32_t signo;
int32_t err;
int32_t code;
@ -332,30 +315,25 @@ signalfd_handler(rb_fde_t *F, void *data)
struct ev_entry *ev;
int ret, x;
for(x = 0; x < SIGFDIOV_COUNT; x++)
{
for(x = 0; x < SIGFDIOV_COUNT; x++) {
iov[x].iov_base = &fdsig[x];
iov[x].iov_len = sizeof(struct our_signalfd_siginfo);
}
while(1)
{
while(1) {
ret = readv(rb_get_fd(F), iov, SIGFDIOV_COUNT);
if(ret == 0 || (ret < 0 && !rb_ignore_errno(errno)))
{
if(ret == 0 || (ret < 0 && !rb_ignore_errno(errno))) {
rb_close(F);
rb_epoll_init_event();
return;
}
if(ret < 0)
{
if(ret < 0) {
rb_setselect(F, RB_SELECT_READ, signalfd_handler, NULL);
return;
}
for(x = 0; x < ret / (int)sizeof(struct our_signalfd_siginfo); x++)
{
for(x = 0; x < ret / (int)sizeof(struct our_signalfd_siginfo); x++) {
#if __WORDSIZE == 32 && defined(__sparc__)
uint32_t *q = (uint32_t *)&fdsig[x].svptr;
ev = (struct ev_entry *)q[0];
@ -378,16 +356,14 @@ rb_epoll_init_event(void)
rb_fde_t *F;
int sfd;
rb_epoll_supports_event();
if(!can_do_timerfd)
{
if(!can_do_timerfd) {
sigemptyset(&ss);
sigaddset(&ss, RTSIGNAL);
sigprocmask(SIG_BLOCK, &ss, 0);
sigemptyset(&ss);
sigaddset(&ss, RTSIGNAL);
sfd = signalfd(-1, &ss, 0);
if(sfd == -1)
{
if(sfd == -1) {
can_do_event = -1;
return;
}
@ -411,8 +387,7 @@ rb_epoll_sched_event_signalfd(struct ev_entry *event, int when)
ev.sigev_signo = RTSIGNAL;
ev.sigev_value.sival_ptr = event;
if(timer_create(CLOCK_REALTIME, &ev, id) < 0)
{
if(timer_create(CLOCK_REALTIME, &ev, id) < 0) {
rb_lib_log("timer_create: %s\n", strerror(errno));
return 0;
}
@ -422,8 +397,7 @@ rb_epoll_sched_event_signalfd(struct ev_entry *event, int when)
if(event->frequency != 0)
ts.it_interval = ts.it_value;
if(timer_settime(*id, 0, &ts, NULL) < 0)
{
if(timer_settime(*id, 0, &ts, NULL) < 0) {
rb_lib_log("timer_settime: %s\n", strerror(errno));
return 0;
}
@ -438,16 +412,14 @@ rb_read_timerfd(rb_fde_t *F, void *data)
int retlen;
uint64_t count;
if(event == NULL)
{
if(event == NULL) {
rb_close(F);
return;
}
retlen = rb_read(F, &count, sizeof(count));
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno)))
{
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) {
rb_close(F);
rb_lib_log("rb_read_timerfd: timerfd[%s] closed on error: %s", event->name,
strerror(errno));
@ -466,8 +438,7 @@ rb_epoll_sched_event_timerfd(struct ev_entry *event, int when)
int fd;
rb_fde_t *F;
if((fd = timerfd_create(CLOCK_REALTIME, 0)) < 0)
{
if((fd = timerfd_create(CLOCK_REALTIME, 0)) < 0) {
rb_lib_log("timerfd_create: %s\n", strerror(errno));
return 0;
}
@ -478,13 +449,12 @@ rb_epoll_sched_event_timerfd(struct ev_entry *event, int when)
if(event->frequency != 0)
ts.it_interval = ts.it_value;
if(timerfd_settime(fd, 0, &ts, NULL) < 0)
{
if(timerfd_settime(fd, 0, &ts, NULL) < 0) {
rb_lib_log("timerfd_settime: %s\n", strerror(errno));
close(fd);
return 0;
}
rb_snprintf(buf, sizeof(buf), "timerfd: %s", event->name);
snprintf(buf, sizeof(buf), "timerfd: %s", event->name);
F = rb_open(fd, RB_FD_UNKNOWN, buf);
rb_set_nb(F);
event->comm_ptr = F;
@ -499,8 +469,7 @@ int
rb_epoll_sched_event(struct ev_entry *event, int when)
{
#ifdef USE_TIMERFD_CREATE
if(can_do_timerfd)
{
if(can_do_timerfd) {
return rb_epoll_sched_event_timerfd(event, when);
}
#endif
@ -511,8 +480,7 @@ void
rb_epoll_unsched_event(struct ev_entry *event)
{
#ifdef USE_TIMERFD_CREATE
if(can_do_timerfd)
{
if(can_do_timerfd) {
rb_close((rb_fde_t *)event->comm_ptr);
event->comm_ptr = NULL;
return;

View File

@ -65,8 +65,7 @@ rb_event_find(EVH * func, void *arg)
{
rb_dlink_node *ptr;
struct ev_entry *ev;
RB_DLINK_FOREACH(ptr, event_list.head)
{
RB_DLINK_FOREACH(ptr, event_list.head) {
ev = ptr->data;
if((ev->func == func) && (ev->arg == arg))
return ev;
@ -96,8 +95,7 @@ rb_event_add(const char *name, EVH * func, void *arg, time_t when)
ev->next = when;
ev->frequency = when;
if((ev->when < event_time_min) || (event_time_min == -1))
{
if((ev->when < event_time_min) || (event_time_min == -1)) {
event_time_min = ev->when;
}
rb_dlinkAdd(ev, &ev->node, &event_list);
@ -170,8 +168,7 @@ rb_event_find_delete(EVH * func, void *arg)
struct ev_entry *
rb_event_addish(const char *name, EVH * func, void *arg, time_t delta_ish)
{
if(delta_ish >= 3.0)
{
if(delta_ish >= 3.0) {
const time_t two_third = (2 * delta_ish) / 3;
delta_ish = two_third + ((rand() % 1000) * two_third) / 1000;
/*
@ -188,8 +185,7 @@ rb_run_event(struct ev_entry *ev)
{
rb_strlcpy(last_event_ran, ev->name, sizeof(last_event_ran));
ev->func(ev->arg);
if(!ev->frequency)
{
if(!ev->frequency) {
rb_io_unsched_event(ev);
rb_dlinkDelete(&ev->node, &event_list);
rb_free(ev);
@ -217,29 +213,22 @@ rb_event_run(void)
return;
event_time_min = -1;
RB_DLINK_FOREACH_SAFE(ptr, next, event_list.head)
{
RB_DLINK_FOREACH_SAFE(ptr, next, event_list.head) {
ev = ptr->data;
if(ev->when <= rb_current_time())
{
if(ev->when <= rb_current_time()) {
rb_strlcpy(last_event_ran, ev->name, sizeof(last_event_ran));
ev->func(ev->arg);
/* event is scheduled more than once */
if(ev->frequency)
{
if(ev->frequency) {
ev->when = rb_current_time() + ev->frequency;
if((ev->when < event_time_min) || (event_time_min == -1))
event_time_min = ev->when;
}
else
{
} else {
rb_dlinkDelete(&ev->node, &event_list);
rb_free(ev);
}
}
else
{
} else {
if((ev->when < event_time_min) || (event_time_min == -1))
event_time_min = ev->when;
}
@ -255,8 +244,7 @@ rb_event_io_register_all(void)
if(!rb_io_supports_event())
return;
RB_DLINK_FOREACH(ptr, event_list.head)
{
RB_DLINK_FOREACH(ptr, event_list.head) {
ev = ptr->data;
rb_io_sched_event(ev, ev->next);
}
@ -284,16 +272,15 @@ rb_dump_events(void (*func) (char *, void *), void *ptr)
struct ev_entry *ev;
len = sizeof(buf);
rb_snprintf(buf, len, "Last event to run: %s", last_event_ran);
snprintf(buf, len, "Last event to run: %s", last_event_ran);
func(buf, ptr);
rb_strlcpy(buf, "Operation Next Execution", len);
func(buf, ptr);
RB_DLINK_FOREACH(dptr, event_list.head)
{
RB_DLINK_FOREACH(dptr, event_list.head) {
ev = dptr->data;
rb_snprintf(buf, len, "%-28s %-4ld seconds", ev->name,
snprintf(buf, len, "%-28s %-4ld seconds", ev->name,
ev->when - (long)rb_current_time());
func(buf, ptr);
}
@ -310,8 +297,7 @@ rb_set_back_events(time_t by)
{
rb_dlink_node *ptr;
struct ev_entry *ev;
RB_DLINK_FOREACH(ptr, event_list.head)
{
RB_DLINK_FOREACH(ptr, event_list.head) {
ev = ptr->data;
if(ev->when > by)
ev->when -= by;

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