Compare commits
122 Commits
fix_path_c
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
d19099eb3c | ||
|
99a1244e46 | ||
|
edd460a8fa | ||
|
4cd5bdb381 | ||
c6a872ed61 | |||
f797d25e06 | |||
0a93c8cfd3 | |||
18665b1501 | |||
f2fd1824ca | |||
|
8d9658ca43 | ||
|
e04f97c78f | ||
|
26d347dec6 | ||
|
ee6ee0bd34 | ||
|
edf78eadb1 | ||
|
efb79b1e80 | ||
|
79d9be4e71 | ||
|
dbf8ccd4de | ||
|
f54775fe92 | ||
|
f379eb35d2 | ||
|
ce4cf8b6a0 | ||
|
368149575d | ||
|
b990a071b3 | ||
|
af590f83b7 | ||
|
62fd77dc17 | ||
|
dd5343b710 | ||
|
94fe272018 | ||
|
fbfae37d65 | ||
|
9d6394679f | ||
|
2a5e7b6f7b | ||
|
e694dae31c | ||
|
26d34bafab | ||
|
fe108e390f | ||
|
e7d82acfff | ||
|
51a46a1454 | ||
|
7680af6a09 | ||
|
34b3c4b0c3 | ||
|
399a104d1e | ||
|
dc43d75d1f | ||
1df884545f | |||
814ef72938 | |||
462c1036fc | |||
9aa9e719d9 | |||
ce67374c0e | |||
42ccca7849 | |||
49688a5aa1 | |||
ef70865450 | |||
9579b5fb3f | |||
bffdbe8b19 | |||
a974323a8f | |||
12a6dbc352 | |||
1816044070 | |||
722ed9a8da | |||
df2a9eab17 | |||
d0bb1d4dc0 | |||
0e9e61decb | |||
844395db1a | |||
0c1881b921 | |||
8b343aa5b0 | |||
|
2c7b8aa155 | ||
1732209c70 | |||
3d732651bc | |||
e6547b8a48 | |||
75317ae17c | |||
7362a46a0f | |||
92a1f07c76 | |||
63453bad41 | |||
|
92819d87ea | ||
|
c9cc64f2e1 | ||
|
0044826084 | ||
|
60122ef160 | ||
814d54c676 | |||
a86b73ab03 | |||
|
e5005cea34 | ||
|
16f2be6ac2 | ||
09053fc5f0 | |||
1f8a8763cb | |||
c93a7e841a | |||
843cf3738e | |||
|
65406960aa | ||
|
df5508eed0 | ||
|
87192685f5 | ||
|
d2dcb0adb1 | ||
02c55a37b2 | |||
|
e224f067c1 | ||
|
936b766905 | ||
|
caf979a4c5 | ||
|
513a6582ad | ||
|
ba5cef017c | ||
|
2bf967bacc | ||
|
34a92dedb1 | ||
|
7844716af5 | ||
|
87f3415330 | ||
|
c0fafe669d | ||
|
a80e74bbdc | ||
|
fabaec9d80 | ||
|
e222e1c986 | ||
|
0b8269e2d3 | ||
|
e27b84f15e | ||
|
4d7f243777 | ||
|
2fd3418a9e | ||
|
b963308e6c | ||
|
fbde155287 | ||
|
012b21a68b | ||
|
40233ff938 | ||
|
7dec6b3072 | ||
|
27f1cf988b | ||
|
1e80291b9c | ||
|
362ec25e4b | ||
|
f4ac33f63c | ||
|
aa35b372b4 | ||
|
34711f7653 | ||
|
53dafd9590 | ||
|
057107a233 | ||
b75345d6b5 | |||
cf144594a0 | |||
eaed46da14 | |||
025689d807 | |||
948b41ef7a | |||
7834471f78 | |||
13b2e37635 | |||
3afb16d795 | |||
348737fab5 |
22
.clang-format
Normal file
22
.clang-format
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
Language: Cpp
|
||||
IndentWidth: 8
|
||||
UseTab: Always
|
||||
BreakBeforeBraces: Linux
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
IndentCaseLabels: false
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AlignAfterOpenBracket: true
|
||||
SpaceAfterCStyleCast: false
|
||||
MaxEmptyLinesToKeep: 2
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakStringLiterals: false
|
||||
SortIncludes: false
|
||||
ContinuationIndentWidth: 8
|
||||
ColumnLimit: 80
|
63
.gitignore
vendored
Normal file
63
.gitignore
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
/ar-lib
|
||||
/mdate-sh
|
||||
/py-compile
|
||||
/test-driver
|
||||
/ylwrap
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
autom4te.cache
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/aclocal.m4
|
||||
/compile
|
||||
/config.guess
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/configure.scan
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
|
||||
# https://www.gnu.org/software/libtool/
|
||||
|
||||
/ltmain.sh
|
||||
|
||||
# http://www.gnu.org/software/texinfo
|
||||
|
||||
/texinfo.tex
|
||||
|
||||
# http://www.gnu.org/software/m4/
|
||||
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
|
||||
# Makefiles
|
||||
Makefile
|
||||
src/.deps/
|
||||
src/Makefile
|
||||
tests/.deps/
|
||||
tests/Makefile
|
||||
|
||||
# Generated code
|
||||
src/conf.c
|
||||
src/conf.h
|
||||
src/config.h
|
||||
src/config.h.in
|
||||
src/lex.c
|
||||
|
||||
# Binaries
|
||||
src/*.o
|
||||
src/*.a
|
||||
src/bip
|
||||
src/bipmkpw
|
1
AUTHORS
1
AUTHORS
@ -10,3 +10,4 @@ Thanks to our marketting and management team:
|
||||
ack|, ato, blackmore, lafouine, Gaston & gromit
|
||||
|
||||
Crypto shamelessly stolen from Christophe 'sexy' Devine.
|
||||
Credits to Jouni Malinen for base64 library (http://web.mit.edu/freebsd/head/contrib/wpa/src/utils/)
|
||||
|
879
ChangeLog
879
ChangeLog
@ -1,10 +1,847 @@
|
||||
commit 901f54eff0f647442923f2ccf6f470f22e4c5ffe (G)
|
||||
commit 18665b150198d283419d2e1d72901af96eda18e4 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Thu Mar 10 14:38:26 2022 +0100
|
||||
|
||||
Update NEWS file (SASL, GCC flags, /bip user info)
|
||||
|
||||
commit f2fd1824caad008ad529a2860d8568208a0955e7 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Thu Mar 10 13:52:03 2022 +0100
|
||||
|
||||
Format the whole code using clang-format
|
||||
|
||||
commit 8d9658ca43242d4c8bc203846017a907ebb39fcc (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Thu Mar 10 13:09:41 2022 +0100
|
||||
|
||||
Build lexer in a separate unit without AM_CFLAGS
|
||||
|
||||
commit e04f97c78ff528b3c83c080fcb3ecade664b5c73 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Mon Jan 10 19:30:56 2022 +0100
|
||||
|
||||
ignore some issues related to array_get
|
||||
|
||||
ignore "passing argument X of .... with different width due to prototype"
|
||||
|
||||
commit 26d347dec6d7f096cc41a9dac67984a3e1987105 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Mon Jan 10 18:10:50 2022 +0100
|
||||
|
||||
sanitize: fix const char * being used as non-const
|
||||
|
||||
commit ee6ee0bd34855baf755c57047bb1404ebd930c17 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 22:15:46 2022 +0100
|
||||
|
||||
irc_cli_part set cname to proper const char *
|
||||
|
||||
commit edf78eadb1f1e69172451189aae50827dc179ea1 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 21:30:25 2022 +0100
|
||||
|
||||
sanitize: pragmas for our code
|
||||
|
||||
commit efb79b1e806142865f63255274f88f43af0c3362 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 21:24:25 2022 +0100
|
||||
|
||||
sanitize: a bit evolved size_t cast for get_str_elem
|
||||
|
||||
commit 79d9be4e71b171cf047bed0f59377dd9ce930d1e (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 20:43:26 2022 +0100
|
||||
|
||||
sanitize: ftell/fseek & len/file_offset type fixes
|
||||
|
||||
commit dbf8ccd4de68f3dc54efaf63e782c19570ef77bb (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 20:39:38 2022 +0100
|
||||
|
||||
sanitize: more NULL pointer failsafes
|
||||
|
||||
commit f54775fe9204942ab174c8d8e9a88a183c42fed3 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 20:37:55 2022 +0100
|
||||
|
||||
sanitize: ignore warnings related to external libs
|
||||
|
||||
commit f379eb35d29c86d0667be072e02e5dfe4af2ec23 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 20:35:50 2022 +0100
|
||||
|
||||
sanitize: oidentd handler fixes
|
||||
|
||||
commit ce4cf8b6a0c8610cc4df096184c006e7cfdd044b (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 21:02:48 2022 +0100
|
||||
|
||||
sanitize: add bip_clock_gettime util function
|
||||
|
||||
commit 368149575d2cf8aefc6b50983dddb6e1a25b6426 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 20:24:40 2022 +0100
|
||||
|
||||
sanitize: null writes, write errors, oversized int,
|
||||
|
||||
and set incoming_end to size_t
|
||||
|
||||
commit b990a071b364696432de23a7b6f84807156129fd (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 20:11:01 2022 +0100
|
||||
|
||||
sanitize: fix pid/pidfile handling
|
||||
|
||||
commit af590f83b7f8e843b2274c33099b653c2be438da (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 21:12:24 2022 +0100
|
||||
|
||||
lag shouldn't be allowed to go negative
|
||||
|
||||
commit 62fd77dc177710574c66e38882c841c1368dec89 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 21:00:33 2022 +0100
|
||||
|
||||
l_clientc should not be allowed to go negative
|
||||
|
||||
commit dd5343b7107ef91a81cae1c74164e08c4421c83f (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 20:59:59 2022 +0100
|
||||
|
||||
use proper types, safe casts (mostly size_t)
|
||||
|
||||
commit 94fe272018cfc38b05e98b5b64d9cc959b39e7f1 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 19:34:49 2022 +0100
|
||||
|
||||
handle more config errors, use char not int:1
|
||||
|
||||
commit fbfae37d6581b6a077021ba5f62bd2af67b16bbf (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 19:23:41 2022 +0100
|
||||
|
||||
sanitize: configuration parsing
|
||||
|
||||
commit 9d6394679f075992b9902a7a3b4c2fe61819cb43 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 18:25:44 2022 +0100
|
||||
|
||||
sanitize: check return value
|
||||
|
||||
commit 2a5e7b6f7bea243117d671ec4812f63b46a23a39 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 21:20:49 2022 +0100
|
||||
|
||||
sanitize: add trivial casts to types
|
||||
|
||||
and add missing default cases
|
||||
|
||||
commit e694dae31cedcfd7dd2eadffb6c9a18b1f4b866c (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 9 18:25:26 2022 +0100
|
||||
|
||||
functions without parameters: add missing void
|
||||
|
||||
commit 26d34bafabe7ba8aa778ff8e7af960d1a6dab081 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Thu Jan 6 19:48:59 2022 +0100
|
||||
|
||||
sanitize: add bipmkpw_fatal & fix bipmkpw warnings
|
||||
|
||||
commit fe108e390f6400ccc94ebfe09e0215ad57dbdccf (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Thu Jan 6 21:34:55 2022 +0100
|
||||
|
||||
Add secure / strict CFLAGS
|
||||
|
||||
Ref: https://airbus-seclab.github.io/c-compiler-security/#gcc-tldr
|
||||
|
||||
commit e7d82acfff5877bcede66b6c1661a4a3e9ed3a2e (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 2 15:26:51 2022 +0100
|
||||
|
||||
Update build configuration
|
||||
|
||||
commit 51a46a1454092dc74f64e299770195a2911fbdd3 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Thu Jan 6 19:57:08 2022 +0100
|
||||
|
||||
Add compiled stuff to gitignore
|
||||
|
||||
commit 7680af6a0998a8fb1b5fb4f93ee8ae3784d01fd6 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Wed Jan 12 21:48:43 2022 +0100
|
||||
|
||||
Add make lint calling clang-format & force 80 cols
|
||||
|
||||
commit 34b3c4b0c3464211ef129ea9f806595833d0b645 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Thu Jan 6 13:43:18 2022 +0100
|
||||
|
||||
Move /BIP to bip_strcat{,f}_fit memccpy wrapper
|
||||
|
||||
instead of snprintf.
|
||||
|
||||
commit 399a104d1ea483623ca15f39a45a699c5ececcb1 (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Thu Jan 6 19:51:11 2022 +0100
|
||||
|
||||
fix /bip user info command
|
||||
|
||||
commit dc43d75d1f7e7c01d943f085120f704d2dac831d (G)
|
||||
Author: Loïc Gomez <bip@kyoshiro.org>
|
||||
Date: Sun Jan 2 14:16:10 2022 +0100
|
||||
|
||||
Add SASL authentication support (EXTERNAL, PLAIN)
|
||||
|
||||
commit 1df884545fc4bb901dcea6d4cc1e9eda117f9220 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Sun Oct 17 12:52:00 2021 +0200
|
||||
|
||||
Add a man page for the bipgenconfig script
|
||||
|
||||
This man page comes from the Debian package.
|
||||
|
||||
commit 814ef729380adb60e7d60fa7fc02f9fac316023c (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Sun Oct 17 12:47:12 2021 +0200
|
||||
|
||||
Add man pages in Documentation key of systemd unit
|
||||
|
||||
commit 462c1036fc3daefe7ee81262134bd6542e4cc8be (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Sun Oct 17 12:09:45 2021 +0200
|
||||
|
||||
Fix spelling errors found by Lintian
|
||||
|
||||
commit 9aa9e719d97ec4dc886946ace3b688674be4144d (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Oct 13 13:13:22 2021 +0200
|
||||
|
||||
new release: ensure NEWS file is up to date
|
||||
|
||||
commit ce67374c0e5844b563559f73c5eb085d7fdba1f7 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Oct 13 11:40:30 2021 +0200
|
||||
|
||||
Synchronize NEWS file & NEWS from project
|
||||
|
||||
commit 42ccca78493e7a5e342883052aeb18dadc82bae9 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Oct 12 21:33:19 2021 +0200
|
||||
|
||||
Add -git to version string.
|
||||
|
||||
commit 49688a5aa19fdf12e7f42b84e5434025399f05e5 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Oct 12 21:33:13 2021 +0200
|
||||
|
||||
Update version and ChangeLog for bip-0.9.2 release.
|
||||
|
||||
commit ef70865450a0b0aab4561f8815630d697dd109dd (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Oct 12 18:53:26 2021 +0200
|
||||
|
||||
Fix minor issues in bip sample configuration file
|
||||
|
||||
commit 9579b5fb3f246cd30a76b618031f7a190f6349c4 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Oct 12 18:36:38 2021 +0200
|
||||
|
||||
Add missing keywords in vim syntax file
|
||||
|
||||
Add autojoin_on_kick, backlog_reset_connection, ignore_server_capab,
|
||||
reconn_timer and write_oidentd keywords.
|
||||
|
||||
commit bffdbe8b1969a57f0dec3da7f3bc4f11487f9059 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Oct 12 18:18:27 2021 +0200
|
||||
|
||||
backlog_timestamp: update man page & vim syntax
|
||||
|
||||
Complete 0c1881b9210794821c71380969c54e1034679f21 and
|
||||
2c7b8aa1550fac97d8a203bcf905bf4c7586fe80.
|
||||
|
||||
commit a974323a8fb7e846c2d8ab28bd42ab41f7852a56 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Oct 12 18:40:21 2021 +0200
|
||||
|
||||
Fix syntax issue in vim syntax file
|
||||
|
||||
backlog keywords were ignored due to this issue.
|
||||
|
||||
commit 12a6dbc352764dbe257a5a1fd4c24bb38ea23b8e (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Oct 11 18:14:43 2021 +0200
|
||||
|
||||
Add -git to version string.
|
||||
|
||||
commit 1816044070374e710a0c015e8c7b0c852dcf1a75 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Oct 11 18:14:37 2021 +0200
|
||||
|
||||
Update version and ChangeLog for bip-0.9.1 release.
|
||||
|
||||
commit 722ed9a8da5470b4b5e75fa140a34cbde409c33b (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Oct 11 18:06:27 2021 +0200
|
||||
|
||||
ENABLED might not be defined: use a default value
|
||||
|
||||
For example using ENABLED in /etc/default/bip is DEPRECATED in Debian.
|
||||
|
||||
Closes #618.
|
||||
|
||||
commit df2a9eab17fc39e2f0da3004b4bc150c848c5d61 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Oct 11 14:50:25 2021 +0200
|
||||
|
||||
Add -git to version string.
|
||||
|
||||
commit d0bb1d4dc0db5f9d50d7e43d6375ff1b77d7273d (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Oct 11 14:50:19 2021 +0200
|
||||
|
||||
Update version and ChangeLog for bip-0.9.0 release.
|
||||
|
||||
commit 0e9e61decb5d2cf5aab85ac3de0b2df12c55d92b (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Oct 11 14:49:17 2021 +0200
|
||||
|
||||
Update version and ChangeLog for bip-0.9.0 release.
|
||||
|
||||
commit 844395db1a0414014f6cdd178c7c73ef30720f6d (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Fri Oct 8 19:22:22 2021 +0200
|
||||
|
||||
Update NEWS file: add user facing changes
|
||||
|
||||
commit 0c1881b9210794821c71380969c54e1034679f21 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Fri Oct 8 18:02:54 2021 +0200
|
||||
|
||||
Deprecate backlog_no_timestamp parameter
|
||||
|
||||
backlog_timestamp must be used instead.
|
||||
|
||||
The default behavior is unchanged and can explicitly used with:
|
||||
|
||||
backlog_timestamp = "time";
|
||||
|
||||
The "none" value can be used with the backlog_timestamp parameter in
|
||||
order to use the same behavior that the "no" value of the deprecated
|
||||
parameter backlog_no_timestamp provided.
|
||||
|
||||
The date can now be displayed (in addition to the time) while backlogging:
|
||||
|
||||
backlog_timestamp = "datetime";
|
||||
|
||||
commit 8b343aa5b0aa43441a7bed943bb8338c31b1fcc7 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Fri Oct 8 11:57:53 2021 +0200
|
||||
|
||||
Merge branch 'allow-customizing-the-timestamp-format'
|
||||
|
||||
commit 2c7b8aa1550fac97d8a203bcf905bf4c7586fe80 (G)
|
||||
Author: Thomas Vigouroux <tomvig38@gmail.com>
|
||||
Date: Thu Oct 7 16:16:02 2021 +0200
|
||||
|
||||
Allow customizing the timestamp format
|
||||
|
||||
commit 1732209c703397e1a9027784c2af559bc3bca7ac (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Fri Oct 8 11:48:18 2021 +0200
|
||||
|
||||
Merge branch 'wording_and_typo'
|
||||
|
||||
commit 3d732651bc2b957d3553f29bf7903a4bdc651b45 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Thu Oct 7 18:06:10 2021 +0200
|
||||
|
||||
Improve wording in error message
|
||||
|
||||
commit e6547b8a48e11f7e235d241b2edd3a9360929836 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Thu Oct 7 18:04:17 2021 +0200
|
||||
|
||||
Fix a typo (s/LOGING/LOGGING/)
|
||||
|
||||
commit 75317ae17ce24e8aafe0358125a632226d3b84fc (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon May 18 04:47:11 2020 +0200
|
||||
|
||||
Add -git to version string.
|
||||
|
||||
commit 7362a46a0fc6bf30941d13dbca9dfbd9ed9094ff (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon May 18 04:47:05 2020 +0200
|
||||
|
||||
Update version and ChangeLog for bip-0.9.0-rc4 release.
|
||||
|
||||
commit 92a1f07c76e69396973fc4015f3285fc5681bb40 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon May 18 04:43:59 2020 +0200
|
||||
|
||||
bip-release: update regex
|
||||
|
||||
Related: c0fafe669d08170b171601d49cf5542a68692a71
|
||||
|
||||
commit 63453bad41681d8c7c98ee279f80a16312deb7e5 (G)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon May 18 04:04:06 2020 +0200
|
||||
|
||||
Update INSTALL file which refers to README
|
||||
|
||||
for specific instructions.
|
||||
|
||||
commit 92819d87eae8ec8076d67a647adbd81d3c29e8b8 (G)
|
||||
Author: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Fri Feb 7 11:20:45 2020 -0800
|
||||
|
||||
Fix stringop-truncation error (thanks DJ Delorie)
|
||||
|
||||
See https://bugzilla.redhat.com/show_bug.cgi?id=1799189. bip build fails
|
||||
on current Fedora Rawhide GCC and glibc. DJ Delorie says "The warning is
|
||||
correct; the code is copying up to the NUL on purpose, then copying the
|
||||
NUL in a separate command. Not sure why." Tom Hughes suggests this as
|
||||
the fix.
|
||||
|
||||
commit c9cc64f2e1932339ddd08d39261331f6b6ceee71 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Tue Dec 25 10:13:54 2018 -0500
|
||||
|
||||
Be more consistent when freeing incomplete clients.
|
||||
|
||||
Cleanup IRC_TYPE_TRUST_CLIENT clients from the connecting client list
|
||||
the same way as IRC_TYPE_LOGING_CLIENT.
|
||||
|
||||
commit 0044826084a135dc853a3d0643f28cb284723e90 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Mon Dec 24 16:58:59 2018 -0500
|
||||
|
||||
Don't unbind succesful trusting clients twice.
|
||||
|
||||
Complements commit 60122ef160bc2bacbd78f7907390a6743bc0c64d.
|
||||
|
||||
commit 60122ef160bc2bacbd78f7907390a6743bc0c64d (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Mon Dec 17 22:33:19 2018 -0500
|
||||
|
||||
Unbind clients of type IRC_TYPE_TRUST_CLIENT.
|
||||
|
||||
The clients connection was nulled in irc_closed, but the clients were
|
||||
not removed from the link, which caused a segfault on successful
|
||||
connection.
|
||||
|
||||
https://projects.duckcorp.org/issues/637
|
||||
|
||||
commit 814d54c676d5827f6ea37c1cd2d6e846d080c13c (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Dec 12 03:02:21 2018 +0100
|
||||
|
||||
use strftime instead of snprintf wherever possible
|
||||
|
||||
commit a86b73ab03711b1bc8eb8b2d0a2dd47aac813413 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Dec 12 02:05:14 2018 +0100
|
||||
|
||||
reuse AM_CFLAGS wherever needed
|
||||
|
||||
commit e5005cea341fea813c44f5e8d7b411bfec6be4be (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Tue Dec 11 19:46:38 2018 -0500
|
||||
|
||||
Cleanup the network properly when we fail to load.
|
||||
|
||||
commit 16f2be6ac268809b67e204463dfbdfcb9a52b023 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Tue Dec 11 19:37:36 2018 -0500
|
||||
|
||||
Give up loading invalid configurations.
|
||||
|
||||
Bip does not know how to deal with a network with no server. Simply
|
||||
prevent loading such bad configs.
|
||||
Fixes: https://projects.duckcorp.org/issues/611
|
||||
|
||||
commit 09053fc5f037e5b29a599681e89627983b744bfe (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Dec 11 11:12:08 2018 +0100
|
||||
|
||||
CFLAGS: use -W{all,extra,error} by default again
|
||||
|
||||
commit 1f8a8763cb1ba01ed8eeb28515b890b97de89c9b (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Dec 11 11:09:25 2018 +0100
|
||||
|
||||
'-Wall -Werror' automake switches are used by default
|
||||
|
||||
since c0fafe669d08170b171601d49cf5542a68692a71
|
||||
|
||||
commit c93a7e841a62b8b47a3fb98ce529d39052f140b5 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Dec 10 00:38:29 2018 +0100
|
||||
|
||||
Fix a typo
|
||||
|
||||
commit 843cf3738e117119c506cc447baf251b1921d5b9 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Dec 10 00:17:14 2018 +0100
|
||||
|
||||
oidentd is a runtime option: update doc & script
|
||||
|
||||
commit 65406960aa54239607b527603479e9e03ba54552 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 20:05:40 2018 -0500
|
||||
|
||||
Merge remote-tracking branch 'origin/master'
|
||||
|
||||
commit df5508eed053c72cda91ae7dfe3d216512695336 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 19:52:46 2018 -0500
|
||||
|
||||
Deal more gracefully with long home directories.
|
||||
|
||||
This is a better fix for:
|
||||
https://projects.duckcorp.org/issues/636
|
||||
|
||||
commit 87192685f55856d2c28021963ab2c308e21faddc (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 19:40:36 2018 -0500
|
||||
|
||||
Fix gcc-8 warning.
|
||||
|
||||
Change weird use of strncpy where we know we will truncate and use an
|
||||
extra byte copy instead.
|
||||
|
||||
commit d2dcb0adb1aa8c2c4526aa6ad650483b0e02ab7d (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 19:27:56 2018 -0500
|
||||
|
||||
Fix warning with gcc-8.
|
||||
|
||||
Fixes: https://projects.duckcorp.org/issues/636
|
||||
|
||||
commit 02c55a37b2cd9561a57ed3869ca147cbb1644ff3 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed May 30 03:34:12 2018 +0200
|
||||
|
||||
add debug log & differentiate error messages
|
||||
|
||||
commit e224f067c1d26c067ed80cd9f94377dbbb878933 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 16:06:18 2018 -0500
|
||||
|
||||
Fix the conditional build of tests again.
|
||||
|
||||
Per [1], you always output the optional directory Makefile.
|
||||
|
||||
[1] https://www.gnu.org/software/automake/manual/html_node/Subdirectories-with-AM_005fCONDITIONAL.html#Subdirectories-with-AM_005fCONDITIONAL
|
||||
|
||||
commit 936b76690596a37fa1c4143f1ca382ccfa974770 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 15:08:58 2018 -0500
|
||||
|
||||
Make the tests subdirectory optional.
|
||||
|
||||
Otherwise build breaks when check is not installed.
|
||||
|
||||
commit caf979a4c5b0205068b61ba6628bb679823068fd (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 14:27:59 2018 -0500
|
||||
|
||||
Close descriptor when SSL reports a system error.
|
||||
|
||||
Avoids leaking fd when connections are closed abruptly.
|
||||
|
||||
commit 513a6582ad2cb395e40b5597b38fcdbb8751b695 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 14:04:43 2018 -0500
|
||||
|
||||
Add CFLAGS needed for openssl.
|
||||
|
||||
Otherwise building fails in platforms with esoteric openssl locations.
|
||||
|
||||
commit ba5cef017cdd5cb579589c7c0f3f8b8938532a62 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Fri Nov 30 09:00:51 2018 -0500
|
||||
|
||||
Fix test automake file to link openssl.
|
||||
|
||||
commit 2bf967bacc58192c92604462b7a5ee704b98a605 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 15:37:46 2018 -0500
|
||||
|
||||
Add missing OpenSSL CFLAGS/LDFLAGs to build.
|
||||
|
||||
Those were removed by mistake in the previous autotool refactor.
|
||||
|
||||
commit 34a92dedb1609bf816b9e11c7993160a87560463 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 15:07:16 2018 -0500
|
||||
|
||||
Remove OIDENTD build options.
|
||||
|
||||
Instead support a runtime option.
|
||||
Note that existing oidentd users will have to add write_oidentd = true
|
||||
in their config to keep existing behavior.
|
||||
|
||||
commit 7844716af5d1c655989afbfc0c3cc12665e3884b (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 14:30:17 2018 -0500
|
||||
|
||||
Fewer configure options.
|
||||
|
||||
Use pkg-config to detect openssl.
|
||||
Eagerly use backtrace if provided by libc.
|
||||
|
||||
commit 87f34153303becc9eeef5d331992b67557ce9a46 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 14:23:06 2018 -0500
|
||||
|
||||
Fewer build options.
|
||||
|
||||
Eagerly depend on openssl and check, build degraded without.
|
||||
|
||||
commit c0fafe669d08170b171601d49cf5542a68692a71 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 09:10:16 2018 -0500
|
||||
|
||||
Simplify autotools configuration.
|
||||
|
||||
commit a80e74bbdc84862342441e0c5bfb3c22faf4d534 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 08:19:26 2018 -0500
|
||||
|
||||
Add .clang-format file.
|
||||
|
||||
commit fabaec9d807e9ac106790f282953ffa5c3aa055a (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 08:18:42 2018 -0500
|
||||
|
||||
More files in .gitignore
|
||||
|
||||
commit e222e1c986ef136b31d98dd444d3ea96827b4bea (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 08:15:31 2018 -0500
|
||||
|
||||
Add .gitignore.
|
||||
|
||||
commit 0b8269e2d31a6aaabeae850b168cc990621dbbbd (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 16:06:18 2018 -0500
|
||||
|
||||
Fix the conditional build of tests again.
|
||||
|
||||
Per [1], you always output the optional directory Makefile.
|
||||
|
||||
[1] https://www.gnu.org/software/automake/manual/html_node/Subdirectories-with-AM_005fCONDITIONAL.html#Subdirectories-with-AM_005fCONDITIONAL
|
||||
|
||||
commit e27b84f15e9e841a7771d86f73640eaaa8c3cbcf (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 15:08:58 2018 -0500
|
||||
|
||||
Make the tests subdirectory optional.
|
||||
|
||||
Otherwise build breaks when check is not installed.
|
||||
|
||||
commit 4d7f2437779464e54353b19f26a001b63883a6ef (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 14:27:59 2018 -0500
|
||||
|
||||
Close descriptor when SSL reports a system error.
|
||||
|
||||
Avoids leaking fd when connections are closed abruptly.
|
||||
|
||||
commit 2fd3418a9e37b34808bbcdd449be4309d54328a8 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Dec 9 14:04:43 2018 -0500
|
||||
|
||||
Add CFLAGS needed for openssl.
|
||||
|
||||
Otherwise building fails in platforms with esoteric openssl locations.
|
||||
|
||||
commit b963308e6c8d7b34c17016cb8a2ee5e5c14d64a4 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Fri Nov 30 09:00:51 2018 -0500
|
||||
|
||||
Fix test automake file to link openssl.
|
||||
|
||||
commit fbde1552870226687ed1e0d6b9b584c987bc0173 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 15:37:46 2018 -0500
|
||||
|
||||
Add missing OpenSSL CFLAGS/LDFLAGs to build.
|
||||
|
||||
Those were removed by mistake in the previous autotool refactor.
|
||||
|
||||
commit 012b21a68b5cc0532a621996abe3d011b2e89b66 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 15:07:16 2018 -0500
|
||||
|
||||
Remove OIDENTD build options.
|
||||
|
||||
Instead support a runtime option.
|
||||
Note that existing oidentd users will have to add write_oidentd = true
|
||||
in their config to keep existing behavior.
|
||||
|
||||
commit 40233ff9388d4f85fdf348c379e2ebf289d85904 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 14:30:17 2018 -0500
|
||||
|
||||
Fewer configure options.
|
||||
|
||||
Use pkg-config to detect openssl.
|
||||
Eagerly use backtrace if provided by libc.
|
||||
|
||||
commit 7dec6b3072341aa338d4cc3952879df57e5aa09b (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet+github@gmail.com>
|
||||
Date: Sun Nov 18 14:23:06 2018 -0500
|
||||
|
||||
Fewer build options.
|
||||
|
||||
Eagerly depend on openssl and check, build degraded without.
|
||||
|
||||
commit 27f1cf988bdc421c285461bd91e4ae1995356db8 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 09:10:16 2018 -0500
|
||||
|
||||
Simplify autotools configuration.
|
||||
|
||||
commit 1e80291b9c091635b9016cb4f4532d8ca0d76331 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 08:19:26 2018 -0500
|
||||
|
||||
Add .clang-format file.
|
||||
|
||||
commit 362ec25e4bec19f079a91a10358ac43220c77411 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 08:18:42 2018 -0500
|
||||
|
||||
More files in .gitignore
|
||||
|
||||
commit f4ac33f63c376970fe59f962e35940e949c51c4c (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 18 08:15:31 2018 -0500
|
||||
|
||||
Add .gitignore.
|
||||
|
||||
commit aa35b372b47c7736a9efa6c6703ed1ffd23b1c36 (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Mon Nov 12 22:55:58 2018 -0500
|
||||
|
||||
Add unit tests.
|
||||
|
||||
Add an optional build dependency on check and add an initial test case.
|
||||
|
||||
commit 34711f765339e3ec8548c06665feb5da713a649e (Y)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 11 18:16:14 2018 -0500
|
||||
|
||||
Move automake file in src subdir, isolate main.
|
||||
|
||||
In preparation for adding a unit test directory, move Makefile.am in
|
||||
src, and build a static libbip before linking a binary.
|
||||
|
||||
commit 53dafd9590ff110b81e1847d01d53b9b022554d2 (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Mon Nov 12 22:55:58 2018 -0500
|
||||
|
||||
Add unit tests.
|
||||
|
||||
Add an optional build dependency on check and add an initial test case.
|
||||
|
||||
commit 057107a2332e73ddbc969d2e74a29d8f8f5c36ee (N)
|
||||
Author: Arnaud Cornet <arnaud.cornet@gmail.com>
|
||||
Date: Sun Nov 11 18:16:14 2018 -0500
|
||||
|
||||
Move automake file in src subdir, isolate main.
|
||||
|
||||
In preparation for adding a unit test directory, move Makefile.am in
|
||||
src, and build a static libbip before linking a binary.
|
||||
|
||||
commit b75345d6b552a3d06b21c843219393245ab7c4d3 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Mar 27 00:14:12 2018 +0200
|
||||
|
||||
Add -git to version string.
|
||||
|
||||
commit cf144594a00ba2820ede56c328489a30a6d80b37 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Tue Mar 27 00:13:57 2018 +0200
|
||||
|
||||
Update version and ChangeLog for bip-0.9.0-rc3 release.
|
||||
|
||||
commit eaed46da1485ea81556ad255d7d56dc33daf1913 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Thu Mar 22 02:37:38 2018 +0100
|
||||
|
||||
Merge branch 'path_test_use_stat'
|
||||
|
||||
commit 025689d8074b13f5229ee99b95190437194bae53 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Thu Mar 22 02:37:23 2018 +0100
|
||||
|
||||
Merge branch 'dh_param_not_mandatory'
|
||||
|
||||
commit 948b41ef7a09b751df22bbd1c8f28b7bbe405a18 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Thu Mar 22 02:37:10 2018 +0100
|
||||
|
||||
Merge branch 'fix_path_construction_issue'
|
||||
|
||||
commit 7834471f78c1af516df4bdbc193a805582e9f7fa (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Mar 21 11:32:46 2018 +0100
|
||||
|
||||
default value isn't used when path doesn't exist
|
||||
|
||||
commit 13b2e3763541fc5045bbc09f14a5b0aae51558d0 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Mar 21 11:12:21 2018 +0100
|
||||
|
||||
DH parameters are not always required
|
||||
|
||||
for example ECDHE ciphers doesn't require DH parameters.
|
||||
|
||||
Closes #499
|
||||
|
||||
commit 3afb16d795073d2aff9e2253619757a4e1e6e77c (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Mar 21 11:54:20 2018 +0100
|
||||
|
||||
checking path: use stat
|
||||
|
||||
fopen was used because it's stdlib but stat is already used in other
|
||||
parts
|
||||
|
||||
commit 348737fab5c6529ba636056d40ec42f2cb18dd96 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Mar 21 11:07:56 2018 +0100
|
||||
|
||||
Fix path construction
|
||||
|
||||
Thanks to Renzokuken for pointing that !
|
||||
Closes #610
|
||||
|
||||
commit 385be75f7e904394dc4c9cccca9656c20c4c44f4 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Feb 19 20:26:34 2018 +0100
|
||||
|
||||
Add -git to version string.
|
||||
|
||||
commit 8ceebf1fd882f855d46a3d1d45dddbf50a357111 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Feb 19 20:25:59 2018 +0100
|
||||
|
||||
Update version and ChangeLog for bip-0.9.0-rc2 release.
|
||||
|
||||
commit 901f54eff0f647442923f2ccf6f470f22e4c5ffe (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Feb 19 20:09:25 2018 +0100
|
||||
|
||||
Merge branch 'username_disallow_duplicate'
|
||||
|
||||
commit 96f0403a2ab2f5df63b4e1f584a1bd9879be1339 (G)
|
||||
commit 96f0403a2ab2f5df63b4e1f584a1bd9879be1339 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Feb 19 20:08:26 2018 +0100
|
||||
|
||||
@ -13,55 +850,55 @@ Date: Mon Feb 19 20:08:26 2018 +0100
|
||||
MOVE_STRING macro is used in order to initialize parameters, this
|
||||
macro calls free when necessary.
|
||||
|
||||
commit 83d7f2acbe3ef464815b8f73e35fd8fc252a0421 (G)
|
||||
commit 83d7f2acbe3ef464815b8f73e35fd8fc252a0421 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Feb 19 20:07:38 2018 +0100
|
||||
|
||||
Add missing call to MAYFREE
|
||||
|
||||
commit dbe19d938775121e8557068fd3254894f2178684 (G)
|
||||
commit dbe19d938775121e8557068fd3254894f2178684 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Wed Mar 1 14:14:35 2017 +0100
|
||||
|
||||
Handle no defined users
|
||||
|
||||
commit 903a88e58977cde81b894d106354bbd74fc26a99 (G)
|
||||
commit 903a88e58977cde81b894d106354bbd74fc26a99 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Mon Feb 19 19:59:06 2018 +0100
|
||||
|
||||
Merge branch 'systemd'
|
||||
|
||||
commit 866552e102d4918735daa9c48eaef764ca201799 (G)
|
||||
commit 866552e102d4918735daa9c48eaef764ca201799 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Wed Mar 1 09:18:23 2017 +0100
|
||||
|
||||
sample conf: on_connect_send can be used more than once
|
||||
|
||||
commit aad87daa9e65a5cab8bf0157c22a1593dbdaad9c (G)
|
||||
commit aad87daa9e65a5cab8bf0157c22a1593dbdaad9c (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:23:21 2017 +0100
|
||||
|
||||
sample conf: reformat
|
||||
|
||||
commit 6d3bff19693047e752b9e649a03946402d6bfdf8 (G)
|
||||
commit 6d3bff19693047e752b9e649a03946402d6bfdf8 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:22:53 2017 +0100
|
||||
|
||||
sample conf: remove trailing spaces
|
||||
|
||||
commit 97e19a52158ae25352fa84b4b5f29379904aa088 (G)
|
||||
commit 97e19a52158ae25352fa84b4b5f29379904aa088 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:21:52 2017 +0100
|
||||
|
||||
sample conf: comment the whole file
|
||||
|
||||
commit a31cbe45fabc4970faef2522e63ad24e619150ad (G)
|
||||
commit a31cbe45fabc4970faef2522e63ad24e619150ad (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:17:34 2017 +0100
|
||||
|
||||
bipmkpw man page: mention bip man page
|
||||
|
||||
commit 072a17b55b61ef95148fdcd4ab467038b88d74fd (G)
|
||||
commit 072a17b55b61ef95148fdcd4ab467038b88d74fd (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:11:19 2017 +0100
|
||||
|
||||
@ -70,49 +907,49 @@ Date: Tue Feb 28 16:11:19 2017 +0100
|
||||
- follow man-pages conventions
|
||||
- HTML output produced by groff is more readable
|
||||
|
||||
commit cdbf22cdb7d40ac25e30ff7b4ae93fb108f14647 (G)
|
||||
commit cdbf22cdb7d40ac25e30ff7b4ae93fb108f14647 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:10:03 2017 +0100
|
||||
|
||||
bip.conf manpage: mention default of ciphers related options
|
||||
|
||||
commit 3b9f683d31c8ba928df636c554e5cafc0c12cdec (G)
|
||||
commit 3b9f683d31c8ba928df636c554e5cafc0c12cdec (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:08:03 2017 +0100
|
||||
|
||||
bip.conf manpage: fix doc of 'ip' option
|
||||
|
||||
commit 09152a1a7d479e0c76c9ae2fea75ddeb9bb0f0ff (G)
|
||||
commit 09152a1a7d479e0c76c9ae2fea75ddeb9bb0f0ff (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:07:07 2017 +0100
|
||||
|
||||
bip.conf manpage: new section 'IRC CLIENT CONF'
|
||||
|
||||
commit 11482caa95fafe5201107060ac334ad6b03f4275 (G)
|
||||
commit 11482caa95fafe5201107060ac334ad6b03f4275 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:02:25 2017 +0100
|
||||
|
||||
bip.conf manpage: add a SYNOPSIS section
|
||||
|
||||
commit b474f55e8ae7c57ee4dbfe71f1b64dc8e42139e5 (G)
|
||||
commit b474f55e8ae7c57ee4dbfe71f1b64dc8e42139e5 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Tue Feb 28 16:00:49 2017 +0100
|
||||
|
||||
bip manpage: mention -s switch in SYNOPSIS section
|
||||
|
||||
commit af46159275c3e533a4c02326ffa80a673a4bcdc3 (G)
|
||||
commit af46159275c3e533a4c02326ffa80a673a4bcdc3 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Thu Feb 23 16:56:17 2017 +0100
|
||||
|
||||
Sample config file: add default values
|
||||
|
||||
commit e52df8d08615f55d58011a720aadaecd1769a104 (G)
|
||||
commit e52df8d08615f55d58011a720aadaecd1769a104 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Wed Feb 15 16:41:59 2017 +0100
|
||||
|
||||
sample.conf: use /run instead of /var/run
|
||||
|
||||
commit 3f4a260a54b6bf8812310c3d3c320d559b8c0374 (G)
|
||||
commit 3f4a260a54b6bf8812310c3d3c320d559b8c0374 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
|
||||
Date: Wed Feb 15 16:03:15 2017 +0100
|
||||
|
||||
@ -126,13 +963,13 @@ Date: Wed Feb 15 16:03:15 2017 +0100
|
||||
- Environment=BIP_DEFAULT_CONFIG='/path/to/default/bip'
|
||||
using a unit file drop-in bip-config.service.d/<distrib>.conf
|
||||
|
||||
commit 554c372452692a88a7d8aeee93f6f4f4d41b6e96 (G)
|
||||
commit 554c372452692a88a7d8aeee93f6f4f4d41b6e96 (Y)
|
||||
Author: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
|
||||
Date: Wed Jul 26 03:41:10 2017 +0200
|
||||
|
||||
Sign commits created by release script
|
||||
|
||||
commit 2ecd82f0112e6d57e8651296d624975aa56e03a4 (G)
|
||||
commit 2ecd82f0112e6d57e8651296d624975aa56e03a4 (Y)
|
||||
Author: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Tue Jul 25 13:08:38 2017 -0700
|
||||
|
||||
|
414
INSTALL
414
INSTALL
@ -1,182 +1,370 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
Briefly, the shell commands './configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache'
|
||||
and enabled with '--cache-file=config.cache' or simply '-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version
|
||||
of 'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
the 'configure' script. 'configure' automatically checks for the
|
||||
source code in the directory that 'configure' is in and in '..'. This
|
||||
is known as a "VPATH" build.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as
|
||||
their prerequisites, which makes it generally unusable when shipped
|
||||
generated files such as 'configure' are involved. Use GNU 'make'
|
||||
instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to
|
||||
an Autoconf limitation. Until the limitation is lifted, you can use
|
||||
this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used
|
||||
only in the top level, while the 'recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
||||
|
26
Makefile.am
26
Makefile.am
@ -1,22 +1,9 @@
|
||||
bin_PROGRAMS = src/bip src/bipmkpw
|
||||
src_bip_SOURCES = src/conf.y src/lex.l \
|
||||
src/bip.c src/bip.h \
|
||||
src/connection.c src/connection.h \
|
||||
src/defaults.h \
|
||||
src/irc.c src/irc.h \
|
||||
src/line.c src/line.h \
|
||||
src/log.c src/log.h \
|
||||
src/md5.c src/md5.h \
|
||||
src/path_util.c src/path_util.h \
|
||||
src/tuple.h \
|
||||
src/util.c src/util.h
|
||||
src_bipmkpw_SOURCES = src/bipmkpw.c src/md5.c src/util.c
|
||||
AM_YFLAGS= -d
|
||||
BUILT_SOURCES = src/conf.c src/conf.h src/lex.c
|
||||
if COND_WANT_TESTS
|
||||
MAYBE_TESTS = tests
|
||||
endif
|
||||
SUBDIRS = src . $(MAYBE_TESTS)
|
||||
|
||||
AM_CFLAGS=-Wall -Wextra -Werror
|
||||
|
||||
dist_man_MANS = bip.1 bip.conf.5 bipmkpw.1
|
||||
dist_man_MANS = bip.1 bip.conf.5 bipmkpw.1 bipgenconfig.1
|
||||
|
||||
examplesdir = $(prefix)/share/doc/bip/examples/
|
||||
dist_examples_DATA = samples/bip.conf samples/bip.vim
|
||||
@ -26,3 +13,6 @@ EXTRA_DIST = \
|
||||
scripts/bip-release \
|
||||
scripts/bipgenconfig \
|
||||
systemd
|
||||
|
||||
lint:
|
||||
find src/ tests/ \( -name *.c -o -name *.h \) -type f -print0 | xargs -0 clang-format -i
|
||||
|
129
NEWS
129
NEWS
@ -1,3 +1,71 @@
|
||||
2022-03-10 (0.9.3) "sanitize our bip and add some layers"
|
||||
- Add SASL authentication support (EXTERNAL, PLAIN)
|
||||
- Handle some recommended GCC flags
|
||||
- fix /bip user info command
|
||||
|
||||
2021-10-12 (0.9.2) "for the love of unsubsquirrel"
|
||||
- Update and fix minor issues in sample bip and vim configuration files
|
||||
|
||||
2021-10-12 (0.9.1) "one more"
|
||||
- ENABLED might not be defined: use a default value.
|
||||
|
||||
2021-10-08 (0.9.0) "it's never too late"
|
||||
Visible changes:
|
||||
- "backlog_no_timestamp" is deprecated, "backlog_timestamp" should be used
|
||||
instead. The allowed values for this new parameter are: "none", "time",
|
||||
"datetime". "time" is the default value and allow to keep the default
|
||||
behavior.
|
||||
- allow to set TLS ciphers: for bip client side (client_side_ciphers),
|
||||
globally for all connections (ssl_default_ciphers) and foreach connection
|
||||
(ssl_ciphers).
|
||||
- allow to set DH parameter used for clients SSL connections with the new
|
||||
client_side_dh_param parameter.
|
||||
- Add write_oidentd_file parameter. Existing oidentd users must use
|
||||
'write_oidentd = true' in their config to keep existing behavior.
|
||||
|
||||
2013-10-19 (0.8.9) "If it's really that urgent, why don't you do it yourself?"
|
||||
- code fixes
|
||||
- buildsys fixes (bison 2.6 compatibility and others)
|
||||
- improved TRUST OK command replies when there's no untrusted certificate
|
||||
- fixed GCC warnings
|
||||
|
||||
2011-04-14 (0.8.8) "spring release"
|
||||
- Allow to disable logs by connection.
|
||||
- When global option log is disabled, query are not backlogged.
|
||||
- Avoid segfault when global option log is false.
|
||||
|
||||
2011-01-18 (0.8.7) "bazooka"
|
||||
- Fix "FATAL: list_remove: item not found"
|
||||
- Fix build errors on armel
|
||||
- minor fixes
|
||||
|
||||
2010-09-12 (0.8.6) "CVE-2010-3071"
|
||||
- Fix for CVE-2010-3071.
|
||||
|
||||
2010-08-07 (0.8.5) "Unpacking"
|
||||
- Now builds position independant executables
|
||||
|
||||
2009-11-15 (0.8.4) "I’ll have the same thing please"
|
||||
- Fix build OpenSSL detection issue.
|
||||
|
||||
2009-11-15 (0.8.3) "Hey Dublin! What’s the craic?"
|
||||
- Fixes a fatal() on gamesurge networks.
|
||||
|
||||
2009-08-24 (0.8.2) "Farewell Paris"
|
||||
- Fix hanging bip on hanging client connexions.
|
||||
|
||||
2009-07-17 (0.8.1) "Ran ran ru in Praha"
|
||||
- Fixed an annoying bug that resulted in too much backlog.
|
||||
- Fix TRUST command.
|
||||
- Close some unused log files.
|
||||
|
||||
2009-03-02 (0.8.0) "swelling millionnaire"
|
||||
- Cosmetic bug fixes since last rc.
|
||||
|
||||
2009-02-02 (0.8.0-rc1) "got booze?"
|
||||
- One bug fixed and a client hack added to avoid the "+" or "-" prefix in
|
||||
irssi when connecting irssi and xchat to the same bip connection.
|
||||
|
||||
2009-01-24 (0.8.x)
|
||||
Visible changes:
|
||||
- One logfile per nick for queries, instead of the messy privates.x.log
|
||||
@ -15,6 +83,29 @@ Visible changes:
|
||||
- bip SSL on the client<->bip part now support Ephemeral Diffie Hellman key
|
||||
exchange.
|
||||
|
||||
2008-10-24 (0.7.5) "But I have promises to keep, And miles to go before I
|
||||
sleep, And miles to go before I sleep."
|
||||
- Halfop handling fixed, and a shameful segfault. The segfault may be
|
||||
exploitable by clients, but only after successful login. Please upgrade.
|
||||
|
||||
2008-06-28 (0.7.4) "But where is 0.7.3 ?!"
|
||||
- Some usefull bugfixes, especially for unreal irc network users.
|
||||
|
||||
2008-04-05 (0.7.2) "Enjoy the fish"
|
||||
- Contains a compilation fix for OpenBSD.
|
||||
|
||||
2008-04-02: bip 0.7.1 "hot mama"
|
||||
- Contains a configuration validation fix, and a memory leak fix.
|
||||
|
||||
2008-02-16 (0.7.0) "birthday party"
|
||||
- The good stuff: sighup support, /bip reload should also work now
|
||||
- New commands (allow a user to add a new network without restarting bip for
|
||||
instance)
|
||||
- Better user feedback when issuing /bip commands.
|
||||
- Lots of new backlog options, some of which can now be set per user instead of
|
||||
globally.
|
||||
- And a few fixes on top of that.
|
||||
|
||||
2008-02-07 Arnaud Cornet <nohar@t1r.net>
|
||||
What's to expect in bip now:
|
||||
- Support kill -HUP and /bip reload cleanly.
|
||||
@ -37,15 +128,33 @@ What's to expect in bip now:
|
||||
- Have a bold arrow to highligh your own word on private messages and multiple
|
||||
connected clients.
|
||||
|
||||
09-12-2007: Bip has now two types of users "admins" and normal user. Some
|
||||
commands are reserved to admin. Add a admin = true; statement in your config
|
||||
(in user block) accordingly.
|
||||
2007-12-09
|
||||
- Bip has now two types of users "admins" and normal user. Some commands are
|
||||
reserved to admin. Add a admin = true; statement in your config (in user
|
||||
block) accordingly.
|
||||
|
||||
29-10-2007: Certificate validation change. In "basic" mode, expired
|
||||
certificates are now accepted as long as they are in store (therefore trusted).
|
||||
This makes the basic mode be more SSH like. Some extreme security zealots might
|
||||
want to be warned.
|
||||
2007-10-29
|
||||
- Certificate validation change. In "basic" mode, expired certificates are now
|
||||
accepted as long as they are in store (therefore trusted). This makes the
|
||||
basic mode be more SSH like. Some extreme security zealots might want to be
|
||||
warned.
|
||||
|
||||
02-09-2007: as of now log parameters go in the user {} statment. This breaks
|
||||
every config and there is no backwrads compatibility as of now.
|
||||
Lots of internal changes, expect crashes.
|
||||
2007-09-02
|
||||
- as of now log parameters go in the user {} statment. This breaks
|
||||
every config and there is no backwrads compatibility as of now.
|
||||
- Lots of internal changes, expect crashes.
|
||||
|
||||
2007-08-19 (0.6.1)
|
||||
- Fixes half closed socket descriptor leak, as well as a potential crash on
|
||||
startup.
|
||||
- Bip switches to git. You can clone the public repository with:
|
||||
- git clone http://bip.t1r.net/bip.git
|
||||
|
||||
2007-02-27 (0.6.0)
|
||||
- Includes more commands, more options, more fixes.
|
||||
- UPDATE: Thanks to YS for the sexy logo! How rude of me to forget to give
|
||||
proper credits!
|
||||
- Bip is developed by Arnaud Cornet and Loïc Gomez and is distributed under
|
||||
the GNU Public License Version 2 (see the AUTHORS file for a list of
|
||||
contributors).
|
||||
- BIP IRC channel is on OFTC : irc://irc.oftc.net/bip
|
||||
|
16
README
16
README
@ -35,18 +35,18 @@ I. INSTALLATION
|
||||
Just issue:
|
||||
|
||||
From bip-X.Y.Z.tar.gz package:
|
||||
# ./configure --enable-oidentd && make
|
||||
# ./configure && make
|
||||
|
||||
From repository:
|
||||
# autoreconf -i -Wall
|
||||
# ./configure --enable-maintainer-mode --enable-oidentd && make
|
||||
# autoreconf -i
|
||||
# ./configure --enable-maintainer-mode && make
|
||||
|
||||
If openssl and its developement files are installed, bip should build with
|
||||
SSL support. After a successful build the bip binary can be found in
|
||||
./src/bip.
|
||||
|
||||
By default, "-Werror" is used. If you encounter warnings, you could try:
|
||||
# CFLAGS="-Wno-error" ./configure --enable-oidentd && make
|
||||
# CFLAGS="-Wno-error" ./configure && make
|
||||
|
||||
|
||||
II. CONFIGURATION
|
||||
@ -190,10 +190,10 @@ IV. USING BIP
|
||||
a default_username set to "myuser", he would appear as ~myuser@yourhost,
|
||||
which may be sufficient for most networks.
|
||||
|
||||
If the network you're on is a bit more requiring, you can set up an
|
||||
oidentd server on your host, and (if not already) compile bip with
|
||||
oidentd spoofing support (--enable-oidentd option of the configure
|
||||
script). Let's say bip is the system user running bip, you should add to
|
||||
If the network you're on is a bit more demanding, you can set up an
|
||||
oidentd server on your host, and enable oidentd spoofing support
|
||||
('write_oidentd = true;' option in bip configuration file). Let's
|
||||
say bip is the system user running bip, you should add to
|
||||
your /etc/oidentd.conf :
|
||||
|
||||
user "bip" {
|
||||
|
42
bip.conf.5
42
bip.conf.5
@ -1,4 +1,4 @@
|
||||
.TH BIP.CONF 5 "23 February 2017"
|
||||
.TH BIP.CONF 5 "2 January 2022"
|
||||
|
||||
.SH NAME
|
||||
|
||||
@ -146,7 +146,7 @@ Defines the delay between each logfiles sync to the disk. Must be a non null
|
||||
positive integer.
|
||||
|
||||
.TP
|
||||
\fBreconn_timer\fP (default: \fB120\fP)
|
||||
\fBreconn_timer\fP (default: \fB30\fP)
|
||||
Defines the initial delay (in seconds) before a reconnection attempt.
|
||||
The delay increases with the number of attempts:
|
||||
delay = reconn_timer * number of attempts
|
||||
@ -156,6 +156,10 @@ delay = reconn_timer * number of attempts
|
||||
Defines the file where BIP's pid will be stored. BIP checks if this file exists
|
||||
and if the pid is still alive upon startup. If true, BIP refuses to start.
|
||||
|
||||
.TP
|
||||
\fBwrite_oidentd\fP (default: \fIfalse\fR)
|
||||
Must be set to true to overwrite oidentd configs.
|
||||
|
||||
.TP
|
||||
\fBoidentd_file\fP (default: \fI<bipdir>/.oidentd.conf\fR)
|
||||
oidentd configuration file (if oidentd enabled).
|
||||
@ -223,7 +227,7 @@ This option should of course not be enabled if \fBbacklog_lines\fP is 0 !
|
||||
If you still want to do so, don't forget to \fB/BIP BLRESET\fP sometimes.
|
||||
|
||||
.TP
|
||||
\fBbacklog_lines\fP (default: \fB10\fP)
|
||||
\fBbacklog_lines\fP (default: \fB0\fP)
|
||||
If set to 0, BIP will replay all the logs since last client disconnect. Else,
|
||||
it'll replay exactly \fBbacklog_lines\fP lines on each channel and privates.
|
||||
Be aware that BIP will replay \fBbacklog_lines\fP lines of all privates, even
|
||||
@ -231,8 +235,22 @@ if there are more. For example if Coyote told you 12 lines and then RoadRunner
|
||||
6, you'll only have a replay of the 6 RoadRunner's lines and the last 4 of
|
||||
Coyote's.
|
||||
|
||||
.TP
|
||||
\fBbacklog_timestamp\fP (default: \fBtime\fP)
|
||||
\fBnone\fP disables timestamps in backlogged lines, \fBtime\fP or
|
||||
\fBdatetime\fP allow one to select the timestamp format in backlogged lines.
|
||||
|
||||
.TP
|
||||
\fBbacklog_no_timestamp\fP (default: \fBfalse\fP)
|
||||
If true, backlogged line won't include the timestamp.
|
||||
This parameter is deprecated, use \fBbacklog_timestamp\fP instead.
|
||||
.I false
|
||||
implies
|
||||
.I backlog_timestamp = "none"
|
||||
and
|
||||
.I true
|
||||
implies
|
||||
.I backlog_timestamp = "time"
|
||||
\&.
|
||||
|
||||
.TP
|
||||
\fBbacklog_reset_on_talk\fP (default: \fBfalse\fP)
|
||||
@ -244,7 +262,7 @@ query.
|
||||
.TP
|
||||
\fBbacklog_reset_connection\fP (default: \fBfalse\fP)
|
||||
When true, backlog_reset_on_talk option above is changed in that the whole
|
||||
network backlog is resetted when you talk in the network.
|
||||
network backlog is reset when you talk in the network.
|
||||
|
||||
.TP
|
||||
\fBbacklog_msg_only\fP (default: \fBfalse\fP)
|
||||
@ -384,6 +402,20 @@ BIP will send that string as the realname part (description in whois result)
|
||||
upon connect. If not specified and if \fBdefault_realname\fP is specified in
|
||||
the \fBuser\fP section, BIP will use that default realname string.
|
||||
|
||||
.TP
|
||||
\fBsasl_mechanism\fP
|
||||
Tells BIP to use specified SASL mechanism. Currently supported: PLAIN, EXTERNAL.
|
||||
PLAIN mechanism requires \fBsasl_username\fP and \fBsasl_password\fP and is the
|
||||
default if these are set.
|
||||
|
||||
.TP
|
||||
\fBsasl_username\fP
|
||||
This connection's username to pass on using SASL authentication.
|
||||
|
||||
.TP
|
||||
\fBsasl_password\fP
|
||||
This connection's password to pass on using SASL authentication.
|
||||
|
||||
.TP
|
||||
\fBsource_port\fP
|
||||
If specified, tells BIP to connect from this port to the IRC server.
|
||||
|
27
bipgenconfig.1
Normal file
27
bipgenconfig.1
Normal file
@ -0,0 +1,27 @@
|
||||
.TH BIP 1 "10 October 2005"
|
||||
|
||||
.SH NAME
|
||||
|
||||
bipgenconfig \- BIP IRC Proxy configuration program
|
||||
|
||||
.SH SYNOPSIS
|
||||
|
||||
\fBbipgenconfig\fP
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
bipgenconfig will help you build a configuration file for BIP IRC Proxy
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
bip, bip.conf, bipmkpw
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
Arnaud 'nohar' Cornet
|
||||
Loïc 'Kyoshiro' Gomez
|
||||
|
||||
Thanks to jj, YS and lafouine, for hanging around while we were coding.
|
||||
|
||||
Crypto shamelessly taken from Christophe 'sexy' Devine.
|
||||
|
208
configure.ac
208
configure.ac
@ -1,132 +1,112 @@
|
||||
m4_pattern_allow([^AM_])
|
||||
m4_pattern_allow([^AC_])
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([Bip Sexy IRC Proxy], [0.9.0-rc2-git],
|
||||
[http://bip.milkypond.org/projects/bip/activity], [bip],
|
||||
[http://bip.milkypond.org/])
|
||||
AM_INIT_AUTOMAKE([subdir-objects])
|
||||
AC_INIT([Bip IRC Proxy],[0.9.3-git],[http://bip.milkypond.org/projects/bip/activity],[bip],[http://bip.milkypond.org/])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
|
||||
AM_MAINTAINER_MODE
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
|
||||
AC_CONFIG_SRCDIR([src/bip.h])
|
||||
|
||||
AC_CONFIG_HEADERS([src/config.h])
|
||||
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AM_PROG_AR
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
AM_PROG_LEX
|
||||
AC_PROG_YACC
|
||||
# AC_PROG_YACC falls back to YACC = "yacc" if bison or byacc are not found,
|
||||
# but it does not mean it is present
|
||||
AS_IF([test x"$YACC" = "xyacc"], [
|
||||
AC_CHECK_PROG([YACC_EXISTS], [yacc], [yes], [no])
|
||||
AS_IF([test x"$YACC_EXISTS" != xyes], [
|
||||
YACC=${am_missing_run}yacc
|
||||
])
|
||||
])
|
||||
|
||||
# Checks for header files.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h malloc.h \
|
||||
netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \
|
||||
sys/socket.h sys/time.h termios.h unistd.h])
|
||||
dnl PKG_PREREQ(MIN-VERSION)
|
||||
dnl -----------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Verify that the version of the pkg-config macros are at least
|
||||
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
||||
dnl installed version of pkg-config, this checks the developer's version
|
||||
dnl of pkg.m4 when generating configure.
|
||||
dnl
|
||||
dnl To ensure that this macro is defined, also add:
|
||||
dnl m4_ifndef([PKG_PREREQ],
|
||||
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
||||
dnl
|
||||
dnl See the "Since" comment for each macro you use to see what version
|
||||
dnl of the macros you require.
|
||||
m4_defun([PKG_PREREQ],
|
||||
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||
])dnl PKG_PREREQ
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_INLINE
|
||||
AC_TYPE_INT16_T
|
||||
AC_TYPE_INT32_T
|
||||
AC_TYPE_INT8_T
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SSIZE_T
|
||||
AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT8_T
|
||||
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
dnl ----------------------------------
|
||||
dnl Since: 0.16
|
||||
dnl
|
||||
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
||||
dnl first found in the path. Checks that the version of pkg-config found
|
||||
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
||||
dnl used since that's the first version where most current features of
|
||||
dnl pkg-config existed.
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
|
||||
AX_C___ATTRIBUTE__
|
||||
AH_BOTTOM([
|
||||
/* Unused attributes such as function parameters (GCC extension) */
|
||||
#ifdef HAVE___ATTRIBUTE__
|
||||
# define UNUSED(ATTRIBUTE) ATTRIBUTE __attribute__((unused))
|
||||
#else
|
||||
# define UNUSED(ATTRIBUTE) ATTRIBUTE
|
||||
#endif])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_MKTIME
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS(clock_gettime ftruncate gethostname gettimeofday localtime_r memmove)
|
||||
AC_CHECK_FUNCS(memset mkdir select socket strcasecmp strchr strcspn strdup strerror)
|
||||
AC_CHECK_FUNCS(strrchr strstr)
|
||||
|
||||
# Deal with parameters
|
||||
|
||||
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debug build]))
|
||||
AC_ARG_WITH([openssl], AS_HELP_STRING([--without-openssl],
|
||||
[Disable SSL using OpenSSL]))
|
||||
AC_ARG_ENABLE([oidentd], AS_HELP_STRING([--enable-oidentd],
|
||||
[Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)]))
|
||||
AC_ARG_ENABLE([pie], AS_HELP_STRING([--disable-pie],
|
||||
[Do not build a position independent executable]))
|
||||
|
||||
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
|
||||
AS_IF([test "x$enable_debug" = "xyes"], [
|
||||
AC_CHECK_FUNC(backtrace_symbols_fd, [
|
||||
AC_DEFINE(HAVE_BACKTRACE, [], [Use glibc backtrace on fatal()])
|
||||
LDFLAGS="-rdynamic $LDFLAGS"
|
||||
backtrace="(with backtrace)"
|
||||
])
|
||||
], [
|
||||
enable_debug=no
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(OIDENTD, test x$enable_identd = xyes)
|
||||
AS_IF([test "x$enable_oidentd" = "xyes"], [
|
||||
AC_DEFINE([HAVE_OIDENTD], [], [Have bip edit ~/.oidentd.conf])
|
||||
], [
|
||||
enable_oidentd=no
|
||||
])
|
||||
|
||||
AS_IF([test "x$with_openssl" != "xno"], [
|
||||
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [
|
||||
AC_MSG_ERROR([library 'crypto' is required for OpenSSL support])
|
||||
with_openssl=no
|
||||
], -lcrypto)
|
||||
AC_CHECK_LIB(ssl, SSL_read, [], [
|
||||
AC_MSG_ERROR([library 'ssl' is required for OpenSSL support])
|
||||
with_openssl=no
|
||||
], -lssl)
|
||||
], [
|
||||
with_openssl=no
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_pie" != "xno"], [
|
||||
AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_pie=yes],
|
||||
[ap_cv_cc_pie=no],
|
||||
[ap_cv_cc_pie=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_pie" = "yes"; then
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
enable_pie=yes
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi[]dnl
|
||||
])dnl PKG_PROG_PKG_CONFIG
|
||||
|
||||
PKG_CHECK_MODULES(OPENSSL, [libssl >= 0.9.8 libcrypto >= 0.9.8], [
|
||||
with_openssl=yes
|
||||
AC_DEFINE([HAVE_LIBSSL], [1],
|
||||
[Build SSL support])
|
||||
], [ with_openssl=no ])
|
||||
|
||||
AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_pie=yes],
|
||||
[ap_cv_cc_pie=no],
|
||||
[ap_cv_cc_pie=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_pie" = "yes"; then
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
enable_pie=yes
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([CHECK], [check >= 0.9.6], [enable_tests=yes], [enable_tests=no])
|
||||
AM_CONDITIONAL([COND_WANT_TESTS], [test "$enable_tests" = yes])
|
||||
|
||||
AC_CHECK_FUNC(backtrace_symbols_fd, [
|
||||
AC_DEFINE(HAVE_BACKTRACE, [], [Use glibc backtrace on fatal()])
|
||||
LDFLAGS="-rdynamic $LDFLAGS"
|
||||
backtrace="(with backtrace)"
|
||||
])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
AS_IF([test "x$with_openssl" != "xno"], [
|
||||
echo OPENSSL: yes
|
||||
])
|
||||
echo DEBUG: $enable_debug $backtrace
|
||||
echo OIDENTD: $enable_oidentd
|
||||
echo OPENSSL: $with_openssl
|
||||
echo PIE: $enable_pie
|
||||
echo TESTS: $enable_tests
|
||||
|
@ -43,11 +43,14 @@
|
||||
# Define where the pidfile should be stored. Defaults to <bipdir>/bip.pid.
|
||||
#pid_file="";
|
||||
|
||||
# Defaults to false, whether to write oidentd.conf files (see below).
|
||||
#write_oidentd = true;
|
||||
|
||||
# Defaults to <bipdir>/.oidentd.conf
|
||||
#oidentd_file="";
|
||||
|
||||
# Set to false and uncomment this line to disable logging and backlogging.
|
||||
#log = true
|
||||
#log = true;
|
||||
|
||||
# Define bip's log level :
|
||||
# 0 : only fatal errors
|
||||
@ -83,7 +86,7 @@
|
||||
# Sets the initial delay (in seconds) before a reconnection attempt.
|
||||
# The delay increases with the number of attempts:
|
||||
# delay = reconn_timer * number of attempts
|
||||
#reconn_timer = 120;
|
||||
#reconn_timer = 30;
|
||||
|
||||
# Network definition, a name and server info
|
||||
#network {
|
||||
@ -178,8 +181,11 @@
|
||||
# when no client attached anymore.
|
||||
#backlog_always = false;
|
||||
|
||||
# When true, disables time stamps if you find them ugly.
|
||||
#backlog_no_timestamp = false;
|
||||
# "none", "time" or "datetime": disables time stamps, use time or datetime.
|
||||
#backlog_timestamp = "time";
|
||||
|
||||
# This parameter is deprecated, use backlog_timestamp instead.
|
||||
#backlog_no_timestamp = false; # implies backlog_timestamp = "none";
|
||||
|
||||
# If blreset_on_talk talking on an irc network has the same effect of
|
||||
# issuing /bip blreset <current window>, meaning that stuffed logged
|
||||
@ -221,7 +227,7 @@
|
||||
# When source_port is defined, bip will connect to the IRC
|
||||
# server from this port number. That means the IRC server will
|
||||
# see the socket coming from <your_ip>:source_port.
|
||||
#source_port = "";
|
||||
#source_port = 10000;
|
||||
|
||||
# These will be sent to the real server. Nick, user and realname are
|
||||
# required. Default values are defined at the parent level
|
||||
@ -234,6 +240,11 @@
|
||||
#You can specify this field more than once. BIP will send the text as is to the server.
|
||||
#on_connect_send = "PRIVMSG NickServ :IDENTIFY nspassword";
|
||||
|
||||
# You can connect with SASL on networks supporting it
|
||||
#sasl_username = "username";
|
||||
#sasl_password = "sikioure password";
|
||||
#sasl_mechanism = "PLAIN";
|
||||
|
||||
# Some options:
|
||||
#away_nick = "bip`away";
|
||||
# Away message to be set when no client is connected
|
||||
@ -253,7 +264,8 @@
|
||||
# key = "sikiour";
|
||||
#};
|
||||
|
||||
#another channel {
|
||||
#another channel
|
||||
#channel {
|
||||
# name = "#huge(28)_activity";
|
||||
# disable backlogging of this channel.
|
||||
# backlog = false;
|
||||
|
@ -53,12 +53,12 @@ syn region bipMain start=/\%^/ end=/\%$/
|
||||
|
||||
" Top level elements
|
||||
syn keyword bipKeyword contained nextgroup=bipBoolV client_side_ssl
|
||||
\ log log_system
|
||||
\ log log_system write_oidentd
|
||||
syn keyword bipKeyword contained nextgroup=bipStringV log_root
|
||||
\ log_format oidentd_file pid_file client_side_ssl_pem client_side_ciphers
|
||||
\ client_side_dh_param ssl_default_ciphers
|
||||
syn keyword bipKeyword contained nextgroup=bipNumericV port log_level
|
||||
\ log_sync_interval
|
||||
\ log_sync_interval reconn_timer
|
||||
syn keyword bipKeyword contained nextgroup=bipIPV ip
|
||||
|
||||
" Network block (level 1)
|
||||
@ -74,22 +74,25 @@ syn region bipUser contained matchgroup=Macro start=/user\s*{\s*/
|
||||
\ contains=bipUKeyword,bipConnection,bipComment,bipEndError,bipWhite
|
||||
syn keyword bipUKeyword contained nextgroup=bipStringV password name
|
||||
\ default_nick default_user default_realname ssl_check_store
|
||||
\ ssl_check_mode ssl_client_certfile
|
||||
\ ssl_check_mode ssl_client_certfile backlog_timestamp
|
||||
syn keyword bipUKeyword contained nextgroup=bipNumericV backlog_lines
|
||||
syn keyword bipUKeyword contained nextgroup=bipBoolV admin
|
||||
" DEPRECATED \ always_backlog bl_msg_only blreset_on_talk
|
||||
\ backlog_no_timestamp backlog backlog_reset_on_talk
|
||||
\ backlog backlog_reset_on_talk
|
||||
\ backlog_msg_only backlog_always bip_use_notice
|
||||
\ backlog_reset_connection
|
||||
" DEPRECATED \ always_backlog bl_msg_only blreset_on_talk
|
||||
" DEPRECATED \ backlog_no_timestamp
|
||||
|
||||
" Connection block (level 2)
|
||||
syn region bipConnection contained matchgroup=Macro
|
||||
\ start=/connection\s*{\s*/ end=/};/
|
||||
\ contains=bipCoKeyword,bipChannel,bipComment,bipEndError,bipWhite
|
||||
syn keyword bipCoKeyword contained nextgroup=bipBoolV follow_nick
|
||||
\ ignore_first_nick log
|
||||
syn keyword bipCoKeyword contained nextgroup=bipBoolV autojoin_on_kick
|
||||
\ follow_nick ignore_first_nick log ignore_server_capab
|
||||
syn keyword bipCoKeyword contained nextgroup=bipStringV name user nick
|
||||
\ network password vhost away_nick on_connect_send realname
|
||||
\ no_client_away_msg ssl_check_mode
|
||||
\ no_client_away_msg ssl_check_mode sasl_username sasl_password
|
||||
\ sasl_mechanism
|
||||
syn keyword bipCoKeyword contained nextgroup=bipNumericV source_port
|
||||
|
||||
" Channel elements (lvl 2)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -d src ] ; then
|
||||
if [ ! -d src ] || [ ! -f NEWS ] ; then
|
||||
echo "Please run me in bip sources root." >&2
|
||||
exit 1
|
||||
fi
|
||||
@ -14,7 +14,7 @@ release_name="$2"
|
||||
set_version() {
|
||||
local release_version
|
||||
release_version="${1}"
|
||||
sed -i -e '/^AC_INIT/s/\(, \[\)[^]]*/\1'${release_version}'/' configure.ac
|
||||
sed -i -e '/^AC_INIT/s/\(,\[\)[^]]*/\1'${release_version}'/' configure.ac
|
||||
}
|
||||
|
||||
get_version() {
|
||||
@ -25,7 +25,7 @@ make_distcheck() {
|
||||
# prepare sources
|
||||
autoreconf -i -Wall
|
||||
# Create makefile, use all possible options
|
||||
./configure --enable-oidentd
|
||||
./configure
|
||||
# run distcheck
|
||||
if ! make ${MAKEOPTS} distcheck; then
|
||||
echo "'make distcheck' fails, please try again." >&2
|
||||
@ -37,6 +37,13 @@ make_distcheck() {
|
||||
|
||||
git log > ChangeLog
|
||||
if [ -n "$release_version" ]; then
|
||||
# Don't forget to update NEWS file before a release
|
||||
expected="$(date --rfc-3339=date) (${release_version})"
|
||||
if [ -n "${release_name}" ]; then
|
||||
expected="${expected} \"${release_name}\""
|
||||
fi
|
||||
head -n 1 NEWS | grep -q "^${expected}$" || (echo "NEWS file doesn't match the expected format (${expected})" && exit 1)
|
||||
|
||||
set_version "${release_version}"
|
||||
make_distcheck || exit 1
|
||||
|
||||
|
@ -119,15 +119,16 @@ my %optdesc = (
|
||||
'optional' => 1,
|
||||
'depends' => 'log', 'depval' => 'true',
|
||||
'desc' => 'Do you want to activate backlog {play back logs} system ?' },
|
||||
'backlog_lines' => { 'type' => 'i', 'adv' => 0, 'default' => '10',
|
||||
'backlog_lines' => { 'type' => 'i', 'adv' => 0, 'default' => '0',
|
||||
'optional' => 1,
|
||||
'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'How much line do you want bip to play back upon client connect' .
|
||||
" {0 => replay everything since backlog's last reset} ?" },
|
||||
'backlog_no_timestamp' => { 'type' => 'b', 'adv' => 0,
|
||||
'backlog_timestamp' => { 'type' => 's', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Disable timestamp in backlog ?' },
|
||||
'default' => 'time', 'depends' => 'backlog', 'depval' => 'true',
|
||||
'desc' => 'Use time, datetime or disable prefix in backlog',
|
||||
'values' => ['none', 'time', 'datetime'] },
|
||||
'backlog_msg_only' => { 'type' => 'b', 'adv' => 0,
|
||||
'optional' => 1,
|
||||
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
|
||||
@ -248,7 +249,7 @@ my %optorder = (
|
||||
undef,
|
||||
'backlog' ,
|
||||
'backlog_lines' ,
|
||||
'backlog_no_timestamp' ,
|
||||
'backlog_timestamp' ,
|
||||
'backlog_msg_only' ,
|
||||
'backlog_always' ,
|
||||
'backlog_reset_on_talk' ,
|
||||
@ -313,6 +314,10 @@ sub askOpt {
|
||||
} else {
|
||||
$o = askval($e->{'desc'}, $sel, ($mayempty && ($opt ne 1 ||
|
||||
$e->{'type'} eq 'i' ? 1 : undef)), 1);
|
||||
if (defined $e->{'values'} && !grep(/^$o$/, @{$e->{'values'}})) {
|
||||
print("The allowed values are '@{[ join '\', \'', @{$e->{'values'}} ]}'\n");
|
||||
next;
|
||||
}
|
||||
}
|
||||
if ($o eq undef && $opt eq 0) {
|
||||
print("This value is mandatory, please enter a value\n");
|
||||
@ -462,6 +467,11 @@ sub loadConfig {
|
||||
$_->{'server'} = [ values %{$_->{'server'}} ];
|
||||
}
|
||||
foreach my $tcu (@{$cf{'users'}}) {
|
||||
my $backlog_no_timestamp = delete($tcu->{'backlog_no_timestamp'});
|
||||
if (defined $backlog_no_timestamp) {
|
||||
grep(/^$backlog_no_timestamp$/, ('false', 'true')) || return "Invalid value for backlog_no_timestamp: '$backlog_no_timestamp'";
|
||||
$tcu->{'backlog_timestamp'} = $backlog_no_timestamp == 'false' ? 'time' : 'none';
|
||||
}
|
||||
$tcu->{'connection'} = [ values %{$tcu->{'connection'}} ];
|
||||
foreach my $tcc (@{$tcu->{'connection'}}) {
|
||||
$tcc->{'channel'} = [ values %{$tcc->{'channel'}} ];
|
||||
|
44
src/Makefile.am
Normal file
44
src/Makefile.am
Normal file
@ -0,0 +1,44 @@
|
||||
noinst_LIBRARIES = libbip.a libbiplex.a
|
||||
|
||||
libbiplex_a_SOURCES = \
|
||||
conf.y lex.l
|
||||
|
||||
# Not adding AM_CFLAGS here, because many debian flex releases generate code
|
||||
# that compares signed and unsigned integers. It looks like this issue is
|
||||
# fixed by flex 2.6.5 which is unreleased.
|
||||
libbiplex_a_CFLAGS = $(OPENSSL_CFLAGS)
|
||||
|
||||
libbip_a_SOURCES = \
|
||||
bip.c bip.h \
|
||||
connection.c connection.h \
|
||||
defaults.h \
|
||||
irc.c irc.h \
|
||||
line.c line.h \
|
||||
log.c log.h \
|
||||
md5.c md5.h \
|
||||
path_util.c path_util.h \
|
||||
tuple.h \
|
||||
util.c util.h \
|
||||
utils/base64.c utils/base64.h
|
||||
|
||||
libbip_a_CFLAGS = ${OPENSSL_CFLAGS} $(AM_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = bip bipmkpw
|
||||
|
||||
bip_SOURCES = bip_main.c
|
||||
bip_CFLAGS = ${OPENSSL_CFLAGS} $(AM_CFLAGS)
|
||||
bip_LDADD = libbip.a libbiplex.a ${OPENSSL_LIBS}
|
||||
|
||||
bipmkpw_SOURCES = bipmkpw.c md5.c util.c
|
||||
bipmkpw_CFLAGS = ${OPENSSL_CFLAGS} $(AM_CFLAGS)
|
||||
bipmkpw_LDADD = libbip.a libbiplex.a $(OPENSSL_LIBS)
|
||||
|
||||
AM_YFLAGS= -d
|
||||
BUILT_SOURCES = conf.c conf.h lex.c
|
||||
|
||||
AM_CFLAGS=-Wall -Wextra -Werror \
|
||||
-O2 \
|
||||
-D_FORTIFY_SOURCE=2 \
|
||||
-fstack-protector-strong -fstack-clash-protection \
|
||||
-Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code \
|
||||
-Wpedantic -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-security -Wnull-dereference -Wstack-protector -Wtrampolines -Walloca -Wvla -Warray-bounds=2 -Wimplicit-fallthrough=3 -Wtraditional-conversion -Wshift-overflow=2 -Wcast-qual -Wstringop-overflow=4 -Wconversion -Warith-conversion -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wformat-signedness -Wshadow -Wstrict-overflow=4 -Wundef -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wstack-usage=1000000 -Wcast-align=strict
|
329
src/bip_main.c
Normal file
329
src/bip_main.c
Normal file
@ -0,0 +1,329 @@
|
||||
/*
|
||||
* $Id: bip.c,v 1.39 2005/04/21 06:58:50 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See the file "COPYING" for the exact licensing terms.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "irc.h"
|
||||
#include "conf.h"
|
||||
#include "path_util.h"
|
||||
#include "tuple.h"
|
||||
#include "log.h"
|
||||
#include "bip.h"
|
||||
#include "line.h"
|
||||
#include "defaults.h"
|
||||
|
||||
#define S_CONF "bip.conf"
|
||||
#define OIDENTD_FILENAME ".oidentd.conf"
|
||||
|
||||
extern int sighup;
|
||||
extern char *conf_log_root;
|
||||
extern char *conf_log_format;
|
||||
extern int conf_log_level;
|
||||
extern char *conf_ip;
|
||||
extern unsigned short conf_port;
|
||||
extern int conf_css;
|
||||
#ifdef HAVE_LIBSSL
|
||||
extern char *conf_ssl_certfile;
|
||||
extern char *conf_client_ciphers;
|
||||
extern char *conf_client_dh_file;
|
||||
extern char *conf_server_default_ciphers;
|
||||
#endif
|
||||
extern int conf_daemonize;
|
||||
extern char *conf_pid_file;
|
||||
extern char *conf_biphome;
|
||||
extern int conf_reconn_timer;
|
||||
|
||||
/* log options, for sure the trickiest :) */
|
||||
extern int conf_log;
|
||||
extern int conf_log_system;
|
||||
extern int conf_log_sync_interval;
|
||||
extern bip_t *_bip;
|
||||
extern FILE *conf_global_log_file;
|
||||
|
||||
void reload_config(int i);
|
||||
void bad_quit(int i);
|
||||
void check_rlimits(void);
|
||||
void rlimit_cpu_reached(int i);
|
||||
void rlimit_bigfile_reached(int i);
|
||||
void conf_die(bip_t *bip, char *fmt, ...);
|
||||
int fireup(bip_t *bip, FILE *conf);
|
||||
int do_pid_stuff(void);
|
||||
|
||||
static void usage(char *name)
|
||||
{
|
||||
printf("Usage: %s [-f config_file] [-h] [-n]\n"
|
||||
" -f config_file: Use config_file as the configuration file\n"
|
||||
" If no config file is given %s will try to open ~/.bip/" S_CONF
|
||||
"\n"
|
||||
" -n: Don't daemonize, log in stderr\n"
|
||||
" -s: Bip HOME, default parent directory for client certificate,\n"
|
||||
" configuration, logs, pid, oidentd\n"
|
||||
" -v: Print version and exit\n"
|
||||
" -h: This help\n",
|
||||
name, name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void version(void)
|
||||
{
|
||||
printf("Bip IRC Proxy - " PACKAGE_VERSION
|
||||
"\n"
|
||||
"Copyright © Arnaud Cornet and Loïc Gomez (2004 - 2008)\n"
|
||||
"Distributed under the GNU General Public License Version 2\n");
|
||||
}
|
||||
|
||||
static void log_file_setup(void)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
if (conf_log_system && conf_daemonize) {
|
||||
if (conf_global_log_file && conf_global_log_file != stderr)
|
||||
fclose(conf_global_log_file);
|
||||
snprintf(buf, (size_t)4095, "%s/bip.log", conf_log_root);
|
||||
FILE *f = fopen(buf, "a");
|
||||
if (!f)
|
||||
fatal("Can't open %s: %s", buf, strerror(errno));
|
||||
conf_global_log_file = f;
|
||||
} else {
|
||||
conf_global_log_file = stderr;
|
||||
}
|
||||
}
|
||||
|
||||
static pid_t daemonize(void)
|
||||
{
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
fatal("Fork failed");
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
if (setsid() < 0)
|
||||
fatal("setsid() failed");
|
||||
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
fatal("Fork failed");
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
/* This better be the very last action since fatal makes use of
|
||||
* conf_global_log_file */
|
||||
return getpid();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *conf = NULL;
|
||||
char *confpath = NULL;
|
||||
int ch;
|
||||
int r, fd;
|
||||
char buf[30];
|
||||
bip_t bip;
|
||||
|
||||
bip_init(&bip);
|
||||
_bip = &bip;
|
||||
|
||||
conf_ip = bip_strdup("0.0.0.0");
|
||||
conf_port = 7778;
|
||||
conf_css = 0;
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGHUP, reload_config);
|
||||
signal(SIGINT, bad_quit);
|
||||
signal(SIGQUIT, bad_quit);
|
||||
signal(SIGTERM, bad_quit);
|
||||
signal(SIGXFSZ, rlimit_bigfile_reached);
|
||||
signal(SIGXCPU, rlimit_cpu_reached);
|
||||
|
||||
conf_log_root = NULL;
|
||||
conf_log_format = bip_strdup(DEFAULT_LOG_FORMAT);
|
||||
conf_log_level = DEFAULT_LOG_LEVEL;
|
||||
conf_reconn_timer = DEFAULT_RECONN_TIMER;
|
||||
conf_daemonize = 1;
|
||||
conf_global_log_file = stderr;
|
||||
conf_pid_file = NULL;
|
||||
#ifdef HAVE_LIBSSL
|
||||
conf_ssl_certfile = NULL;
|
||||
conf_client_ciphers = NULL;
|
||||
conf_server_default_ciphers = NULL;
|
||||
conf_client_dh_file = NULL;
|
||||
#endif
|
||||
|
||||
while ((ch = getopt(argc, argv, "hvnf:s:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'f':
|
||||
confpath = bip_strdup(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
conf_daemonize = 0;
|
||||
break;
|
||||
case 's':
|
||||
conf_biphome = bip_strdup(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
version();
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
version();
|
||||
usage(argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
umask(0027);
|
||||
|
||||
check_rlimits();
|
||||
|
||||
char *home = NULL; /* oidentd path searching ignores conf_biphome */
|
||||
home = getenv("HOME");
|
||||
if (!home && !conf_biphome) {
|
||||
conf_die(&bip,
|
||||
"no value for environment variable $HOME,"
|
||||
"use '-s' parameter");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!conf_biphome) {
|
||||
conf_biphome = bip_malloc(strlen(home) + strlen("/.bip") + 1);
|
||||
strcpy(conf_biphome, home);
|
||||
strcat(conf_biphome, "/.bip");
|
||||
}
|
||||
|
||||
if (!bip.oidentdpath) {
|
||||
bip.oidentdpath = bip_malloc(strlen(conf_biphome) + 1
|
||||
+ strlen(OIDENTD_FILENAME) + 1);
|
||||
strcpy(bip.oidentdpath, conf_biphome);
|
||||
strcat(bip.oidentdpath, "/");
|
||||
strcat(bip.oidentdpath, OIDENTD_FILENAME);
|
||||
}
|
||||
|
||||
if (!confpath) {
|
||||
confpath = bip_malloc(strlen(conf_biphome) + 1 + strlen(S_CONF)
|
||||
+ 1);
|
||||
strcpy(confpath, conf_biphome);
|
||||
strcat(confpath, "/");
|
||||
strcat(confpath, S_CONF);
|
||||
}
|
||||
conf = fopen(confpath, "r");
|
||||
if (!conf)
|
||||
fatal("config file not found (%s)", confpath);
|
||||
|
||||
r = fireup(&bip, conf);
|
||||
fclose(conf);
|
||||
if (!r)
|
||||
fatal("Not starting: error in config file.");
|
||||
|
||||
if (!conf_log_root) {
|
||||
char *ap = "/logs";
|
||||
conf_log_root =
|
||||
bip_malloc(strlen(conf_biphome) + strlen(ap) + 1);
|
||||
strcpy(conf_log_root, conf_biphome);
|
||||
strcat(conf_log_root, ap);
|
||||
mylog(LOG_INFO, "Default log root: %s", conf_log_root);
|
||||
}
|
||||
if (!conf_pid_file) {
|
||||
char *pid = "/bip.pid";
|
||||
conf_pid_file =
|
||||
bip_malloc(strlen(conf_biphome) + strlen(pid) + 1);
|
||||
strcpy(conf_pid_file, conf_biphome);
|
||||
strcat(conf_pid_file, pid);
|
||||
mylog(LOG_INFO, "Default pid file: %s", conf_pid_file);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
if (conf_css) {
|
||||
int e;
|
||||
struct stat fs;
|
||||
|
||||
if (!conf_ssl_certfile) {
|
||||
conf_ssl_certfile = default_path(
|
||||
conf_biphome, "bip.pem", "SSL certificate");
|
||||
}
|
||||
assert_path_exists(conf_ssl_certfile);
|
||||
|
||||
e = stat(conf_ssl_certfile, &fs);
|
||||
if (e)
|
||||
mylog(LOG_WARN,
|
||||
"Unable to check PEM file, stat(%s): "
|
||||
"%s",
|
||||
conf_ssl_certfile, strerror(errno));
|
||||
else if ((fs.st_mode & S_IROTH) | (fs.st_mode & S_IWOTH))
|
||||
mylog(LOG_ERROR,
|
||||
"PEM file %s should not be world "
|
||||
"readable / writable. Please fix the modes.",
|
||||
conf_ssl_certfile);
|
||||
|
||||
if (conf_client_dh_file) {
|
||||
assert_path_exists(conf_client_dh_file);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
check_dir(conf_log_root, 1);
|
||||
fd = do_pid_stuff();
|
||||
pid_t pid = 0;
|
||||
|
||||
log_file_setup();
|
||||
if (conf_daemonize)
|
||||
pid = daemonize();
|
||||
else
|
||||
pid = getpid();
|
||||
snprintf(buf, (size_t)29, "%lu\n", (unsigned long int)pid);
|
||||
ssize_t written;
|
||||
written = write(fd, buf, strlen(buf));
|
||||
if (written <= 0)
|
||||
mylog(LOG_ERROR, "Could not write to PID file");
|
||||
close(fd);
|
||||
|
||||
bip.listener = listen_new(conf_ip, conf_port, conf_css);
|
||||
if (!bip.listener || bip.listener->connected == CONN_ERROR)
|
||||
fatal("Could not create listening socket");
|
||||
|
||||
for (;;) {
|
||||
irc_main(&bip);
|
||||
|
||||
sighup = 0;
|
||||
|
||||
conf = fopen(confpath, "r");
|
||||
if (!conf)
|
||||
fatal("%s config file not found", confpath);
|
||||
fireup(&bip, conf);
|
||||
fclose(conf);
|
||||
|
||||
/* re-open to allow logfile rotate */
|
||||
log_file_setup();
|
||||
}
|
||||
return 1;
|
||||
}
|
@ -2,7 +2,8 @@
|
||||
* $Id$
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -26,34 +27,43 @@ int conf_log_level;
|
||||
FILE *conf_global_log_file;
|
||||
int conf_log_system;
|
||||
|
||||
void bipmkpw_fatal(char *msg, char *err)
|
||||
{
|
||||
fprintf(stderr, "%s: %s\n", msg, err);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void readpass(char *buffer, int buflen)
|
||||
{
|
||||
int ttyfd = open("/dev/tty", O_RDWR);
|
||||
if (ttyfd == -1) {
|
||||
fprintf(stderr, "Unable to open tty: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (ttyfd == -1)
|
||||
bipmkpw_fatal("Unable to open tty", strerror(errno));
|
||||
|
||||
struct termios tt, ttback;
|
||||
memset(&ttback, 0, sizeof(ttback));
|
||||
if (tcgetattr(ttyfd, &ttback) < 0) {
|
||||
fprintf(stderr, "tcgetattr failed: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (tcgetattr(ttyfd, &ttback) < 0)
|
||||
bipmkpw_fatal("tcgetattr failed", strerror(errno));
|
||||
|
||||
memcpy(&tt, &ttback, sizeof(ttback));
|
||||
tt.c_lflag &= ~(ICANON|ECHO);
|
||||
if (tcsetattr(ttyfd, TCSANOW, &tt) < 0) {
|
||||
fprintf(stderr, "tcsetattr failed: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
// unsigned conversion from ‘int’ to ‘tcflag_t’ {aka ‘unsigned int’} changes
|
||||
// value from ‘-11’ to ‘4294967285’
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
tt.c_lflag &= ~(ICANON | ECHO);
|
||||
#pragma GCC diagnostic pop
|
||||
if (tcsetattr(ttyfd, TCSANOW, &tt) < 0)
|
||||
bipmkpw_fatal("tcsetattr failed", strerror(errno));
|
||||
|
||||
write(ttyfd, "Password: ", 10);
|
||||
if (!write(ttyfd, "Password: ", (size_t)10))
|
||||
bipmkpw_fatal("tty write failed", strerror(errno));
|
||||
|
||||
int idx = 0;
|
||||
int valid = 1;
|
||||
while (idx < buflen) {
|
||||
read(ttyfd, buffer+idx, 1);
|
||||
ssize_t rbytes = read(ttyfd, buffer + idx, (size_t)1);
|
||||
if (rbytes <= 0) {
|
||||
break;
|
||||
}
|
||||
if (buffer[idx] == '\n') {
|
||||
buffer[idx] = 0;
|
||||
break;
|
||||
@ -63,7 +73,8 @@ void readpass(char *buffer, int buflen)
|
||||
idx++;
|
||||
}
|
||||
|
||||
write(ttyfd, "\n", 1);
|
||||
if (!write(ttyfd, "\n", (size_t)1))
|
||||
bipmkpw_fatal("tty write failed", strerror(errno));
|
||||
|
||||
tcsetattr(ttyfd, TCSANOW, &ttback);
|
||||
close(ttyfd);
|
||||
@ -84,12 +95,19 @@ int main(void)
|
||||
readpass(str, 256);
|
||||
str[255] = 0;
|
||||
|
||||
// passing argument 1 of ‘srand’ with different width due to prototype
|
||||
// [-Werror=traditional-conversion] conversion from ‘time_t’ {aka ‘long int’} to
|
||||
// ‘unsigned int’ may change value [-Werror=conversion] We don't care.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtraditional-conversion"
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
// the time used to type the pass is entropy
|
||||
srand(time(NULL));
|
||||
seed = rand();
|
||||
#pragma GCC diagnostic pop
|
||||
seed = (unsigned)rand(); // rand should be > 0
|
||||
|
||||
md5 = chash_double(str, seed);
|
||||
for (i = 0; i < 20; i++)
|
||||
for (i = 0; i < 20; i++)
|
||||
printf("%02x", md5[i]);
|
||||
printf("\n");
|
||||
free(md5);
|
||||
|
18
src/conf.y
18
src/conf.y
@ -4,6 +4,7 @@
|
||||
*
|
||||
* This file is part of the bip proproject
|
||||
* Copyright (C) 2004 Arnaud Cornet
|
||||
* Copyright (C) 2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -24,7 +25,7 @@ extern int linec;
|
||||
|
||||
extern int yyerror(char *);
|
||||
|
||||
int yywrap()
|
||||
int yywrap(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -68,7 +69,7 @@ struct tuple *tuple_l_new(int type, void *p)
|
||||
|
||||
%}
|
||||
|
||||
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CIPHERS LEX_CSS_CIPHERS LEX_DEFAULT_CIPHERS LEX_DH_PARAM LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_OIDENTD_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB LEX_RECONN_TIMER
|
||||
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CIPHERS LEX_CSS_CIPHERS LEX_DEFAULT_CIPHERS LEX_DH_PARAM LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_TIMESTAMP LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_WRITE_OIDENTD LEX_OIDENTD_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB LEX_RECONN_TIMER LEX_SASL_USERNAME LEX_SASL_PASSWORD LEX_SASL_MECHANISM
|
||||
|
||||
%union {
|
||||
int number;
|
||||
@ -107,11 +108,15 @@ command:
|
||||
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
||||
LEX_LOG_SYNC_INTERVAL, $3); }
|
||||
| LEX_PID_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PID_FILE, $3); }
|
||||
| LEX_WRITE_OIDENTD LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_WRITE_OIDENTD, $3); }
|
||||
| LEX_OIDENTD_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_OIDENTD_FILE, $3); }
|
||||
/* deprecated */
|
||||
| LEX_BACKLOG_LINES LEX_EQ LEX_INT {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_LINES, $3);
|
||||
}
|
||||
| LEX_BACKLOG_TIMESTAMP LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_BACKLOG_TIMESTAMP, $3);
|
||||
}
|
||||
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_NO_TIMESTAMP, $3);
|
||||
}
|
||||
@ -167,6 +172,9 @@ usr_command:
|
||||
| LEX_BACKLOG_LINES LEX_EQ LEX_INT {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_LINES, $3);
|
||||
}
|
||||
| LEX_BACKLOG_TIMESTAMP LEX_EQ LEX_STRING {
|
||||
$$ = tuple_s_new(LEX_BACKLOG_TIMESTAMP, $3);
|
||||
}
|
||||
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
|
||||
$$ = tuple_i_new(LEX_BACKLOG_NO_TIMESTAMP, $3);
|
||||
}
|
||||
@ -201,6 +209,12 @@ con_command:
|
||||
$3); }
|
||||
| LEX_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PASSWORD,
|
||||
$3); }
|
||||
| LEX_SASL_USERNAME LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SASL_USERNAME, $3); }
|
||||
| LEX_SASL_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SASL_PASSWORD, $3); }
|
||||
| LEX_SASL_MECHANISM LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
||||
LEX_SASL_MECHANISM, $3); }
|
||||
| LEX_VHOST LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_VHOST, $3); }
|
||||
| LEX_SOURCE_PORT LEX_EQ LEX_INT {
|
||||
$$ = tuple_i_new(LEX_SOURCE_PORT, $3); }
|
||||
|
662
src/connection.c
662
src/connection.c
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,8 @@
|
||||
* $Id: connection.h,v 1.40 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -74,7 +75,7 @@ typedef struct connection {
|
||||
time_t connect_time;
|
||||
time_t timeout;
|
||||
char *incoming;
|
||||
unsigned incoming_end;
|
||||
size_t incoming_end;
|
||||
list_t *outgoing;
|
||||
char *partial;
|
||||
list_t *incoming_lines;
|
||||
@ -91,8 +92,9 @@ typedef struct connection {
|
||||
} connection_t;
|
||||
|
||||
connection_t *connection_new(char *dsthostname, int dstport, char *srchostname,
|
||||
int srcport, int ssl, char *ssl_ciphers, int ssl_check_mode,
|
||||
char *ssl_check_store, char *ssl_client_certfile, int timeout);
|
||||
int srcport, int ssl, char *ssl_ciphers,
|
||||
int ssl_check_mode, char *ssl_check_store,
|
||||
char *ssl_client_certfile, time_t timeout);
|
||||
connection_t *listen_new(char *hostname, int port, int ssl);
|
||||
connection_t *accept_new(connection_t *cn);
|
||||
void connection_free(connection_t *cn);
|
||||
@ -102,13 +104,13 @@ void write_line(connection_t *cn, char *line);
|
||||
void write_lines(connection_t *cn, list_t *lines);
|
||||
void write_line_fast(connection_t *cn, char *line);
|
||||
list_t *read_lines(connection_t *cn, int *error);
|
||||
list_t *wait_event(list_t *cn_list, int *msec, int *nc);
|
||||
list_t *wait_event(list_t *cn_list, time_t *msec, int *nc);
|
||||
|
||||
int cn_is_connected(connection_t *cn);
|
||||
int cn_is_listening(connection_t *cn);
|
||||
|
||||
int connection_localport(connection_t *cn);
|
||||
int connection_remoteport(connection_t *cn);
|
||||
uint16_t connection_localport(connection_t *cn);
|
||||
uint16_t connection_remoteport(connection_t *cn);
|
||||
char *connection_localip(connection_t *cn);
|
||||
char *connection_remoteip(connection_t *cn);
|
||||
#endif
|
||||
|
@ -14,11 +14,13 @@
|
||||
#ifndef DEFAULTS_H
|
||||
#define DEFAULTS_H
|
||||
|
||||
#include "irc.h"
|
||||
|
||||
#define DEFAULT_BACKLOG 1
|
||||
#define DEFAULT_ALWAYS_BACKLOG 0
|
||||
#define DEFAULT_BL_MSG_ONLY 0
|
||||
#define DEFAULT_BACKLOG_LINES 10
|
||||
#define DEFAULT_BACKLOG_NO_TIMESTAMP 0
|
||||
#define DEFAULT_BACKLOG_LINES 0
|
||||
#define DEFAULT_BACKLOG_TIMESTAMP BLTSTime
|
||||
#define DEFAULT_BLRESET_ON_TALK 0
|
||||
#define DEFAULT_BLRESET_CONNECTION 0
|
||||
#define DEFAULT_LOG 1
|
||||
@ -27,6 +29,6 @@
|
||||
#define DEFAULT_LOG_LEVEL LOG_INFO
|
||||
#define DEFAULT_LOG_FORMAT "%u/%n/%Y-%m/%c.%d.log"
|
||||
#define DEFAULT_BIP_USE_NOTICE 0
|
||||
#define DEFAULT_RECONN_TIMER 120
|
||||
#define DEFAULT_RECONN_TIMER 30
|
||||
|
||||
#endif /* DEFAULTS_H */
|
||||
|
77
src/irc.h
77
src/irc.h
@ -2,7 +2,8 @@
|
||||
* $Id: irc.h,v 1.43 2005/04/21 06:58:50 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -51,9 +52,15 @@ struct channel {
|
||||
|
||||
#define IRC_TYPE_CLIENT (0)
|
||||
#define IRC_TYPE_SERVER (1)
|
||||
#define IRC_TYPE_LOGING_CLIENT (2)
|
||||
#define IRC_TYPE_LOGGING_CLIENT (2)
|
||||
#define IRC_TYPE_TRUST_CLIENT (3)
|
||||
|
||||
enum BLTimestamp {
|
||||
BLTSNone = 0,
|
||||
BLTSTime,
|
||||
BLTSDateTime,
|
||||
};
|
||||
|
||||
struct bipuser {
|
||||
/** client connection static data **/
|
||||
|
||||
@ -70,13 +77,14 @@ struct bipuser {
|
||||
char *default_realname;
|
||||
|
||||
/* backlog options */
|
||||
int backlog:1;
|
||||
char backlog;
|
||||
int backlog_lines;
|
||||
int always_backlog:1;
|
||||
int bl_msg_only:1;
|
||||
int backlog_no_timestamp:1;
|
||||
int blreset_on_talk:1;
|
||||
int blreset_connection:1;
|
||||
char always_backlog;
|
||||
char bl_msg_only;
|
||||
char blreset_on_talk;
|
||||
char blreset_connection;
|
||||
|
||||
enum BLTimestamp backlog_timestamp;
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl_check_mode;
|
||||
@ -85,11 +93,10 @@ struct bipuser {
|
||||
#endif
|
||||
|
||||
hash_t connections;
|
||||
int in_use:1; /* for mark and sweep on reload */
|
||||
char in_use; /* for mark and sweep on reload */
|
||||
};
|
||||
|
||||
struct network
|
||||
{
|
||||
struct network {
|
||||
char *name;
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl;
|
||||
@ -99,12 +106,15 @@ struct network
|
||||
struct server *serverv;
|
||||
};
|
||||
|
||||
#define SASL_AUTH_EXTERNAL 1
|
||||
#define SASL_AUTH_PLAIN 2
|
||||
|
||||
struct link {
|
||||
char *name; /* id */
|
||||
char *name; /* id */
|
||||
|
||||
/** link live data **/
|
||||
struct link_server *l_server;
|
||||
int l_clientc;
|
||||
unsigned int l_clientc;
|
||||
struct link_client **l_clientv;
|
||||
|
||||
struct log *log;
|
||||
@ -126,15 +136,15 @@ struct link {
|
||||
|
||||
/** link options */
|
||||
|
||||
int follow_nick:1;
|
||||
int ignore_first_nick:1;
|
||||
int autojoin_on_kick:1;
|
||||
int ignore_server_capab:1;
|
||||
char follow_nick;
|
||||
char ignore_first_nick;
|
||||
char autojoin_on_kick;
|
||||
char ignore_server_capab;
|
||||
list_t on_connect_send;
|
||||
char *no_client_away_msg;
|
||||
char *away_nick;
|
||||
hash_t chan_infos; /* channels we want */
|
||||
list_t chan_infos_order; /* for order only */
|
||||
hash_t chan_infos; /* channels we want */
|
||||
list_t chan_infos_order; /* for order only */
|
||||
|
||||
struct bipuser *user;
|
||||
|
||||
@ -146,6 +156,9 @@ struct link {
|
||||
char *username;
|
||||
char *realname;
|
||||
char *s_password;
|
||||
char *sasl_username;
|
||||
char *sasl_password;
|
||||
int sasl_mechanism;
|
||||
char *connect_nick;
|
||||
|
||||
/* socket creation info */
|
||||
@ -154,7 +167,7 @@ struct link {
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
int ssl_check_mode;
|
||||
STACK_OF(X509) *untrusted_certs;
|
||||
STACK_OF(X509) * untrusted_certs;
|
||||
#endif
|
||||
int in_use; /* for mark and sweep on reload */
|
||||
};
|
||||
@ -175,9 +188,9 @@ struct link_any {
|
||||
|
||||
#define IRCC_NONE (0)
|
||||
#define IRCC_NICK (1)
|
||||
#define IRCC_USER (1<<1)
|
||||
#define IRCC_PASS (1<<2)
|
||||
#define IRCC_READY (IRCC_NICK|IRCC_PASS|IRCC_USER)
|
||||
#define IRCC_USER (1 << 1)
|
||||
#define IRCC_PASS (1 << 2)
|
||||
#define IRCC_READY (IRCC_NICK | IRCC_PASS | IRCC_USER)
|
||||
|
||||
struct link_client {
|
||||
struct link_connection _link_c;
|
||||
@ -211,7 +224,7 @@ struct chan_info {
|
||||
int backlog;
|
||||
};
|
||||
|
||||
#define chan_info_new() bip_calloc(sizeof(struct chan_info), 1)
|
||||
#define chan_info_new() bip_calloc(sizeof(struct chan_info), (size_t)1)
|
||||
|
||||
struct link_server {
|
||||
struct link_connection _link_c;
|
||||
@ -222,11 +235,11 @@ struct link_server {
|
||||
hash_t channels;
|
||||
|
||||
char *user_mode;
|
||||
int user_mode_len;
|
||||
size_t user_mode_len;
|
||||
|
||||
/* init stuff */
|
||||
int lag;
|
||||
int laginit_ts;
|
||||
unsigned lag;
|
||||
time_t laginit_ts;
|
||||
int lagtest_timeout;
|
||||
|
||||
/* chanmodes */
|
||||
@ -250,22 +263,19 @@ typedef struct bip {
|
||||
hash_t users;
|
||||
list_t errors;
|
||||
struct link_client *reloading_client;
|
||||
|
||||
#ifdef HAVE_OIDENTD
|
||||
char *oidentdpath;
|
||||
#endif
|
||||
int write_oidentd;
|
||||
} bip_t;
|
||||
|
||||
void bip_init(bip_t *bip);
|
||||
struct link_client *irc_client_new(void);
|
||||
struct link_server *irc_server_new(struct link *link, connection_t *conn);
|
||||
void irc_server_free(struct link_server *is);
|
||||
struct client *client_new();
|
||||
struct client *client_new(void);
|
||||
void irc_main(bip_t *);
|
||||
int ischannel(char p);
|
||||
void irc_client_close(struct link_client *);
|
||||
void irc_client_free(struct link_client *);
|
||||
struct link *irc_link_new();
|
||||
struct link *irc_link_new(void);
|
||||
void link_kill(bip_t *bip, struct link *);
|
||||
void unbind_from_link(struct link_client *ic);
|
||||
char *nick_from_ircmask(const char *mask);
|
||||
@ -273,4 +283,3 @@ void irc_cli_backlog(struct link_client *ic, int hours);
|
||||
#define BIP_FAKEMASK "!bip@bip.bip.bip"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
* This file is part of the bip proproject
|
||||
* Copyright (C) 2004 Arnaud Cornet
|
||||
* Copyright (C) 2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -90,7 +91,8 @@ list_t *parse_conf(FILE *file, int *err)
|
||||
"log_root" { return LEX_LOG_ROOT; }
|
||||
"log_format" { return LEX_LOG_FORMAT; }
|
||||
"backlog_lines" { return LEX_BACKLOG_LINES; }
|
||||
"backlog_no_timestamp" { return LEX_BACKLOG_NO_TIMESTAMP; }
|
||||
"backlog_timestamp" { return LEX_BACKLOG_TIMESTAMP; }
|
||||
"backlog_no_timestamp" { return LEX_BACKLOG_NO_TIMESTAMP; }
|
||||
"backlog" { return LEX_BACKLOG; }
|
||||
"backlog_always" { return LEX_ALWAYS_BACKLOG; }
|
||||
"backlog_msg_only" { return LEX_BL_MSG_ONLY; }
|
||||
@ -108,11 +110,15 @@ list_t *parse_conf(FILE *file, int *err)
|
||||
"on_connect_send" { return LEX_ON_CONNECT_SEND; }
|
||||
"no_client_away_msg" { return LEX_NO_CLIENT_AWAY_MSG; }
|
||||
"pid_file" { return LEX_PID_FILE; }
|
||||
"write_oidentd" { return LEX_WRITE_OIDENTD; }
|
||||
"oidentd_file" { return LEX_OIDENTD_FILE; }
|
||||
"bip_use_notice" { return LEX_BIP_USE_NOTICE; }
|
||||
"client_side_ssl_pem" { return LEX_CSS_PEM; }
|
||||
"client_side_ciphers" { return LEX_CSS_CIPHERS; }
|
||||
"client_side_dh_param" { return LEX_DH_PARAM; }
|
||||
"sasl_username" { return LEX_SASL_USERNAME; }
|
||||
"sasl_password" { return LEX_SASL_PASSWORD; }
|
||||
"sasl_mechanism" { return LEX_SASL_MECHANISM; }
|
||||
"ignore_server_capab" { return LEX_IGNORE_CAPAB; }
|
||||
"reconn_timer" { return LEX_RECONN_TIMER; }
|
||||
\"[^"]*\" {
|
||||
|
45
src/line.c
45
src/line.c
@ -2,7 +2,8 @@
|
||||
* $Id$
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -15,6 +16,10 @@
|
||||
#include "line.h"
|
||||
#include "util.h"
|
||||
|
||||
// TODO resolve assuming signed overflow does not occur when changing X +- C1
|
||||
// cmp C2 to X cmp C2 -+ C1
|
||||
#pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||
|
||||
void irc_line_init(struct line *l)
|
||||
{
|
||||
memset(l, 0, sizeof(struct line));
|
||||
@ -62,7 +67,7 @@ char *irc_line_pop(struct line *l)
|
||||
|
||||
void _irc_line_append(struct line *l, const char *s)
|
||||
{
|
||||
array_push(&l->words, (char *)s);
|
||||
array_push(&l->words, bip_strdup(s));
|
||||
}
|
||||
|
||||
void irc_line_append(struct line *l, const char *s)
|
||||
@ -81,7 +86,7 @@ char *irc_line_to_string(struct line *l)
|
||||
for (i = 0; i < array_count(&l->words); i++)
|
||||
len += strlen(array_get(&l->words, i)) + 1;
|
||||
len += 1; /* remove one trailing space and add \r\n */
|
||||
len++; /* last args ":" */
|
||||
len++; /* last args ":" */
|
||||
ret = bip_malloc(len + 1);
|
||||
ret[0] = 0;
|
||||
|
||||
@ -106,11 +111,14 @@ char *irc_line_to_string_to(struct line *line, char *nick)
|
||||
{
|
||||
char *tmp;
|
||||
char *l;
|
||||
const char *prev;
|
||||
|
||||
tmp = (char *)irc_line_elem(line, 1);
|
||||
prev = irc_line_elem(line, 1);
|
||||
tmp = bip_strdup(prev);
|
||||
array_set(&line->words, 1, nick);
|
||||
l = irc_line_to_string(line);
|
||||
array_set(&line->words, 1, tmp);
|
||||
bip_cfree(prev);
|
||||
|
||||
return l;
|
||||
}
|
||||
@ -132,7 +140,13 @@ const char *irc_line_elem(struct line *line, int elem)
|
||||
|
||||
void irc_line_drop(struct line *line, int elem)
|
||||
{
|
||||
free(array_drop(&line->words, elem));
|
||||
bip_cfree(array_drop(&line->words, elem));
|
||||
}
|
||||
|
||||
int irc_line_is_error(struct line *line)
|
||||
{
|
||||
const char *irc_code = irc_line_elem(line, 0);
|
||||
return (irc_code[0] == '4');
|
||||
}
|
||||
|
||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp)
|
||||
@ -164,7 +178,8 @@ struct line *irc_line_new_from_string(char *str)
|
||||
irc_line_free(line);
|
||||
return NULL;
|
||||
}
|
||||
len = space - str - 1; /* leading ':' */
|
||||
// space is at least str + 1, len >= 0
|
||||
len = (size_t)(space - str - 1); /* leading ':' */
|
||||
line->origin = bip_malloc(len + 1);
|
||||
memcpy(line->origin, str + 1, len);
|
||||
line->origin[len] = 0;
|
||||
@ -187,7 +202,9 @@ struct line *irc_line_new_from_string(char *str)
|
||||
while (*space && *space != ' ')
|
||||
space++;
|
||||
}
|
||||
len = space - str;
|
||||
// str is the start of string
|
||||
// space is the end of string or end of word
|
||||
len = (size_t)(space - str);
|
||||
tmp = bip_malloc(len + 1);
|
||||
memcpy(tmp, str, len);
|
||||
tmp[len] = 0;
|
||||
@ -207,21 +224,9 @@ void irc_line_free(struct line *l)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < array_count(&l->words); i++)
|
||||
free(array_get(&l->words, i));
|
||||
bip_cfree(array_get(&l->words, i));
|
||||
array_deinit(&l->words);
|
||||
if (l->origin)
|
||||
free(l->origin);
|
||||
free(l);
|
||||
}
|
||||
|
||||
void irc_line_free_args(char **elemv, int elemc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (elemc == 0)
|
||||
return;
|
||||
for (i = 0; i < elemc; i++)
|
||||
free(elemv[i]);
|
||||
free(elemv);
|
||||
}
|
||||
|
||||
|
117
src/line.h
117
src/line.h
@ -2,7 +2,8 @@
|
||||
* $Id$
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -16,65 +17,65 @@
|
||||
|
||||
#include "connection.h"
|
||||
|
||||
#define WRITE_LINE0(con, org, com) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while(0)
|
||||
#define WRITE_LINE0(con, org, com) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
|
||||
#define WRITE_LINE1(con, org, com, a) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while(0)
|
||||
#define WRITE_LINE1(con, org, com, a) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
|
||||
#define WRITE_LINE2(con, org, com, a1, a2) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while(0)
|
||||
#define WRITE_LINE2(con, org, com, a1, a2) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
|
||||
#define WRITE_LINE3(con, org, com, a1, a2, a3) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while(0)
|
||||
#define WRITE_LINE3(con, org, com, a1, a2, a3) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
|
||||
#define WRITE_LINE4(con, org, com, a1, a2, a3, a4) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
_irc_line_append(&l, a4); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while(0)
|
||||
#define WRITE_LINE4(con, org, com, a1, a2, a3, a4) \
|
||||
do { \
|
||||
struct line l; \
|
||||
irc_line_init(&l); \
|
||||
l.origin = org; \
|
||||
_irc_line_append(&l, com); \
|
||||
_irc_line_append(&l, a1); \
|
||||
_irc_line_append(&l, a2); \
|
||||
_irc_line_append(&l, a3); \
|
||||
_irc_line_append(&l, a4); \
|
||||
irc_line_write(&l, con); \
|
||||
_irc_line_deinit(&l); \
|
||||
} while (0)
|
||||
|
||||
struct line {
|
||||
char *origin;
|
||||
@ -84,7 +85,7 @@ struct line {
|
||||
|
||||
void irc_line_init(struct line *l);
|
||||
void _irc_line_deinit(struct line *l);
|
||||
struct line *irc_line_new();
|
||||
struct line *irc_line_new(void);
|
||||
void irc_line_write(struct line *l, connection_t *c);
|
||||
void irc_line_append(struct line *l, const char *s);
|
||||
struct line *irc_line_new_from_string(char *str);
|
||||
@ -97,9 +98,9 @@ int irc_line_includes(struct line *line, int elem);
|
||||
const char *irc_line_elem(struct line *line, int elem);
|
||||
int irc_line_count(struct line *line);
|
||||
char *irc_line_pop(struct line *l);
|
||||
int irc_line_is_error(struct line *line);
|
||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp);
|
||||
int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp);
|
||||
void irc_line_free_args(char **elemv, int elemc);
|
||||
void irc_line_drop(struct line *line, int elem);
|
||||
|
||||
#endif
|
||||
|
36
src/log.h
36
src/log.h
@ -2,7 +2,8 @@
|
||||
* $Id: log.h,v 1.26 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004 Arnaud Cornet
|
||||
* Copyright (C) 2004,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -28,8 +29,7 @@
|
||||
|
||||
struct list;
|
||||
|
||||
typedef struct logfile
|
||||
{
|
||||
typedef struct logfile {
|
||||
FILE *file;
|
||||
char *filename;
|
||||
char *canonical_filename;
|
||||
@ -37,8 +37,7 @@ typedef struct logfile
|
||||
size_t len;
|
||||
} logfile_t;
|
||||
|
||||
typedef struct logstore
|
||||
{
|
||||
typedef struct logstore {
|
||||
char *name;
|
||||
list_t file_group;
|
||||
int skip_advance;
|
||||
@ -47,11 +46,10 @@ typedef struct logstore
|
||||
int memc;
|
||||
int track_backlog;
|
||||
list_iterator_t file_it;
|
||||
size_t file_offset;
|
||||
long file_offset;
|
||||
} logstore_t;
|
||||
|
||||
typedef struct log
|
||||
{
|
||||
typedef struct log {
|
||||
hash_t logfgs;
|
||||
char *network;
|
||||
char *buffer;
|
||||
@ -68,29 +66,29 @@ void logdata_free(log_t *logdata);
|
||||
|
||||
void log_join(log_t *logdata, const char *ircmask, const char *channel);
|
||||
void log_part(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
const char *message);
|
||||
void log_kick(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *who, const char *message);
|
||||
const char *who, const char *message);
|
||||
void log_quit(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
const char *message);
|
||||
void log_nick(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *newnick);
|
||||
const char *newnick);
|
||||
void log_privmsg(log_t *logdata, const char *ircmask, const char *destination,
|
||||
const char *message);
|
||||
const char *message);
|
||||
void log_notice(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
void log_cli_privmsg(log_t *logdata, const char *ircmask,
|
||||
const char *destination, const char *message);
|
||||
const char *destination, const char *message);
|
||||
void log_cli_notice(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
const char *message);
|
||||
void log_write(log_t *logdata, const char *str, const char *destination);
|
||||
void log_mode(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *modes, array_t *mode_args);
|
||||
const char *modes, array_t *mode_args);
|
||||
void log_topic(log_t *logdata, const char *ircmask, const char *channel,
|
||||
const char *message);
|
||||
const char *message);
|
||||
void log_init_topic(log_t *logdata, const char *channel, const char *message);
|
||||
void log_init_topic_time(log_t *logdata, const char *channel, const char *who,
|
||||
const char *when);
|
||||
const char *when);
|
||||
void log_connected(log_t *logdata);
|
||||
void log_disconnected(log_t *logdata);
|
||||
void log_ping_timeout(log_t *logdata);
|
||||
@ -107,5 +105,5 @@ void log_drop(log_t *log, const char *storename);
|
||||
|
||||
list_t *log_backlogs(log_t *log);
|
||||
list_t *backlog_lines(log_t *log, const char *bl, const char *cli_nick,
|
||||
int hours);
|
||||
int hours);
|
||||
#endif
|
||||
|
483
src/md5.c
483
src/md5.c
@ -1,7 +1,8 @@
|
||||
/*
|
||||
* RFC 1321 compliant MD5 implementation
|
||||
*
|
||||
* Copyright (C) 2001-2003 Christophe Devine
|
||||
* Copyright (C) 2001-2003 Christophe Devine
|
||||
* Copyright (C) 2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -24,226 +25,218 @@
|
||||
#include "md5.h"
|
||||
#include "util.h"
|
||||
|
||||
#define GET_UINT32(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (uint32) (b)[(i) ] ) \
|
||||
| ( (uint32) (b)[(i) + 1] << 8 ) \
|
||||
| ( (uint32) (b)[(i) + 2] << 16 ) \
|
||||
| ( (uint32) (b)[(i) + 3] << 24 ); \
|
||||
}
|
||||
#define GET_UINT32(n, b, i) \
|
||||
{ \
|
||||
(n) = ((uint32)(b)[(i)]) | ((uint32)(b)[(i) + 1] << 8) \
|
||||
| ((uint32)(b)[(i) + 2] << 16) \
|
||||
| ((uint32)(b)[(i) + 3] << 24); \
|
||||
}
|
||||
|
||||
#define PUT_UINT32(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (uint8) ( (n) ); \
|
||||
(b)[(i) + 1] = (uint8) ( (n) >> 8 ); \
|
||||
(b)[(i) + 2] = (uint8) ( (n) >> 16 ); \
|
||||
(b)[(i) + 3] = (uint8) ( (n) >> 24 ); \
|
||||
}
|
||||
#define PUT_UINT32(n, b, i) \
|
||||
{ \
|
||||
(b)[(i)] = (uint8)((n)); \
|
||||
(b)[(i) + 1] = (uint8)((n) >> 8); \
|
||||
(b)[(i) + 2] = (uint8)((n) >> 16); \
|
||||
(b)[(i) + 3] = (uint8)((n) >> 24); \
|
||||
}
|
||||
|
||||
void md5_starts( md5_context *ctx )
|
||||
void md5_starts(md5_context *ctx)
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
void md5_process( md5_context *ctx, uint8 data[64] )
|
||||
void md5_process(md5_context *ctx, uint8 data[64])
|
||||
{
|
||||
uint32 X[16], A, B, C, D;
|
||||
uint32 X[16], A, B, C, D;
|
||||
|
||||
GET_UINT32( X[0], data, 0 );
|
||||
GET_UINT32( X[1], data, 4 );
|
||||
GET_UINT32( X[2], data, 8 );
|
||||
GET_UINT32( X[3], data, 12 );
|
||||
GET_UINT32( X[4], data, 16 );
|
||||
GET_UINT32( X[5], data, 20 );
|
||||
GET_UINT32( X[6], data, 24 );
|
||||
GET_UINT32( X[7], data, 28 );
|
||||
GET_UINT32( X[8], data, 32 );
|
||||
GET_UINT32( X[9], data, 36 );
|
||||
GET_UINT32( X[10], data, 40 );
|
||||
GET_UINT32( X[11], data, 44 );
|
||||
GET_UINT32( X[12], data, 48 );
|
||||
GET_UINT32( X[13], data, 52 );
|
||||
GET_UINT32( X[14], data, 56 );
|
||||
GET_UINT32( X[15], data, 60 );
|
||||
GET_UINT32(X[0], data, 0);
|
||||
GET_UINT32(X[1], data, 4);
|
||||
GET_UINT32(X[2], data, 8);
|
||||
GET_UINT32(X[3], data, 12);
|
||||
GET_UINT32(X[4], data, 16);
|
||||
GET_UINT32(X[5], data, 20);
|
||||
GET_UINT32(X[6], data, 24);
|
||||
GET_UINT32(X[7], data, 28);
|
||||
GET_UINT32(X[8], data, 32);
|
||||
GET_UINT32(X[9], data, 36);
|
||||
GET_UINT32(X[10], data, 40);
|
||||
GET_UINT32(X[11], data, 44);
|
||||
GET_UINT32(X[12], data, 48);
|
||||
GET_UINT32(X[13], data, 52);
|
||||
GET_UINT32(X[14], data, 56);
|
||||
GET_UINT32(X[15], data, 60);
|
||||
|
||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
#define S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
|
||||
#define P(a,b,c,d,k,s,t) \
|
||||
{ \
|
||||
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
|
||||
}
|
||||
#define P(a, b, c, d, k, s, t) \
|
||||
{ \
|
||||
a += F(b, c, d) + X[k] + t; \
|
||||
a = S(a, s) + b; \
|
||||
}
|
||||
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
|
||||
#define F(x,y,z) (z ^ (x & (y ^ z)))
|
||||
#define F(x, y, z) (z ^ (x & (y ^ z)))
|
||||
|
||||
P( A, B, C, D, 0, 7, 0xD76AA478 );
|
||||
P( D, A, B, C, 1, 12, 0xE8C7B756 );
|
||||
P( C, D, A, B, 2, 17, 0x242070DB );
|
||||
P( B, C, D, A, 3, 22, 0xC1BDCEEE );
|
||||
P( A, B, C, D, 4, 7, 0xF57C0FAF );
|
||||
P( D, A, B, C, 5, 12, 0x4787C62A );
|
||||
P( C, D, A, B, 6, 17, 0xA8304613 );
|
||||
P( B, C, D, A, 7, 22, 0xFD469501 );
|
||||
P( A, B, C, D, 8, 7, 0x698098D8 );
|
||||
P( D, A, B, C, 9, 12, 0x8B44F7AF );
|
||||
P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
|
||||
P( B, C, D, A, 11, 22, 0x895CD7BE );
|
||||
P( A, B, C, D, 12, 7, 0x6B901122 );
|
||||
P( D, A, B, C, 13, 12, 0xFD987193 );
|
||||
P( C, D, A, B, 14, 17, 0xA679438E );
|
||||
P( B, C, D, A, 15, 22, 0x49B40821 );
|
||||
P(A, B, C, D, 0, 7, 0xD76AA478);
|
||||
P(D, A, B, C, 1, 12, 0xE8C7B756);
|
||||
P(C, D, A, B, 2, 17, 0x242070DB);
|
||||
P(B, C, D, A, 3, 22, 0xC1BDCEEE);
|
||||
P(A, B, C, D, 4, 7, 0xF57C0FAF);
|
||||
P(D, A, B, C, 5, 12, 0x4787C62A);
|
||||
P(C, D, A, B, 6, 17, 0xA8304613);
|
||||
P(B, C, D, A, 7, 22, 0xFD469501);
|
||||
P(A, B, C, D, 8, 7, 0x698098D8);
|
||||
P(D, A, B, C, 9, 12, 0x8B44F7AF);
|
||||
P(C, D, A, B, 10, 17, 0xFFFF5BB1);
|
||||
P(B, C, D, A, 11, 22, 0x895CD7BE);
|
||||
P(A, B, C, D, 12, 7, 0x6B901122);
|
||||
P(D, A, B, C, 13, 12, 0xFD987193);
|
||||
P(C, D, A, B, 14, 17, 0xA679438E);
|
||||
P(B, C, D, A, 15, 22, 0x49B40821);
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (z & (x ^ y)))
|
||||
#define F(x, y, z) (y ^ (z & (x ^ y)))
|
||||
|
||||
P( A, B, C, D, 1, 5, 0xF61E2562 );
|
||||
P( D, A, B, C, 6, 9, 0xC040B340 );
|
||||
P( C, D, A, B, 11, 14, 0x265E5A51 );
|
||||
P( B, C, D, A, 0, 20, 0xE9B6C7AA );
|
||||
P( A, B, C, D, 5, 5, 0xD62F105D );
|
||||
P( D, A, B, C, 10, 9, 0x02441453 );
|
||||
P( C, D, A, B, 15, 14, 0xD8A1E681 );
|
||||
P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
|
||||
P( A, B, C, D, 9, 5, 0x21E1CDE6 );
|
||||
P( D, A, B, C, 14, 9, 0xC33707D6 );
|
||||
P( C, D, A, B, 3, 14, 0xF4D50D87 );
|
||||
P( B, C, D, A, 8, 20, 0x455A14ED );
|
||||
P( A, B, C, D, 13, 5, 0xA9E3E905 );
|
||||
P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
|
||||
P( C, D, A, B, 7, 14, 0x676F02D9 );
|
||||
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
|
||||
P(A, B, C, D, 1, 5, 0xF61E2562);
|
||||
P(D, A, B, C, 6, 9, 0xC040B340);
|
||||
P(C, D, A, B, 11, 14, 0x265E5A51);
|
||||
P(B, C, D, A, 0, 20, 0xE9B6C7AA);
|
||||
P(A, B, C, D, 5, 5, 0xD62F105D);
|
||||
P(D, A, B, C, 10, 9, 0x02441453);
|
||||
P(C, D, A, B, 15, 14, 0xD8A1E681);
|
||||
P(B, C, D, A, 4, 20, 0xE7D3FBC8);
|
||||
P(A, B, C, D, 9, 5, 0x21E1CDE6);
|
||||
P(D, A, B, C, 14, 9, 0xC33707D6);
|
||||
P(C, D, A, B, 3, 14, 0xF4D50D87);
|
||||
P(B, C, D, A, 8, 20, 0x455A14ED);
|
||||
P(A, B, C, D, 13, 5, 0xA9E3E905);
|
||||
P(D, A, B, C, 2, 9, 0xFCEFA3F8);
|
||||
P(C, D, A, B, 7, 14, 0x676F02D9);
|
||||
P(B, C, D, A, 12, 20, 0x8D2A4C8A);
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
#define F(x, y, z) (x ^ y ^ z)
|
||||
|
||||
P( A, B, C, D, 5, 4, 0xFFFA3942 );
|
||||
P( D, A, B, C, 8, 11, 0x8771F681 );
|
||||
P( C, D, A, B, 11, 16, 0x6D9D6122 );
|
||||
P( B, C, D, A, 14, 23, 0xFDE5380C );
|
||||
P( A, B, C, D, 1, 4, 0xA4BEEA44 );
|
||||
P( D, A, B, C, 4, 11, 0x4BDECFA9 );
|
||||
P( C, D, A, B, 7, 16, 0xF6BB4B60 );
|
||||
P( B, C, D, A, 10, 23, 0xBEBFBC70 );
|
||||
P( A, B, C, D, 13, 4, 0x289B7EC6 );
|
||||
P( D, A, B, C, 0, 11, 0xEAA127FA );
|
||||
P( C, D, A, B, 3, 16, 0xD4EF3085 );
|
||||
P( B, C, D, A, 6, 23, 0x04881D05 );
|
||||
P( A, B, C, D, 9, 4, 0xD9D4D039 );
|
||||
P( D, A, B, C, 12, 11, 0xE6DB99E5 );
|
||||
P( C, D, A, B, 15, 16, 0x1FA27CF8 );
|
||||
P( B, C, D, A, 2, 23, 0xC4AC5665 );
|
||||
P(A, B, C, D, 5, 4, 0xFFFA3942);
|
||||
P(D, A, B, C, 8, 11, 0x8771F681);
|
||||
P(C, D, A, B, 11, 16, 0x6D9D6122);
|
||||
P(B, C, D, A, 14, 23, 0xFDE5380C);
|
||||
P(A, B, C, D, 1, 4, 0xA4BEEA44);
|
||||
P(D, A, B, C, 4, 11, 0x4BDECFA9);
|
||||
P(C, D, A, B, 7, 16, 0xF6BB4B60);
|
||||
P(B, C, D, A, 10, 23, 0xBEBFBC70);
|
||||
P(A, B, C, D, 13, 4, 0x289B7EC6);
|
||||
P(D, A, B, C, 0, 11, 0xEAA127FA);
|
||||
P(C, D, A, B, 3, 16, 0xD4EF3085);
|
||||
P(B, C, D, A, 6, 23, 0x04881D05);
|
||||
P(A, B, C, D, 9, 4, 0xD9D4D039);
|
||||
P(D, A, B, C, 12, 11, 0xE6DB99E5);
|
||||
P(C, D, A, B, 15, 16, 0x1FA27CF8);
|
||||
P(B, C, D, A, 2, 23, 0xC4AC5665);
|
||||
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (y ^ (x | ~z))
|
||||
#define F(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
P( A, B, C, D, 0, 6, 0xF4292244 );
|
||||
P( D, A, B, C, 7, 10, 0x432AFF97 );
|
||||
P( C, D, A, B, 14, 15, 0xAB9423A7 );
|
||||
P( B, C, D, A, 5, 21, 0xFC93A039 );
|
||||
P( A, B, C, D, 12, 6, 0x655B59C3 );
|
||||
P( D, A, B, C, 3, 10, 0x8F0CCC92 );
|
||||
P( C, D, A, B, 10, 15, 0xFFEFF47D );
|
||||
P( B, C, D, A, 1, 21, 0x85845DD1 );
|
||||
P( A, B, C, D, 8, 6, 0x6FA87E4F );
|
||||
P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
|
||||
P( C, D, A, B, 6, 15, 0xA3014314 );
|
||||
P( B, C, D, A, 13, 21, 0x4E0811A1 );
|
||||
P( A, B, C, D, 4, 6, 0xF7537E82 );
|
||||
P( D, A, B, C, 11, 10, 0xBD3AF235 );
|
||||
P( C, D, A, B, 2, 15, 0x2AD7D2BB );
|
||||
P( B, C, D, A, 9, 21, 0xEB86D391 );
|
||||
P(A, B, C, D, 0, 6, 0xF4292244);
|
||||
P(D, A, B, C, 7, 10, 0x432AFF97);
|
||||
P(C, D, A, B, 14, 15, 0xAB9423A7);
|
||||
P(B, C, D, A, 5, 21, 0xFC93A039);
|
||||
P(A, B, C, D, 12, 6, 0x655B59C3);
|
||||
P(D, A, B, C, 3, 10, 0x8F0CCC92);
|
||||
P(C, D, A, B, 10, 15, 0xFFEFF47D);
|
||||
P(B, C, D, A, 1, 21, 0x85845DD1);
|
||||
P(A, B, C, D, 8, 6, 0x6FA87E4F);
|
||||
P(D, A, B, C, 15, 10, 0xFE2CE6E0);
|
||||
P(C, D, A, B, 6, 15, 0xA3014314);
|
||||
P(B, C, D, A, 13, 21, 0x4E0811A1);
|
||||
P(A, B, C, D, 4, 6, 0xF7537E82);
|
||||
P(D, A, B, C, 11, 10, 0xBD3AF235);
|
||||
P(C, D, A, B, 2, 15, 0x2AD7D2BB);
|
||||
P(B, C, D, A, 9, 21, 0xEB86D391);
|
||||
|
||||
#undef F
|
||||
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
}
|
||||
|
||||
void md5_update( md5_context *ctx, uint8 *input, uint32 length )
|
||||
void md5_update(md5_context *ctx, uint8 *input, uint32 length)
|
||||
{
|
||||
uint32 left, fill;
|
||||
uint32 left, fill;
|
||||
|
||||
if( ! length ) return;
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += length;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
ctx->total[0] += length;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if( ctx->total[0] < length )
|
||||
ctx->total[1]++;
|
||||
if (ctx->total[0] < length)
|
||||
ctx->total[1]++;
|
||||
|
||||
if( left && length >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, fill );
|
||||
md5_process( ctx, ctx->buffer );
|
||||
length -= fill;
|
||||
input += fill;
|
||||
left = 0;
|
||||
}
|
||||
if (left && length >= fill) {
|
||||
memcpy((void *)(ctx->buffer + left), (void *)input, fill);
|
||||
md5_process(ctx, ctx->buffer);
|
||||
length -= fill;
|
||||
input += fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while( length >= 64 )
|
||||
{
|
||||
md5_process( ctx, input );
|
||||
length -= 64;
|
||||
input += 64;
|
||||
}
|
||||
while (length >= 64) {
|
||||
md5_process(ctx, input);
|
||||
length -= 64;
|
||||
input += 64;
|
||||
}
|
||||
|
||||
if( length )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, length );
|
||||
}
|
||||
if (length) {
|
||||
memcpy((void *)(ctx->buffer + left), (void *)input, length);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 md5_padding[64] =
|
||||
static uint8 md5_padding[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
void md5_finish(md5_context *ctx, uint8 digest[16])
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
uint32 last, padn;
|
||||
uint32 high, low;
|
||||
uint8 msglen[8];
|
||||
|
||||
void md5_finish( md5_context *ctx, uint8 digest[16] )
|
||||
{
|
||||
uint32 last, padn;
|
||||
uint32 high, low;
|
||||
uint8 msglen[8];
|
||||
high = (ctx->total[0] >> 29) | (ctx->total[1] << 3);
|
||||
low = (ctx->total[0] << 3);
|
||||
|
||||
high = ( ctx->total[0] >> 29 )
|
||||
| ( ctx->total[1] << 3 );
|
||||
low = ( ctx->total[0] << 3 );
|
||||
PUT_UINT32(low, msglen, 0);
|
||||
PUT_UINT32(high, msglen, 4);
|
||||
|
||||
PUT_UINT32( low, msglen, 0 );
|
||||
PUT_UINT32( high, msglen, 4 );
|
||||
last = ctx->total[0] & 0x3F;
|
||||
padn = (last < 56) ? (56 - last) : (120 - last);
|
||||
|
||||
last = ctx->total[0] & 0x3F;
|
||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||
md5_update(ctx, md5_padding, padn);
|
||||
md5_update(ctx, msglen, (unsigned long)8);
|
||||
|
||||
md5_update( ctx, md5_padding, padn );
|
||||
md5_update( ctx, msglen, 8 );
|
||||
|
||||
PUT_UINT32( ctx->state[0], digest, 0 );
|
||||
PUT_UINT32( ctx->state[1], digest, 4 );
|
||||
PUT_UINT32( ctx->state[2], digest, 8 );
|
||||
PUT_UINT32( ctx->state[3], digest, 12 );
|
||||
PUT_UINT32(ctx->state[0], digest, 0);
|
||||
PUT_UINT32(ctx->state[1], digest, 4);
|
||||
PUT_UINT32(ctx->state[2], digest, 8);
|
||||
PUT_UINT32(ctx->state[3], digest, 12);
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
@ -255,92 +248,76 @@ void md5_finish( md5_context *ctx, uint8 digest[16] )
|
||||
* those are the standard RFC 1321 test vectors
|
||||
*/
|
||||
|
||||
static char *msg[] =
|
||||
static char *msg[] = {
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"message digest",
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||
"12345678901234567890123456789012345678901234567890123456789012"
|
||||
"345678901234567890"};
|
||||
|
||||
static char *val[] = {
|
||||
"d41d8cd98f00b204e9800998ecf8427e", "0cc175b9c0f1b6a831c399e269772661",
|
||||
"900150983cd24fb0d6963f7d28e17f72", "f96b697d7cb7938d525a2f31aaf161d0",
|
||||
"c3fcd3d76192e4007dfb496cca67e13b", "d174ab98d277d9f5a5611c2c9f419d9f",
|
||||
"57edf4a22be3c955ac49da2e2107b67a"};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"message digest",
|
||||
"abcdefghijklmnopqrstuvwxyz",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||
"12345678901234567890123456789012345678901234567890123456789012" \
|
||||
"345678901234567890"
|
||||
};
|
||||
FILE *f;
|
||||
int i, j;
|
||||
char output[33];
|
||||
md5_context ctx;
|
||||
unsigned char buf[1000];
|
||||
unsigned char md5sum[16];
|
||||
|
||||
static char *val[] =
|
||||
{
|
||||
"d41d8cd98f00b204e9800998ecf8427e",
|
||||
"0cc175b9c0f1b6a831c399e269772661",
|
||||
"900150983cd24fb0d6963f7d28e17f72",
|
||||
"f96b697d7cb7938d525a2f31aaf161d0",
|
||||
"c3fcd3d76192e4007dfb496cca67e13b",
|
||||
"d174ab98d277d9f5a5611c2c9f419d9f",
|
||||
"57edf4a22be3c955ac49da2e2107b67a"
|
||||
};
|
||||
if (argc < 2) {
|
||||
printf("\n MD5 Validation Tests:\n\n");
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
int i, j;
|
||||
char output[33];
|
||||
md5_context ctx;
|
||||
unsigned char buf[1000];
|
||||
unsigned char md5sum[16];
|
||||
for (i = 0; i < 7; i++) {
|
||||
printf(" Test %d ", i + 1);
|
||||
|
||||
if( argc < 2 )
|
||||
{
|
||||
printf( "\n MD5 Validation Tests:\n\n" );
|
||||
md5_starts(&ctx);
|
||||
md5_update(&ctx, (uint8 *)msg[i], strlen(msg[i]));
|
||||
md5_finish(&ctx, md5sum);
|
||||
|
||||
for( i = 0; i < 7; i++ )
|
||||
{
|
||||
printf( " Test %d ", i + 1 );
|
||||
for (j = 0; j < 16; j++) {
|
||||
sprintf(output + j * 2, "%02x", md5sum[j]);
|
||||
}
|
||||
|
||||
md5_starts( &ctx );
|
||||
md5_update( &ctx, (uint8 *) msg[i], strlen( msg[i] ) );
|
||||
md5_finish( &ctx, md5sum );
|
||||
if (memcmp(output, val[i], 32)) {
|
||||
printf("failed!\n");
|
||||
return (1);
|
||||
}
|
||||
|
||||
for( j = 0; j < 16; j++ )
|
||||
{
|
||||
sprintf( output + j * 2, "%02x", md5sum[j] );
|
||||
}
|
||||
printf("passed.\n");
|
||||
}
|
||||
|
||||
if( memcmp( output, val[i], 32 ) )
|
||||
{
|
||||
printf( "failed!\n" );
|
||||
return( 1 );
|
||||
}
|
||||
printf("\n");
|
||||
} else {
|
||||
if (!(f = fopen(argv[1], "rb"))) {
|
||||
perror("fopen");
|
||||
return (1);
|
||||
}
|
||||
|
||||
printf( "passed.\n" );
|
||||
}
|
||||
md5_starts(&ctx);
|
||||
|
||||
printf( "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ! ( f = fopen( argv[1], "rb" ) ) )
|
||||
{
|
||||
perror( "fopen" );
|
||||
return( 1 );
|
||||
}
|
||||
while ((i = fread(buf, 1, sizeof(buf), f)) > 0) {
|
||||
md5_update(&ctx, buf, i);
|
||||
}
|
||||
|
||||
md5_starts( &ctx );
|
||||
md5_finish(&ctx, md5sum);
|
||||
|
||||
while( ( i = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
|
||||
{
|
||||
md5_update( &ctx, buf, i );
|
||||
}
|
||||
for (j = 0; j < 16; j++) {
|
||||
printf("%02x", md5sum[j]);
|
||||
}
|
||||
|
||||
md5_finish( &ctx, md5sum );
|
||||
printf(" %s\n", argv[1]);
|
||||
}
|
||||
|
||||
for( j = 0; j < 16; j++ )
|
||||
{
|
||||
printf( "%02x", md5sum[j] );
|
||||
}
|
||||
|
||||
printf( " %s\n", argv[1] );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -359,21 +336,26 @@ unsigned char *chash_double(char *str, unsigned int seed)
|
||||
length = strlen(str);
|
||||
length += 4;
|
||||
ptr = bip_malloc(length);
|
||||
// conversion from ‘unsigned int’ to ‘unsigned char’ may change value
|
||||
// [-Werror=conversion]
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
ptr[0] = seed >> 24 & 0xff;
|
||||
#pragma GCC diagnostic pop
|
||||
ptr[1] = seed >> 16 & 0xff;
|
||||
ptr[2] = seed >> 8 & 0xff;
|
||||
ptr[3] = seed & 0xff;
|
||||
memcpy(ptr + 4, str, length - 4);
|
||||
|
||||
md5 = bip_malloc(16 + 4);
|
||||
memcpy(md5, ptr, 4);
|
||||
md5 = bip_malloc((size_t)16 + 4);
|
||||
memcpy(md5, ptr, (size_t)4);
|
||||
|
||||
md5_starts(&ctx);
|
||||
md5_update(&ctx, ptr, length);
|
||||
md5_finish(&ctx, md5 + 4);
|
||||
|
||||
md5_starts(&ctx);
|
||||
md5_update(&ctx, md5, 20);
|
||||
md5_update(&ctx, md5, (unsigned long)20);
|
||||
md5_finish(&ctx, md5 + 4);
|
||||
free(ptr);
|
||||
return md5;
|
||||
@ -394,4 +376,3 @@ int chash_cmp(char *try, unsigned char *pass, unsigned int seed)
|
||||
free(try_hash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
17
src/md5.h
17
src/md5.h
@ -2,22 +2,19 @@
|
||||
#define _MD5_H
|
||||
|
||||
#ifndef uint8
|
||||
#define uint8 unsigned char
|
||||
#define uint8 unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef uint32
|
||||
#define uint32 unsigned long int
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 total[2];
|
||||
uint32 state[4];
|
||||
uint8 buffer[64];
|
||||
}
|
||||
md5_context;
|
||||
typedef struct {
|
||||
uint32 total[2];
|
||||
uint32 state[4];
|
||||
uint8 buffer[64];
|
||||
} md5_context;
|
||||
|
||||
int chash_cmp(char *try, unsigned char *pass,
|
||||
unsigned int seed);
|
||||
int chash_cmp(char *try, unsigned char *pass, unsigned int seed);
|
||||
unsigned char *chash_double(char *str, unsigned int seed);
|
||||
#endif /* md5.h */
|
||||
|
@ -18,20 +18,20 @@
|
||||
char *default_path(const char *biphome, const char *filename, const char *desc)
|
||||
{
|
||||
char *conf_file;
|
||||
// '/' and NULL
|
||||
// '/' and \0
|
||||
conf_file = bip_malloc(strlen(biphome) + strlen(filename) + 2);
|
||||
strcpy(conf_file, biphome);
|
||||
conf_file[strlen(biphome)] = '/';
|
||||
conf_file[strlen(biphome) + 1] = '\0';
|
||||
strcat(conf_file, filename);
|
||||
mylog(LOG_INFO, "Using default %s: %s", desc, conf_file);
|
||||
mylog(LOG_INFO, "Default %s: %s", desc, conf_file);
|
||||
return conf_file;
|
||||
}
|
||||
|
||||
void assert_path_exists(char *path)
|
||||
{
|
||||
FILE* f;
|
||||
if ((f = fopen(path, "r")) == NULL)
|
||||
fatal("Unable to open file %s for reading", path);
|
||||
else
|
||||
fclose(f);
|
||||
struct stat st_buf;
|
||||
|
||||
if (stat(path, &st_buf) != 0)
|
||||
fatal("Path %s doesn't exist (%s)", path, strerror(errno));
|
||||
}
|
||||
|
@ -11,6 +11,9 @@
|
||||
#ifndef PATH_UTIL_H
|
||||
#define PATH_UTIL_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* return path of filename located in bip home directory */
|
||||
char *default_path(const char *biphome, const char *filename, const char *desc);
|
||||
/* exit program if path doesn't exist */
|
||||
|
205
src/util.c
205
src/util.c
@ -2,7 +2,8 @@
|
||||
* $Id: util.c,v 1.60 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -28,14 +29,17 @@
|
||||
|
||||
extern int conf_log_level;
|
||||
extern int conf_log_system;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
extern int errno;
|
||||
#pragma GCC diagnostic pop
|
||||
extern FILE *conf_global_log_file;
|
||||
|
||||
void memory_fatal(void)
|
||||
{
|
||||
fflush(conf_global_log_file);
|
||||
#define OOMMSG "Out of memory.\n"
|
||||
fwrite(OOMMSG, 1, strlen(OOMMSG), conf_global_log_file);
|
||||
fwrite(OOMMSG, (size_t)1, strlen(OOMMSG), conf_global_log_file);
|
||||
#undef OOMMSG
|
||||
fflush(conf_global_log_file);
|
||||
exit(28);
|
||||
@ -73,6 +77,17 @@ void *bip_realloc(void *ptr, size_t size)
|
||||
return r;
|
||||
}
|
||||
|
||||
void bip_cfree(const void *ptr)
|
||||
{
|
||||
if (!ptr)
|
||||
return;
|
||||
// there's no other way to free a const pointer
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
free((void *)ptr);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
char *bip_strdup(const char *str)
|
||||
{
|
||||
char *r = strdup(str);
|
||||
@ -81,6 +96,98 @@ char *bip_strdup(const char *str)
|
||||
return r;
|
||||
}
|
||||
|
||||
char *bip_strcat_fit(size_t *remaining, char *str, const char *str2)
|
||||
{
|
||||
char *res;
|
||||
|
||||
if (!remaining || !str || !str2) {
|
||||
mylog(LOG_DEBUGVERB, "bip_strcat_fit: got NULL pointer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res = memccpy(str, str2, '\0', *remaining);
|
||||
if (!res) {
|
||||
mylog(LOG_DEBUGTOOMUCH,
|
||||
"bip_strcat_fit: memccpy() failed, remaining %lu",
|
||||
*remaining);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res--;
|
||||
if (res < str) {
|
||||
mylog(LOG_DEBUG, "bip_strcat_fit: memccpy res < str");
|
||||
return NULL;
|
||||
}
|
||||
(*remaining) -= (size_t)(res - str);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define STRCATF_BUF_MAXLEN 1024
|
||||
char *bip_strcatf_fit(size_t *remaining, char *str, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char str2[STRCATF_BUF_MAXLEN + 1];
|
||||
int written;
|
||||
char *res = NULL;
|
||||
|
||||
if (!remaining || !str || !fmt) {
|
||||
mylog(LOG_DEBUGVERB, "bip_strcatf_fit: NULL pointer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (*remaining > STRCATF_BUF_MAXLEN) {
|
||||
mylog(LOG_ERROR,
|
||||
"bip_strcatf_fit: remaining "
|
||||
"is over STRCATF_BUF_MAXLEN");
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
str2[*remaining] = '\0';
|
||||
written = vsnprintf(str2, *remaining, fmt, ap);
|
||||
if (written < 0) {
|
||||
mylog(LOG_ERROR, "bip_strcatf_fit: vsnprintf failed with: %s",
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((unsigned)written >= *remaining) {
|
||||
mylog(LOG_DEBUGVERB,
|
||||
"bip_strcatf_fit,vsnprintf: no space left");
|
||||
goto end;
|
||||
}
|
||||
|
||||
res = memccpy(str, str2, '\0', *remaining);
|
||||
if (!res) {
|
||||
mylog(LOG_DEBUGTOOMUCH,
|
||||
"bip_strcatf_fit: memccpy() failed, "
|
||||
"remaining %lu",
|
||||
*remaining);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (res < str) {
|
||||
mylog(LOG_DEBUG, "bip_strcatf_fit: memccpy res < str");
|
||||
goto end;
|
||||
}
|
||||
res--;
|
||||
(*remaining) -= (size_t)(res - str);
|
||||
|
||||
end:
|
||||
va_end(ap);
|
||||
return res;
|
||||
}
|
||||
|
||||
void bip_clock_gettime(clockid_t clockid, struct timespec *tp)
|
||||
{
|
||||
int err = clock_gettime(clockid, tp);
|
||||
|
||||
if (err != 0)
|
||||
fatal("clock_gettime: %s", strerror(errno));
|
||||
|
||||
if (tp->tv_sec < 0 || tp->tv_nsec < 0)
|
||||
fatal("clock_gettime returned negative time");
|
||||
}
|
||||
|
||||
/*
|
||||
* <nick> ::= <letter> { <letter> | <number> | <special> }
|
||||
* <special> ::= '-' | '[' | ']' | '\' | '`' | '^' | '{' | '}'
|
||||
@ -92,10 +199,10 @@ int is_valid_nick(char *str)
|
||||
return 0;
|
||||
|
||||
tmp = str;
|
||||
while (*tmp != '\0' && (isalnum(*tmp) || *tmp == '-' || *tmp == '[' ||
|
||||
*tmp == ']' || *tmp == '\\' || *tmp == '`' ||
|
||||
*tmp == '^' || *tmp == '{' || *tmp == '}' ||
|
||||
*tmp == '|' || *tmp == '_' ))
|
||||
while (*tmp != '\0'
|
||||
&& (isalnum(*tmp) || *tmp == '-' || *tmp == '[' || *tmp == ']'
|
||||
|| *tmp == '\\' || *tmp == '`' || *tmp == '^' || *tmp == '{'
|
||||
|| *tmp == '}' || *tmp == '|' || *tmp == '_'))
|
||||
tmp++;
|
||||
return (*tmp == '\0');
|
||||
}
|
||||
@ -107,8 +214,8 @@ int is_valid_username(char *str)
|
||||
return 0;
|
||||
|
||||
tmp = str;
|
||||
while (*tmp != '\0' && *tmp != ' ' && *tmp != '\0' && *tmp != '\r' &&
|
||||
*tmp != '\n')
|
||||
while (*tmp != '\0' && *tmp != ' ' && *tmp != '\0' && *tmp != '\r'
|
||||
&& *tmp != '\n')
|
||||
tmp++;
|
||||
return (*tmp == '\0');
|
||||
}
|
||||
@ -122,9 +229,7 @@ char *timestamp(void)
|
||||
time(&tv);
|
||||
tm = localtime(&tv);
|
||||
|
||||
snprintf(ts, 20, "%02d-%02d-%04d %02d:%02d:%02d", tm->tm_mday,
|
||||
tm->tm_mon + 1, tm->tm_year + 1900, tm->tm_hour,
|
||||
tm->tm_min, tm->tm_sec);
|
||||
strftime(ts, (size_t)20, "%d-%m-%Y %H:%M:%S", tm);
|
||||
return ts;
|
||||
}
|
||||
|
||||
@ -137,9 +242,7 @@ char *hrtime(time_t s)
|
||||
return "never";
|
||||
tm = localtime(&s);
|
||||
|
||||
snprintf(ts, 20, "%02d-%02d-%04d %02d:%02d:%02d", tm->tm_mday,
|
||||
tm->tm_mon + 1, tm->tm_year + 1900, tm->tm_hour,
|
||||
tm->tm_min, tm->tm_sec);
|
||||
strftime(ts, (size_t)20, "%d-%m-%Y %H:%M:%S", tm);
|
||||
return ts;
|
||||
}
|
||||
|
||||
@ -168,27 +271,27 @@ void _mylog(int level, char *fmt, va_list ap)
|
||||
return;
|
||||
|
||||
switch (level) {
|
||||
case LOG_FATAL:
|
||||
prefix = "FATAL: ";
|
||||
break;
|
||||
case LOG_DEBUGVERB:
|
||||
prefix = "DEBUGVERB: ";
|
||||
break;
|
||||
case LOG_DEBUG:
|
||||
prefix = "DEBUG: ";
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
prefix = "ERROR: ";
|
||||
break;
|
||||
case LOG_WARN:
|
||||
prefix = "WARNING: ";
|
||||
break;
|
||||
case LOG_INFO:
|
||||
prefix = "";
|
||||
break;
|
||||
default:
|
||||
prefix = "";
|
||||
break;
|
||||
case LOG_FATAL:
|
||||
prefix = "FATAL: ";
|
||||
break;
|
||||
case LOG_DEBUGVERB:
|
||||
prefix = "DEBUGVERB: ";
|
||||
break;
|
||||
case LOG_DEBUG:
|
||||
prefix = "DEBUG: ";
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
prefix = "ERROR: ";
|
||||
break;
|
||||
case LOG_WARN:
|
||||
prefix = "WARNING: ";
|
||||
break;
|
||||
case LOG_INFO:
|
||||
prefix = "";
|
||||
break;
|
||||
default:
|
||||
prefix = "";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(conf_global_log_file, "%s %s", timestamp(), prefix);
|
||||
@ -210,11 +313,10 @@ void mylog(int level, char *fmt, ...)
|
||||
|
||||
#ifdef HAVE_BACKTRACE
|
||||
#include <execinfo.h>
|
||||
|
||||
void print_trace(void)
|
||||
void dump_trace(void)
|
||||
{
|
||||
void *array[32];
|
||||
size_t size;
|
||||
int size;
|
||||
|
||||
size = backtrace(array, 32);
|
||||
fflush(conf_global_log_file);
|
||||
@ -232,7 +334,7 @@ void fatal(char *fmt, ...)
|
||||
va_end(ap);
|
||||
|
||||
#ifdef HAVE_BACKTRACE
|
||||
print_trace();
|
||||
dump_trace();
|
||||
#endif
|
||||
|
||||
exit(200);
|
||||
@ -509,13 +611,13 @@ void hash_init(hash_t *h, int options)
|
||||
switch (options) {
|
||||
case HASH_NOCASE:
|
||||
list_init(&h->lists[i],
|
||||
(int (*)(const void*, const void*))
|
||||
hash_item_nocase_cmp);
|
||||
(int (*)(const void *,
|
||||
const void *))hash_item_nocase_cmp);
|
||||
break;
|
||||
case HASH_DEFAULT:
|
||||
list_init(&h->lists[i],
|
||||
(int (*)(const void*,const void*))
|
||||
hash_item_cmp);
|
||||
(int (*)(const void *,
|
||||
const void *))hash_item_cmp);
|
||||
break;
|
||||
default:
|
||||
fatal("wrong hash option %d", options);
|
||||
@ -558,8 +660,9 @@ static unsigned char hash_func(const char *pkey)
|
||||
char c;
|
||||
unsigned long hash = 5381; /* 5381 & 0xff makes more sense */
|
||||
|
||||
// toupper should not return negative values (only char compatible int)
|
||||
while ((c = *pkey++))
|
||||
hash = ((hash << 5) + hash) ^ toupper(c);
|
||||
hash = ((hash << 5) + hash) ^ (long unsigned)toupper(c);
|
||||
return (unsigned char)hash;
|
||||
}
|
||||
|
||||
@ -702,7 +805,7 @@ void hash_dump(hash_t *h)
|
||||
{
|
||||
hash_iterator_t it;
|
||||
assert(h);
|
||||
for (hash_it_init(h, &it); hash_it_key(&it) ;hash_it_next(&it))
|
||||
for (hash_it_init(h, &it); hash_it_key(&it); hash_it_next(&it))
|
||||
printf("%s => %p\n", hash_it_key(&it), hash_it_item(&it));
|
||||
}
|
||||
|
||||
@ -738,7 +841,7 @@ char *bip_strmaydup(char *s)
|
||||
void strucase(char *s)
|
||||
{
|
||||
while (*s) {
|
||||
*s = toupper(*s);
|
||||
*s = (char)toupper(*s); // toupper, safe to cast to char
|
||||
s++;
|
||||
}
|
||||
}
|
||||
@ -768,15 +871,17 @@ void array_ensure(array_t *a, int index)
|
||||
|
||||
if (array_includes(a, index))
|
||||
return;
|
||||
a->elemv = bip_realloc(a->elemv, sizeof(void *) * (index + 1));
|
||||
memset(a->elemv + a->elemc, 0, sizeof(void *) * (index + 1 - a->elemc));
|
||||
a->elemv = bip_realloc(a->elemv, sizeof(void *) * (size_t)(index + 1));
|
||||
// a->elemc should be lower than index + 1
|
||||
memset(a->elemv + a->elemc, 0,
|
||||
sizeof(void *) * (size_t)(index + 1 - a->elemc));
|
||||
a->elemc = index + 1;
|
||||
}
|
||||
|
||||
void *array_drop(array_t *a, int index)
|
||||
const void *array_drop(array_t *a, int index)
|
||||
{
|
||||
int i;
|
||||
void *ret;
|
||||
const void *ret;
|
||||
|
||||
assert(a && array_includes(a, index));
|
||||
|
||||
|
86
src/util.h
86
src/util.h
@ -2,7 +2,8 @@
|
||||
* $Id: util.h,v 1.35 2005/04/12 19:34:35 nohar Exp $
|
||||
*
|
||||
* This file is part of the bip project
|
||||
* Copyright (C) 2004 2005 Arnaud Cornet and Loïc Gomez
|
||||
* Copyright (C) 2004,2005 Arnaud Cornet
|
||||
* Copyright (C) 2004,2005,2022 Loïc Gomez
|
||||
*
|
||||
* 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
|
||||
@ -42,11 +43,14 @@ struct list_item {
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
typedef struct list {
|
||||
struct list_item *first;
|
||||
struct list_item *last;
|
||||
int (*cmp)();
|
||||
} list_t;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
typedef struct list_iterator {
|
||||
list_t *list;
|
||||
@ -67,40 +71,45 @@ typedef struct hash_iterator {
|
||||
|
||||
typedef struct array {
|
||||
int elemc;
|
||||
void **elemv;
|
||||
const void **elemv;
|
||||
} array_t;
|
||||
|
||||
#define MOVE_STRING(dest, src) do {\
|
||||
if (dest)\
|
||||
free(dest);\
|
||||
(dest) = (src);\
|
||||
(src) = NULL;\
|
||||
} while(0)
|
||||
#define MOVE_STRING(dest, src) \
|
||||
do { \
|
||||
if (dest) \
|
||||
free(dest); \
|
||||
(dest) = (src); \
|
||||
(src) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define FREE(a) free(a); (a) = NULL;
|
||||
#define FREE(a) \
|
||||
free(a); \
|
||||
(a) = NULL;
|
||||
|
||||
#define MAYFREE(a) do { \
|
||||
if (a) { \
|
||||
free(a); \
|
||||
(a) = NULL; \
|
||||
} \
|
||||
} while(0);
|
||||
#define MAYFREE(a) \
|
||||
do { \
|
||||
if (a) { \
|
||||
free(a); \
|
||||
(a) = NULL; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define assert(condition) \
|
||||
do { \
|
||||
if (!(condition)) \
|
||||
fatal("Failed assertion in " __FILE__ "(%d): " \
|
||||
#condition, __LINE__); \
|
||||
} while(0)
|
||||
#define assert(condition) \
|
||||
do { \
|
||||
if (!(condition)) \
|
||||
fatal("Failed assertion in " __FILE__ \
|
||||
"(%d): " #condition, \
|
||||
__LINE__); \
|
||||
} while (0)
|
||||
|
||||
#define assert_msg(condition, msg) \
|
||||
do { \
|
||||
if (!(condition)) \
|
||||
fatal("%s in " __FILE__ "(%d): " \
|
||||
#condition, (msg), __LINE__); \
|
||||
} while(0)
|
||||
#define assert_msg(condition, msg) \
|
||||
do { \
|
||||
if (!(condition)) \
|
||||
fatal("%s in " __FILE__ "(%d): " #condition, (msg), \
|
||||
__LINE__); \
|
||||
} while (0)
|
||||
|
||||
void list_init(list_t *list, int (*cmp)(const void*, const void*));
|
||||
void list_init(list_t *list, int (*cmp)(const void *, const void *));
|
||||
int list_ptr_cmp(const void *a, const void *b);
|
||||
list_t *list_new(int (*cmp)(const void *, const void *));
|
||||
void *list_remove(list_t *list, const void *ptr);
|
||||
@ -125,7 +134,7 @@ static inline void list_it_next(list_iterator_t *ti)
|
||||
assert(ti);
|
||||
if (ti->cur) {
|
||||
if (ti->next)
|
||||
fatal("list_it_next: inconsistent interator state");
|
||||
fatal("list_it_next: inconsistent iterator state");
|
||||
ti->cur = ti->cur->next;
|
||||
} else if (ti->next) {
|
||||
ti->cur = ti->next;
|
||||
@ -174,10 +183,15 @@ char *checkmode2text(int v);
|
||||
void *bip_malloc(size_t size);
|
||||
void *bip_calloc(size_t nmemb, size_t size);
|
||||
void *bip_realloc(void *ptr, size_t size);
|
||||
void bip_cfree(const void *ptr);
|
||||
char *bip_strdup(const char *str);
|
||||
#define array_each(a, idx, ptr) for ((idx) = 0; \
|
||||
(idx) < (a)->elemc && (((ptr) = array_get((a), (idx))) || 1); \
|
||||
(idx)++)
|
||||
char *bip_strcat_fit(size_t *remaining, char *str, const char *str2);
|
||||
char *bip_strcatf_fit(size_t *remaining, char *str, const char *str2, ...);
|
||||
void bip_clock_gettime(clockid_t clockid, struct timespec *tp);
|
||||
#define array_each(a, idx, ptr) \
|
||||
for ((idx) = 0; (idx) < (a)->elemc \
|
||||
&& (((ptr) = bip_strdup(array_get((a), (idx)))) || 1); \
|
||||
(idx)++)
|
||||
|
||||
void array_init(array_t *a);
|
||||
array_t *array_new(void);
|
||||
@ -185,7 +199,7 @@ void array_ensure(array_t *a, int index);
|
||||
array_t *array_extract(array_t *a, int index, int upto);
|
||||
void array_deinit(array_t *a);
|
||||
void array_free(array_t *a);
|
||||
void *array_drop(array_t *a, int index);
|
||||
const void *array_drop(array_t *a, int index);
|
||||
static inline int array_count(array_t *a)
|
||||
{
|
||||
assert(a);
|
||||
@ -205,7 +219,7 @@ static inline void array_set(array_t *a, int index, void *ptr)
|
||||
a->elemv[index] = ptr;
|
||||
}
|
||||
|
||||
static inline void *array_get(array_t *a, int index)
|
||||
static inline const void *array_get(array_t *a, int index)
|
||||
{
|
||||
assert(a && array_includes(a, index));
|
||||
return a->elemv[index];
|
||||
@ -227,13 +241,13 @@ static inline void *array_pop(array_t *a)
|
||||
if (a->elemc == 0)
|
||||
return NULL;
|
||||
if (a->elemc == 1) {
|
||||
void *ptr = a->elemv[0];
|
||||
void *ptr = bip_strdup(a->elemv[0]);
|
||||
free(a->elemv);
|
||||
a->elemv = NULL;
|
||||
a->elemc = 0;
|
||||
return ptr;
|
||||
}
|
||||
return a->elemv[--a->elemc];
|
||||
return (void *)bip_strdup(a->elemv[--a->elemc]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
93
src/utils/base64.c
Normal file
93
src/utils/base64.c
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Base64 encoding/decoding (RFC1341)
|
||||
* Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2022 Loïc Gomez
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "base64.h"
|
||||
|
||||
static const unsigned char base64_table[65] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
/**
|
||||
* base64_encode - Base64 encode
|
||||
* @src: Data to be encoded
|
||||
* @len: Length of the data to be encoded
|
||||
* @out_len: Pointer to output length variable, or %NULL if not used
|
||||
* Returns: Allocated buffer of out_len bytes of encoded data,
|
||||
* or %NULL on failure
|
||||
*
|
||||
* Caller is responsible for freeing the returned buffer. Returned buffer is
|
||||
* nul terminated to make it easier to use as a C string. The nul terminator is
|
||||
* not included in out_len.
|
||||
*
|
||||
* BIP change: remove line returns.
|
||||
*/
|
||||
unsigned char *base64_encode(const unsigned char *src, size_t len,
|
||||
size_t *out_len)
|
||||
{
|
||||
unsigned char *out, *pos;
|
||||
const unsigned char *end, *in;
|
||||
size_t olen;
|
||||
int line_len;
|
||||
|
||||
olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
|
||||
olen += olen / 72; /* line feeds */
|
||||
olen++; /* nul termination */
|
||||
if (olen < len)
|
||||
return NULL; /* integer overflow */
|
||||
out = malloc(olen);
|
||||
if (out == NULL)
|
||||
return NULL;
|
||||
|
||||
end = src + len;
|
||||
in = src;
|
||||
pos = out;
|
||||
line_len = 0;
|
||||
while (end - in >= 3) {
|
||||
*pos++ = base64_table[in[0] >> 2];
|
||||
*pos++ = base64_table[((in[0] & 0x03) << 4) | (in[1] >> 4)];
|
||||
*pos++ = base64_table[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
|
||||
*pos++ = base64_table[in[2] & 0x3f];
|
||||
in += 3;
|
||||
line_len += 4;
|
||||
/*
|
||||
* BIP change: remove line returns.
|
||||
if (line_len >= 72) {
|
||||
*pos++ = '\n';
|
||||
line_len = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (end - in) {
|
||||
*pos++ = base64_table[in[0] >> 2];
|
||||
if (end - in == 1) {
|
||||
*pos++ = base64_table[(in[0] & 0x03) << 4];
|
||||
*pos++ = '=';
|
||||
} else {
|
||||
*pos++ = base64_table[((in[0] & 0x03) << 4)
|
||||
| (in[1] >> 4)];
|
||||
*pos++ = base64_table[(in[1] & 0x0f) << 2];
|
||||
}
|
||||
*pos++ = '=';
|
||||
line_len += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* BIP change: remove line returns.
|
||||
if (line_len)
|
||||
*pos++ = '\n';
|
||||
*/
|
||||
|
||||
*pos = '\0';
|
||||
if (out_len)
|
||||
*out_len = (size_t)(pos - out);
|
||||
return out;
|
||||
}
|
16
src/utils/base64.h
Normal file
16
src/utils/base64.h
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Base64 encoding/decoding (RFC1341)
|
||||
* Copyright (c) 2005, Jouni Malinen <j@w1.fi>
|
||||
* Copyright (c) 2022 Loïc Gomez
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef BASE64_H
|
||||
#define BASE64_H
|
||||
|
||||
unsigned char *base64_encode(const unsigned char *src, size_t len,
|
||||
size_t *out_len);
|
||||
|
||||
#endif /* BASE64_H */
|
@ -1,5 +1,6 @@
|
||||
[Unit]
|
||||
Description=Bip IRC Proxy
|
||||
Documentation=man:bip(1) man:bip.conf(5)
|
||||
Requires=network.target
|
||||
|
||||
Wants=bip-config.service
|
||||
@ -11,7 +12,7 @@ EnvironmentFile=/run/sysconfig/bip
|
||||
Type=forking
|
||||
User=bip
|
||||
Group=bip
|
||||
ExecStartPre=/bin/sh -c '[ $ENABLED != 0 ]'
|
||||
ExecStartPre=/bin/sh -c '[ ${ENABLED:-1} != 0 ]'
|
||||
ExecStart=/usr/bin/bip $DAEMON_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
RuntimeDirectory=bip
|
||||
|
5
tests/Makefile.am
Normal file
5
tests/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
||||
TESTS = check_line
|
||||
check_PROGRAMS = check_line
|
||||
check_line_SOURCES = check_line.c $(top_builddir)/src/line.h
|
||||
check_line_CFLAGS = @CHECK_CFLAGS@ $(OPENSSL_CFLAGS)
|
||||
check_line_LDADD = $(top_builddir)/src/libbip.a $(top_builddir)/src/libbiplex.a @CHECK_LIBS@ $(OPENSSL_LIBS)
|
134
tests/check_line.c
Normal file
134
tests/check_line.c
Normal file
@ -0,0 +1,134 @@
|
||||
#include <check.h>
|
||||
#include "../src/line.h"
|
||||
|
||||
START_TEST(test_line_init)
|
||||
{
|
||||
struct line line;
|
||||
irc_line_init(&line);
|
||||
irc_line_append(&line, "line");
|
||||
char *hi_string = irc_line_to_string(&line);
|
||||
ck_assert_str_eq(hi_string, "line\r\n");
|
||||
free(hi_string);
|
||||
_irc_line_deinit(&line);
|
||||
|
||||
struct line *line2 = irc_line_new();
|
||||
irc_line_append(line2, "line");
|
||||
hi_string = irc_line_to_string(line2);
|
||||
ck_assert_str_eq(hi_string, "line\r\n");
|
||||
free(hi_string);
|
||||
irc_line_free(line2);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_line_parse)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
ck_assert_int_eq(irc_line_count(line), 4);
|
||||
ck_assert(irc_line_includes(line, 0));
|
||||
ck_assert(irc_line_includes(line, 3));
|
||||
ck_assert(!irc_line_includes(line, 4));
|
||||
ck_assert_str_eq(line->origin, "origin");
|
||||
ck_assert_str_eq(irc_line_elem(line, 0), "COMMAND");
|
||||
ck_assert_str_eq(irc_line_elem(line, 1), "parameter1");
|
||||
ck_assert_str_eq(irc_line_elem(line, 2), "parameter2");
|
||||
ck_assert_str_eq(irc_line_elem(line, 3), "multi word parameter\r\n");
|
||||
irc_line_free(line);
|
||||
|
||||
line = irc_line_new_from_string(
|
||||
"COMMAND parameter1 parameter2 :multi word parameter\r\n");
|
||||
ck_assert_int_eq(irc_line_count(line), 4);
|
||||
ck_assert(irc_line_includes(line, 0));
|
||||
ck_assert(irc_line_includes(line, 3));
|
||||
ck_assert(!irc_line_includes(line, 4));
|
||||
ck_assert_str_eq(irc_line_elem(line, 0), "COMMAND");
|
||||
ck_assert_str_eq(irc_line_elem(line, 1), "parameter1");
|
||||
ck_assert_str_eq(irc_line_elem(line, 2), "parameter2");
|
||||
ck_assert_str_eq(irc_line_elem(line, 3), "multi word parameter\r\n");
|
||||
irc_line_free(line);
|
||||
|
||||
line = irc_line_new_from_string(":origin COMMAND\r\n");
|
||||
ck_assert_str_eq(line->origin, "origin");
|
||||
ck_assert_int_eq(irc_line_count(line), 1);
|
||||
ck_assert(irc_line_includes(line, 0));
|
||||
ck_assert(!irc_line_includes(line, 1));
|
||||
ck_assert_str_eq(irc_line_elem(line, 0), "COMMAND\r\n");
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_elem_equals)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
ck_assert(irc_line_elem_equals(line, 0, "COMMAND"));
|
||||
ck_assert(irc_line_elem_case_equals(line, 0, "command"));
|
||||
ck_assert(!irc_line_elem_equals(line, 0, "notcommand"));
|
||||
ck_assert(!irc_line_elem_case_equals(line, 0, "notcommand"));
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_line_pop)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
char *top = irc_line_pop(line);
|
||||
ck_assert_str_eq(top, "multi word parameter\r\n");
|
||||
free(top);
|
||||
top = irc_line_pop(line);
|
||||
ck_assert_str_eq(top, "parameter2");
|
||||
free(top);
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_line_drop)
|
||||
{
|
||||
struct line *line = irc_line_new_from_string(
|
||||
":origin COMMAND parameter1 parameter2 "
|
||||
":multi word parameter\r\n");
|
||||
irc_line_drop(line, 1);
|
||||
ck_assert(irc_line_elem_equals(line, 0, "COMMAND"));
|
||||
ck_assert(irc_line_elem_equals(line, 1, "parameter2"));
|
||||
irc_line_drop(line, 0);
|
||||
ck_assert(irc_line_elem_equals(line, 0, "parameter2"));
|
||||
irc_line_free(line);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
Suite *money_suite(void)
|
||||
{
|
||||
Suite *s;
|
||||
TCase *tc_core;
|
||||
|
||||
s = suite_create("bip");
|
||||
|
||||
tc_core = tcase_create("core");
|
||||
|
||||
tcase_add_test(tc_core, test_line_init);
|
||||
tcase_add_test(tc_core, test_line_parse);
|
||||
tcase_add_test(tc_core, test_elem_equals);
|
||||
tcase_add_test(tc_core, test_line_pop);
|
||||
suite_add_tcase(s, tc_core);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int number_failed;
|
||||
Suite *s;
|
||||
SRunner *sr;
|
||||
|
||||
s = money_suite();
|
||||
sr = srunner_create(s);
|
||||
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
number_failed = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
Loading…
Reference in New Issue
Block a user