Compare commits

...

529 Commits

Author SHA1 Message Date
Loïc Gomez 40ac98214a
Add missing defines for SOFT_FAIL/HARD_FAIL in util.h
This is for these previous 2 commits:
  * 428c1b6 Allow checking ssl files are readable (check_ssl_files)
  * a03b123 Also reload SSL context on bip reload, allowing for SSL cert updates
2024-03-20 23:27:33 +09:00
Loïc Gomez a03b12319a
Also reload SSL context on bip reload, allowing for SSL cert updates
- on BIP reload, check if SSL files are readable, and try to load new
  SSL context.
- on success only, update SSL context for new client connections

This allows for SSL certificate/key updates on /BIP reload or SIGHUP.

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:42:01 +09:00
Loïc Gomez 428c1b6173
Allow checking ssl files are readable (check_ssl_files)
- adds a new check_path_exists() method to path_util
- move code checking if SSL-related files exist with assertions (thus
  causing a fatal error) to a new check_ssl_files() method, allowing for
  soft or hard fail modes

This will allow for non-fatal checks of SSL files existence on reload.

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:33:31 +09:00
Loïc Gomez f2443aaf23
Move SSL context code to get/set_ssl_context methods
- Move code setting up SSL context from accept_new() to new
  get/set_ssl_context() methods
- set_ssl_context() will allow setting context only if not already set,
  or force re-setting context even if already present
- set_ssl_context() will return 1 if SSL context has been set
- if getting the new SSL context fails, set_ssl_context() will not break
  current SSL context

This is preparatory work for reloading SSL certificates/key on BIP
reload.

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:29:05 +09:00
Loïc Gomez 400b0d66de
Fix deprecation notices for OpenSSL 3 and failure to build on GCC12
Tested with libssl 3.0.10-1ubuntu2.1 (Ubuntu 23.10) and 1.1.1f-1ubuntu2.20
(Ubuntu 20.04).

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:27:20 +09:00
Loïc Gomez e643cd4944
Fix endless loop on /BIP LIST connections with long on_connect_send
- when the line to send to IRC was over a specific limit, the code was
  not moving to the next item in the on_connect_send list after sending
  the text to the client
- this change also adds a hard limit of 10 on_connect_send to display
  for each connection

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:19:28 +09:00
Loïc Gomez 8f3b313776
Fix file descriptor leak on erroring client disconnects
- Client connections in error also need to be closed/freed
- This fixes a file descriptor leak that would result in a bip crash

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:18:09 +09:00
Loïc Gomez d49f135370
Move strict gcc compilation flags to configure.ac to avoid breaking incompatible environments
- Move gcc hardening/warning/advanced warnings flags to configure.ac to avoid
  breaking incompatible environments
- Use -Warith-conversion only with gcc 10 and later
- Keep -Wundef -Wpedantic enabled globally

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:16:25 +09:00
Loïc Gomez 5f054bdded
Fix bipmkpw compilation issues per external variables
- Add missing extern stanza to global variables

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:10:37 +09:00
Loïc Gomez 76c9ee11de
Handle CAP requests from clients, reply with no capabilities
Some clients require the server to handle CAP requests (IRCv3).
This adds basic support for CAP requests during the authentication
phase, sending no capabilities on CAP LS or CAP LIST, and CAP NAK
with all requested capabilities listed on CAP REQ.

This will be a base for adding capabilities later.

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 22:07:43 +09:00
Loïc Gomez b810ba0f77
Add method to stringify a line struct, skipping first N elements
- adds an internal method _irc_line_to_string with current irc_line_to_string
  code, adding capability to skip the first N elements
- call this internal method from irc_line_to_string with N=0
- call this internal method from new irc_line_to_string_skip method

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-03-20 21:53:45 +09:00
Loïc Gomez d19099eb3c
Log unhandled IRC errors as LOG_INFO in bip.log
This will allow for user feedback in main bip.log when an IRC error
occurs, like:
- 401 ERR_NOSUCHNICK
- 404 ERR_CANNOTSENDTOCHAN
- 432 ERR_ERRONEUSNICKNAME

These should not be logged as LOG_ERROR as they are not bip errors but
usually on the end user instead.

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-02-18 23:45:12 +01:00
Loïc Gomez 99a1244e46
Allow a user to /BIP JUMP [-f] [other_conn] (within their list).
This can be useful when a connection is very slow to reconnect and the
user wants to force an immediate reconnection.

Also:
- fix message when JUMPing on some already reconnecting link
- add find_link() method
- add reconnect timer info if any (else display 0s)
- add -f flag to reset reconnect timer

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-02-18 23:39:27 +09:00
Loïc Gomez edd460a8fa
Set default recon_timer (and step) to 30s
Waiting 2 minutes on the first disconnect is depressing.
With this the maximum of 10min wait time is reached after 20 attempts
instead of the current 5 attempts.

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-02-18 00:07:41 +01:00
Loïc Gomez 4cd5bdb381
Set default backlog_lines = 0 (fixes Debian bug #818374)
This would have defaults move to backlog_always=false / log=true /
backlog_lines=0, which should not cause much trouble as backlog will
be reset after being displayed.

Also, it is doubtfuk anyone would be keeping the default of 10 for
backlog as it is pretty much an undesirable configuration.

We need to annouce this change as important though, so users having
log = false are aware memory usage could increase if they don't set
it manually to another value.

Signed-off-by: Loïc Gomez <bip@animanova.fr>
2024-02-17 03:29:45 +01:00
Pierre-Louis Bonicoli c6a872ed61
Add bipgenconfig.1 to dist_man_MANS
Fix 1df884545f
2022-03-20 11:42:09 +01:00
Pierre-Louis Bonicoli f797d25e06
Add -git to version string. 2022-03-10 15:57:31 +01:00
Pierre-Louis Bonicoli 0a93c8cfd3
Update version and ChangeLog for bip-0.9.3 release. 2022-03-10 15:57:25 +01:00
Pierre-Louis Bonicoli 18665b1501
Update NEWS file (SASL, GCC flags, /bip user info) 2022-03-10 14:38:26 +01:00
Pierre-Louis Bonicoli f2fd1824ca
Format the whole code using clang-format 2022-03-10 14:21:01 +01:00
Loïc Gomez 8d9658ca43
Build lexer in a separate unit without AM_CFLAGS 2022-03-10 14:20:58 +01:00
Loïc Gomez e04f97c78f
ignore some issues related to array_get
ignore "passing argument X of .... with different width due to prototype"
2022-03-10 14:20:55 +01:00
Loïc Gomez 26d347dec6
sanitize: fix const char * being used as non-const 2022-03-10 14:20:52 +01:00
Loïc Gomez ee6ee0bd34
irc_cli_part set cname to proper const char * 2022-03-10 14:20:49 +01:00
Loïc Gomez edf78eadb1
sanitize: pragmas for our code 2022-03-10 14:20:46 +01:00
Loïc Gomez efb79b1e80
sanitize: a bit evolved size_t cast for get_str_elem 2022-03-10 14:20:43 +01:00
Loïc Gomez 79d9be4e71
sanitize: ftell/fseek & len/file_offset type fixes 2022-03-10 14:20:41 +01:00
Loïc Gomez dbf8ccd4de
sanitize: more NULL pointer failsafes 2022-03-10 14:20:35 +01:00
Loïc Gomez f54775fe92
sanitize: ignore warnings related to external libs 2022-03-10 14:20:32 +01:00
Loïc Gomez f379eb35d2
sanitize: oidentd handler fixes 2022-03-10 14:20:29 +01:00
Loïc Gomez ce4cf8b6a0
sanitize: add bip_clock_gettime util function 2022-03-10 14:20:26 +01:00
Loïc Gomez 368149575d
sanitize: null writes, write errors, oversized int,
and set incoming_end to size_t
2022-03-10 14:20:23 +01:00
Loïc Gomez b990a071b3
sanitize: fix pid/pidfile handling 2022-03-10 14:20:20 +01:00
Loïc Gomez af590f83b7
lag shouldn't be allowed to go negative 2022-03-10 14:20:17 +01:00
Loïc Gomez 62fd77dc17
l_clientc should not be allowed to go negative 2022-03-10 14:20:15 +01:00
Loïc Gomez dd5343b710
use proper types, safe casts (mostly size_t) 2022-03-10 14:20:12 +01:00
Loïc Gomez 94fe272018
handle more config errors, use char not int:1 2022-03-10 14:20:06 +01:00
Loïc Gomez fbfae37d65
sanitize: configuration parsing 2022-03-10 14:20:03 +01:00
Loïc Gomez 9d6394679f
sanitize: check return value 2022-03-10 14:20:00 +01:00
Loïc Gomez 2a5e7b6f7b
sanitize: add trivial casts to types
and add missing default cases
2022-03-10 14:19:57 +01:00
Loïc Gomez e694dae31c
functions without parameters: add missing void 2022-03-10 14:19:51 +01:00
Loïc Gomez 26d34bafab
sanitize: add bipmkpw_fatal & fix bipmkpw warnings 2022-03-10 14:19:46 +01:00
Loïc Gomez fe108e390f
Add secure / strict CFLAGS
Ref: https://airbus-seclab.github.io/c-compiler-security/#gcc-tldr
2022-03-10 14:19:40 +01:00
Loïc Gomez e7d82acfff
Update build configuration 2022-03-10 14:19:37 +01:00
Loïc Gomez 51a46a1454
Add compiled stuff to gitignore 2022-03-10 14:19:34 +01:00
Loïc Gomez 7680af6a09
Add make lint calling clang-format & force 80 cols 2022-03-10 14:19:31 +01:00
Loïc Gomez 34b3c4b0c3
Move /BIP to bip_strcat{,f}_fit memccpy wrapper
instead of snprintf.
2022-03-10 14:19:28 +01:00
Loïc Gomez 399a104d1e
fix /bip user info command 2022-03-10 14:19:22 +01:00
Loïc Gomez dc43d75d1f
Add SASL authentication support (EXTERNAL, PLAIN) 2022-03-10 14:19:19 +01:00
Pierre-Louis Bonicoli 1df884545f
Add a man page for the bipgenconfig script
This man page comes from the Debian package.
2021-10-17 12:52:00 +02:00
Pierre-Louis Bonicoli 814ef72938
Add man pages in Documentation key of systemd unit 2021-10-17 12:47:12 +02:00
Pierre-Louis Bonicoli 462c1036fc
Fix spelling errors found by Lintian 2021-10-17 12:19:39 +02:00
Pierre-Louis Bonicoli 9aa9e719d9
new release: ensure NEWS file is up to date 2021-10-13 13:13:22 +02:00
Pierre-Louis Bonicoli ce67374c0e
Synchronize NEWS file & NEWS from project 2021-10-13 12:01:18 +02:00
Pierre-Louis Bonicoli 42ccca7849
Add -git to version string. 2021-10-12 21:33:19 +02:00
Pierre-Louis Bonicoli 49688a5aa1
Update version and ChangeLog for bip-0.9.2 release. 2021-10-12 21:33:13 +02:00
Pierre-Louis Bonicoli ef70865450
Fix minor issues in bip sample configuration file 2021-10-12 18:53:26 +02:00
Pierre-Louis Bonicoli 9579b5fb3f
Add missing keywords in vim syntax file
Add autojoin_on_kick, backlog_reset_connection, ignore_server_capab,
reconn_timer and write_oidentd keywords.
2021-10-12 18:46:23 +02:00
Pierre-Louis Bonicoli bffdbe8b19
backlog_timestamp: update man page & vim syntax
Complete 0c1881b921 and
2c7b8aa155.
2021-10-12 18:45:44 +02:00
Pierre-Louis Bonicoli a974323a8f
Fix syntax issue in vim syntax file
backlog keywords were ignored due to this issue.
2021-10-12 18:44:10 +02:00
Pierre-Louis Bonicoli 12a6dbc352
Add -git to version string. 2021-10-11 18:14:43 +02:00
Pierre-Louis Bonicoli 1816044070
Update version and ChangeLog for bip-0.9.1 release. 2021-10-11 18:14:37 +02:00
Pierre-Louis Bonicoli 722ed9a8da
ENABLED might not be defined: use a default value
For example using ENABLED in /etc/default/bip is DEPRECATED in Debian.

Closes #618.
2021-10-11 18:06:27 +02:00
Pierre-Louis Bonicoli df2a9eab17
Add -git to version string. 2021-10-11 14:50:25 +02:00
Pierre-Louis Bonicoli d0bb1d4dc0
Update version and ChangeLog for bip-0.9.0 release. 2021-10-11 14:50:19 +02:00
Pierre-Louis Bonicoli 0e9e61decb
Update version and ChangeLog for bip-0.9.0 release. 2021-10-11 14:49:17 +02:00
Pierre-Louis Bonicoli 844395db1a
Update NEWS file: add user facing changes 2021-10-08 19:44:40 +02:00
Pierre-Louis Bonicoli 0c1881b921
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";
2021-10-08 19:44:08 +02:00
Pierre-Louis Bonicoli 8b343aa5b0
Merge branch 'allow-customizing-the-timestamp-format' 2021-10-08 11:57:53 +02:00
Thomas Vigouroux 2c7b8aa155
Allow customizing the timestamp format 2021-10-08 11:50:17 +02:00
Pierre-Louis Bonicoli 1732209c70
Merge branch 'wording_and_typo' 2021-10-08 11:48:18 +02:00
Pierre-Louis Bonicoli 3d732651bc
Improve wording in error message 2021-10-07 18:10:28 +02:00
Pierre-Louis Bonicoli e6547b8a48
Fix a typo (s/LOGING/LOGGING/) 2021-10-07 18:10:25 +02:00
Pierre-Louis Bonicoli 75317ae17c
Add -git to version string. 2020-05-18 04:47:11 +02:00
Pierre-Louis Bonicoli 7362a46a0f
Update version and ChangeLog for bip-0.9.0-rc4 release. 2020-05-18 04:47:05 +02:00
Pierre-Louis Bonicoli 92a1f07c76
bip-release: update regex
Related: c0fafe669d
2020-05-18 04:43:59 +02:00
Pierre-Louis Bonicoli 63453bad41
Update INSTALL file which refers to README
for specific instructions.
2020-05-18 04:04:06 +02:00
Adam Williamson 92819d87ea
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.
2020-05-18 03:28:44 +02:00
Arnaud Cornet c9cc64f2e1 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.
2018-12-25 10:13:54 -05:00
Arnaud Cornet 0044826084 Don't unbind succesful trusting clients twice.
Complements commit 60122ef160.
2018-12-24 16:58:59 -05:00
Arnaud Cornet 60122ef160 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
2018-12-17 22:33:19 -05:00
Pierre-Louis Bonicoli 814d54c676
use strftime instead of snprintf wherever possible 2018-12-12 03:02:21 +01:00
Pierre-Louis Bonicoli a86b73ab03
reuse AM_CFLAGS wherever needed 2018-12-12 02:09:10 +01:00
Arnaud Cornet e5005cea34 Cleanup the network properly when we fail to load. 2018-12-11 19:46:38 -05:00
Arnaud Cornet 16f2be6ac2 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
2018-12-11 19:37:36 -05:00
Pierre-Louis Bonicoli 09053fc5f0
CFLAGS: use -W{all,extra,error} by default again 2018-12-11 11:12:08 +01:00
Pierre-Louis Bonicoli 1f8a8763cb
'-Wall -Werror' automake switches are used by default
since c0fafe669d
2018-12-11 11:09:25 +01:00
Pierre-Louis Bonicoli c93a7e841a
Fix a typo 2018-12-11 11:04:39 +01:00
Pierre-Louis Bonicoli 843cf3738e
oidentd is a runtime option: update doc & script 2018-12-11 11:04:18 +01:00
Arnaud Cornet 65406960aa Merge remote-tracking branch 'origin/master' 2018-12-09 20:05:40 -05:00
Arnaud Cornet df5508eed0 Deal more gracefully with long home directories.
This is a better fix for:
https://projects.duckcorp.org/issues/636
2018-12-09 19:52:46 -05:00
Arnaud Cornet 87192685f5 Fix gcc-8 warning.
Change weird use of strncpy where we know we will truncate and use an
extra byte copy instead.
2018-12-09 19:40:36 -05:00
Arnaud Cornet d2dcb0adb1 Fix warning with gcc-8.
Fixes: https://projects.duckcorp.org/issues/636
2018-12-09 19:27:56 -05:00
Pierre-Louis Bonicoli 02c55a37b2
add debug log & differentiate error messages 2018-12-10 00:18:54 +01:00
Arnaud Cornet e224f067c1
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
2018-12-10 00:15:18 +01:00
Arnaud Cornet 936b766905
Make the tests subdirectory optional.
Otherwise build breaks when check is not installed.
2018-12-10 00:15:07 +01:00
Arnaud Cornet caf979a4c5
Close descriptor when SSL reports a system error.
Avoids leaking fd when connections are closed abruptly.
2018-12-10 00:14:57 +01:00
Arnaud Cornet 513a6582ad
Add CFLAGS needed for openssl.
Otherwise building fails in platforms with esoteric openssl locations.
2018-12-10 00:14:45 +01:00
Arnaud Cornet ba5cef017c
Fix test automake file to link openssl. 2018-12-10 00:14:19 +01:00
Arnaud Cornet 2bf967bacc
Add missing OpenSSL CFLAGS/LDFLAGs to build.
Those were removed by mistake in the previous autotool refactor.
2018-12-10 00:14:08 +01:00
Arnaud Cornet 34a92dedb1
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.
2018-12-10 00:05:44 +01:00
Arnaud Cornet 7844716af5
Fewer configure options.
Use pkg-config to detect openssl.
Eagerly use backtrace if provided by libc.
2018-12-10 00:05:29 +01:00
Arnaud Cornet 87f3415330
Fewer build options.
Eagerly depend on openssl and check, build degraded without.
2018-12-10 00:05:19 +01:00
Arnaud Cornet c0fafe669d
Simplify autotools configuration. 2018-12-10 00:03:50 +01:00
Arnaud Cornet a80e74bbdc
Add .clang-format file. 2018-12-10 00:02:28 +01:00
Arnaud Cornet fabaec9d80
More files in .gitignore 2018-12-10 00:02:13 +01:00
Arnaud Cornet e222e1c986
Add .gitignore. 2018-12-10 00:02:04 +01:00
Arnaud Cornet 0b8269e2d3 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
2018-12-09 16:06:18 -05:00
Arnaud Cornet e27b84f15e Make the tests subdirectory optional.
Otherwise build breaks when check is not installed.
2018-12-09 15:08:58 -05:00
Arnaud Cornet 4d7f243777 Close descriptor when SSL reports a system error.
Avoids leaking fd when connections are closed abruptly.
2018-12-09 14:27:59 -05:00
Arnaud Cornet 2fd3418a9e Add CFLAGS needed for openssl.
Otherwise building fails in platforms with esoteric openssl locations.
2018-12-09 14:04:43 -05:00
Arnaud Cornet b963308e6c Fix test automake file to link openssl. 2018-11-30 09:00:51 -05:00
Arnaud Cornet fbde155287 Add missing OpenSSL CFLAGS/LDFLAGs to build.
Those were removed by mistake in the previous autotool refactor.
2018-11-18 15:37:46 -05:00
Arnaud Cornet 012b21a68b 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.
2018-11-18 15:07:16 -05:00
Arnaud Cornet 40233ff938 Fewer configure options.
Use pkg-config to detect openssl.
Eagerly use backtrace if provided by libc.
2018-11-18 14:30:17 -05:00
Arnaud Cornet 7dec6b3072 Fewer build options.
Eagerly depend on openssl and check, build degraded without.
2018-11-18 14:23:06 -05:00
Arnaud Cornet 27f1cf988b Simplify autotools configuration. 2018-11-18 09:10:16 -05:00
Arnaud Cornet 1e80291b9c Add .clang-format file. 2018-11-18 08:19:26 -05:00
Arnaud Cornet 362ec25e4b More files in .gitignore 2018-11-18 08:18:42 -05:00
Arnaud Cornet f4ac33f63c Add .gitignore. 2018-11-18 08:15:31 -05:00
Arnaud Cornet aa35b372b4
Add unit tests.
Add an optional build dependency on check and add an initial test case.
2018-11-14 02:26:39 +01:00
Arnaud Cornet 34711f7653
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.
2018-11-14 02:26:27 +01:00
Arnaud Cornet 53dafd9590 Add unit tests.
Add an optional build dependency on check and add an initial test case.
2018-11-13 08:25:46 -05:00
Arnaud Cornet 057107a233 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.
2018-11-11 18:18:21 -05:00
Pierre-Louis Bonicoli b75345d6b5
Add -git to version string. 2018-03-27 00:14:12 +02:00
Pierre-Louis Bonicoli cf144594a0
Update version and ChangeLog for bip-0.9.0-rc3 release. 2018-03-27 00:13:57 +02:00
Pierre-Louis Bonicoli eaed46da14
Merge branch 'path_test_use_stat' 2018-03-22 02:37:38 +01:00
Pierre-Louis Bonicoli 025689d807
Merge branch 'dh_param_not_mandatory' 2018-03-22 02:37:23 +01:00
Pierre-Louis Bonicoli 948b41ef7a
Merge branch 'fix_path_construction_issue' 2018-03-22 02:37:10 +01:00
Pierre-Louis Bonicoli 7834471f78
default value isn't used when path doesn't exist 2018-03-22 02:33:25 +01:00
Pierre-Louis Bonicoli 13b2e37635
DH parameters are not always required
for example ECDHE ciphers doesn't require DH parameters.

Closes #499
2018-03-22 02:33:19 +01:00
Pierre-Louis Bonicoli 3afb16d795
checking path: use stat
fopen was used because it's stdlib but stat is already used in other
parts
2018-03-21 11:54:20 +01:00
Pierre-Louis Bonicoli 348737fab5
Fix path construction
Thanks to Renzokuken for pointing that !
Closes #610
2018-03-21 11:09:48 +01:00
Pierre-Louis Bonicoli 385be75f7e
Add -git to version string. 2018-02-19 20:26:34 +01:00
Pierre-Louis Bonicoli 8ceebf1fd8
Update version and ChangeLog for bip-0.9.0-rc2 release. 2018-02-19 20:25:59 +01:00
Pierre-Louis Bonicoli 901f54eff0
Merge branch 'username_disallow_duplicate' 2018-02-19 20:09:25 +01:00
Pierre-Louis Bonicoli 96f0403a2a
remove useless calls to FREE
MOVE_STRING macro is used in order to initialize parameters, this
macro calls free when necessary.
2018-02-19 20:08:26 +01:00
Pierre-Louis Bonicoli 83d7f2acbe
Add missing call to MAYFREE 2018-02-19 20:07:38 +01:00
Pierre-Louis Bonicoli dbe19d9387
Handle no defined users 2018-02-19 20:05:32 +01:00
Pierre-Louis Bonicoli 903a88e589
Merge branch 'systemd' 2018-02-19 19:59:06 +01:00
Pierre-Louis Bonicoli 866552e102
sample conf: on_connect_send can be used more than once 2018-02-19 19:57:51 +01:00
Pierre-Louis Bonicoli aad87daa9e
sample conf: reformat 2018-02-19 19:57:46 +01:00
Pierre-Louis Bonicoli 6d3bff1969
sample conf: remove trailing spaces 2018-02-19 19:57:40 +01:00
Pierre-Louis Bonicoli 97e19a5215
sample conf: comment the whole file 2018-02-19 19:57:35 +01:00
Pierre-Louis Bonicoli a31cbe45fa
bipmkpw man page: mention bip man page 2018-02-19 19:57:29 +01:00
Pierre-Louis Bonicoli 072a17b55b
bip.conf manpage: improve formatting
- follow man-pages conventions
- HTML output produced by groff is more readable
2018-02-19 19:57:24 +01:00
Pierre-Louis Bonicoli cdbf22cdb7
bip.conf manpage: mention default of ciphers related options 2018-02-19 19:57:18 +01:00
Pierre-Louis Bonicoli 3b9f683d31
bip.conf manpage: fix doc of 'ip' option 2018-02-19 19:57:13 +01:00
Pierre-Louis Bonicoli 09152a1a7d
bip.conf manpage: new section 'IRC CLIENT CONF' 2018-02-19 19:57:07 +01:00
Pierre-Louis Bonicoli 11482caa95
bip.conf manpage: add a SYNOPSIS section 2018-02-19 19:57:01 +01:00
Pierre-Louis Bonicoli b474f55e8a
bip manpage: mention -s switch in SYNOPSIS section 2018-02-19 19:56:55 +01:00
Pierre-Louis Bonicoli af46159275
Sample config file: add default values 2018-02-19 19:56:49 +01:00
Pierre-Louis Bonicoli e52df8d086
sample.conf: use /run instead of /var/run 2018-02-19 19:56:44 +01:00
Pierre-Louis Bonicoli 3f4a260a54
Add systemd unit files
Largely inspired by https://lwn.net/Articles/584175/
"They must be suitable for every distribution to use."

Packagers must define:
- ExecStart=/path/to/bip_env.sh
- Environment=BIP_DEFAULT_CONFIG='/path/to/default/bip'
using a unit file drop-in bip-config.service.d/<distrib>.conf
2018-02-19 19:56:37 +01:00
Pierre-Louis Bonicoli 554c372452
Sign commits created by release script 2017-07-26 10:41:43 +02:00
Adam Williamson 2ecd82f011
Fix some 'const const char' declarations
That's one two many consts...recent GCC blips on this.

Signed-off-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
2017-07-26 02:46:26 +02:00
Pierre-Louis Bonicoli 0e6444198b Add -git to version string. 2016-11-12 01:36:22 +01:00
Pierre-Louis Bonicoli 19c1b631ea Update version and ChangeLog for bip-0.9.0-rc1 release. 2016-11-12 01:36:21 +01:00
Pierre-Louis Bonicoli 2e81cca480 Check value returned by X509_OBJECT_new()
Reported by Alexander Couzens, thanks to him !
2016-11-12 01:09:40 +01:00
Pierre-Louis Bonicoli e452c023ad X509_OBJECT_new: call X509err
mimic behavior of X509_OBJECT_new provided by OpenSSL >= 1.1
2016-11-12 01:09:40 +01:00
Pierre-Louis Bonicoli 6b38449875 Allow to set DH parameters 2016-11-07 17:50:20 +01:00
Pierre-Louis Bonicoli 5db61f3982 Allow to set oidentd path 2016-11-07 11:26:22 +01:00
Pierre-Louis Bonicoli e8b5d02f13 Add missing call to SSL_CTX_free 2016-11-07 11:25:47 +01:00
Pierre-Louis Bonicoli 406ebacfe5 check value returned by SSL_CTX_new 2016-11-07 11:25:44 +01:00
Pierre-Louis Bonicoli 30270bc8e8 sample configuration: add per connection log parameter 2016-11-07 11:25:39 +01:00
Pierre-Louis Bonicoli ab8e5eece1 Add cipher specifications setting
Allow to configure cipher specifications for the listening bip
connection and for each outgoing IRC connection.

Closes #301
2016-11-07 11:25:37 +01:00
Pierre-Louis Bonicoli 20f39abc56 bipdir improvements
- more documentation
- don't die if environment variable $HOME isn't defined but '-s'
  parameter is used
- oidentd: change path, file is located in bipdir
2016-11-07 11:25:34 +01:00
Pierre-Louis Bonicoli 39414f8ff9 Handle OpenSSL version 1.1
adding forward-compatible code to older versions
2016-06-29 19:40:32 +02:00
Pierre-Louis Bonicoli 148b38a953 Prefixes and usermodes were inverted 2015-09-11 11:31:37 +02:00
Pierre-Louis Bonicoli 209b9a7cd7 Add missing terminating null byte
Reported by Trou, thanks to him !
Closes #477
2015-09-11 11:31:32 +02:00
Pierre-Louis Bonicoli 5594e69bf6 Use a new logfile when day changed 2015-09-11 11:22:32 +02:00
Pierre-Louis Bonicoli bdec94020e Use monotonic time 2015-09-11 11:22:21 +02:00
Pierre-Louis Bonicoli 34baf6e841 Always call bip_tick when select timeout 2015-09-11 11:21:52 +02:00
Pierre-Louis Bonicoli 9df25a6423 Reformatting 2015-07-10 23:09:18 +02:00
Pierre-Louis Bonicoli ddf7958353 Use AC_RUN_IFELSE instead deprecated AC_TRY_RUN 2015-07-10 13:18:27 +02:00
Pierre-Louis Bonicoli fbb285fc91 Update AC_PREREQ entry: bump to 2.69 2015-07-10 13:18:01 +02:00
Pierre-Louis Bonicoli 4eec084452 Allow to configure the delay before a reconnection
Initial patch submitted by Romain Gayon, thanks to him !
2014-12-11 18:19:11 +01:00
Pierre-Louis Bonicoli 73483ff088 Handle PREFIX defined in ISUPPORT
ISUPPORT is a de facto standard extension to IRC.
Available prefixes and usermodes are handled at the connection
level (link_level struct).
2014-12-11 16:50:18 +01:00
Pierre-Louis Bonicoli e88d7da760 Handle CHANMODES defined in ISUPPORT
ISUPPORT is a de facto standard extension to IRC.
chanmodes are handled at the connection level (link_level struct).
2014-12-11 16:50:17 +01:00
Pierre-Louis Bonicoli fda9fccb85 Handle unlikely case: "CAPAB" present twice
If "CAPAB" element were present twice, a wrong element would be removed.
2014-12-11 16:50:17 +01:00
Pierre-Louis Bonicoli db27168c76 Avoid unnecessary test
The first element is "005", it cannot be "CAPAB".
2014-12-11 16:50:05 +01:00
Pierre-Louis Bonicoli f7ace64abe Remove dead links from the list of all links
Fix segfault that occurs when bip admin users use:
/BIP DEL_CONN <connection name>
/BIP ADD_CONN <connection name> <network>

Closes #325
2014-12-11 16:40:28 +01:00
Adam Williamson 88242715f4 allow for certificate store to be unspecified in CA mode
In many cases, using OpenSSL's default certificate store is fine
and even preferred. If your OpenSSL provider (e.g. your
distribution) is competent, they will manage this database
better than you likely will. With this change, bip will
attempt to use the default certificate store if you set
CA mode but do not specify a certificate store location.

This could be refined to test after enabling the default paths
whether the certificate store is empty, and error/warn if
so.
2014-12-11 14:50:02 +01:00
Adam Williamson 89295ca4b2 check whether trust store is a file or directory in CHECK_CA
The existing code only allows you to provide a set of trusted
CA certificates as an openssl 'CApath'-type directory. Fedora,
RHEL (and derived distros) and probably other distros provide
a system-wide database of trusted CA certs in various bundle
formats, but not as a CApath-type directory. This checks whether
check_store is a file or directory and loads it appropriately,
when initializing an SSL connection.

Note that there is code elsewhere which assumes the trust store
will be a file, but that code is hit only in CHECK_BASIC mode.
This change applies only to CHECK_CA mode.
2014-12-11 14:49:53 +01:00
Pierre-Louis Bonicoli e0b63528f2 Channel modes: 'Type B' flags always have a value
even when removed.
Refs #345
2014-09-04 10:32:04 +02:00
Pierre-Louis Bonicoli d2fa844960 Channel mode: handle flags 'f' and 'j'
Closes #345
2014-09-04 10:32:00 +02:00
Pierre-Louis Bonicoli 8d3539a7d0 Fix --without-openssl build
Reported & fixed by Whoopie, thanks to him !
Closes #313
2013-11-04 08:49:06 +01:00
Marc Dequènes (Duck) acfad6dee2 Add -git to version string. 2013-10-19 15:58:19 +02:00
Marc Dequènes (Duck) a6e2985887 Update version and ChangeLog for bip-0.8.9 release. 2013-10-19 15:58:14 +02:00
Marc Dequènes (Duck) c34b030e21 bip-release script can now handle an optional release name
This release name is used in the git tag. The previous 'release'
variable was renamed in 'release_version' to avoid confusion.
2013-10-19 14:57:15 +02:00
Marc Dequènes (Duck) ca4dd55e71 Use full year in dev tarball name made by bip-release 2013-10-19 13:34:15 +02:00
Marc Dequènes (Duck) d9461b8c8d make_distcheck in bip-release needs to prepare sources 2013-10-19 13:32:25 +02:00
Marc Dequènes (Duck) b6d9151e8c Corrected AC_INIT: package and tarname were inverted 2013-10-19 13:07:45 +02:00
Marc Dequènes (Duck) 400cfedb6c Sign release tags
Closes #270
2013-10-19 12:52:04 +02:00
Marc Dequènes (Duck) 1c3ef1d360 Really ensure a Yacc alternative is installed at build time
AC_PROG_YACC falls back to YACC = "yacc" if bison or byacc are not
found, but it does not mean it is present.

Closes #294
2013-10-19 12:36:07 +02:00
Marc Dequènes (Duck) 8b98c3746e Compatibility fix with bison 2.6
Bison 2.6 now declares yyparse in the generated header. This fix
ensure it still works for older versions.

Reported in Debian#710614
2013-10-18 17:31:47 +02:00
Nathan Phillip Brink 71801fb3d2 Throttle almost everything (except PING, PONG, and certain QUIT messages) sent to the IRCd.
Fixes being killed for Excess Flooding on freenode by using the
existing fakelag mechanism. The existing fakelag works great but
was just not hooked into earlier.

Closes #191
2013-10-18 17:22:08 +02:00
Pierre-Louis Bonicoli aa4ee44d68 Remove useless bootstrap script
Refs #284
2013-10-18 17:21:45 +02:00
Pierre-Louis Bonicoli 2c390390ed Password cannot contain spaces. Closes #265.
Thanks to Tim Hansen for reporting this bug.
2012-01-25 05:18:59 +01:00
Pierre-Louis Bonicoli df45c4c2d6 Closes #261. Fix by Thijs Alkemade.
- use conf_global_log_file instead of stderr
- when a SSL handshake error occurs, close socket
2012-01-25 05:08:52 +01:00
Pierre-Louis Bonicoli f1bec50a9c Revert f19e1f6. Fix #252.
f19e1f6 introduces a regression (#252) and bug described in commit
message can not be reproduced.
2012-01-25 04:03:18 +01:00
Pierre-Louis Bonicoli 222a33cb84 Buffer Overflow: check against the implicit size of select() arrays
Reported by Julien Tinnes (Fix #269)
exit is called when the listening socket can not be created
2012-01-23 22:38:59 +01:00
Pierre-Louis Bonicoli 0ed5240de5 doc: automake,autoconf-archive:deps, add bootstrap
- build dependencies: add automake & autoconf-archive
- mention 'bootstrap' script
2012-01-20 05:38:00 +01:00
Pierre-Louis Bonicoli 7fef65fbe8 use maintainer mode when building from a repo
try CFLAGS="-Wno-error" if build failed
2011-10-25 01:17:54 +02:00
Pierre-Louis Bonicoli 975ccac0b1 delete generated file 2011-10-24 23:45:01 +02:00
Arnaud Fontaine a46b8bd2c2 Fix GCC warnings. 2011-10-24 23:44:43 +02:00
Arnaud Fontaine ab0a41b7bb Add AM_MAINTAINER_MODE for vendors. 2011-10-24 23:40:50 +02:00
Pierre-Louis Bonicoli 6103f8bc84 CFLAGS: add -Werror 2011-10-04 00:47:22 +02:00
Arnaud Fontaine 0da434d126 Fix GCC warnings. 2011-10-04 00:30:07 +02:00
Pierre-Louis Bonicoli 559fa7ed44 don't override user var. Thanks to Alex Legler
Based on gentoo-x86/net-irc/bip/files/bip-configure.patch
See http://www.gnu.org/software/autoconf/manual/automake.html#User-Variables
If user doesn't specify CFLAGS, default value is "-Wall -Wextra -g -O2".
2011-09-14 06:31:58 +02:00
Nathan Phillip Brink 7e1c80a65a Use 'make dist' instead of 'git archive' to create a release or snapshot tarball. 2011-09-14 06:28:14 +02:00
Pierre-Louis Bonicoli 84fa6c7eb0 Fix typo in assertion message 2011-05-23 04:36:58 +02:00
Pierre-Louis Bonicoli b2dde370d6 Improve 'trust ok' command
if a client send "TRUST OK" to bip and all connexions are already trusted,
reply "No untrusted certificates." instead of "Unknown command"
2011-05-23 04:01:27 +02:00
Pierre-Louis Bonicoli 46c599d92e Add -git to version string. 2011-04-12 02:21:25 +02:00
Pierre-Louis Bonicoli e730a96cd8 Update src/version.h and Changelog for release. 2011-04-12 02:21:24 +02:00
Pierre-Louis Bonicoli f19e1f6209 Fix backlog of queries when option 'log' is False
Issue #212
2011-04-12 01:08:41 +02:00
Yoann Guillot 87da44e583 connection: allow to disable / enable log (#211)
add option 'log' (true/false) in connection section,
this option overrides the global 'log' option.
Thanks to jj !
2011-04-07 02:32:44 +02:00
Pierre-Louis Bonicoli 2e49437ed7 revert 4fdabdd166
better quick fix
2011-02-06 21:59:14 +01:00
Pierre-Louis Bonicoli 81b8ed48cf Fix build errors on armel
sys/user.h on armel has a conflicting definition of 'struct user'.
This patch renames bip's structure to avoid the conflict.
Thanks to Philipp Kern and Dann Frazier !
2011-01-15 18:13:26 +01:00
Pierre-Louis Bonicoli 4d4710acb9 Fix "FATAL: list_remove: item not found"
Thanks to Jean-Edouard Babin for reporting it.

How to reproduce:
1) connect to bip with an irc client using username (eg 'Pilou')
2) disconnect irc client
3) in client configuration, change the case of username (eg 'pilou')
4) reconnect to bip -> bip log FATAL message and exit

If old nick and new nick are equal ignoring the case of the characters,
don't delete store associated with old nick: only rename it.
2010-12-28 03:22:19 +01:00
Pierre-Louis Bonicoli ca1b383a74 check return value of hash_get 2010-12-28 03:20:01 +01:00
Pierre-Louis Bonicoli 4fdabdd166 filename is NULL if !store && !conf_log 2010-12-28 03:18:13 +01:00
Arnaud Cornet 0b7a3e6a07 Add -git to version string. 2010-09-12 17:48:00 +01:00
Arnaud Cornet ec078131ea Update src/version.h and Changelog for release. 2010-09-12 17:47:57 +01:00
Arnaud Cornet 7fb0823167 cp 2010-09-12 17:32:55 +01:00
Arnaud Cornet 4822364c0f Fix for null pointer deference
CVE-2010-3071
2010-09-12 16:52:00 +01:00
Arnaud Cornet d0ee9df3ec Add -git to version string. 2010-08-07 12:18:59 +01:00
Arnaud Cornet 3c6d776597 Update src/version.h and Changelog for release. 2010-08-07 12:18:53 +01:00
Arnaud Cornet 4f5f08677f Enable PIE executable creation. 2010-08-07 12:10:32 +01:00
Trou 7712ae3a92 Fix typo 2010-06-15 23:02:01 +01:00
Zach Wily 4d3ee53e7b RFC 1459 specifies that the PONG message may have 1 or 2 parameters. 2010-04-07 22:12:26 +01:00
Arnaud Cornet f995c1f537 try to mitigate freenode antiflood throttling 2010-02-17 12:34:57 +00:00
Arnaud Cornet 4d5ef34325 oidentd is not debug 2010-02-17 12:33:05 +00:00
Arnaud Cornet 92365874d4 Revert "Fix antiflood. Fixes freenode kicking us out."
This reverts commit 639e929021.
2010-02-17 12:32:22 +00:00
Arnaud Cornet 5c3f22d8a8 Revert "Unbraindead"
This reverts commit b21c658b8c.
2010-02-17 12:32:15 +00:00
Arnaud Cornet b21c658b8c Unbraindead 2010-02-17 12:00:55 +00:00
Arnaud Cornet 5b26dac489 More lose MODE command handling 2010-02-17 10:55:09 +00:00
Mathieu Pillard 5d6b7fedaf backread_hours is in hours, not days 2010-02-16 10:08:27 +00:00
Arnaud Cornet 7c0b6036f2 Ugly header fixups to fix build 2010-02-15 14:22:00 +00:00
Mathieu Pillard 2e5f4287ff With necessary header fix 2010-02-15 14:17:44 +00:00
Mathieu Pillard c0772f54bf Fix time parsing. Fixes backlog replaying one month to many, 2010-02-15 14:16:08 +00:00
Arnaud Cornet 639e929021 Fix antiflood. Fixes freenode kicking us out. 2010-02-15 14:06:50 +00:00
Arnaud Cornet bfe14ebb20 Add -git to version string. 2009-11-15 20:41:59 +00:00
Arnaud Cornet ce506aaec7 Update src/version.h and Changelog for release. 2009-11-15 20:41:56 +00:00
Arnaud Cornet a932cc53a9 [BUILD] Attempt to fix autostuff 2009-11-15 20:40:17 +00:00
Arnaud Cornet 944f18962a Add -git to version string. 2009-11-15 20:21:27 +00:00
Arnaud Cornet 06a67e08af Update src/version.h and Changelog for release. 2009-11-15 20:21:24 +00:00
Arnaud Cornet 03ee43ca89 [BUG] fatal() on nick change on gamesurge network
Some time gamesurge sends a "foo NICK :foo" which we didn't handle
correctly.
2009-11-15 20:14:28 +00:00
Arnaud Cornet 31ae5ac0bf [autostuff] Rewrite. Use non recursive make. Drop src/config.h.in that must be populated by autoheader 2009-08-24 21:26:46 +02:00
Arnaud Cornet 889f3cc1b7 Add -git to version string. 2009-08-24 19:05:48 +02:00
Arnaud Cornet c496bd7027 Update src/version.h and Changelog for release. 2009-08-24 19:05:45 +02:00
Arnaud Cornet 70fbf99c7f Refactor _write_socket
Call real_write_all in write_lines and write_line.
This should fix debian bug #542291.
BIG thanks to Zygo Blaxell.
2009-08-19 22:02:56 +02:00
Arnaud Cornet 7546daa276 [BUG] Handle badly lagging client conns decently. 2009-08-19 02:09:16 +02:00
Arnaud Cornet fa0c70539b Allow parallel build (thks Whoopie and psychon). 2009-07-26 11:38:20 +02:00
Arnaud Cornet 442e4973cd Add -git to version string. 2009-07-17 11:43:34 +02:00
Arnaud Cornet a7c38c17c0 Update src/version.h and Changelog for release. 2009-07-17 11:43:29 +02:00
Arnaud Cornet 213643d5bf size hour array correctly 2009-07-05 19:35:00 +02:00
Arnaud Cornet 1a2b1dd165 Cleanup log outputs 2009-07-05 19:04:51 +02:00
Arnaud Cornet 3698955365 Don't reset store->file_offset when adding a new file
This just makes no sense
2009-07-05 18:08:35 +02:00
Arnaud Cornet a8fb0c40d3 Support hour in log format. Mostly for debugging 2009-07-05 14:00:06 +02:00
Arnaud Cornet 32e08c94aa SSL basic mode, support X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 2009-07-02 18:05:51 +02:00
Arnaud Cornet 405f8b4afc [log] Use canonical name to detect need for log rotation
Also reset store on part from server to close more file descriptor.
2009-06-28 16:33:29 +02:00
Arnaud Cornet 4532234426 [ssl:basic] Restore trust command behavior that was broken (repported by psychon) 2009-06-25 01:24:38 +02:00
Arnaud Cornet 5ae1c1dec5 [log] close logs files more intensively. 2009-06-25 00:43:44 +02:00
Arnaud Cornet 7af35a3018 Bad and useless strncat use (reported by psychon, thanks to him) 2009-06-18 13:50:43 +02:00
Arnaud Cornet 015969e86b [log] Fix to /bip backlog x
This is fix for:
When using /bip backlog X windows with no tracked backlog (ie after a
blreset) do not show backlog
2009-06-13 17:29:44 +02:00
Arnaud Cornet 8cea2bdb71 Don't fail if ressetting non existing store. 2009-06-07 13:22:20 +02:00
Arnaud Cornet 94b5ac4797 [release script] Fix mktemp usage 2009-06-05 00:44:28 +02:00
Arnaud Cornet 499a7d75b5 backlog tweak 2009-06-05 00:43:05 +02:00
Arnaud Cornet 9187d556b5 Fix info user parsing. 2009-03-25 11:40:19 +01:00
Arnaud Cornet 3166a57022 Add -git to version string. 2009-03-02 12:54:27 +01:00
Arnaud Cornet 104d251a0b Update src/version.h and Changelog for release. 2009-03-02 12:54:25 +01:00
Arnaud Cornet b6f30f6a03 Fix one leak. Fix git-release script for new git. 2009-02-28 11:19:57 +01:00
Arnaud Cornet 29ff342d93 Add option ignore_server_capab 2009-02-08 12:36:49 +01:00
Arnaud Cornet b8c740357d Add -git to version string. 2009-02-02 19:51:10 +01:00
Arnaud Cornet 1f462ef035 Update src/version.h and Changelog for release. 2009-02-02 19:51:05 +01:00
Arnaud Cornet eef2fd180d [CLIENTHACK] Remove xchat's + and - on each msg
This patch drops CAPAB setting in 005 message from server to client.
Doing this xchat does not start the mode that prepends a + or a - at the
beginning of PRIVMSGS.
2009-02-02 19:47:53 +01:00
Arnaud Cornet c4fb1b140a Another man typo found by Renzokuken. 2009-01-28 19:21:30 +01:00
Arnaud Cornet b5d777dfee man typo found by Renzokuken. 2009-01-28 15:13:44 +01:00
Arnaud Cornet 69640eaf8c [FIX] Complete previous commit
Previous commit was incomplete and did not log some weird messages. They
still might be legit, so we come with them
2009-01-27 11:24:50 +01:00
Arnaud Cornet 5416fc19b2 [FIX] check for weird shape notice messages
Prevents a fatal on some rare conditions
2009-01-27 08:25:44 +01:00
Arnaud Cornet c2b3090e47 Cosmetic (special kasdedi a trou) 2009-01-26 16:57:52 +01:00
Arnaud Cornet bfc86202a1 Add -git to version string. 2009-01-25 14:44:26 +01:00
Arnaud Cornet 488a17dab5 Update src/version.h and Changelog for release. 2009-01-25 14:44:22 +01:00
Arnaud Cornet 5628da3ee0 Add warning when using 512 bits long moduli for diffie hellman 2009-01-25 14:41:19 +01:00
Arnaud Cornet b62c3e4697 [SSL] Support ephemeral diffie hellman kex
Pushing some non private data into openssl enables to use edh that
provides perfect forward secrecy.
2009-01-25 14:24:22 +01:00
Arnaud Cornet 7e539298fd Update NEWS file. 2009-01-24 21:48:12 +01:00
Arnaud Cornet 03210a796e [CLEANUP] Add lots of asserts in utils
list hash and array types are now even stricter on their usage.
2009-01-22 12:06:26 +01:00
Ben Byer dae6cad3f7 Add limit.h for INT_MAX 2009-01-22 11:26:03 +01:00
Arnaud Cornet 23b6ec4492 Better check for backread returning NULL 2009-01-22 11:24:44 +01:00
Ben Byer 43fe81e114 add null pointer check to backlog_lines
In some configuration backlog_lines can return NULL
2009-01-22 10:14:33 +01:00
Arnaud Cornet 170d4d1e00 [FEATURE] autojoin_on_kick in connection blocks
true by default
2009-01-21 17:24:54 +01:00
Arnaud Cornet afefc9a3d4 [FIX] Try to guess current daylight saving time
When backloging we have no clue of a log lines dst, we try to guess it
with current dst, which makes no sense, but at least it provides decent
result when not near dst change.
2009-01-20 19:30:20 +01:00
Arnaud Cornet 500d546706 [FIX] improper log rotation
disconnection/reconnection log message bypassed the log rotation checks
So if the message after a new day is a disconnected message, logs files
did not rotate.
2009-01-18 12:26:41 +01:00
Arnaud Cornet 7a7c2432cf [FIX] make log_has_backlog actually work
log_has_backlog used to check for the presnece of tracked logfiles to
determine the presence of logs. This does not work anymore. This patch
uses the last file tracker to determine that.
2009-01-18 11:26:08 +01:00
Arnaud Cornet 9882a0cbdc [CLEANUP] various cleanups 2009-01-17 15:03:06 +01:00
Arnaud Cornet fe251f72b5 [FEATURE] /quote bip backlog [n]
/quote bip backlog triggers a log replay.
With the optional argument n in hours, you can request a backlog of a
few hours.
2009-01-17 14:16:31 +01:00
Arnaud Cornet 26eb9c28d7 [OPTION] implement backlog_reset_connection
backlog_reset_on_talk no works per query/channel.
Setting backlog_reset_connection to true falls back to the former kind
of backlog reset.
2009-01-17 12:50:39 +01:00
Arnaud Cornet 0e2f305d4e [cleanup] Try to cleanup this pid mess
close files, but no too soon...
2009-01-16 15:17:34 +01:00
Arnaud Cornet 2d9d388fba Close some fds, original path from Trou. 2009-01-16 15:09:53 +01:00
Arnaud Cornet 7565b9cb8e typos 2009-01-16 15:09:22 +01:00
Trou 111f1382d1 Fix fd leak 2009-01-16 15:02:24 +01:00
Arnaud Cornet b912282410 optionnal -> optional 2009-01-16 12:30:24 +01:00
Arnaud Cornet 3b704f53c4 drop unused variables 2009-01-15 22:56:42 +01:00
Arnaud Cornet be0d83d681 Remove code inside #if 0... it's what svcs are for 2009-01-10 14:16:36 +01:00
Arnaud Cornet 8ed0565266 [LOG] Fixup log_beautify to work beautifully :) 2009-01-10 14:08:41 +01:00
Arnaud Cornet a5814b17a0 Don't log queries with -bip, fix blreset help 2009-01-10 13:34:40 +01:00
Arnaud Cornet b3d7dbfb02 [COSMETIC] Avoid opening a query with your own nic
This exception is cosmetic, but you want it.  Most of the time, you get
backlog from your own nick for your mode changes only.  Hence opening a
query just to say "end of backlog"...
2009-01-10 13:26:59 +01:00
Arnaud Cornet 744ea7d03b Merge branch 'master' into bip08 2009-01-10 12:55:13 +01:00
Arnaud Cornet 67ddf15264 [BUG] channel with key handling
A bug existed when a client issued join commands with multiple keys:
JOIN #a,#b keya,keyb
which this patch fixes
2009-01-10 12:53:25 +01:00
Arnaud Cornet f536a0546d Cleanup and fixes of the backlog code 2009-01-10 12:35:59 +01:00
Arnaud Cornet 32cf2d462f Backlogging code cleanup: fixes
This makes the new backlogging code, actually backlog something.
2009-01-09 13:24:11 +01:00
Arnaud Cornet f1221703b0 [FEATURE] reset backlog on talk now "window" local
The reset_backlog_on_talk now resets current query or channel.
The /bip blreset command not takes an optional argument taking query
name or channel name.
2009-01-09 11:26:12 +01:00
Arnaud Cornet a6bb697f5d Merge branch 'master' into bip08
Conflicts:

	src/log.c
2009-01-09 09:57:17 +01:00
Arnaud Cornet d2f7840ced [BUG] Fix fatal on some nick change
When a nick changes to one for which we already have a logstore
allocated. We try to overwrite a hash entry that is already existing
leading to a fatal.

This pach cleans things up before rename the logstore.
2009-01-08 11:01:47 +01:00
Arnaud Cornet a57e76f883 add fclose on pid file 2009-01-06 16:34:17 +01:00
Arnaud Cornet eb57d9683d Drop some unused variable. 2009-01-06 16:28:06 +01:00
Arnaud Cornet 41c0a5a9c6 Fix bip_notify usage
These may lead to crash if you call in your conf networks or other names
with %s or other fancy format strings.
2009-01-06 15:58:18 +01:00
Arnaud Cornet 0600196102 merge master 2009-01-05 23:24:49 +01:00
Arnaud Cornet 217816c220 And anothear nick_from_ircmask leak. 2009-01-05 22:57:27 +01:00
Arnaud Cornet 00a10a9f61 Fix another leak. 2009-01-05 22:56:01 +01:00
Arnaud Cornet 96a91cd92e Fix leak during backlog. 2009-01-05 22:54:10 +01:00
Arnaud Cornet aab5e61c05 Fix leak. 2009-01-05 22:52:25 +01:00
Arnaud Cornet 2ef3506a22 Remove useless null check. Cycle server on early connection problem. 2008-12-30 11:12:52 +01:00
Arnaud Cornet 0ecb77617c Sanitize bip_(m|re)alloc size. 2008-12-29 15:31:32 +01:00
Arnaud Cornet b9f86d544d Add autoheader in boostrap script. 2008-12-29 14:07:09 +01:00
Arnaud Cornet a4b101cea8 ensure null terminated str 2008-12-29 14:04:51 +01:00
Arnaud Cornet 3f895fa6ea Merge branch 'master' into bip08 2008-12-29 09:15:44 +01:00
Arnaud Cornet 5a5f1b8bfb Some autoconf magic fix 2008-12-29 09:15:27 +01:00
Arnaud Cornet 8d7eecf78b Fix fatal Element with key %s already in hash
on client disconnect.
bad hash usage
2008-12-29 09:14:24 +01:00
Arnaud Cornet b222196b18 Use backtrace when --enable-debug=yes and avail.
I KNOW AUTOCONF.
2008-12-28 15:47:43 +01:00
Arnaud Cornet c0db3c408d Merge fixups 2008-12-28 14:47:44 +01:00
Arnaud Cornet 24110a58dc Fix leak + cleanup list_append.
Thanks to TheMIROn for spotting the leak.
2008-12-28 14:45:44 +01:00
Arnaud Cornet 3c810eef53 Refactor log system. prepare for /backlog 1 hour 2008-12-26 18:43:35 +01:00
Arnaud Cornet 8693044511 fix notice logging file storage 2008-12-26 08:56:03 +01:00
Arnaud Cornet 20ce456e38 Work out autoconf magic
Now --disable-ssl works as expected.
The bug is there since bip uses autoconf. CHAMPAGNE.
2008-12-25 18:34:36 +01:00
Arnaud Cornet b102aed08a array_extract: fix braindeadness. 2008-12-25 17:49:48 +01:00
Arnaud Cornet 7c6cc20e90 Use hash_it_key cause now hash items can be null. 2008-12-20 21:15:04 +01:00
Arnaud Cornet fa78df6482 Fixup file name allocation 2008-12-20 20:26:38 +01:00
Arnaud Cornet e8bb841e5f refactor nick management code
- drop struct nick.
- follow nick changes in a basic way.
  right now it does not work if one changes nick and somebody else takes
  the old unused nick.
2008-12-20 17:59:16 +01:00
Arnaud Cornet 4d231e8ddc Inline most array methods 2008-12-20 14:28:18 +01:00
Arnaud Cornet d3ef106c4f New array type, cleanupts and rename logfilegroup log_store 2008-12-20 14:20:50 +01:00
Arnaud Cornet 4b723ca479 more cleanups, start of a log refactoring
That changes log format and might breack everything.
2008-12-18 14:27:16 +01:00
Arnaud Cornet fd644b312b bip_strdup fatals on out of memory 2008-12-15 20:02:56 +01:00
Arnaud Cornet c150151066 BIG cleanup. check for memory allocation failure, add extra checks all arround. 2008-12-15 19:19:27 +01:00
Arnaud Cornet e18d335578 calloc/realloc checks. 2008-12-11 11:00:05 +01:00
Arnaud Cornet 2b96805ecb Revert "drop fork priviledges when running."
This reverts commit 1cbb1b9b7a.
It juste does not work, since this limit is uid-wide (thanks julien`)
2008-12-10 23:27:53 +01:00
Arnaud Cornet 3ab2755767 Catch malloc returning NULL. 2008-12-10 23:26:37 +01:00
Vladislav Grishenko c3bb6639b6 Send after join /names before backlog
there're some irc client which create windows, session etc only on 366
packet received (End of /NAMES list) like Miranda IM, QIP
that's why backlog sent from bip after 332/333 packets and just before
353/336 goes to nowhere
i'v took a look at other irc bouncers, all of them send backlog right
after 353 /336 packets
so, all what we need is just chamge the order in
static void irc_send_join(struct link_client *ic, struct channel *chan)
2008-11-23 15:12:32 +01:00
Arnaud Cornet 0f0d0427b8 Enlarge connection buffer size and logline_maxlen. 2008-11-23 15:09:24 +01:00
theMIROn c21db5a556 Fix for empty topic creator and timestamp on RusNet IRC Servers 2008-11-11 16:07:42 +01:00
Arnaud Cornet 383a3a4477 Fix help message: bip reload is quite stable for some time now. 2008-11-09 19:05:49 +01:00
Arnaud Cornet 1cbb1b9b7a drop fork priviledges when running. 2008-10-31 19:38:12 +01:00
Arnaud Cornet e8c6adedc9 Add -git to version string. 2008-10-24 10:24:52 +02:00
Arnaud Cornet fcfea9921a Update src/version.h and Changelog for release. 2008-10-24 10:24:49 +02:00
Arnaud Cornet cd82512f7a Ignore nick channel status in whorepl. Fix crash on client empty privmsg. 2008-10-24 09:11:23 +02:00
Arnaud Cornet f6582a54b2 bipgenconfig: generate 4096 bit rsa keys 2008-10-24 00:08:47 +02:00
Arnaud Cornet 83b19b7c5a Hack around to make halfop support actually work. 2008-10-08 01:04:14 +02:00
Arnaud Cornet ed92b9a8bd Build fix 2008-10-08 00:05:26 +02:00
Arnaud Cornet 8ba984165b Implement quick halfop tracking support. 2008-09-20 14:48:16 +02:00
Arnaud Cornet ddacb833dd Add -git to version string. 2008-06-28 18:59:19 +02:00
Arnaud Cornet 412cddaf51 Update src/version.h and Changelog for release. 2008-06-28 18:59:15 +02:00
Sebastian Hagen babaac246d Do not freak out when seeing unreal ircd wierd name flags. 2008-06-24 20:27:12 +02:00
Arnaud Cornet 81239265b9 Add -git to version string. 2008-06-01 11:11:30 +02:00
Arnaud Cornet 1fb6c2a164 Update src/version.h and Changelog for release. 2008-06-01 11:11:28 +02:00
Arnaud Cornet 9ab6e6e125 Update src/version.h and Changelog for release. 2008-06-01 11:11:08 +02:00
Arnaud Cornet 35e5812448 Make jj's patch build 2008-06-01 11:11:03 +02:00
Arnaud Cornet e863227099 Fix probable but rare memory leak 2008-06-01 11:05:22 +02:00
Arnaud Cornet 3f9d162129 Add -git to version string. 2008-06-01 10:56:16 +02:00
Arnaud Cornet 9fcbe8a6aa Update src/version.h and Changelog for release. 2008-06-01 10:56:12 +02:00
Arnaud Cornet fc546e9db8 Support channel modes q and I (oftc) 2008-06-01 10:27:52 +02:00
Arnaud Cornet 604eb26ec6 Merge jj's patch (debian bug 481488) 2008-05-31 12:31:30 +02:00
Arnaud Cornet d92ffeea09 Update todo 2008-05-31 12:24:56 +02:00
Arnaud Cornet 4b2a0eb935 Add -git to version string. 2008-04-05 11:55:42 +02:00
Arnaud Cornet 39d2850ad7 Update src/version.h and Changelog for release. 2008-04-05 11:55:40 +02:00
Arnaud Cornet dbcd0aad07 Fix build on systems without RLIMIT_AS (eg OpenBSD). 2008-04-05 11:44:15 +02:00
Arnaud Cornet f618d05af8 Merge bip.conf.5 fix from debian. 2008-04-02 23:56:21 +02:00
Arnaud Cornet 82dbe852f8 Add -git to version string. 2008-04-02 23:49:51 +02:00
Arnaud Cornet 37a44139d1 Update src/version.h and Changelog for release. 2008-04-02 23:49:48 +02:00
Arnaud Cornet 2cbf377cc2 Fix default nick/user/realname check
(debian bug 473999).
allow ssl_check_mode = none.
tweak HOME handling.

Most of this is Yoann Guillot's work.
2008-04-02 23:41:27 +02:00
Loc Gomez e383c2b6f6 Merge branch 'master' of http://bip.t1r.net/bip 2008-02-16 13:50:40 +01:00
Arnaud Cornet 6cee8c728f bip-release glitch fix. 2008-02-16 11:33:00 +01:00
Arnaud Cornet 303503cfc7 Post release leak fix. :) 2008-02-16 11:32:13 +01:00
Arnaud Cornet 2516a89ac8 Add -git to version string. 2008-02-15 23:59:35 +01:00
Arnaud Cornet eb1dbb1023 Update src/version.h and Changelog for release. 2008-02-15 23:59:30 +01:00
Loc Gomez d7430d44cc SSL:
- make bip compile with --disable-ssl configuration
2008-02-11 13:10:42 +01:00
Loc Gomez ba4e70d664 fix unwanted commit 2008-02-04 18:38:09 +01:00
Loc Gomez efe0c43b9c Documentation fixes
- update bip.vim and bip.conf sample files
- remove nonsense LOG_STD log level
2008-02-04 18:36:35 +01:00
Loc Gomez 89e88f6b7b /BIP commands:
- fix "(admin)" info inverted in /BIP list users
2008-02-04 18:07:27 +01:00
Arnaud Cornet fd5e483a49 Warn only when open files limit is smaller that 256. 2008-02-03 11:55:24 +01:00
Arnaud Cornet b024221cec Use const varibable more consistently. 2008-02-02 12:46:20 +01:00
Arnaud Cornet d5ef114c2e Have autodirt install manpages. 2008-01-22 00:36:18 +01:00
Arnaud Cornet 7470ebe96e Move bip.conf man page to section 5 (Fix debian bug 461871). 2008-01-21 22:21:09 +01:00
Arnaud Cornet 055266f92d Add -git to version string. 2008-01-20 18:51:04 +01:00
Arnaud Cornet f8c2876633 Update src/version.h and Changelog for release. 2008-01-20 18:51:01 +01:00
Arnaud Cornet f1cc6451f5 Handle SSL-client auth. Fix crash on del_conn when the link never got connected at all. 2008-01-20 18:49:44 +01:00
Loc Gomez c90578103c README:
- add a "session limit exceeded" / oidentd section
2008-01-10 11:33:00 +01:00
Loc Gomez 06cfc9160b Merge branch 'master' of http://bip.t1r.net/bip 2008-01-10 11:11:49 +01:00
Arnaud Cornet 78cb1c44c4 Cleanup BUGS and TODO. 2008-01-09 23:47:19 +01:00
Loc Gomez 671a455219 Fix UTF-8 in all files 2008-01-09 23:45:40 +01:00
Arnaud Cornet 1ea9f51539 Fixup for release script. 2008-01-09 23:31:22 +01:00
Arnaud Cornet 7aae8ed180 ctcp version reply cosmetics. 2008-01-09 20:32:35 +01:00
Arnaud Cornet 60e50d56c6 Add -git to version string. 2008-01-09 20:18:48 +01:00
Arnaud Cornet 985c75a38b Update src/version.h for release. 2008-01-09 20:18:27 +01:00
Arnaud Cornet 8827476701 Turn bip-take-snapshot to a bip-release script. 2008-01-09 20:17:38 +01:00
Arnaud Cornet b9b491725e Don't close not opened file. 2008-01-08 23:47:26 +01:00
Loc Gomez 9f9a2e0856 Documentation :
- README.floodcontrol is in README now
2008-01-08 10:50:55 +01:00
Loc Gomez 7ba4297a92 Documentation :
- fix typos
- include README.floodcontrol into README
2008-01-08 10:50:31 +01:00
Loc Gomez eb32b16872 SSL options:
- fixes
- PEM file world readable is a non fatal error
2008-01-08 10:31:22 +01:00
Loc Gomez 8c0ce5efd3 SSL:
- check PEM, last version...
2008-01-08 00:24:53 +01:00
Loc Gomez 517cda4946 SSL:
- fix checking of PEM file
2008-01-08 00:09:16 +01:00
Loc Gomez c10061172c Merge branch 'master' of http://bip.t1r.net/bip 2008-01-07 23:46:31 +01:00
Loc Gomez 4d97f4ebcd SSL:
check for client_side_ssl_pem file to be present
2008-01-07 23:46:29 +01:00
Arnaud Cornet d007a14baa Bail on config errro on startup. 2008-01-07 23:43:37 +01:00
Arnaud Cornet 1a8b06ab30 Update Changelog and NEWS. 2008-01-07 23:32:34 +01:00
Loc Gomez 47807cd2b3 bipgenconfig:
- detect bipmkpw path when possible
2008-01-07 22:57:11 +01:00
Arnaud Cornet f8e377c2b6 README typo fixes. 2008-01-07 22:53:40 +01:00
Arnaud Cornet 74ef2e7460 Cosmetic fix for man page. 2008-01-07 22:31:28 +01:00
Arnaud Cornet ca785fd280 Merge commit 'kyo/pemfile_option' 2008-01-07 22:21:55 +01:00
Loc Gomez 36d31e32e5 rename client_side_ssl_key to client_side_ssl_pem 2008-01-07 20:42:40 +01:00
Loc Gomez d02957f8bb Merge branch 'master' into pemfile_option 2008-01-07 20:39:13 +01:00
Loc Gomez 2cd37c0e13 fill readme with more information 2008-01-07 20:38:57 +01:00
Loc Gomez d3a4ee6bcb forgot the manpage.. 2008-01-07 19:48:04 +01:00
Arnaud Cornet 87ef072bb9 Merge commit 'kyo/pemfile_option' 2008-01-07 19:36:38 +01:00
Loc Gomez da442e0be7 bipgenconfig client_side_ssl_key option 2008-01-07 15:54:51 +01:00
Loc Gomez 2034713356 Merge branch 'master' into pemfile_option 2008-01-07 15:50:25 +01:00
Loc Gomez 8eda1ace0e bipgenconfig script :
- add missing options
- generate options before sub-blocks (for example in user block)
- fix loadConfig not loading networks and users as arrays
- add compatibility process to rename old options to their new names
  when loading config from bipgenconfig store
2008-01-07 15:22:28 +01:00
Loc Gomez e7e49fdad1 SSL configuration:
- warn when bip is not SSL-capable and configuration contain SSL options
- add a client_side_ssl_key option to define the path to bip.pem file
2008-01-07 14:27:37 +01:00
Loc Gomez 8b272bb0fd fix misleading fatal() message (pidfile error) 2008-01-07 14:00:25 +01:00
Loc Gomez 56b73ad73a Merge branch 'master' of http://bip.t1r.net/bip
Conflicts:

	bip.conf.1
2008-01-07 13:47:12 +01:00
Arnaud Cornet 20129da225 Realloc correct size when receiving admin privmsg. 2008-01-06 00:25:56 +01:00
Arnaud Cornet c5d1f537e4 Null deref fixes when fetching info. 2008-01-05 23:25:24 +01:00
Arnaud Cornet f96751cfb9 We are in 2008, and strncasecmp -> strcasecmp when cmp'ing with constants. 2008-01-05 23:11:41 +01:00
Arnaud Cornet b095e53efb Fix adm privmsg parsing. 2008-01-05 23:04:07 +01:00
Arnaud Cornet a7e5ca3d0b Have a sane ctcp version code. 2008-01-01 21:24:04 +01:00
Arnaud Cornet eb82981996 Allow weirdly ordered user blocks in config. 2008-01-01 15:02:45 +01:00
Arnaud Cornet 781b1ba8d0 Fix README (thanks to Brian Evans). 2008-01-01 13:59:48 +01:00
Arnaud Cornet f7d07bc5fa Bail on invalid confs. 2008-01-01 13:55:47 +01:00
Arnaud Cornet 3eab14cfb9 Have the arrow bold to highlight your own words in remote clients. 2008-01-01 13:33:21 +01:00
Arnaud Cornet 8b8024b81e Make it even build. 2007-12-29 18:17:50 +01:00
Arnaud Cornet 95618a06ab Fix stuuuuuupid leak in hash_clean. 2007-12-29 18:15:03 +01:00
Loïc Gomez b020e895a8 Add subcategory in help commands. 2007-12-29 01:35:11 +01:00
Loc Gomez ac407d9a3d Merge branch 'master' of http://bip.t1r.net/bip 2007-12-23 21:17:57 +01:00
Arnaud Cornet e0170c8144 This makes no sense. 2007-12-21 12:54:06 +01:00
Arnaud Cornet 64b3468393 Fix misplaced free. 2007-12-21 12:45:49 +01:00
Arnaud Cornet 8d25dfea51 Clear newly allocated connection structs. 2007-12-21 12:27:44 +01:00
Arnaud Cornet e6efc4b1c5 Fix just introduced leak. 2007-12-21 12:21:23 +01:00
Arnaud Cornet 27b16a86b8 Avoid unncessary calls to getaddrinfo.
Refactor calls to getaddrinfo only on socket establishement, cache in
connection structure.
2007-12-21 12:20:21 +01:00
Loc Gomez 130d649e0b Fix misleading text in manpage 2007-12-16 17:28:01 +01:00
Arnaud Cornet 8f998c97b6 Be verbose when conf_die is called. Try to inform calling client. 2007-12-14 23:07:18 +01:00
Arnaud Cornet cbcd4c18a3 Fix fatal() on /bip jump. 2007-12-14 22:06:20 +01:00
Arnaud Cornet 7c3fc4bc27 Fix ctcp reply so it has a chance to work 2007-12-11 00:23:49 +01:00
Arnaud Cornet 73c4a8f1f1 Fix bad error message when log_format does not contain %u 2007-12-09 14:23:00 +01:00
Arnaud Cornet 91fa881f94 Update news file. 2007-12-09 14:10:33 +01:00
Arnaud Cornet 5f562e7432 Annoying bip-take-snapshot fix 2007-12-08 16:22:56 +01:00
Arnaud Cornet e1fb3e42ff Fix backloging error when one character message. 2007-12-08 16:12:05 +01:00
Arnaud Cornet 1a9a72432b Fix double arrow prefix for self issued private messages when more that
two clients are connected.
2007-12-08 16:00:50 +01:00
Arnaud Cornet 95586c79e3 init ci->backlog properly 2007-11-26 22:58:10 +01:00
Arnaud Cornet d92525b7a3 Add ctcp reply.
Fix badly initied chan_info
2007-11-26 19:57:12 +01:00
Arnaud Cornet 731a39f0d2 Respond to CTCP VERSION. 2007-11-25 23:44:14 +01:00
Arnaud Cornet 8c649b4357 Big grammar round-up :) 2007-11-25 18:37:13 +01:00
Arnaud Cornet 7020e7fa4c snprintf fixups. 2007-11-25 18:35:53 +01:00
Loc Gomez 05e0f84af8 bip_use_notice option 2007-11-25 16:34:52 +01:00
Loc Gomez b68b0dc71d Merge branch 'master' of http://bip.t1r.net/bip
Conflicts:

	src/bip.c
2007-11-25 16:12:36 +01:00
Arnaud Cornet c064fe6472 notify when addconn command is successful. 2007-11-25 16:07:53 +01:00
Loc Gomez a65ffa67fa Merge branch 'bip_use_notice'
Conflicts:

	src/bip.c
2007-11-25 16:06:45 +01:00
Arnaud Cornet 32cdb53d09 Add bip-take-snapshot 2007-11-25 15:50:19 +01:00
Arnaud Cornet 5faa6581b7 make log_has_backlog aware of track_backlog. 2007-11-25 15:39:38 +01:00
Arnaud Cornet 546f86b592 Fix help message. 2007-11-25 15:37:26 +01:00
Arnaud Cornet b3b6df53bb Add track_backlog member in lfg, so we have a cleaner way to exempt a channel from backloggin. 2007-11-25 15:29:32 +01:00
Arnaud Cornet cc9afd6b1e Support live addition and removal of connection. 2007-11-25 14:50:22 +01:00
Arnaud Cornet f1a0aede23 typo. 2007-11-19 23:02:25 +01:00
Arnaud Cornet b33e832d2d add -q option to blreset. 2007-11-18 14:57:00 +01:00
Arnaud Cornet 51f5a91664 Cleanups. 2007-11-18 11:08:41 +01:00
Arnaud Cornet a21488ead6 nick collision recover fix. 2007-11-15 23:29:10 +01:00
Arnaud Cornet d96543f1db Fix double free at init time. 2007-11-15 22:50:51 +01:00
Loïc Gomez 0876e783f3 is_valid_nick fix. small validate_config fix 2007-11-14 22:03:58 +01:00
Arnaud Cornet ec68655ccd Handle deprecated directives... 2007-11-11 07:37:19 +01:00
Arnaud Cornet 1e449da922 Make SSL "basic" certificate check more loose (more SSH-like).
In "basic" mode, normally un trusted certificates get to be trusted if they are
manually trusted by user. This provides an SSH like private key auth mechanism.
Expired certificates were considered invalid in this mode which does not make
much sense.
2007-10-29 00:38:42 +01:00
Arnaud Cornet 6a0ced8929 Describe basic ca mode in bip.conf.1 2007-10-29 00:24:48 +01:00
Arnaud Cornet addfac8ffa Allow building with SSL. 2007-10-24 20:31:06 +02:00
Arnaud Cornet e5d45e7e64 Fix initialisation time bug found by Trou. 2007-10-23 00:46:00 +02:00
Arnaud Cornet 664ebb68a7 Destroy unused link after sighup 2007-10-21 19:35:22 +02:00
Arnaud Cornet 0abd8a386d Config load fixes.
- Leaks
- Better logging
- Handle historical configs
2007-10-21 12:31:07 +02:00
Arnaud Cornet 32e47b900c Fixes to get the /BIP RELOAD command to at least work in a quick test.
- reuse existing channel infos
- dont clear conn_list on end of irc_main and don't add the listener if
conn_list is not empty at start of irc_main
2007-10-20 23:12:22 +02:00
Arnaud Cornet 0a689b19f8 Don't forget to free the buffer... 2007-10-20 22:57:09 +02:00
Arnaud Cornet b026214142 Various fixes
- Fix log redirrect to stderr when not going into background.
- Fix connection_close to handle connections on error.
- Handle servers you can't connect to the same way as servers that get disconnected. (wrt to reconnection timers)
- Fix some log message
2007-10-20 21:26:21 +02:00
Arnaud Cornet 38148bbdc5 Make the thing build without HAVE_SSL 2007-10-06 15:43:38 +02:00
Arnaud Cornet dbe633ec59 Fixes for kyo's merge.
A few rare snprintf bugs.
Mostly cosmetic and cleanness stuff.
2007-10-06 15:40:56 +02:00
Loc Gomez a169ceb693 BIP commands:
- fix bug: ON_CONNECT_SEND can be multiword
- add unified header/footer to each command reply
2007-09-28 18:18:31 +02:00
Loc Gomez 572f0a74f8 fixes:
- add old TODO
- fix adm_print_connection, channels with backlog wrongly printed with "key"
flag
2007-09-28 17:52:41 +02:00
Loc Gomez dab337dfb8 fix order in bip.conf.1 2007-09-28 13:21:05 +02:00
Loc Gomez d3a5c40a40 bip_use_notice option + fix
add bip_use_notice option to user-level configuration.
fix typo in bip_notify()
2007-09-28 13:20:32 +02:00
Loc Gomez 72b028221d adm_reply -> bip_notify 2007-09-28 10:43:34 +02:00
Loc Gomez dd49be1755 define some defaults 2007-09-27 14:44:25 +02:00
Loc Gomez 12ea45b132 cleanup
change some log levels
remove ssl_check_store from connection
indent fixes
check_rlimits: change explain text
Git-explicit version
2007-09-27 14:12:27 +02:00
Loc Gomez 2090349f9c add backlog option to channels. 2007-09-27 01:08:10 +02:00
Loc Gomez 45e9688c45 changelog 2007-09-26 22:21:01 +02:00
Loc Gomez e5ed7c92ae add ssl_check_mode option to the connection block (requested by Trou)
die if ssl_check_mode is unset while the network needs SSL.
2007-09-26 22:18:50 +02:00
Loc Gomez 96693716fb fix SSL 2007-09-26 22:08:59 +02:00
Loc Gomez 5aec7804af src/log: fix backlogging again, memlog was distrubing the process
src/connection: change some log levels, errors are errors, not debug info...
2007-09-26 21:22:44 +02:00
Loc Gomez 6ab2bb5146 * src/sample: Update manpage, sample config and sample bip.vim + typo
* src/bip: warn the user about rlimits upon start and whenever they're
reached
* src/bip: add -v flag (show version)
* src/bip: add admin option to user block, and restrict some commands to
admins. Log whenever a /bip command is used
* src/bip: enhance /BIP LIST and HELP commands, add INFO command
* src: fix defaults user/nick/realnames not loaded into connections,
resulting in segfault (WRITE_LINE1 to NULL) and oidentd.conf file not
containing usernames
* src: add default.h and version.h
* src: fflush() system log every log_sync_interval
* src/bip: fix "Resetted." printed whenever a client talks with
backlog_reset_ontalk true
* src/bip: fix backlog user options not set to defaults in add_user
* src/bip: fix oidentd.conf config written lately. Still some issues
* src/util: add human readable time hrtime(), bool2text() and ssl
checlmode2text() functions
* src: lower RECONN_TIMER + add RECONN_TIMER_MAX option
* src/bip: code some validate_config
2007-09-26 14:45:30 +02:00
Arnaud Cornet d888825da5 Raise LAGOUT_TIME to 480. 2007-09-13 17:24:57 +02:00
Arnaud Cornet ba4b9b9941 Fix off by one in path allocation for oident file path.
Hell, that's lame.
2007-09-13 17:02:00 +02:00
Arnaud Cornet 7967a47be0 Add log_free prototype. 2007-09-09 11:24:21 +02:00
Arnaud Cornet e9e9549228 Reinit logs for a given connection on well chosen times. 2007-09-08 23:51:45 +02:00
Arnaud Cornet a00a146193 Add some reply when running commands.
Remove commented code
2007-09-07 01:05:55 +02:00
Arnaud Cornet d7e870fe67 Lot of cleanups wrt init and killing links
Cleanup sample config (make cert).
Implement some free functions (log_free and link_kill).
Move utility macros in src/util.h
Reorganiize initialisation functions.
2007-09-04 00:24:50 +02:00
Arnaud Cornet 995b3f071a Re-open main logfile to allow rotate.
Trivial fix.
2007-09-03 12:01:13 +02:00
Arnaud Cornet a5f8902232 Drop autostuff noise. Add boostrap to regenerate it. 2007-09-02 18:26:27 +02:00
Arnaud Cornet 909fe5e1c1 Lots of structural changes.
Move backlog options to user statment.
Drop ircise, to go towards real SIGHUP support.
2007-09-02 14:59:19 +02:00
Arnaud Cornet 7c4667bf1d Fix crash on startup 2007-08-19 09:59:57 +02:00
nohar aa40fef29a Close cleanly. Bug repported by netnut. 2007-07-20 14:45:33 +00:00
nohar 6273cf2d59 Add configuration directive to be able not to log bip information (not irc related, that is) 2007-07-01 12:43:09 +00:00
nohar 46bc59b0a6 Compile fix by trou. 2007-06-26 07:37:51 +00:00
nohar 0546c4baa2 Set socket flags setting. 2007-06-14 08:48:04 +00:00
nohar 5bffd8efb8 some stuff TODO 2007-05-31 22:09:24 +00:00
nohar 56fd224916 Lot's of cleanups. 2007-05-26 10:31:44 +00:00
kyoshiro ad9c4d7021 create mandatory directories 2007-05-23 20:55:09 +00:00
nohar fbd899145f Add comment in conf sample file. 2007-05-23 19:35:22 +00:00
nohar e4e0e8d9fc Comment typo fix. 2007-05-23 19:34:12 +00:00
nohar 88df6fb0cf And fix. 2007-05-23 19:32:54 +00:00
nohar 735743a321 Add comment in sample. 2007-05-23 19:29:56 +00:00
nohar f7bc5e4d7e add bug in BUGS. 2007-04-25 07:41:13 +00:00
nohar bd804576d9 Add BUGS. 2007-04-25 07:35:13 +00:00
kyoshiro cc21d62522 fix password not quoted 2007-03-24 12:47:09 +00:00
kyoshiro 220de6e088 fixes 2007-03-24 11:58:58 +00:00
kyoshiro c41cc8c155 todo faq
ssl network sample
2007-03-23 21:45:03 +00:00
nohar c0b86c5e2c Say somegthing in changelog about a release. 2007-02-27 21:02:27 +00:00
69 changed files with 14083 additions and 16198 deletions

22
.clang-format Normal file
View 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
View 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

View File

@ -1,12 +1,13 @@
Arnaud 'nohar' Cornet
Loïc 'Kyoshiro' Gomez
Loïc 'Kyoshiro' Gomez
Sexy contributors:
Yoan 'jj' Guillot: fixes
Yannick 'YS' Schaus: SSL cert stuff
Raphaël 'Trou' Rigo: fixes
Raphaël 'Trou' Rigo: fixes
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/)

1
BUGS Normal file
View File

@ -0,0 +1 @@
- make install fails to install examples.

View File

@ -1,4 +1,4 @@
bip copyright 2004 2005 Arnaud Cornet and Loic Gomez, is released under the
bip copyright 2004 2005 Arnaud Cornet and Loïc Gomez, is released under the
terms of the GNU GPL, License that you can find below.
Specific permission is granted for the GPLed code in this distribution to

4658
ChangeLog

File diff suppressed because it is too large Load Diff

414
INSTALL
View File

@ -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.

View File

@ -1 +1,18 @@
SUBDIRS = src samples
if COND_WANT_TESTS
MAYBE_TESTS = tests
endif
SUBDIRS = src . $(MAYBE_TESTS)
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
EXTRA_DIST = \
BUGS \
scripts/bip-release \
scripts/bipgenconfig \
systemd
lint:
find src/ tests/ \( -name *.c -o -name *.h \) -type f -print0 | xargs -0 clang-format -i

View File

@ -1,574 +0,0 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \
install-sh missing mkinstalldirs ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src samples
all: all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d $(distdir) || mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
tags-recursive uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

160
NEWS
View File

@ -0,0 +1,160 @@
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) "Ill have the same thing please"
- Fix build OpenSSL detection issue.
2009-11-15 (0.8.3) "Hey Dublin! Whats 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
Slight log format change (now the format of the log of queries is very
similar to the on used for channels)
- "Window"-local blreset and blreset on talk. By default the blreset_on_talk
now only clears the backlog of the query you talked to or the channel you
talked to. The /quote bip blreset command now can take a query name or a
channel name as an argument. "/quote bip blreset" still resets the backlog of
the whole network.
- /quote bip backlog x command where x is the number of hours will backlog x
hours.
- autorejoin on kick by default. Can be disabled with the option
autojoin_on_kick = false in a connection block.
- 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.
- Close/reopen files on sighup.
- Have some reply when running BIP commands. ssl_check_mode, always_backlog,
backlog, bl_msg_only, backlog_lines, backlog_no_timestamp, blreset_on_talk be
settable at the connection block rather than the user block.
- Add backlog option to channels. Useful if you don't care about one particular
channel.
- bip_use_notice: Add this option to receive bip message through notices.
- Make SSL "basic" certificate check more loose (more SSH-like). In "basic"
mode, normally un trusted certificates get to be trusted if they manually
trusted by user. This provides an SSH like private key auth mechani Expired
certificates were considered invalid in this mode which does not make much
sense.
- blreset: add -q option to /bip blreset command if you don't want it to reply
anything (for scripts).
- Support add_conn and del_conn bip commands for live connection addition and
removal.
- Have a bold arrow to highligh your own word on private messages and multiple
connected clients.
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.
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.
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

243
README
View File

@ -1,53 +1,224 @@
Bip can be used in two different way:
This is the BIP IRC Proxy README.
Bip can be used in two different ways:
- Old school bnc user style: easy and straightforward.
- Unix service style with and init.d scripts and the logs in /var/log
This small README file explains the usage "Old school" with which :
This small README file explains the usage "Old school" with which :
- you do not need the root privileges.
- gives easy access to the logs of the users of this bip to the one owning the
shell.
- gives easy access to the logs to the owner of the shell.
Install bip on the machine that will be running bip (which is likely to be your
personnal or shared server) either compiling the package or using your distro's
package. Then create a configuration file:
Table of contents :
If you are using a distribution package, the bip.conf sample configuration file
is likely to be shipped in /usr/share/doc/bip/examples/bip.conf.gz or something
similar.
I. Installation
II. Configuration
A. Manual configuration
B. Automated configuration
III. Running bip
IV. Using bip
A. Connecting your client(s)
B. Backlog and flood control
C. Multiple users and ident issues
Create your bip configuration an log directory:
# mkdir -p ~/.bip/logs
Put the uncompressed configuration file in your ~/.bip directory (it's path
should be ~/.bip/bip.conf), and edit it, most importantly the "user" section
that contains information about you and the servers you will want to connect
to. The "name" field in the "user" section is your login to connect to bip.
The "password" field is a hash of the password you will use to connect to bip.
To generate a hash value from a password, use bipmkpw, program which comes in
the bip package and source.
The "name" field of the "connection" subsections are the server identifier for
when you connect to bip.
I. INSTALLATION
Once all this is configured, start bip as you regular user:
Install bip on the machine that will be running bip (which is likely to be
your personnal or shared server) either compiling the package or using your
distro's package. Then create a configuration file.
# bip
Choose your distribution package if available. If not, build bip the
old-fashioned way. You will need make, gcc, lex, yacc, automake,
autoconf-archive and optionally libssl-dev to build bip.
Once bip starts, it connects to the different servers your defined in
"connection". Then you want to use your regular irc client and connect to bip.
Point your client to the machine bip is running and set the proper port number
(defined in your bip.conf). You should then configure the client to use a
specific irc server password constructed this way:
Just issue:
user:password:network
From bip-X.Y.Z.tar.gz package:
# ./configure && make
The user is the name field of the "user" section, the password is the *hash* of
the password you entered in the "password" field of the same user section (the
hash is generated with bipmkpw) and the network is the "name" field of the
"connection" subsection. This is how bip authenticates you and puts your client
to the correct network.
From repository:
# autoreconf -i
# ./configure --enable-maintainer-mode && make
Using the default (or sample file) configuration, logs are in ~/.bip/logs/
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.
Happy ircing!
By default, "-Werror" is used. If you encounter warnings, you could try:
# CFLAGS="-Wno-error" ./configure && make
II. CONFIGURATION
First of all, create your bip configuration an log directory:
# mkdir -p ~/.bip/logs
There are two ways to create your bip configuration :
- edit the sample bip.conf file to match your needs
- use the bipgenconfig script to easily generate a configuration
If you want to connect to bip using an SSL client, you'll need to create
a certificate / key pair (in a bip.pem file) to allow bip to serve SSL
sockets.
A. MANUAL CONFIGURATION
If you are using a distribution package, the bip.conf sample configuration
file is likely to be shipped in /usr/share/doc/bip/examples/bip.conf.gz or
something similar.
If not, you'll find sample configuration file in the source package's
`samples' subdirectory.
Put the uncompressed configuration file in your ~/.bip directory (its
path should be ~/.bip/bip.conf), and edit it, most importantly the "user"
section that contains information about you and the servers you will want
to connect to. The "name" field in the "user" section is your login to
connect to bip.
The "name" field of the "connection" subsections are the server identifier
for when you connect to bip.
The "password" field is a hash of the password you will use to connect to
bip. To generate a hash value from a password, use bipmkpw, program which
comes in the bip package and source.
If you've set client_side_ssl to true, you'll need to generate a bip.pem
file containing a certificate / key pair. In order to do so, you can use
the third party `openssl' binary :
# openssl req -new -x509 -days 365 -nodes -out bip.pem -keyout bip.pem
You can then remove the passphrase with :
# openssl x509 -subject -dates -fingerprint -noout -in bip.pem
B. AUTOMATED CONFIGURATION
You can also use the bipgenconfig script to generate a new configuration.
This script will also help you generate the SSL certificate / key pair
needed for clients to connect to BIP through SSL.
This script can be found either in the source package's `scripts'
directory or shipped with your distribution's package.
Using the script is very simple, and it will generate a configuration
file but won't overwrite any existing configuration.
It will ask you the path to the bipmkpw binary, to automatically hash the
passwords you'll provide. Please make sure to enter the correct path to
the binary or you might observe unexpected behaviour.
You'll need to move the generated configuration from bip.conf.autogen to
bip.conf and the generated PEM file from bip.pem.autogen to bip.pem (or
whatever path you've configured in bip.conf).
III. RUNNING BIP
Once all this is configured, start bip as your regular user:
# ./src/bip
If you have installed bip in your path (or if you are using you
distribution's package), simply use:
# bip
Once bip starts, it connects to the different servers your defined in
all "user"'s "connection" blocks.
IV. USING BIP
A. CONNECTING YOUR CLIENT(S)
Then you want to use your regular irc client and connect to bip. Point
your client to the machine bip is running and set the proper port number
(defined in your bip.conf). You should then configure the client to use a
specific irc server password constructed this way:
user:password:connection
The user is the name field of the "user" section, the password is the
password (*not* the hash) corresponding to the "password" field of the
same user section (which is the hash generated with bipmkpw) and the
connection is the "name" field of the "connection" subsection. This is
how bip authenticates you and puts your client to the correct network.
Using the default (or sample file) configuration, logs are in ~/.bip/logs/
B. BACKLOG AND FLOOD CONTROL
Bip has a backlogging system which will send back parts of the last logs
upon client connection. Depending on your configuration, that may mean a
*lot* of data sent back to your client.
Users' messages will be replayed as if they were being sent at the moment
your client connects to bip, and if not disabled, system messages will
appear as coming from the "-bip" user.
Considering that, you may want to disable your client's anti-flood system,
totally or not, depending on it's flexibility.
Since bip doesn't replay CTCP messages, you can safely let your client's
anti-flood system manage them.
[Xchat]
If you're using Xchat, you can "disable" it by issuing these commands :
/set flood_msg_num = 1000
/set flood_msg_time = 10
In fact you'll tell xchat to activate its anti-flood system when you're
receiving more than 1000 messages in less than 10 seconds.
If you forgot to set these, private messages may not appear in separate
tabs as usual. If so, simply issue a :
/set gui_auto_open_dialog on
C. MULTIPLE USERS AND IDENT ISSUES
When you host many connections to the same IRC network, you might have
more connections than allowed by the network from one host.
Depending on the network and the services it runs, session limits may be
enforced either matching only your ip address/hostname, or matching the
username/ident part too.
To avoid being killed for session limit exceeded, you should define a
default_username in each user {}; block. A user without default_username
would appear as ~bip@yourhost if bip is the system user running bip. With
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 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" {
default {
allow spoof_all
allow spoof_privport
allow spoof
}
}
Then reload oidentd and make sure that ~bip is accessible (+rx) by the
user running oidentd (which means most of the time ~bip should be world
readable and browsable +rx).
If you already have a ~bip/.oidentd.conf file, don't worry, bip'll only
add its entries without deleting any of the contents of the file.
This step should remove the "~" character from the username/ident part of
your ircmask, and thus satisfy some networks.
If the network is still killing you for session limit exceeded, you'll
have to contact it's admins and ask them for an exception on your host or
ip address.
Happy ircing!
-- Arnaud Cornet <nohar@t1r.net> and Loïc Gomez <opensource@kyoshiro.org>

View File

@ -1,25 +0,0 @@
*** This is a warning about bip's replay/backlog system ***
Bip has a backlogging system which will send back parts of the last logs upon
client connection. Depending on your configuration, that may mean a *lot* of
data sent back to your client.
Users' messages will be replayed as if they were being sent at the moment your
client connects to bip, and if not disabled, system messages will appear as
coming from the "-bip" user.
Considering that, you may want to disable your client's anti-flood system,
totally or not, depending on it's flexibility.
Since bip doesn't relay CTCP messages, you can safely let your client's
anti-flood system manage them.
[Xchat]
If you're using Xchat, you can "disable" it by issuing these commands :
/set flood_msg_num = 1000
/set flood_msg_time = 10
In fact you'll tell xchat to activate its anti-flood system when you're
receiving more than 1000 messages in less than 10 seconds.
If you forgot to set these, private messages may not appear in separate tabs
as usual. If so, simply issue a :
/set gui_auto_open_dialog on

15
TODO
View File

@ -1,9 +1,10 @@
- uid, gid
- keep invites when detached ?
- Allow to dump a config file, so that when the config is dynamically
changed, we can find it back after bip restart.
- allow global (or per net ?) IP filtering
- more /bip commands
- DCC proxying...
- encrypt logs
- pre_on_connect_send => before join
- use gnutls
- MODE #channel and WHO #channel on join
@ -23,7 +24,6 @@ Best regards,
Whoopie
--
23:46 < nixternal> i have a question...when i log into my bip server with more
than 1 client at a time...i get a mass "ban message" from
the server..notice of all channel bans that i am in
@ -38,3 +38,10 @@ Whoopie
that asked for it
23:54 < nohar> there is such thing for /who already
_____________
FAQ:
- why I cannot add non-ssl servers with ssl-servers
- why is my vhost not used when I connect (one IP)
- backlog_no_private

895
aclocal.m4 vendored
View File

@ -1,895 +0,0 @@
# generated automatically by aclocal 1.10 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_if(m4_PACKAGE_VERSION, [2.61],,
[m4_fatal([this file was generated for autoconf 2.61.
You have another version of autoconf. If you want to use that,
you should regenerate the build system entirely.], [63])])
# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.10])dnl
_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_PROG_LEX
# -----------
# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a
# "missing" invocation, for better error output.
AC_DEFUN([AM_PROG_LEX],
[AC_PREREQ(2.50)dnl
AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
AC_REQUIRE([AC_PROG_LEX])dnl
if test "$LEX" = :; then
LEX=${am_missing_run}flex
fi])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR

10
bip.1
View File

@ -6,7 +6,7 @@ bip \- BIP IRC Proxy
.SH SYNOPSIS
\fBbip\fP [ \fB-f\fP \fIconfig_file\fP ] [ \fB-n\fP ] [ \fB-h\fP ]
\fBbip\fP [ \fB-n\fP ] [ \fB-f\fP \fIconfig_file\fP ] [ \fB-s\fP \fIbipdir\fP ] [ \fB-h\fP ]
.SH DESCRIPTION
@ -24,8 +24,10 @@ Use config_file as the configuration file.
If no config file is given, bip will try to open ~/.bip/bip.conf.
.TP
\fB-s\fP homedir
Set bip home directory to homedir instead of $HOME/.bip.
\fB-s\fP bipdir
Set bip home directory to bipdir instead of $HOME/.bip. \fBbipdir\fP is
the default parent directory for client certificate, configuration, logs, pid,
oidentd.
.TP
\fB-h\fP
@ -38,7 +40,7 @@ bip.conf
.SH AUTHOR
Arnaud 'nohar' Cornet
Loic 'Kyoshiro' Gomez
Loïc 'Kyoshiro' Gomez
Thanks to jj, YS and lafouine, for hanging around while we were coding.

View File

@ -1,322 +0,0 @@
.TH BIP 1 "10 October 2005"
.SH NAME
bip.conf \- Configuration file for BIP IRC Proxy
.SH DESCRIPTION
A BIP configuration file consists of a list of variable affectations or
sections. It contains the global options, networks definitions, users
configuration, users connections declarations. Each section is described in
this manpage.
The bip.conf skeleton should be something like this :
.nf
option1 = value;
option2 = value;
...
network {
net_opt = value;
...
server { ... };
server { ... };
};
...
user {
user_opt = value;
...
connection {
conn_opt = value;
...
channel { ... };
};
connection {
conn_opt = value;
...
channel { ... };
channel { ... };
...
};
};
.fi
.SH SYNTAX RULES
The syntax is quite simple :
.br
\- everything after the \fB#\fP character is ignored (comments)
.br
\- each variable affectation must be finished with a \fB;\fP
.br
\- each section { } must be finished with a \fB;\fP
.br
If you use vim you will probably want to use vim with the provided
\fBbip.vim\fP syntax file to avoid common syntax and lexical mistakes. You can
also find an example configuration file along with BIP.
.SH GLOBAL OPTIONS
.TP
\fBbacklog_always\fP (default: \fBfalse\fP)
If true, clients will always receive \fBbacklog_lines\fP log lines, even if
they were already sent before. This option should of course not be enabled if
\fBbacklog_lines\fP is 0 !
.TP
\fBbacklog\fP (default: \fBtrue\fP)
Enable or disable the whole backlog system, which allows clients to see a
log replay upon connection.
.TP
\fBbacklog_lines\fP (default: \fB10\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
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.
\fBbacklog_no_timestamp\fP (default: \fBfalse\fP)
If true, backlogged line won't include the timestamp.
.TP
\fBbacklog_reset_on_talk\fP (default: \fBfalse\fP)
When true, backlog will not be reset upon client disconnection but upon client
talk (channel/private message or action). It means that next time you log to
your bip session the backlogging will start at the time right after your last
words on irc.
.TP
\fBbacklog_msg_only\fP (default: \fBfalse\fP)
When true, bip will backlog only channel/private messages/notices. No topic
change, nick change, user quit/part/join will be backlogged upon connection.
.TP
\fBclient_side_ssl\fP (default: \fBfalse\fP)
When true, clients will need to connect to BIP using SSL.
.TP
\fBip\fP
Ignored for the time beeing.
.TP
\fBlog\fP (default: \fBtrue\fP)
When true, the log system is enabled. Else, BIP will not write a single log
file. Backlog is then stored into memory.
.TP
\fBlog_format\fP (default: \fB%u/%n/%Y-%m/%c.%d.log\fP)
Determines the log file name depending on :
.br
\- %u username (name in user { }; section)
.br
\- %n network name (name in connection { }; section)
.br
\- %c channel name
.br
\- %Y 4 digits year
.br
\- %m 2 digits month
.br
\- %d 2 digits day
.TP
\fBlog_level\fP (default: \fB1\fP)
Specify the verbosity of BIP from 0 (fatal errors) to 6 (huge debug output)
.TP
\fBlog_root\fP (default: \fBHOME/.bip/logs\fP)
Main log directory. Sub-directories and files will be created from there
depending on \fBlog_format\fP.
.TP
\fBlog_sync_interval\fP (default: \fB5\fP)
Defines the delay between each logfiles sync to the disk. Must be a non null
positive integer.
.TP
\fBpid_file\fP (default: \fBHOME/.bip/bip.pid\fP)
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
\fBport\fP (default: \fB7778\fP)
The port on which BIP should listen for clients.
.SH NETWORK SECTION
This section allows you to declare a network for use in the connection
sections. It may appear more than once in the configuration file.
.TP
\fBssl\fP (default: \fBfalse\fP)
If true, BIP will connect to this network using SSL only. You cannot mix
SSL servers and non-SSL servers in the same network section. This is by choice,
we believe it's a bad idea.
.TP
\fBname\fP
It's the network name used in the \fBconnection section\fP. Please note that
this value is not used in \fBlog_format\fP, since it uses the variable
\fBname\fP from the \fBconnection section\fP.
.SH SERVER SUB-SECTION
BIP will cycle through the server sections list when reconnecting to a network.
It may appear more than once in a network section.
.TP
\fBhost\fP
The server's hostname or IP address.
.TP
\fBport\fP (default: \fB6667\fP)
The server port to connect to.
.SH USER SECTION
This section allows you to define the users allowed to connect to BIP and their
options. It may appear more than once in the configuration file.
.TP
\fBdefault_nick\fP
The default nick option for each \fBconnection section\fP where no \fBnick\fP
is defined. See \fBCONNECTION SECTION\fP for more details.
.TP
\fBdefault_realname\fP
The default realname option for each \fBconnection section\fP where no
\fBrealname\fP is defined. See \fBCONNECTION SECTION\fP for more details.
.TP
\fBdefault_user\fP
The default user option for each \fBconnection section\fP where no \fBuser\fP
is defined. See \fBCONNECTION SECTION\fP for more details.
.TP
\fBname\fP
The user name. It'll be used to authenticate to bip and in \fBlog_format\fP.
.TP
\fBpassword\fP
The password. It \fBMUST\fP be generated with \fBbimkpw\fP or it'll not work.
.TP
\fBssl_check_mode\fP (default: \fBnone\fP)
Tells whether BIP should check the server SSL certificate and against what.
Can be \fBnone\fP for no check at all, \fBca\fP to check if the cert is signed
by a Certificate Authority in repository, or \fBbasic\fP to check if cert
exists in repository. The repository is defined by \fBssl_check_store\fP.
.TP
\fBssl_check_store\fP (default: \fBnot set\fP)
This repository is browsed by BIP when a SSL certificate or CA check is needed.
.SH CONNECTION SUB-SECTION
Each connection section associates a user to the networks he wants to connect
to. Thus, it must be declared in the user sections, and can be used more than
once.
.TP
\fBaway_nick\fP (default: \fBnot set\fP)
If true, and if there are no more client attached, BIP will change nickname to
this \fBaway_nick\fP. Your nickname will be restored upon client connect.
.TP
\fBno_client_away_msg\fP (default: \fBnot set\fP)
This options allows you to set an away message. This away message will be set
when the last client disconnects, and removed when a client connects.
.TP
\fBfollow_nick\fP (default: \fBfalse\fP)
If set to true, when you change nick, BIP stores the new nickname as the new
default nickname value. Thus, if you are disconnected from the server, BIP will
restore the correct nickname.
.TP
\fBignore_first_nick\fP (default: \fBfalse\fP)
If set to true, BIP will ignore the nickname sent by the client upon connect.
Further nickname changes will be processed as usual.
.TP
\fBnetwork\fP
The network name. See the \fBNETWORK SECTION\fP.
.TP
\fBnick\fP
BIP will send that string as your nickname upon connect. If not specified
and if \fBdefault_nickname\fP is specified in the \fBuser section\fP, BIP will
use that default nickname string.
.TP
\fBon_connect_send\fP
You can specify this field more than once. BIP will send the text as is to the
server. It'd be useful for a greet on connect or to send you NickServ password.
.TP
\fBpassword\fP
This is the irc server password, which is sent upon connection to the irc server
only.
.TP
\fBrealname\fP
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 section\fP, BIP will use that default realname string.
.TP
\fBsource_port\fP
If specified, tells BIP to connect from this port to the IRC server.
.TP
\fBuser\fP
BIP will send that string as the user part (usually between ! and @ in a whois
result) upon connect. It's also used by the oidentd support (if enabled). If
not specified and if \fBdefault_user\fP is specified in the \fBuser section\fP,
BIP will use that default user string.
.TP
\fBvhost\fP
If specified, BIP will use \fBvhost\fP as the IP address to bind to when
connecting to the IRC server. It'll allow you to use a specific IP address
for this network when you have more than one. This options is totally useless
to people who only have one IP address.
.SH CHANNEL SUB-SUB-SECTION
This section defines the list of channels to join for a user on a particular
network. It is to be found in the connection sections and appear more than once
in a connection section.
.TP
\fBname\fP
The channel name (#bip, &bip, ...).
.TP
\fBkey\fP
The channel key if needed.
.SH SEE ALSO
bip, bipmkpw
.SH AUTHOR
bip authors:
.br
Arnaud 'nohar' Cornet
.br
Loic 'Kyoshiro' Gomez
Thanks to jj, YS and lafouine, for hanging around while we were coding.
.br
Crypto shamelessly taken from Christophe 'sexy' Devine.
.br
This man page is written by Loic 'Kyoshiro' Gomez.

497
bip.conf.5 Normal file
View File

@ -0,0 +1,497 @@
.TH BIP.CONF 5 "2 January 2022"
.SH NAME
bip.conf \- Configuration file for BIP IRC Proxy
.SH SYNOPSIS
.PP
~/.bip/bip.conf
.SH DESCRIPTION
A BIP configuration file consists of a list of variable affectations or
sections. It contains the global options, networks definitions, users
configuration, users connections declarations. Each section is described in
this manpage.
The
.BR bip.conf
skeleton should be something like this :
.EX
option1 = value;
option2 = value;
...
network {
net_opt = value;
...
server { ... };
server { ... };
};
...
user {
user_opt = value;
...
connection {
conn_opt = value;
...
channel { ... };
};
connection {
conn_opt = value;
...
channel { ... };
channel { ... };
...
};
};
.EE
.SH SYNTAX RULES
The syntax is quite simple :
.RS
.IP \(bu 4
everything after the \fB#\fP character is ignored (comments)
.IP \(bu 4
each variable affectation must be finished with a \fB;\fP
.IP \(bu 4
each section { } must be finished with a \fB;\fP
.RE
If you use vim you will probably want to use vim with the provided
\fBbip.vim\fP syntax file to avoid common syntax and lexical mistakes. You can
also find an example configuration file along with BIP.
By default, \fBbipdir\fR is the \fI$HOME/.bip\fR directory and the parent
directory for client certificate, configuration, logs, pid, oidentd. If
environment variable \fB$HOME\fP doesn't exist, \fB-s\fP parameter must be
used.
.SH GLOBAL OPTIONS
.TP
\fBclient_side_ssl\fP (default: \fBfalse\fP)
When true, clients will need to connect to BIP using SSL.
You'll also need to generate a SSL cert/key pair in \fIbipdir/bip.pem\fR
(usually \fI~/.bip/bip.pem\fR or \fI/var/lib/bip/bip.pem\fR) or \fBclient_side_ssl_pem\fP if
defined.
.TP
\fBclient_side_ssl_pem\fP (default: \fI<bipdir>/bip.pem\fR)
Set this to the full path of the cert/key pair bip should use to accept clients
SSL connections.
.TP
\fBclient_side_ciphers\fP
OpenSSL cipher lists used for clients SSL connections. If not set, OpenSSL
default ciphers will be used.
.TP
\fBclient_side_dh_param\fP DH parameters filename\fP (default: \fI<bipdir>/dh.pem\fR)
Used for clients SSL connections, Supply at least 2048-bit parameters.
.TP
\fBssl_default_ciphers\fP
OpenSSL cipher lists used for server connections. If not set, OpenSSL default
ciphers will be used.
.TP
\fBip\fP (default: \fB0.0.0.0\fP)
Listening IP address. This is the IP address bip will listen for incoming
client connections.
.TP
\fBlog\fP (default: \fBtrue\fP)
When true, the log system is enabled. Else, BIP will not write a single log
file. Backlog is then stored into memory.
.TP
\fBlog_system\fP (default: \fBtrue\fP)
When true, system messages such as connection errors are logged. Else, BIP will
not write system logs.
.TP
\fBlog_format\fP (default: \fB%u/%n/%Y-%m/%c.%d.log\fP)
Determines the log filename depending on :
.br
\- %u username (name in \fBuser\fP { }; section)
.br
\- %n network name (name in \fBconnection\fP { }; section)
.br
\- %c channel name
.br
\- %Y 4 digits year
.br
\- %m 2 digits month
.br
\- %d 2 digits day
.TP
\fBlog_level\fP (default: \fB1\fP)
Specify the verbosity of BIP from 0 (fatal errors) to 6 (huge debug output)
.TP
\fBlog_root\fP (default: \fI<bipdir>/logs\fR
Main log directory. Sub-directories and files will be created from there
depending on \fBlog_format\fP.
.TP
\fBlog_sync_interval\fP (default: \fB5\fP)
Defines the delay between each logfiles sync to the disk. Must be a non null
positive integer.
.TP
\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
.TP
\fBpid_file\fP (default: \fI<bipdir>/bip.pid\fR)
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).
.TP
\fBport\fP (default: \fB7778\fP)
The port on which BIP should listen for clients.
.SH NETWORK SECTION
This section allows you to declare a network for use in the connection
sections. It may appear more than once in the configuration file.
.TP
\fBssl\fP (default: \fBfalse\fP)
If true, BIP will connect to this network using SSL only. You cannot mix
SSL servers and non-SSL servers in the same \fBnetwork\fP section. This is by choice,
we believe it's a bad idea.
.TP
\fBssl_ciphers\fP (override global \fBssl_default_ciphers\fP)
OpenSSL cipher lists used for this network.
.TP
\fBname\fP
It's the network name used in the \fBconnection\fP section. Please note that
this value is not used in \fBlog_format\fP, since it uses the variable
\fBname\fP from the \fBconnection\fP section.
.SH SERVER SUB-SECTION
BIP will cycle through the server sections list when reconnecting to a network.
It may appear more than once in a network section.
.TP
\fBhost\fP
The server's hostname or IP address.
.TP
\fBport\fP (default: \fB6667\fP)
The server port to connect to.
.SH USER SECTION
This section allows you to define the users allowed to connect to BIP and their
options. It may appear more than once in the configuration file.
.TP
\fBadmin\fP (default: \fBfalse\fP)
If a user has admin set to true, he'll become a bip administrator, which allows
him for example to reload bip from IRC or to see the user configuration.
.TP
\fBbacklog\fP (default: \fBtrue\fP)
Enable or disable the whole backlog system, which allows clients to see a
log replay upon connection.
.TP
\fBbacklog_always\fP (default: \fBfalse\fP)
If true, clients will always receive \fBbacklog_lines\fP log lines, even if
they were already sent before. That means :
If \fBbacklog_always\fP is false, backlog will be reset whenever there
is no more client connected to a network. Else backlog will not be reset.
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: \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
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)
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)
When true, backlog will be reset upon client talk (channel/private message or
action). It means that next time you log to your bip session, the backlogging
will start at the time right after your last words on that specific channel or
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 reset when you talk in the network.
.TP
\fBbacklog_msg_only\fP (default: \fBfalse\fP)
When true, bip will backlog only channel/private messages/notices. No topic
change, nick change, user quit/part/join will be backlogged upon connection.
.TP
\fBbip_use_notice\fP (default: \fBfalse\fP)
If \fBbip_use_notice\fP is true, bip's notifications to the clients will be
send as notices instead of private messages. For example, this setting applies
to disconnection notifications or \fB/BIP\fP command replies.
.TP
\fBdefault_nick\fP
The default nick option for each \fBconnection\fP section where no \fBnick\fP
is defined. See \fBCONNECTION SECTION\fP for more details.
.TP
\fBdefault_realname\fP
The default realname option for each \fBconnection\fP section where no
\fBrealname\fP is defined. See \fBCONNECTION SECTION\fP for more details.
.TP
\fBdefault_user\fP
The default user option for each \fBconnection\fP section where no \fBuser\fP
is defined. See \fBCONNECTION SECTION\fP for more details.
.TP
\fBname\fP
The username. It'll be used to authenticate to bip and in \fBlog_format\fP.
.TP
\fBpassword\fP
The password. It \fBMUST\fP be generated with \fBbipmkpw\fP or it'll not work.
.TP
\fBssl_check_mode\fP (default: \fBnone\fP)
Tells whether BIP should check the server SSL certificate and against what.
Can be \fBnone\fP for no check at all, \fBca\fP to check if the cert is signed
by a Certificate Authority in repository, or \fBbasic\fP to check if cert
exists in repository. The repository is defined by \fBssl_check_store\fP. This
allows a "ssh-like" private key generation scheme. Note that in basic mode:
.br
- expired certificates that are in the store are considered valid.
.br
- CA-signed certificates are considered valid even if not in store.
.TP
\fBssl_check_store\fP (default: \fBnot set\fP)
This repository is browsed by BIP when a SSL certificate or CA check is needed.
In ssl_check_mode \fBbasic\fP it must be a file, to which certificates you
choose to trust will be appended. In ssl_check_mode \fBca\fP it may be a
single file containing one or more trusted certificates concatenated together
between BEGIN CERTIFICATE and END CERTIFICATE lines, a directory containing
individual certificates in PEM format which has been processed by \fBc_rehash\fP,
or unset, in which case bip will attempt to use the default certificate store of
the OpenSSL it is built against.
.TP
\fBssl_client_certfile\fP (default: \fBnot set\fP)
Some networks (OFTC at least) allow you to authenticate to nickserv services
using a client side certificate. Make this variable point to the .pem file to
use this feature.
.SH CONNECTION SUB-SECTION
Each \fBconnection\fP section associates a user to the networks he wants to connect
to. Thus, it must be declared in the \fBUser\fP sections, and can be used more than
once.
.TP
\fBaway_nick\fP (default: \fBnot set\fP)
If set, and if there are no more client attached, BIP will change nickname to
this \fBaway_nick\fP. Your nickname will be restored upon client connect.
.TP
\fBno_client_away_msg\fP (default: \fBnot set\fP)
This options allows you to set an away message. This away message will be set
when the last client disconnects, and removed when a client connects.
.TP
\fBfollow_nick\fP (default: \fBfalse\fP)
If set to true, when you change nick, BIP stores the new nickname as the new
default nickname value. Thus, if you are disconnected from the server, BIP will
restore the correct nickname.
.TP
\fBautojoin_on_kick\fP (default: \fBtrue\fP)
If set to false bip will not attempt to re-join a channel from which you were
kicked.
.TP
\fBignore_first_nick\fP (default: \fBfalse\fP)
If set to true, BIP will ignore the nickname sent by the client upon connect.
Further nickname changes will be processed as usual.
.TP
\fBignore_server_capab\fP (default: \fBtrue\fP)
By default bip ignores when a server advertises the CAPAB feature. Servers that
support this can prefix each line with a "+" or a "-" depending if a user is
registered or not. xchat checks if a server has the CAPAB feature and enables
it.
If you have two clients connected to a bip connection, one that supports this
mode and one that does not, you see the plus and the minuses on each line in
the client that does not support CAPAB. To avoid that, when a server advertises
CAPAB bip simply removes it. You can set this option to false to keep using
CAPAB (if you only use clients that support it for instance).
.TP
\fBnetwork\fP
The network name. See the \fBNETWORK SECTION\fP.
.TP
\fBlog\fP (override global log)
When \fBtrue\fP, the file logs are enabled for this connection.
When \fBfalse\fP, no log file is written, logs are kept in memory.
.TP
\fBnick\fP
BIP will send that string as your nickname upon connect. If not specified
and if \fBdefault_nickname\fP is specified in the \fBuser\fP section, BIP will
use that default nickname string.
.TP
\fBon_connect_send\fP
You can specify this field more than once. BIP will send the text as is to the
server. It'd be useful for a greet on connect or to send your NickServ password.
.TP
\fBpassword\fP
This is the IRC server password, which is sent upon connection to the IRC server
only.
.TP
\fBrealname\fP
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.
.TP
\fBssl_check_mode\fP (default: \fBthe user's option\fP)
See \fBssl_check_mode\fP option in \fBUser\fP section.
.TP
\fBuser\fP
BIP will send that string as the user part (usually between ! and @ in a whois
result) upon connect. It's also used by the oidentd support (if enabled). If
not specified and if \fBdefault_user\fP is specified in the \fBuser\fP section,
BIP will use that default user string.
.TP
\fBvhost\fP
If specified, BIP will use \fBvhost\fP as the IP address to bind to when
connecting to the IRC server. It'll allow you to use a specific IP address
for this network when you have more than one. This options is totally useless
to people who only have one IP address.
.SH CHANNEL SUB-SUB-SECTION
This section defines the list of channels to join for a user on a particular
network. It is to be found in the \fBconnection\fP sections and appear more than once
in a \fBconnection\fP section.
.TP
\fBname\fP
The channel name (#bip, &bip, ...).
.TP
\fBkey\fP
The channel key if needed.
.TP
\fBbacklog\fP (default: \fBtrue\fP)
Enable or disable backlogging of this particular channel.
Setting this to true will NOT enable the backlog system, see the \fBuser\fP
section.
.SH IRC CLIENT CONFIGURATION
.P
On your IRC client, setup as many IRC servers as connections defined in your
\fBconnection\fP section.
.P
Host and port must match values defined in \fBip\fP and \fBport\fP global
option. The password must be \fIusername:password:connectionname\fR where:
.RS
.IP \(bu 4
username is the \fIname\fR defined in the \fIuser\fR section;
.IP \(bu 4
password is the clear text value of the \fIpassword\fR corresponding to the
hashed password defined in the \fIuser\fR section;
.IP \(bu 4
connectionname is the \fIname\fR defined in \fIconnection\fR sub-section.
.RE
.SH SEE ALSO
.BR bip (1),
.BR bipmkpw (1)
.SH AUTHOR
bip authors:
.br
Arnaud 'nohar' Cornet
.br
Loïc 'Kyoshiro' Gomez
Thanks to jj, YS and lafouine, for hanging around while we were coding.
.br
Crypto shamelessly taken from Christophe 'sexy' Devine.
.br
This man page is written by Loïc 'Kyoshiro' Gomez.

27
bipgenconfig.1 Normal file
View 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.

View File

@ -13,14 +13,17 @@ bipmkpw \- Password hasher for BIP
bipmkpw converts a password into the double-hash used by bip. Copy the
generated output from bipmkpw into bip config file.
Password cannot contain spaces.
.SH SEE ALSO
bip.conf
.BR bip.conf (5)
.BR bip (1)
.SH COPYRIGHT
Arnaud 'nohar' Cornet
Loic 'Kyoshiro' Gomez
Loïc 'Kyoshiro' Gomez
Thanks to jj, YS and lafouine, for hanging around while we were coding.

1465
config.guess vendored

File diff suppressed because it is too large Load Diff

1569
config.sub vendored

File diff suppressed because it is too large Load Diff

5141
configure vendored

File diff suppressed because it is too large Load Diff

180
configure.ac Normal file
View File

@ -0,0 +1,180 @@
m4_pattern_allow([^AM_])
m4_pattern_allow([^AC_])
AC_PREREQ([2.69])
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
AC_CONFIG_HEADERS([src/config.h])
# Checks for programs
AC_PROG_CC
AM_PROG_AR
AC_PROG_RANLIB
AC_PROG_INSTALL
AM_PROG_LEX
AC_PROG_YACC
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
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])
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
AC_CACHE_CHECK([whether $CC accepts hardening flags], [ap_cv_cc_hardening], [
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code"
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
[ap_cv_cc_hardening=yes],
[ap_cv_cc_hardening=no],
[ap_cv_cc_hardening=yes]
)
CFLAGS=$save_CFLAGS
])
if test "$ap_cv_cc_hardening" = "yes"; then
CFLAGS="$CFLAGS -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code"
enable_cc_hardening=yes
fi
AC_CACHE_CHECK([whether $CC accepts some warning flags], [ap_cv_cc_warnings], [
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS -Wformat-overflow=2 -Wformat-truncation=2 -Wtrampolines -Warray-bounds=2 -Wimplicit-fallthrough=3 -Wtraditional-conversion -Wshift-overflow=2 -Wstringop-overflow=4 -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wformat-signedness -Wstack-usage=1000000 -Wcast-align=strict"
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
[ap_cv_cc_warnings=yes],
[ap_cv_cc_warnings=no],
[ap_cv_cc_warnings=yes]
)
CFLAGS=$save_CFLAGS
])
if test "$ap_cv_cc_warnings" = "yes"; then
CFLAGS="$CFLAGS -Wformat-overflow=2 -Wformat-truncation=2 -Wtrampolines -Warray-bounds=2 -Wimplicit-fallthrough=3 -Wtraditional-conversion -Wshift-overflow=2 -Wstringop-overflow=4 -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wformat-signedness -Wstack-usage=1000000 -Wcast-align=strict"
enable_cc_warnings=yes
fi
AC_CACHE_CHECK([whether $CC accepts some supplementary warning flags], [ap_cv_cc_warnings2], [
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS -Wformat=2 -Wformat-security -Wnull-dereference -Wstack-protector -Walloca -Wvla -Wcast-qual -Wconversion -Wshadow -Wstrict-overflow=4 -Wstrict-prototypes -Wswitch-default -Wswitch-enum"
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
[ap_cv_cc_warnings2=yes],
[ap_cv_cc_warnings2=no],
[ap_cv_cc_warnings2=yes]
)
CFLAGS=$save_CFLAGS
])
if test "$ap_cv_cc_warnings2" = "yes"; then
CFLAGS="$CFLAGS -Wformat=2 -Wformat-security -Wnull-dereference -Wstack-protector -Walloca -Wvla -Wcast-qual -Wconversion -Wshadow -Wstrict-overflow=4 -Wstrict-prototypes -Wswitch-default -Wswitch-enum"
enable_cc_warnings2=yes
fi
AC_CACHE_CHECK([whether $CC accepts -Warith-conversion flag], [ap_cv_cc_warith], [
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS -Warith-conversion"
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
[ap_cv_cc_warith=yes],
[ap_cv_cc_warith=no],
[ap_cv_cc_warith=yes]
)
CFLAGS=$save_CFLAGS
])
if test "$ap_cv_cc_warith" = "yes"; then
CFLAGS="$CFLAGS -Warith-conversion"
enable_warith_conversion=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 src/Makefile tests/Makefile])
AC_OUTPUT
echo OPENSSL: $with_openssl
echo PIE: $enable_pie
echo TESTS: $enable_tests

View File

@ -1,39 +0,0 @@
AC_INIT(src/bip.c)
AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE(bip,0.6.0)
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_YACC
AM_PROG_LEX
CFLAGS="-O2 -W -Wall"
debug=false
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on debugging],
[debug=true && CFLAGS="-O0 -g -W -Wall"])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
oidentd=false
AC_ARG_ENABLE(oidentd,
[ --enable-oidentd Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)],
AC_DEFINE([HAVE_OIDENTD], [], [Enable oidentd.conf management support])
)
#[oidentd=true]
AM_CONDITIONAL(OIDENTD, test x$debug = xtrue)
requires_libssl="yes"
AC_ARG_ENABLE(ssl,
[ --disable-ssl Drop OpenSSL support],
[requires_libssl=no])
if test "x$requires_libssl" = "xyes" ; then
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [],
[AC_MSG_ERROR([library 'crypto' is required for OpenSSL support])])
AC_CHECK_LIB(ssl, SSL_read, [],
[AC_MSG_ERROR(
[library 'ssl' is required for OpenSSL support])],
-lcrypto)
fi
AC_OUTPUT(Makefile src/Makefile samples/Makefile)

530
depcomp
View File

@ -1,530 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-07-09.11
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,269 +0,0 @@
#!/bin/sh
#
# install - install a program, script, or datafile
#
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

360
missing
View File

@ -1,360 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2005-06-08.21
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,40 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

View File

@ -1,2 +0,0 @@
examplesdir = $(prefix)/share/doc/bip/examples/
examples_DATA = bip.conf bip.vim

View File

@ -1,324 +0,0 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = samples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(examplesdir)"
examplesDATA_INSTALL = $(INSTALL_DATA)
DATA = $(examples_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
examplesdir = $(prefix)/share/doc/bip/examples/
examples_DATA = bip.conf bip.vim
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu samples/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu samples/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-examplesDATA: $(examples_DATA)
@$(NORMAL_INSTALL)
test -z "$(examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(examplesdir)"
@list='$(examples_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(examplesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(examplesdir)/$$f'"; \
$(examplesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(examplesdir)/$$f"; \
done
uninstall-examplesDATA:
@$(NORMAL_UNINSTALL)
@list='$(examples_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(examplesdir)/$$f'"; \
rm -f "$(DESTDIR)$(examplesdir)/$$f"; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(examplesdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-examplesDATA
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-examplesDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-examplesDATA install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am uninstall uninstall-am uninstall-examplesDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,87 +1,140 @@
# bip default config file.
# Thou shoult change thy password
ip = "0.0.0.0";
# Default values are commented out.
# Listening IP address. This is the IP address bip will listen for incoming
# client connections.
#ip = "0.0.0.0";
# To connect a client to bip, try the port below, and
# be sure to set the password to the value
# specified in the network you want to connect to.
port = 7778;
# specified in the network you want to connect to.
# Port is 7778 by default.
#port = 7778;
# If you set this to true, you'll only be able to connect to bip
# with a SSL capable IRC client. Be sure to generate a certificate
# for bip with 'make cert'
client_side_ssl = false;
# for bip using scripts/bipgenconfig.
#client_side_ssl = false;
log_level = 3;
# This is the file containing the SSL cert/key pair bip'll use to
# serve SSL clients. If unset, it defaults to <bipdir>/bip.pem
# Supply at least 2048-bit parameters, for example using openssl:
# openssl dhparam -out dh.pem 2048;
#client_side_ssl_pem = "<bipdir>/bip.pem";
#pid_file="/var/run/bip/bip.pid";
# OpenSSL cipher lists used with SSL client connections.
# If not set, OpenSSL default ciphers will be used. See OpenSSL ciphers
# command. An example value: "ECDHE-RSA-AES128-GCM-SHA256".
#client_side_ciphers = ;
# DH parameters bip'll use when serving SSL clients.
# Supply at least 2048-bit parameters, for example using openssl:
# openssl dhparam -out dh.pem 2048;
#client_side_dh_param = "<bipdir>/dh.pem";
# Default OpenSSL cipher lists used with outgoing connections to IRC servers.
# If not set, OpenSSL default ciphers will be used. See OpenSSL ciphers
# command. An example value: "ECDHE-RSA-AES128-GCM-SHA256".
# If not set, OpenSSL default ciphers will be used.
#ssl_default_ciphers = ;
# 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;
# Define bip's log level :
# 0 : only fatal errors
# 1 : add others errors
# 2 : add warnings
# 3 : add info messages
# 4 : add debug messages
#log_level = 3;
# This is where logs go. Channel and private messages will use that
# configuration value as a prefix, and then log_format to determine
# full log filename.
#log_root = "/var/proxy/logs";
# full log filename. Defaults to <bipdir>/logs.
#log_root = "";
# Set to false and uncomment this line to disable bip's internal messages
# logging. This is not recommended, a better option is to reduce log_level.
#log_system = true;
# Log format allows you to make log filenames depend on the log line's
# attributes. Here's a list :
# %u -> user name
# %u -> username
# %n -> network name
# %Y -> 4 digit year
# %m -> 2 digit month
# %d -> 2 digit day
# %c -> destination (#chan, privates, ...)
#log_format = "%n/%Y-%m/%c.%d.log";
# %h -> 2 digit hour of the day
# %c -> destination (#chan, nick, ...)
#log_format = "%u/%n/%Y-%m/%c.%d.log";
# Sets the frequency (in seconds) of log syncing (real write to kernel)
#log_sync_interval = 5;
# Makes bip send the log of each channel and privates while
# you were not connected to the proxy upon connection.
#backlog = true; # enable backlog
backlog_lines = 10; # number of lines in backlog, 0 means no limit
backlog_always = true; # backlog even lines already backlogged
#backlog_no_timestamp = false; # Disables time stamps if you find them ugly.
# If blreset_on_talk talking on an irc network has the same effect of issuing
# /bip blreset, meaning that stuffed logged before the command won't be read
# back on backlog
#blreset_on_talk = false;
# If bl_msg_only is true, only channel and private messages will be backlogged
# upon the reconnection of a client. Default is false, thus joins, parts, quits,
# nick changes, topic changes, ... are backlogged
#backlog_msg_only = false;
# 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 = 30;
# Network definition, a name and server info
network {
name = "iiens";
server { host = "irc.iiens.net"; port = 6667; };
};
#network {
# name = "iiens";
# server { host = "irc.iiens.net"; port = 6667; };
#};
network {
name = "oftc";
server { host = "irc.oftc.net"; port = 6667; };
#server { host = "other.oftc.server"; port = 6667; };
};
#network {
# name = "oftc";
# server { host = "irc.oftc.net"; port = 6667; };
# server { host = "other.oftc.server"; port = 6667; };
#};
# SSL network sample. SSL is per-network option, not per-server !
#network {
# name = "oftcs";
# ssl = true;
# server { host = "ircs.oftc.net"; port = 9999; };
#};
# Configuration example with one user who connects to two irc networks
# To use the multi-server feature:
# - define the connections
# - chose and setup a different login for each connection
# on your irc client:
# - Use the multi server feature of your client, the server beeing each time
# - Use the multi server feature of your client, the server being each time
# the server where bip is running. In your client setup server password to:
# username:password:connectionname
# - do not store the password in clear here, use the bipmkpw util to generate
# a hash
# a hash
# User structure is grouping information for a given user
user {
# The name in bip of the user
# This is used by bip only
name = "bip4ever";
# this user's password (md5(md5("tata"))) with seed - generated by bipmkpw
password = "3880f2b39b3b9cb507b052b695d2680859bfc327";
#user {
# The name in bip of the user, required. This is used by bip only.
#name = ;
# This user's password (md5(md5("tata"))) with seed - generated by
# bipmkpw, for example: "3880f2b39b3b9cb507b052b695d2680859bfc327".
#password = ;
# Set this to true if you want this user to have admin privileges on
# bip. User will be able to RELOAD bip and see all users' configuration
# (except pass).
#admin = false;
# When bip_use_notice is true, bip will send internal messages like
# disconnection notifications or /BIP commands replies as notices
# instead of private messages. The default is false.
#bip_use_notice = false;
# SSL certificates checking mode for user:
# - "none" to accept anything;
@ -92,71 +145,144 @@ user {
# in the store below (you have to put in it every cert, CRL, up to the
# root CA). You have to build your store manually, so you may prefer
# using "basic" unless you're a crypto zealot...
ssl_check_mode = "none";
#ssl_check_mode = "none";
# Location of the user's store for SSL certificate check
# Location of the user's store for server SSL certificate check
# In "basic" mode, that must point to a single file with all trusted
# certs concatenated together (the interactive "trust" appends to this
# file).
# In "ca" mode, it's a directory of a standard openssl store; you must
# put PEM objects (certificates, CRLs...) with .pem extension and run
# `c_rehash .' in it
ssl_check_store = "/home/bip4ever/.bip/trustedcerts.txt";
# In "ca" mode, it can be either:
# - a directory of a standard openssl store; you must put PEM objects
# (certificates, CRLs...) with .pem extension and run `c_rehash .' in it
# - a certificate bundle file containing one or more certificates in PEM
# format, enclosed in BEGIN CERTIFICATE / END CERTIFICATE lines
# - unspecified: in this case, bip will attempt to use the default
# certificate store of the OpenSSL it is built against. This is the default.
#ssl_check_store = "";
# Some networks (OFTC at least) allow you to authenticate to nickserv
# using client side certificates, see
# http://www.oftc.net/oftc/NickServ/CertFP
# This is where you put your user's certificate.
# The default is not to use a certificate.
#ssl_client_certfile = "";
# These will be the default for each connections.
#default_nick = ;
#default_user = ;
#default_realname = ;
# Makes bip send the log of each channel and privates while
# you were not connected to the proxy upon connection.
#backlog = true; # enable backlog
#backlog_lines = 10; # number of lines in backlog, 0 means no limit
# When true, backlog even lines already backlogged, do not reset backlog
# when no client attached anymore.
#backlog_always = 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
# before the command won't be read back on backlog.
#backlog_reset_on_talk = false;
# If you have backlog_reset_on_talk set to true, talking in a query
# will reset the backlog for the query. Same goes for channel. With the
# following option set to true, talking in a connection will reset the
# whole connection. The backlog for the current network is reset.
#backlog_reset_connection = false;
# If bl_msg_only is true, only channel and private messages will be
# backlogged upon the reconnection of a client. Default is false, thus
# joins, parts, quits, nick changes, topic changes, ... are backlogged.
#backlog_msg_only = false;
# These will be the default for each connections
default_nick = "bip4ever";
default_user = "bip4ever";
default_realname = "bip4ever";
# A user can have mutiple connections to irc networks.
# define a connection:
connection {
name = "iiens"; # used by bip only
network = "iiens"; # which ircnet to connect to
#connection {
# used by bip only, required (for example: "oftc").
#name = ;
# which ircnet to connect to, required (for example: "oftc").
#network = ;
#log = false; # disable or enable logging and backlogging for
# the current connection. Overrides global
# (top-level) log parameter.
# You can define ssl_check_mode here, if you want a different
# behavior than the one defined in the parent level ('user' section).
#ssl_check_mode = "none";
# If you have multiple IP addresses, you can set the one you
# want bip to use here. See manpage for more information
#vhost = "192.168.10.6";
# want bip to use here. This options is totally useless to people who
# only have one IP address.
#vhost = "";
# 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 = "4567";
#source_port = 10000;
# these will be sent to the real server
# These will be sent to the real server. Nick, user and realname are
# required. Default values are defined at the parent level
# (default_nick, default_user, default_realname).
#nick = "othernick";
#user = "otheruser";
#realname = "otheruser";
#password = "serverpassword";
#password = "server password";
#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
#no_client_away_msg = "Having life, knock again later";
#follow_nick = true;
#ignore_first_nick = true;
#on_connect_send = "PRIVMSG NickServ :IDENTIFY nspassword";
#follow_nick = false;
#ignore_first_nick = false;
#autojoin_on_kick = true;
#ignore_server_capab = true;
# Autojoined channels:
channel { name = "#bip"; };
# Password protected channel
channel {
name = "#elite_UnDeRgR0uNd";
key = "sikour";
};
};
#channel { name = "#bip"; }; # name is required.
# another connection (optionnal)
connection {
name = "oftc"; # used by bip only
network = "oftc"; # which ircnet to connect to
# Password protected channel
#channel {
# name = "#elite_UnDeRgR0uNd";
# key = "sikiour";
#};
#another channel
#channel {
# name = "#huge(28)_activity";
# disable backlogging of this channel.
# backlog = false;
#};
#};
# another connection (optional)
#connection {
#name = "iiens"; # used by bip only
#network = "iiens"; # which ircnet to connect to
# Some options:
#away_nick = "bip`away";
#follow_nick = true;
#ignore_first_nick = true;
#on_connect_send = "PRIVMSG NickServ :IDENTIFY nspassword";
# Autojoined channels:
channel { name = "#bip"; };
};
};
#channel { name = "#bip"; };
#};
#};

View File

@ -1,6 +1,6 @@
" Vim syntax file
" Language: Bip configuration file
" Copyright: Copyright (C) 2004 Arnaud Cornet and Loïc Gomez
" Copyright: Copyright (C) 2004 Arnaud Cornet and Loïc Gomez
" License: This file is part of the bip project. See the file 'COPYING' for
" the exact licensing terms.
"
@ -52,20 +52,20 @@ syn region bipMain start=/\%^/ end=/\%$/
\ contains=bipKeyword,bipNetwork,bipUser,bipComment,bipEndError
" Top level elements
syn keyword bipKeyword contained nextgroup=bipBoolV client_side_ssl
\ no_backlog always_backlog bl_msg_only blreset_on_talk
\ backlog_no_timestamp backlog
syn keyword bipKeyword contained nextgroup=bipBoolV client_side_ssl
\ log log_system write_oidentd
syn keyword bipKeyword contained nextgroup=bipStringV log_root
\ log_format pid_file
\ 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
\ backlog_lines log_sync_interval
\ log_sync_interval reconn_timer
syn keyword bipKeyword contained nextgroup=bipIPV ip
" Network block (level 1)
syn region bipNetwork contained matchgroup=Macro
\ start=/network\s*{\s*/ end=/};/
\ contains=bipNKeyword,bipServer,bipComment,bipEndError,bipWhite
syn keyword bipNKeyword contained nextgroup=bipStringV name
syn keyword bipNKeyword contained nextgroup=bipStringV name ciphers
syn keyword bipNKeyword contained nextgroup=bipBoolV ssl
" User block (level 1)
@ -74,25 +74,33 @@ 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_check_mode ssl_client_certfile backlog_timestamp
syn keyword bipUKeyword contained nextgroup=bipNumericV backlog_lines
syn keyword bipUKeyword contained nextgroup=bipBoolV admin
\ 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 ssl follow_nick
\ ignore_first_nick
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
\ no_client_away_msg ssl_check_mode sasl_username sasl_password
\ sasl_mechanism
syn keyword bipCoKeyword contained nextgroup=bipNumericV source_port
no_client_away_msg
" Channel elements (lvl 2)
syn region bipChannel contained matchgroup=Macro
\ start=/channel\s*{\s*/ end=/};/
\ contains=bipCKeyword,bipComment,bipEndError,bipWhite
syn keyword bipCKeyword contained nextgroup=bipStringV name key
syn keyword bipCKeyword contained nextgroup=bipBoolV backlog
" Server elements (lvl 2)
syn region bipServer contained matchgroup=Macro

83
scripts/bip-release Executable file
View File

@ -0,0 +1,83 @@
#!/bin/sh
set -e
if [ ! -d src ] || [ ! -f NEWS ] ; then
echo "Please run me in bip sources root." >&2
exit 1
fi
release_version="$1"
release_name="$2"
: ${MAKEOPTS:=-j -l4}
set_version() {
local release_version
release_version="${1}"
sed -i -e '/^AC_INIT/s/\(,\[\)[^]]*/\1'${release_version}'/' configure.ac
}
get_version() {
grep -e '^AC_INIT' configure.ac | cut -d [ -f 3 | cut -d ] -f 1
}
make_distcheck() {
# prepare sources
autoreconf -i -Wall
# Create makefile, use all possible options
./configure
# run distcheck
if ! make ${MAKEOPTS} distcheck; then
echo "'make distcheck' fails, please try again." >&2
return 1
else
true
fi
}
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
git commit -a --gpg-sign -m "Update version and ChangeLog for bip-${release_version} release."
TAG_COMMENT="Release ${release_version}"
if [ -n "${release_name}" ]; then
TAG_COMMENT="${TAG_COMMENT} '${release_name}'"
fi
git tag --sign -m "${TAG_COMMENT}" release-${release_version}
set_version "${release_version}-git"
git commit -a --gpg-sign -m "Add -git to version string."
echo "See bip-${release_version}.tar.gz"
else
make_distcheck || exit 1
tarname=bip-$(get_version)
prefix=bip-$(date +%Y%m%d)
rm -rf "${tarname}" "${prefix}"
tar -xzf "${tarname}".tar.gz
rm -rf "${tarname}".tar.gz
mv "${tarname}" "${prefix}"
tar -czf "${prefix}".tar.gz "${prefix}"
rm -rf "${prefix}"
# Revert the ChangeLog.
git checkout HEAD -- ChangeLog
echo "See ${prefix}.tar.gz"
fi
# cleanup
git clean -d -i -e "bip-*.tar.gz"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env perl
#
# This file is part of the bip project
# Copyright (C) 2004 2007 Arnaud Cornet and Loïc Gomez
# Copyright (C) 2004 2007 Arnaud Cornet and 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
@ -14,19 +14,27 @@ use strict;
use IO::File;
use Data::Dumper;
my $CFILE = $ENV{'HOME'} . '/.bip/bip.conf.autogen';
my $sfile = $ENV{'HOME'} . '/.bip/bipgenconfig.store';
my $bipdir = $ENV{'HOME'} . '/.bip';
my $CFILE = $bipdir . '/bip.conf.autogen';
my $sfile = $bipdir . '/bipgenconfig.store';
my $certout = $bipdir . '/bip.pem.autogen';
my $SERIALIZE_DBG = 1;
my %cf;
my $DEBUG = 0;
my $global_done = 0;
my $cert_done = 0;
my $mode = 'normal';
# maximum level of blocks { { { } } }
# maximum level of nested blocks { { { } } }
my $maxlevel = 5;
my $bipmkpw;
my $tmpcrt = "/tmp/bip-cert.cnf";
my $certout = $ENV{'HOME'} . '/.bip/bip.pem.autogen';
my %optcompat = (
"bl_msg_only" => "backlog_msg_only",
"blreset_on_talk" => "backlog_reset_on_talk",
"always_backlog" => "backlog_always",
);
my %optdesc = (
'global' => {
'ip' => { 'type' => 's', 'adv' => 1, 'default' => '0.0.0.0',
@ -38,12 +46,18 @@ my %optdesc = (
'client_side_ssl' => { 'type' => 'b', 'adv' => 1, 'default' => 'true',
'optional' => 1,
'desc' => 'Do you want to enable client side SSL ?' },
'client_side_ssl_pem' => { 'type' => 's', 'adv' => 1, 'optional' => 1,
'default' => '',
'desc' => 'Where is the bip.pem file (cert/key pair) ?' },
'pid_file' => { 'type' => 's', 'adv' => 1, 'optional' => 1,
'default' => $ENV{'HOME'} . '/.bip/bip.pid',
'default' => $bipdir . '/bip.pid',
'desc' => 'Where do you want the pidfile to be stored ?' },
'log' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
'optional' => 1,
'desc' => 'Do you want to enable the logging system ?' },
'desc' => 'Do you want to enable channel logging ?' },
'log_system' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
'optional' => 1,
'desc' => 'Do you want to enable system logging ?' },
'log_sync_interval' => { 'type' => 'i', 'adv' => 1,
'optional' => 1,
'default' => '5', 'depends' => 'log', 'depval' => 'true',
@ -54,38 +68,13 @@ my %optdesc = (
'desc' => 'Define bip\'s system logs verbosity level {less 0 - 7 tremendous}:' },
'log_root' => { 'type' => 's', 'adv' => 0,
'optional' => 1,
'default' => $ENV{'HOME'} . '/.bip/logs',
'default' => $bipdir . '/logs',
'depends' => 'log', 'depval' => 'true',
'desc' => 'In which directory do you want logs to be stored ?' },
'log_format' => { 'type' => 's', 'adv' => 1, 'default' => '%n/%Y-%m/%c.%d.log',
'optional' => 1,
'depends' => 'log', 'depval' => 'true',
'desc' => 'Define the channel/private log format {see strftime, limited}:' },
'backlog' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
'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',
'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,
'optional' => 1,
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
'desc' => 'Disable timestamp in backlog ?' },
'bl_msg_only' => { 'type' => 'b', 'adv' => 0,
'optional' => 1,
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
'desc' => 'Only playback users messages {chan/priv}, no nick/join/... ?' },
'always_backlog' => { 'type' => 'b', 'adv' => 0,
'optional' => 1,
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
'desc' => 'Always backlog {false means backlog pointers are reset after each backlog} ?' },
'blreset_on_talk' => { 'type' => 'b', 'adv' => 0,
'optional' => 1,
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
'desc' => 'Reset backlog each time an attached client "talks" ?' },
},
'network' => {
@ -102,9 +91,15 @@ my %optdesc = (
'name' => { 'type' => 's', 'adv' => 0, 'default' => '',
'optional' => 0,
'desc' => 'User\'s internal name ?' },
'admin' => { 'type' => 'b', 'adv' => 0, 'default' => 'false',
'optional' => 1,
'desc' => 'Is user an admin ?' },
'password' => { 'type' => 'p', 'adv' => 0, 'default' => '',
'optional' => 0,
'desc' => 'Set a password for his bip account:' },
'bip_use_notice' => { 'type' => 'b', 'adv' => 0, 'default' => 'false',
'optional' => 1,
'desc' => 'Do you prefer bip to use notices instead of privmsgs ?' },
'ssl_check_mode' => { 'type' => 's', 'adv' => 1,
'optional' => 1, 'default' => 'none',
'desc' => 'Type of SSL servers certificate\'s checks' },
@ -120,7 +115,34 @@ my %optdesc = (
'default_realname' => { 'type' => 's', 'adv' => 0, 'default' => '',
'optional' => 0,
'desc' => 'User\'s default IRC realname' },
'backlog' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
'optional' => 1,
'depends' => 'log', 'depval' => 'true',
'desc' => 'Do you want to activate backlog {play back logs} system ?' },
'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_timestamp' => { 'type' => 's', 'adv' => 0,
'optional' => 1,
'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',
'desc' => 'Only playback users messages {chan/priv}, no nick/join/... ?' },
'backlog_always' => { 'type' => 'b', 'adv' => 0,
'optional' => 1,
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
'desc' => 'Always backlog {false means backlog pointers are reset after each backlog} ?' },
'backlog_reset_on_talk' => { 'type' => 'b', 'adv' => 0,
'optional' => 1,
'default' => 'false', 'depends' => 'backlog', 'depval' => 'true',
'desc' => 'Reset backlog each time an attached client "talks" ?' },
'connection' => { 'type' => 'e' },
},
'connection' => {
@ -169,6 +191,9 @@ my %optdesc = (
'on_connect_send' => { 'type' => 's', 'adv' => 0, 'default' => '',
'optional' => 1,
'desc' => 'Send this raw message upon connection to IRC server' },
'ssl_check_mode' => { 'type' => 's', 'adv' => 1,
'optional' => 1, 'default' => '',
'desc' => 'Type of SSL servers certificate\'s checks' },
'channel' => { 'type' => 'e' },
},
@ -195,20 +220,15 @@ my %optorder = (
'ip' ,
'port' ,
'client_side_ssl' ,
'client_side_ssl_pem' ,
'pid_file' ,
undef,
'log' ,
'log_system' ,
'log_sync_interval' ,
'log_level' ,
'log_root' ,
'log_format' ,
undef,
'backlog' ,
'backlog_lines' ,
'backlog_no_timestamp' ,
'bl_msg_only' ,
'always_backlog' ,
'blreset_on_talk' ,
],
'network' => [
@ -226,6 +246,13 @@ my %optorder = (
'default_nick' ,
'default_user' ,
'default_realname' ,
undef,
'backlog' ,
'backlog_lines' ,
'backlog_timestamp' ,
'backlog_msg_only' ,
'backlog_always' ,
'backlog_reset_on_talk' ,
'connection' ,
],
@ -245,6 +272,7 @@ my %optorder = (
'away_nick' ,
'no_client_away_msg' ,
'on_connect_send' ,
'ssl_check_mode' ,
'channel' ,
],
@ -286,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");
@ -346,6 +378,31 @@ sub askbool {
sub askPass {
my ($text) = @_;
which_bipmkpw();
print("$text ? ");
my $pass = `$bipmkpw`;
chomp($pass);
$pass =~ s/^Password:\s*\n?//si;
chomp($pass);
return $pass;
}
sub which_bipmkpw {
my ($which);
return if ($bipmkpw ne '' && -x "$bipmkpw");
if (-x "/usr/bin/bipmkpw") {
$bipmkpw = '/usr/bin/bipmkpw';
return;
}
$which = `which bipmkpw`;
if ($which ne '' && -x "$which") {
$bipmkpw = $which;
return;
}
while (!$bipmkpw || ! -x "$bipmkpw") {
if ($bipmkpw ne '' && (! -f $bipmkpw || ! -x $bipmkpw)) {
print("No exec permission: $bipmkpw\n");
@ -353,12 +410,7 @@ sub askPass {
$bipmkpw = askval("Please enter the path to bipmkpw:",
undef, 1);
}
print("$text ? ");
my $pass = `$bipmkpw`;
chomp($pass);
$pass =~ s/^Password:\s*\n?//si;
chomp($pass);
return $pass;
return;
}
sub askval {
@ -407,9 +459,40 @@ sub loadConfig {
$fh->close;
$hr = unserialize($data) || return "Invalid format in $f";
%cf = %{$hr};
$cf{'networks'} = [ values %{$cf{'networks'}} ];
$cf{'users'} = [ values %{$cf{'users'}} ];
sanitizeCompat(\%cf);
foreach (@{$cf{'networks'}}) {
$_->{'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'}} ];
}
}
return "Config loaded from $f";
}
sub sanitizeCompat {
my ($d) = @_;
foreach (keys %$d) {
if (ref($d->{$_}) eq 'ARRAY') {
foreach my $d2 (@{$d->{$_}}) {
sanitizeCompat($d2);
}
}
$d->{$optcompat{$_}} = $d->{$_} if (defined $optcompat{$_});
}
}
sub resetConfig {
my $r = askbool("Do you want to reset current loaded configuration options, networks, users... ?", 'false');
$r eq 'false' && return "Reset config aborted";
@ -501,7 +584,7 @@ authorityKeyIdentifier=keyid:always";
# print "Existing $certout found, renamed to $certout.$ts\n";
# }
`openssl req -new -x509 -days 365 -nodes -config "$tmpcrt" -out "$certout" -keyout "$certout"`;
`openssl req -new -newkey rsa:4096 -x509 -days 365 -nodes -config "$tmpcrt" -out "$certout" -keyout "$certout"`;
# TODO check command status
`openssl x509 -subject -dates -fingerprint -noout -in "$certout"`;
# TODO check command status
@ -530,7 +613,7 @@ sub writeConfig {
next if ($cf{'global'}->{$k} eq undef);
next if ($optdesc{'global'}->{$k}->{'nosave'} eq 1);
my $t = $optdesc{'global'}->{$k}->{'type'};
if ($t eq 's' || $t eq 'b') {
if ($t eq 's') {
print $fh "$k = \"" . $cf{'global'}->{$k} . "\";\n";
} else {
print $fh "$k = " . $cf{'global'}->{$k} . ";\n";
@ -582,11 +665,12 @@ sub printBlock {
fatal("Too much recursion levels ($level)") if ($level ge $maxlevel);
$out .= $prefix . $name . " {\n";
foreach my $k (keys(%{$e})) {
foreach my $k (@{$optorder{$name}}) {
next if ($k eq undef);
next if ($e->{$k} eq undef);
next if ($optdesc{$name}->{$k}->{'nosave'} eq 1);
my $t = $optdesc{$name}->{$k}->{'type'};
if ($t eq 's' || $t eq 'b') {
if ($t eq 's' || $t eq 'p') {
$out .= $prefix . "\t$k = \"" . $e->{$k} . "\";\n";
} elsif (ref($e->{$k}) eq 'ARRAY') {
foreach my $e2 (@{$e->{$k}}) {
@ -596,7 +680,7 @@ sub printBlock {
$out .= $prefix . "\t$k = " . $e->{$k} . ";\n";
}
}
$out .= $prefix . "}\n\n";
$out .= $prefix . "};\n\n";
return $out;
}
@ -1271,6 +1355,14 @@ sub invMode {
return ($mode eq 'advanced' ? 'normal' : 'advanced');
}
if (! -e $bipdir) {
mkdir($bipdir) || fatal("Unable to create bip's dir `$bipdir'");
} elsif (! -d $bipdir) {
fatal("Bip's dir `$bipdir' already exists and is not a directory");
} elsif (! -w $bipdir) {
fatal("Bip's dir `$bipdir' already exists and is not writable");
}
main_menu();
#sets config backlog
#different user/nick/real ?

View File

@ -1,10 +1,39 @@
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 = conf.y lex.l bip.c connection.c irc.c line.c log.c md5.c util.c
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
if DEBUG
AM_CFLAGS+=-Wall -g
AM_LDFLAGS+=-g
else
AM_CFLAGS+=-Wall
endif
BUILT_SOURCES = conf.c conf.h lex.c
AM_CFLAGS=-Wall -Wextra -Werror -Wundef -Wpedantic

View File

@ -1,467 +0,0 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = bip$(EXEEXT) bipmkpw$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in conf.c conf.h lex.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_bip_OBJECTS = conf.$(OBJEXT) lex.$(OBJEXT) bip.$(OBJEXT) \
connection.$(OBJEXT) irc.$(OBJEXT) line.$(OBJEXT) \
log.$(OBJEXT) md5.$(OBJEXT) util.$(OBJEXT)
bip_OBJECTS = $(am_bip_OBJECTS)
bip_LDADD = $(LDADD)
am_bipmkpw_OBJECTS = bipmkpw.$(OBJEXT) md5.$(OBJEXT) util.$(OBJEXT)
bipmkpw_OBJECTS = $(am_bipmkpw_OBJECTS)
bipmkpw_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
YLWRAP = $(top_srcdir)/ylwrap
YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
SOURCES = $(bip_SOURCES) $(bipmkpw_SOURCES)
DIST_SOURCES = $(bip_SOURCES) $(bipmkpw_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
bip_SOURCES = conf.y lex.l bip.c connection.c irc.c line.c log.c md5.c util.c
bipmkpw_SOURCES = bipmkpw.c md5.c util.c
AM_YFLAGS = -d
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .l .o .obj .y
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status src/config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
conf.h: conf.c
@if test ! -f $@; then \
rm -f conf.c; \
$(MAKE) $(AM_MAKEFLAGS) conf.c; \
else :; fi
bip$(EXEEXT): $(bip_OBJECTS) $(bip_DEPENDENCIES)
@rm -f bip$(EXEEXT)
$(LINK) $(bip_OBJECTS) $(bip_LDADD) $(LIBS)
bipmkpw$(EXEEXT): $(bipmkpw_OBJECTS) $(bipmkpw_DEPENDENCIES)
@rm -f bipmkpw$(EXEEXT)
$(LINK) $(bipmkpw_OBJECTS) $(bipmkpw_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bipmkpw.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connection.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.l.c:
$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
.y.c:
$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) config.h
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-rm -f conf.c
-rm -f conf.h
-rm -f lex.c
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic ctags distclean distclean-compile \
distclean-generic distclean-hdr distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS
@DEBUG_TRUE@ AM_CFLAGS+=-Wall -g
@DEBUG_TRUE@ AM_LDFLAGS+=-g
@DEBUG_FALSE@ AM_CFLAGS+=-Wall
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

2749
src/bip.c

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* $Id: bip.h,v 1.6 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 and 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
@ -14,60 +14,12 @@
#ifndef BIP_H
#define BIP_H
struct c_network
{
char *name;
#ifdef HAVE_LIBSSL
int ssl;
#endif
list_t serverl;
};
struct c_user
{
char *name;
unsigned char *password;
unsigned int seed;
char *default_user;
char *default_nick;
char *default_realname;
#ifdef HAVE_LIBSSL
int ssl_check_mode;
char *ssl_check_store;
#endif
list_t connectionl;
};
struct c_connection
{
char *name;
struct c_network *network;
char *realname, *user, *nick;
char *password; /* server pass */
char *vhost;
unsigned short source_port;
list_t channell;
int follow_nick;
int ignore_first_nick;
char *away_nick;
list_t on_connect_send;
char *no_client_away_msg;
struct client *client;
};
struct c_channel
{
char *name;
char *key;
};
#ifdef HAVE_LIBSSL
int adm_trust(struct link_client *ic, struct line *line);
#endif
int adm_bip(struct link_client *ic, struct line *line, unsigned int privmsg);
int adm_bip(bip_t *bip, struct link_client *ic, struct line *line, int privmsg);
int ssl_check_trust(struct link_client *ic);
void adm_blreset(struct link_client *ic);
void bip_notify(struct link_client *ic, char *fmt, ...);
#endif

363
src/bip_main.c Normal file
View File

@ -0,0 +1,363 @@
/*
* $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 check_ssl_files(int failmode);
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 check_ssl_files(int failmode)
{
int e;
struct stat fs;
if (!conf_ssl_certfile) {
conf_ssl_certfile = default_path(
conf_biphome, "bip.pem", "SSL certificate");
}
if (failmode == HARD_FAIL)
assert_path_exists(conf_ssl_certfile);
else if (!check_path_exists(conf_ssl_certfile))
return 0;
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) {
if (failmode == HARD_FAIL) {
assert_path_exists(conf_client_dh_file);
} else if (!check_path_exists(conf_client_dh_file)) {
return 0;
}
}
/* all is well */
return 1;
}
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) {
check_ssl_files(HARD_FAIL);
}
#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();
#ifdef HAVE_LIBSSL
/*
* reload SSL context if server-side SSL is enabled and SSL files
* seem accessible.
*/
if (conf_css) {
if (check_ssl_files(SOFT_FAIL)) {
if (set_ssl_context(SSLCTX_FORCE_UPDATE) == 1)
mylog(LOG_DEBUG, "SSL context has been updated");
else
mylog(LOG_DEBUG, "SSL context has not been updated");
} else {
mylog(LOG_ERROR, "Unable to update SSL context, "
"file checks failed");
}
}
#endif
}
return 1;
}

View File

@ -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
@ -22,48 +23,66 @@
#include "util.h"
#include "md5.h"
int conf_log_level;
FILE *conf_global_log_file;
int conf_log;
extern int conf_log_level;
extern FILE *conf_global_log_file;
extern 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) {
printf("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) {
printf("tcsetattr failed: %s\n", strerror(errno));
exit(1);
}
write(ttyfd, "Password: ", 10);
// 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));
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;
} else if (buffer[idx] == ' ') {
valid = 0;
}
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);
if (!valid) {
fprintf(stderr, "Password cannot contain spaces.\n");
exit(1);
}
}
int main(void)
@ -74,13 +93,21 @@ int main(void)
unsigned int seed;
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);

View File

@ -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
@ -19,34 +20,24 @@
extern int yylex (void);
extern char *yytext;
extern int linec;
extern int conf_error;
#define ERRBUFSZ 80
extern char conf_errstr[ERRBUFSZ];
int yywrap()
#define YYMALLOC bip_malloc
extern int yyerror(char *);
int yywrap(void)
{
return 1;
}
int yyerror()
{
snprintf(conf_errstr, ERRBUFSZ, "Parse error near %s, line %d\n",
yytext, linec + 1);
conf_errstr[ERRBUFSZ - 1] = 0;
conf_error = 1;
return 1;
}
int yydebug = 1;
//int yydebug = 1;
list_t *root_list;
struct tuple *tuple_i_new(int type, int i)
{
struct tuple *t;
t = malloc(sizeof(struct tuple));
if (!t)
fatal("malloc");
t = bip_malloc(sizeof(struct tuple));
t->type = type;
t->ndata = i;
t->tuple_type = TUPLE_INT;
@ -56,9 +47,7 @@ struct tuple *tuple_i_new(int type, int i)
struct tuple *tuple_p_new(int type, void *p)
{
struct tuple *t;
t = malloc(sizeof(struct tuple));
if (!t)
fatal("malloc");
t = bip_malloc(sizeof(struct tuple));
t->type = type;
t->pdata = p;
return t;
@ -80,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_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_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY
%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;
@ -106,30 +95,43 @@ command:
| LEX_LOG_FORMAT LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_LOG_FORMAT,
$3); }
| LEX_LOG_LEVEL LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_LOG_LEVEL, $3); }
| LEX_RECONN_TIMER LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_RECONN_TIMER, $3); }
| LEX_IP LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_IP, $3); }
| LEX_PORT LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_PORT, $3); }
| LEX_CSS LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_CSS, $3); }
| LEX_BACKLOG_LINES LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_BACKLOG_LINES,
$3); }
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
| LEX_CSS_PEM LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CSS_PEM, $3); }
| LEX_CSS_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CSS_CIPHERS, $3); }
| LEX_DEFAULT_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_DEFAULT_CIPHERS, $3); }
| LEX_DH_PARAM LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_DH_PARAM, $3); }
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
| LEX_LOG_SYSTEM LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG_SYSTEM, $3); }
| 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);
}
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG,
$3); }
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
}
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
LEX_ALWAYS_BACKLOG, $3); }
| 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_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
| LEX_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BLRESET_ON_TALK, $3);
}
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
}
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
LEX_ALWAYS_BACKLOG, $3); }
/* /deprecated */
| LEX_NETWORK LEX_LBRA network LEX_RBRA { $$ = tuple_l_new(LEX_NETWORK,
$3); }
$3); }
| LEX_USER LEX_LBRA user LEX_RBRA { $$ = tuple_l_new(LEX_USER, $3); }
network:
@ -139,8 +141,9 @@ network:
net_command:
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
| LEX_SSL LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_SSL, $3); }
| LEX_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CIPHERS, $3); }
| LEX_SERVER LEX_LBRA server LEX_RBRA {
$$ = tuple_l_new(LEX_SERVER, $3); }
$$ = tuple_l_new(LEX_SERVER, $3); }
user:
{ $$ = list_new(NULL); }
@ -150,19 +153,45 @@ usr_command:
LEX_NAME LEX_EQ LEX_STRING {
$$ = tuple_s_new(LEX_NAME, $3); }
| LEX_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PASSWORD,
$3); }
$3); }
| LEX_ADMIN LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_ADMIN, $3); }
| LEX_BIP_USE_NOTICE LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BIP_USE_NOTICE, $3); }
| LEX_SSL_CHECK_MODE LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_SSL_CHECK_MODE, $3); }
LEX_SSL_CHECK_MODE, $3); }
| LEX_SSL_CHECK_STORE LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_SSL_CHECK_STORE, $3); }
LEX_SSL_CHECK_STORE, $3); }
| LEX_SSL_CLIENT_CERTFILE LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_SSL_CLIENT_CERTFILE, $3); }
| LEX_DEFAULT_USER LEX_EQ LEX_STRING {
$$ = tuple_s_new(LEX_DEFAULT_USER, $3); }
| LEX_DEFAULT_NICK LEX_EQ LEX_STRING {
$$ = tuple_s_new(LEX_DEFAULT_NICK, $3); }
| LEX_DEFAULT_REALNAME LEX_EQ LEX_STRING {
$$ = tuple_s_new(LEX_DEFAULT_REALNAME, $3); }
| 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);
}
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
| LEX_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BLRESET_ON_TALK, $3);
}
| LEX_BLRESET_CONNECTION LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BLRESET_CONNECTION, $3);
}
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
}
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
LEX_ALWAYS_BACKLOG, $3); }
| LEX_CONNECTION LEX_LBRA connection LEX_RBRA {
$$ = tuple_l_new(LEX_CONNECTION, $3); }
$$ = tuple_l_new(LEX_CONNECTION, $3); }
connection:
{ $$ = list_new(NULL); }
@ -172,28 +201,41 @@ connection:
con_command:
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
| LEX_NETWORK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NETWORK,
$3); }
$3); }
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
| LEX_NICK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NICK, $3); }
| LEX_USER LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_USER, $3); }
| LEX_REALNAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_REALNAME,
$3); }
$3); }
| LEX_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PASSWORD,
$3); }
$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); }
| LEX_AWAY_NICK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_AWAY_NICK,
$3); }
$3); }
| LEX_FOLLOW_NICK LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_FOLLOW_NICK, $3); }
| LEX_IGN_FIRST_NICK LEX_EQ LEX_BOOL { $$ = tuple_i_new(
LEX_IGN_FIRST_NICK, $3); }
| LEX_AUTOJOIN_ON_KICK LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_AUTOJOIN_ON_KICK, $3); }
| LEX_IGNORE_CAPAB LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_IGNORE_CAPAB, $3); }
| LEX_CHANNEL LEX_LBRA channel LEX_RBRA { $$ = tuple_l_new(
LEX_CHANNEL, $3); }
LEX_CHANNEL, $3); }
| LEX_ON_CONNECT_SEND LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_ON_CONNECT_SEND, $3); }
LEX_ON_CONNECT_SEND, $3); }
| LEX_NO_CLIENT_AWAY_MSG LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_NO_CLIENT_AWAY_MSG, $3); }
LEX_NO_CLIENT_AWAY_MSG, $3); }
| LEX_SSL_CHECK_MODE LEX_EQ LEX_STRING { $$ = tuple_s_new(
LEX_SSL_CHECK_MODE, $3); }
channel:
{ $$ = list_new(NULL); }
| channel cha_command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }
@ -201,6 +243,7 @@ channel:
cha_command:
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
| LEX_KEY LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_KEY, $3); }
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
server:
{ $$ = list_new(NULL); }

View File

@ -1,35 +0,0 @@
/* src/config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define to 1 if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL
/* Enable oidentd.conf management support */
#undef HAVE_OIDENTD
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Version number of package */
#undef VERSION
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER

File diff suppressed because it is too large Load Diff

View File

@ -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
@ -29,7 +30,6 @@
#include <errno.h>
#include <netdb.h>
#ifdef HAVE_LIBSSL
#include <openssl/crypto.h>
#include <openssl/x509.h>
@ -40,7 +40,7 @@
#include <openssl/bio.h>
#endif
#define CONN_BUFFER_SIZE 2048
#define CONN_BUFFER_SIZE 8192
#define CONN_OK 1
#define CONN_TIMEOUT 2
@ -60,6 +60,9 @@
#define SSL_CHECK_NONE (0)
#define SSL_CHECK_BASIC (1)
#define SSL_CHECK_CA (2)
#define SSLCTX_NO_REPLACE 0
#define SSLCTX_FORCE_UPDATE 1
#endif
struct connecting_data;
@ -75,39 +78,47 @@ 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;
void *user_data;
list_t *ip_list;
struct connecting_data *connecting_data;
#ifdef HAVE_LIBSSL
SSL_CTX *ssl_ctx_h;
SSL *ssl_h;
int ssl_check_mode;
char *ssl_check_store;
X509 *cert;
#endif
char *localip, *remoteip;
uint16_t localport, remoteport;
} connection_t;
connection_t *connection_new(char *dsthostname, int dstport, char *srchostname,
int srcport, int ssl, int ssl_check_mode,
char *ssl_check_store,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);
void connection_close(connection_t *cn);
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);
#ifdef HAVE_LIBSSL
/* Set SSL context, force update if already set and force is 1
* Return 1 if SSL context has been set */
int set_ssl_context(int force);
#endif
#endif

34
src/defaults.h Normal file
View File

@ -0,0 +1,34 @@
/*
* $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
*
* 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.
*/
#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 0
#define DEFAULT_BACKLOG_TIMESTAMP BLTSTime
#define DEFAULT_BLRESET_ON_TALK 0
#define DEFAULT_BLRESET_CONNECTION 0
#define DEFAULT_LOG 1
#define DEFAULT_LOG_SYSTEM 1
#define DEFAULT_LOG_SYNC_INTERVAL 5
#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 30
#endif /* DEFAULTS_H */

2468
src/irc.c

File diff suppressed because it is too large Load Diff

173
src/irc.h
View File

@ -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
@ -15,7 +16,7 @@
#define IRC_H
#include "connection.h"
#include "line.h"
#include "log.h"
#define ERR_PROTOCOL (-1)
#define ERR_AUTH (-2)
@ -25,24 +26,16 @@
#define OK_COPY_CLI (4)
#define OK_COPY_WHO (5)
#define P_SERV "bip.bip.bip"
#define P_SERV "b.i.p"
#define S_PING "BIPPING"
#define P_IRCMASK "-bip!bip@bip.bip.bip"
#define P_IRCMASK "-bip!bip@" P_SERV
struct server {
char *host;
unsigned short port;
};
#define server_new() calloc(sizeof(struct server), 1)
#define NICKOP 1
#define NICKVOICED 2
struct nick {
char *name;
int ovmask;
};
#define server_new() bip_calloc(sizeof(struct server), 1)
struct channel {
char *name;
@ -53,29 +46,83 @@ struct channel {
char type;
char *creator;
char *create_ts;
hash_t nicks;
hash_t ovmasks;
int running_names;
};
#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 **/
char *name;
unsigned char *password;
unsigned int seed;
int admin;
int bip_use_notice;
/* common link options */
char *default_nick;
char *default_username;
char *default_realname;
/* backlog options */
char backlog;
int backlog_lines;
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;
char *ssl_check_store;
char *ssl_client_certfile;
#endif
hash_t connections;
char in_use; /* for mark and sweep on reload */
};
struct network {
char *name;
#ifdef HAVE_LIBSSL
int ssl;
char *ciphers;
#endif
int serverc;
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;
/* we honnor the /who from clients one client at a time, this is the
struct log *log;
/* we honnor the /who from clients one client at a time, this is the
* client that is /who-ing. Now for bans too */
struct link_client *who_client;
struct log *log;
/* server related live stuff */
int s_state;
int s_conn_attempt;
@ -85,45 +132,44 @@ struct link {
/* connection state (reconnecting, was_connected ...) */
int recon_timer;
time_t last_connection;
time_t last_connection_attempt;
/** link options */
int follow_nick;
int ignore_first_nick;
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 */
/** client connection static data **/
char *username;
unsigned char *password;
unsigned int seed;
struct bipuser *user;
/** server connection static data **/
/* server list */
int serverc;
struct server **serverv;
struct network *network;
int cur_server;
char *user;
char *real_name;
char *username;
char *realname;
char *s_password;
char *sasl_username;
char *sasl_password;
int sasl_mechanism;
char *connect_nick;
/* socket creation info */
char *vhost;
int bind_port;
int s_ssl;
#ifdef HAVE_LIBSSL
int ssl_check_mode;
char *ssl_check_store;
STACK_OF(X509) *untrusted_certs;
STACK_OF(X509) * untrusted_certs;
#endif
int in_use; /* for mark and sweep on reload */
};
struct link_connection {
@ -142,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;
@ -168,15 +214,17 @@ struct link_client {
#define IRCS_CONNECTED (2)
#define IRCS_WAS_CONNECTED (3)
#define IRCS_RECONNECTING (4)
#define IRCS_TIMER_WAIT (5)
struct log;
struct chan_info {
char *name;
char *key;
int backlog;
};
#define chan_info_new() 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;
@ -187,22 +235,51 @@ 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 */
array_t chanmodes;
/* user modes */
char *prefixes;
char *usermodes;
};
typedef struct bip {
connection_t *listener;
/* all connected tcp connections */
list_t conn_list;
/* all links */
list_t link_list;
/* connecting clients */
list_t connecting_client_list;
hash_t networks;
hash_t users;
list_t errors;
struct link_client *reloading_client;
char *oidentdpath;
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();
void irc_main(connection_t *inc, list_t *clientl);
int ischannel(char p);
struct client *client_new(void);
void irc_main(bip_t *);
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);
void irc_cli_backlog(struct link_client *ic, int hours);
#define BIP_FAKEMASK "!bip@bip.bip.bip"
#endif

View File

@ -1,9 +1,11 @@
%option nounput noinput
%{
/*
* $Id: lex.l,v 1.23 2005/04/12 19:34:35 nohar Exp $
*
* 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
@ -13,32 +15,35 @@
*/
#include "conf.h"
int linec = 0;
#define YY_NO_UNPUT
int linec;
#include "util.h"
extern int conf_error;
extern list_t *root_list;
void yyparse(void);
extern int yyparse(void);
void free_conf(list_t*);
int conf_error;
typedef struct bip bip_t;
extern bip_t *_bip;
#if 0
/* SPANK ME WITH A SHOVEL */
static void yyunput(int c, char *buf);
void dummy_lex_FFS(void)
void conf_die(bip_t *, char *, ...);
int yyerror(char *err)
{
yyunput(0, NULL);
conf_die(_bip, "Parse error '%s' near '%s', line %d", err, yytext,
linec + 1);
conf_error = 1;
return 1;
}
#endif
list_t *parse_conf(FILE *file)
list_t *parse_conf(FILE *file, int *err)
{
conf_error = 0;
linec = 0;
YY_BUFFER_STATE in = yy_create_buffer(file, YY_BUF_SIZE);
yy_switch_to_buffer(in);
yyparse();
if (conf_error) {
free_conf(root_list);
return NULL;
}
yy_delete_buffer(in);
*err = conf_error;
return root_list;
}
%}
@ -63,6 +68,7 @@ list_t *parse_conf(FILE *file)
"host" { return LEX_HOST; }
"name" { return LEX_NAME; }
"user" { return LEX_USER; }
"admin" { return LEX_ADMIN; }
"connection" { return LEX_CONNECTION; }
"nick" { return LEX_NICK; }
"realname" { return LEX_REALNAME; }
@ -75,21 +81,28 @@ list_t *parse_conf(FILE *file)
"ssl" { return LEX_SSL; }
"ssl_check_mode" { return LEX_SSL_CHECK_MODE; }
"ssl_check_store" { return LEX_SSL_CHECK_STORE; }
"ssl_client_certfile" { return LEX_SSL_CLIENT_CERTFILE; }
"ssl_default_ciphers" { return LEX_DEFAULT_CIPHERS; }
"ciphers" { return LEX_CIPHERS; }
"key" { return LEX_KEY; }
"autojoin_on_kick" { return LEX_AUTOJOIN_ON_KICK; }
"channel" { return LEX_CHANNEL; }
"log_level" { return LEX_LOG_LEVEL; }
"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; }
"backlog_reset_on_talk" { return LEX_BLRESET_ON_TALK; }
"backlog_reset_connection" { return LEX_BLRESET_CONNECTION; }
"blreset_on_talk" { return LEX_BLRESET_ON_TALK; }
"bl_msg_only" { return LEX_BL_MSG_ONLY; }
"always_backlog" { return LEX_ALWAYS_BACKLOG; }
"log" { return LEX_LOG; }
"log_system" { return LEX_LOG_SYSTEM; }
"log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; }
"follow_nick" { return LEX_FOLLOW_NICK; }
"ignore_first_nick" { return LEX_IGN_FIRST_NICK; }
@ -97,11 +110,20 @@ list_t *parse_conf(FILE *file)
"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; }
\"[^"]*\" {
size_t len = strlen(yytext) - 2;
yylval.string = malloc(len + 1);
if (!yylval.string)
fatal("malloc");
yylval.string = bip_malloc(len + 1);
memcpy(yylval.string, yytext + 1, len);
yylval.string[len] = 0;
return LEX_STRING;
@ -110,6 +132,6 @@ list_t *parse_conf(FILE *file)
"{" { return LEX_LBRA; }
"}" { return LEX_RBRA; }
";" { return LEX_SEMICOLON; }
. { printf("Parse error line %d, unknown character '%s'\n", linec + 1, yytext);
. { conf_die(_bip, "Parse error in config file line %d, unknown character '%s'", linec + 1, yytext); conf_error = 1;
return LEX_BUNCH; }
%%

View File

@ -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
@ -13,33 +14,34 @@
#include "config.h"
#include "line.h"
#include "util.h"
char *_irc_line_to_string(struct line *l, int skip_first);
// 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));
array_init(&l->words);
}
void _irc_line_deinit(struct line *l)
{
array_deinit(&l->words);
}
struct line *irc_line_new()
{
struct line *l;
l = malloc(sizeof(struct line));
if (!l)
fatal("malloc");
l = bip_malloc(sizeof(struct line));
irc_line_init(l);
return l;
}
void irc_line_clear(struct line *l)
{
unsigned i;
for (i = 0; i < l->elemc; i++)
free(l->elemv[i]);
free(l->elemv);
if (l->origin)
free(l->origin);
memset(l, 0, sizeof(struct line));
}
void irc_line_write(struct line *l, connection_t *c)
{
char *bytes = irc_line_to_string(l);
@ -49,44 +51,58 @@ void irc_line_write(struct line *l, connection_t *c)
struct line *irc_line_dup(struct line *line)
{
unsigned i;
int i;
struct line *nl = irc_line_new();
nl->origin = line->origin ? strdup(line->origin) : NULL;
nl->elemc = line->elemc;
nl->elemv = malloc(sizeof(char *) * line->elemc);
for (i = 0; i < line->elemc; i++)
nl->elemv[i] = strdup(line->elemv[i]);
char *ptr;
nl->origin = line->origin ? bip_strdup(line->origin) : NULL;
array_each(&line->words, i, ptr)
array_set(&nl->words, i, bip_strdup(ptr));
nl->colon = line->colon;
return nl;
}
void _irc_line_append(struct line *l, char *s)
char *irc_line_pop(struct line *l)
{
l->elemc++;
l->elemv = realloc(l->elemv, l->elemc * sizeof(char *));
if (!l)
fatal("realloc");
l->elemv[l->elemc - 1] = s;
return (char *)array_pop(&l->words);
}
void irc_line_append(struct line *l, char *s)
void _irc_line_append(struct line *l, const char *s)
{
_irc_line_append(l, strdup(s));
array_push(&l->words, bip_strdup(s));
}
void irc_line_append(struct line *l, const char *s)
{
_irc_line_append(l, bip_strdup(s));
}
char *irc_line_to_string(struct line *l)
{
return _irc_line_to_string(l, 0);
}
char *irc_line_to_string_skip(struct line *l, int skip_first)
{
if (skip_first >= irc_line_count(l)) {
return NULL;
}
return _irc_line_to_string(l, skip_first);
}
char *_irc_line_to_string(struct line *l, int skip_first)
{
size_t len = 0;
unsigned i;
int i;
char *ret;
if (l->origin)
len = strlen(l->origin) + 2;
for (i = 0; i < l->elemc; i++)
len += strlen(l->elemv[i]) + 1;
for (i = skip_first; 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 ":" */
ret = malloc(len + 1);
len++; /* last args ":" */
ret = bip_malloc(len + 1);
ret[0] = 0;
if (l->origin) {
@ -94,42 +110,92 @@ char *irc_line_to_string(struct line *l)
strcat(ret, l->origin);
strcat(ret, " ");
}
for (i = 0; i < l->elemc - 1; i++) {
strcat(ret, l->elemv[i]);
for (i = skip_first; i < array_count(&l->words) - 1; i++) {
strcat(ret, array_get(&l->words, i));
strcat(ret, " ");
}
if (strchr(l->elemv[i], ' ') || l->colon)
if (strchr(array_get(&l->words, i), ' ') || l->colon)
strcat(ret, ":");
strcat(ret, l->elemv[i]);
strcat(ret, array_get(&l->words, i));
strcat(ret, "\r\n");
return ret;
}
char *irc_line_to_string_to(struct line *line, char *nick)
{
char *tmp;
char *l;
const char *prev;
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;
}
int irc_line_count(struct line *line)
{
return array_count(&line->words);
}
int irc_line_includes(struct line *line, int elem)
{
return array_includes(&line->words, elem);
}
const char *irc_line_elem(struct line *line, int elem)
{
return array_get(&line->words, elem);
}
void irc_line_drop(struct line *line, int 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)
{
return !strcmp(irc_line_elem(line, elem), cmp);
}
int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp)
{
return !strcasecmp(irc_line_elem(line, elem), cmp);
}
/*
* takes a null terminated string as input w/o \r\n
*/
struct line *irc_line(char *str)
struct line *irc_line_new_from_string(char *str)
{
struct line *line;
char *space;
size_t len;
int curelem = 0;
line = calloc(sizeof(struct line), 1);
if (!line)
fatal("calloc");
line = irc_line_new();
if (str[0] == ':') {
space = str + 1;
while (*space && *space != ' ')
space++;
if (!*space)
if (!*space) {
irc_line_free(line);
return NULL;
len = space - str - 1; /* leading ':' */
line->origin = malloc(len + 1);
if (!line->origin)
fatal("malloc");
}
// 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;
str = space;
@ -141,12 +207,6 @@ struct line *irc_line(char *str)
while (*str) {
char *tmp;
line->elemc++;
line->elemv = realloc(line->elemv,
line->elemc * sizeof(char *));
if (!line->elemv)
fatal("realloc");
space = str;
if (*space == ':') {
line->colon = 1;
@ -157,16 +217,15 @@ struct line *irc_line(char *str)
while (*space && *space != ' ')
space++;
}
len = space - str;
tmp = line->elemv[curelem] = malloc(len + 1);
if (!tmp)
fatal("malloc");
// 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;
if (curelem == 0)
strucase(line->elemv[curelem]);
curelem++;
if (array_count(&line->words) == 0)
strucase(tmp);
array_push(&line->words, tmp);
str = space;
while (*str == ' ')
@ -177,10 +236,11 @@ struct line *irc_line(char *str)
void irc_line_free(struct line *l)
{
unsigned i;
for (i = 0; i < l->elemc; i++)
free(l->elemv[i]);
free(l->elemv);
int i;
for (i = 0; i < array_count(&l->words); i++)
bip_cfree(array_get(&l->words, i));
array_deinit(&l->words);
if (l->origin)
free(l->origin);
free(l);

View File

@ -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,82 +17,91 @@
#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); \
free(l.elemv); \
} 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); \
free(l.elemv); \
} 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); \
free(l.elemv); \
} 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); \
free(l.elemv); \
} 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); \
free(l.elemv); \
} 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;
unsigned int elemc;
char **elemv;
array_t words;
int colon;
};
void irc_line_init(struct line *l);
struct line *irc_line_new();
void irc_line_clear(struct line *l);
void _irc_line_deinit(struct line *l);
struct line *irc_line_new(void);
void irc_line_write(struct line *l, connection_t *c);
void irc_line_append(struct line *l, char *s);
struct line *irc_line(char *str);
void irc_line_append(struct line *l, const char *s);
struct line *irc_line_new_from_string(char *str);
char *irc_line_to_string(struct line *l);
char *irc_line_to_string_skip(struct line *l, int skip_first);
char *irc_line_to_string_to(struct line *line, char *nick);
void irc_line_free(struct line *l);
struct line *irc_line_dup(struct line *line);
void _irc_line_append(struct line *l, char *s);
void _irc_line_append(struct line *l, const char *s);
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_drop(struct line *line, int elem);
#endif

1500
src/log.c

File diff suppressed because it is too large Load Diff

View File

@ -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
@ -13,6 +14,7 @@
#ifndef LOG_H
#define LOG_H
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@ -23,74 +25,85 @@
#include "util.h"
#define MAX_PATH_LEN 1024
#define LOGLINE_MAXLEN 512
#define S_PRIVATES "privates"
#define LOGLINE_MAXLEN 2048
struct list;
typedef struct logfile {
FILE *file;
char *filename;
char *canonical_filename;
struct tm last_log;
size_t backlog_offset;
size_t len;
} logfile_t;
typedef struct logfilegroup
{
typedef struct logstore {
char *name;
list_t file_group;
int skip_advance;
list_t *memlog;
int memc;
list_iterator_t backlog_it;
} logfilegroup_t;
int track_backlog;
list_iterator_t file_it;
long file_offset;
} logstore_t;
typedef struct log {
hash_t logfgs;
char *network;
char *user;
char *buffer;
int connected;
int backlogging;
list_iterator_t file_it;
int lastfile_seeked;
int log_to_file;
struct bipuser *user;
} log_t;
void log_close_all(log_t *logdata);
log_t *log_new(char *user, char *network);
log_t *log_new(struct bipuser *user, const char *network);
void logdata_free(log_t *logdata);
int log_compare_files(logfile_t *f1, char *f2);
void log_join(log_t *logdata, char *ircmask, char *channel);
void log_part(log_t *logdata, char *ircmask, char *channel, char *message);
void log_kick(log_t *logdata, char *ircmask, char *channel, char *who,
char *message);
void log_quit(log_t *logdata, char *ircmask, char *channel, char *message);
void log_nick(log_t *logdata, char *ircmask, char *channel, char *newnick);
void log_privmsg(log_t *logdata, char *ircmask, char *destination,
char *message);
void log_notice(log_t *logdata, char *ircmask, char *channel, char *message);
void log_cli_privmsg(log_t *logdata, char *ircmask, char *destination,
char *message);
void log_cli_notice(log_t *logdata, char *ircmask, char *channel,
char *message);
void log_write(log_t *logdata, char *str, char *destination);
void log_mode(log_t *logdata, char *ircmask, char *channel,
char *modes, char **modargv, unsigned modargc);
void log_topic(log_t *logdata, char *ircmask, char *channel, char *message);
void log_init_topic(log_t *logdata, char *channel, char *message);
void log_init_topic_time(log_t *logdata, char *channel, char *who, char *when);
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);
void log_kick(log_t *logdata, const char *ircmask, const char *channel,
const char *who, const char *message);
void log_quit(log_t *logdata, const char *ircmask, const char *channel,
const char *message);
void log_nick(log_t *logdata, const char *ircmask, const char *channel,
const char *newnick);
void log_privmsg(log_t *logdata, const char *ircmask, const char *destination,
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);
void log_cli_notice(log_t *logdata, const char *ircmask, const char *channel,
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);
void log_topic(log_t *logdata, const char *ircmask, const char *channel,
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);
void log_connected(log_t *logdata);
void log_disconnected(log_t *logdata);
void log_ping_timeout(log_t *logdata);
void log_client_disconnected(log_t *logdata);
void log_client_connected(log_t *logdata);
char *log_backread(log_t *logdata, char *destination, int *skip);
int log_has_backlog(log_t *logdata, char *destination);
int log_has_backlog(log_t *logdata, const char *destination);
void log_flush_all(void);
void log_client_none_connected(log_t *logdata);
void log_reset(logfilegroup_t *);
void log_reset_all(log_t *logdata);
void log_free(log_t *log);
int check_dir(char *filename, int is_fatal);
void log_reset_store(log_t *log, const char *storename);
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);
#endif

517
src/md5.c
View File

@ -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
@ -22,227 +23,220 @@
#include <string.h>
#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 );
#undef F
#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, 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) (y ^ (x | ~z))
#define F(x, y, z) (x ^ y ^ 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, 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
ctx->state[0] += A;
ctx->state[1] += B;
ctx->state[2] += C;
ctx->state[3] += D;
#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);
#undef F
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
@ -254,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
@ -348,29 +326,6 @@ int main( int argc, char *argv[] )
#include <stdlib.h>
/*
unsigned char *md5dup(unsigned char *data, size_t len)
{
md5_context ctx;
unsigned char *md5 = malloc(16);
md5_starts(&ctx);
md5_update(&ctx, data, len);
md5_finish(&ctx, md5);
return md5;
}
unsigned char *strmd5(char *str)
{
size_t length;
if (!str)
return NULL;
length = strlen(str);
if (length == 0)
return NULL;
return md5dup((unsigned char*)str, length);
}
*/
unsigned char *chash_double(char *str, unsigned int seed)
{
size_t length;
@ -380,22 +335,27 @@ unsigned char *chash_double(char *str, unsigned int seed)
length = strlen(str);
length += 4;
ptr = malloc(length);
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 = 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;
@ -416,4 +376,3 @@ int chash_cmp(char *try, unsigned char *pass, unsigned int seed)
free(try_hash);
return 0;
}

View File

@ -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 */

49
src/path_util.c Normal file
View File

@ -0,0 +1,49 @@
/*
* This file is part of the bip project
* Copyright (C) 2016 Pierre-Louis Bonicoli
*
* 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 "path_util.h"
#include "util.h"
#include <stdio.h>
#include <string.h>
char *default_path(const char *biphome, const char *filename, const char *desc)
{
char *conf_file;
// '/' 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, "Default %s: %s", desc, conf_file);
return conf_file;
}
void assert_path_exists(char *path)
{
struct stat st_buf;
if (stat(path, &st_buf) != 0)
fatal("Path %s doesn't exist (%s)", path, strerror(errno));
}
int check_path_exists(char *path)
{
struct stat st_buf;
if (stat(path, &st_buf) != 0) {
mylog(LOG_WARN, "Path %s doesn't exist (%s)", path, strerror(errno));
return 0;
} else {
return 1;
}
}

24
src/path_util.h Normal file
View File

@ -0,0 +1,24 @@
/*
* This file is part of the bip project
* Copyright (C) 2016 Pierre-Louis Bonicoli
*
* 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.
*/
#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 */
void assert_path_exists(char *path);
/* return 1 if path exists, 0 otherwise */
int check_path_exists(char *path);
#endif

View File

@ -2,7 +2,7 @@
* $Id: conf.h,v 1.5 2005/04/17 15:20:32 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 and 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

View File

@ -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
@ -12,11 +13,14 @@
*/
#include "config.h"
#include "connection.h"
#include "util.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
@ -24,8 +28,165 @@
#include <errno.h>
extern int conf_log_level;
extern int conf_log;
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, (size_t)1, strlen(OOMMSG), conf_global_log_file);
#undef OOMMSG
fflush(conf_global_log_file);
exit(28);
}
void *bip_malloc(size_t size)
{
void *r;
assert(size < INT_MAX / 4);
r = malloc(size);
if (!r)
memory_fatal();
return r;
}
void *bip_calloc(size_t nmemb, size_t size)
{
void *r = calloc(nmemb, size);
if (!r)
memory_fatal();
return r;
}
void *bip_realloc(void *ptr, size_t size)
{
void *r;
assert(size < INT_MAX / 4);
r = realloc(ptr, size);
if (size > 0 && r == NULL)
memory_fatal();
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);
if (!r)
memory_fatal();
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> }
@ -38,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 == '|'))
while (*tmp != '\0'
&& (isalnum(*tmp) || *tmp == '-' || *tmp == '[' || *tmp == ']'
|| *tmp == '\\' || *tmp == '`' || *tmp == '^' || *tmp == '{'
|| *tmp == '}' || *tmp == '|' || *tmp == '_'))
tmp++;
return (*tmp == '\0');
}
@ -53,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');
}
@ -68,43 +229,69 @@ 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;
}
extern FILE *conf_global_log_file;
char *hrtime(time_t s)
{
static char ts[20];
struct tm *tm;
if (s == 0)
return "never";
tm = localtime(&s);
strftime(ts, (size_t)20, "%d-%m-%Y %H:%M:%S", tm);
return ts;
}
#ifdef HAVE_LIBSSL
char *checkmode2text(int v)
{
switch (v) {
case SSL_CHECK_BASIC:
return "basic";
case SSL_CHECK_CA:
return "ca";
default:
return "none";
}
}
#endif
void _mylog(int level, char *fmt, va_list ap)
{
char *prefix;
if (!conf_log_system)
return;
if (level > conf_log_level)
return;
switch (level) {
case LOG_FATAL:
prefix = "FATAL: ";
break;
case LOG_DEBUGVERB:
prefix = "DEBUG: ";
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);
@ -119,23 +306,37 @@ void mylog(int level, char *fmt, ...)
{
va_list ap;
if (!conf_log)
return;
va_start(ap, fmt);
_mylog(level, fmt, ap);
va_end(ap);
}
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
void dump_trace(void)
{
void *array[32];
int size;
size = backtrace(array, 32);
fflush(conf_global_log_file);
backtrace_symbols_fd(array, size, fileno(conf_global_log_file));
}
#endif
extern char *conf_pid_file;
void fatal(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
_mylog(LOG_FATAL, fmt, ap);
va_end(ap);
#ifdef HAVE_BACKTRACE
dump_trace();
#endif
exit(200);
}
@ -143,32 +344,24 @@ void fatal(char *fmt, ...)
* list handling functions
*/
struct list_item {
struct list_item *next;
struct list_item *prev;
void *ptr;
};
int list_ptr_cmp(void *a, void *b)
int list_ptr_cmp(const void *a, const void *b)
{
if (a == b)
return 0;
return -1;
}
void list_init(list_t *l, int (*cmp)(void *, void *))
void list_init(list_t *l, int (*cmp)(const void *, const void *))
{
l->first = NULL;
l->last = NULL;
l->cmp = cmp;
}
list_t *list_new(int (*cmp)(void *, void *))
list_t *list_new(int (*cmp)(const void *, const void *))
{
list_t *l;
l = malloc(sizeof(list_t));
if (!l)
fatal("malloc");
l = bip_malloc(sizeof(list_t));
list_init(l, cmp);
return l;
}
@ -176,9 +369,7 @@ list_t *list_new(int (*cmp)(void *, void *))
static struct list_item *list_item(void *ptr)
{
struct list_item *l;
l = malloc(sizeof(struct list_item));
if (!l)
fatal("malloc");
l = bip_malloc(sizeof(struct list_item));
l->ptr = ptr;
l->next = NULL;
l->prev = NULL;
@ -188,6 +379,10 @@ static struct list_item *list_item(void *ptr)
void list_add_first(list_t *list, void *ptr)
{
struct list_item *li;
assert(list);
if (!ptr)
fatal("Cannot add NULL ptr to list.");
li = list_item(ptr);
if (!list->first) {
list->first = list->last = li;
@ -200,6 +395,8 @@ void list_add_first(list_t *list, void *ptr)
void list_add_first_uniq(list_t *list, void *ptr)
{
assert(list);
assert_msg(ptr, "Cannot add NULL ptr to list.");
if (list_get(list, ptr))
return;
list_add_first(list, ptr);
@ -208,6 +405,9 @@ void list_add_first_uniq(list_t *list, void *ptr)
void list_add_last(list_t *list, void *ptr)
{
struct list_item *li;
assert(list);
assert_msg(ptr, "Cannot add NULL ptr to list.");
li = list_item(ptr);
if (!list->first) {
list->first = list->last = li;
@ -220,6 +420,7 @@ void list_add_last(list_t *list, void *ptr)
void *list_get_first(list_t *list)
{
assert(list);
if (!list->first)
return NULL;
return list->first->ptr;
@ -227,6 +428,7 @@ void *list_get_first(list_t *list)
void *list_get_last(list_t *list)
{
assert(list);
if (!list->last)
return NULL;
return list->last->ptr;
@ -235,8 +437,10 @@ void *list_get_last(list_t *list)
void *list_remove_first(list_t *list)
{
struct list_item *l;
void *ptr = list_get_first(list);
void *ptr;
assert(list);
ptr = list_get_first(list);
if (!ptr)
return NULL;
l = list->first;
@ -250,7 +454,10 @@ void *list_remove_first(list_t *list)
void *list_remove_last(list_t *list)
{
struct list_item *l;
void *ptr = list_get_last(list);
void *ptr;
assert(list);
ptr = list_get_last(list);
if (!ptr)
return NULL;
@ -262,36 +469,14 @@ void *list_remove_last(list_t *list)
return ptr;
}
/*
static void *list_remove_item(list_t *l, struct list_item *li)
{
void *ret = li->ptr;
if (!li->prev) {
if (l->first != li)
fatal("list_remove_item");
l->first = li->next;
} else
li->prev->next = li->next;
if (!li->next) {
if (l->last != li)
fatal("list_remove_item");
l->last = li->prev;
} else
li->next->prev = li->prev;
free(li);
return ret;
}
*/
void *list_remove_if_exists(list_t *list, void *ptr)
void *list_remove_if_exists(list_t *list, const void *ptr)
{
list_iterator_t li;
int debug = 0;
void *ret = 0;
if (!list->cmp)
fatal("list_remove: list does not have a cmp function\n");
assert(list);
assert_msg(list->cmp, "list does not have a cmp function");
for (list_it_init(list, &li); list_it_item(&li); list_it_next(&li)) {
if (list->cmp(list_it_item(&li), ptr) == 0) {
@ -306,7 +491,7 @@ void *list_remove_if_exists(list_t *list, void *ptr)
return NULL;
}
void *list_remove(list_t *list, void *ptr)
void *list_remove(list_t *list, const void *ptr)
{
void *ret;
if (!(ret = list_remove_if_exists(list, ptr)))
@ -314,12 +499,11 @@ void *list_remove(list_t *list, void *ptr)
return ret;
}
void *list_get(list_t *list, void *ptr)
void *list_get(list_t *list, const void *ptr)
{
struct list_item *it;
if (!list->cmp)
fatal("list_get: list does not have a cmp function\n");
assert_msg(list->cmp, "list_get: list does not have a cmp function");
for (it = list->first; it; it = it->next) {
if (list->cmp(it->ptr, ptr) == 0)
@ -330,30 +514,29 @@ void *list_get(list_t *list, void *ptr)
int list_is_empty(list_t *l)
{
assert(l);
return (l->first ? 0 : 1);
}
void list_it_init(list_t *list, list_iterator_t *ti)
{
assert(list && ti);
ti->list = list;
ti->cur = list->first;
ti->next = NULL;
}
void list_it_next(list_iterator_t *ti)
void list_it_init_last(list_t *list, list_iterator_t *ti)
{
if (ti->cur)
ti->cur = ti->cur->next;
}
void *list_it_item(list_iterator_t *ti)
{
if (!ti->cur)
return NULL;
return ti->cur->ptr;
assert(list && ti);
ti->list = list;
ti->cur = list->last;
ti->next = NULL;
}
void *list_it_remove(list_iterator_t *li)
{
assert(li);
if (!li->cur)
return NULL;
@ -369,24 +552,34 @@ void *list_it_remove(list_iterator_t *li)
void *ptr = li->cur->ptr;
struct list_item *item = li->cur;
li->cur = li->cur->next;
li->next = li->cur->next;
li->cur = NULL;
free(item);
return ptr;
}
void list_free(list_t *t)
{
if (t->first != NULL)
fprintf(stderr, "Warning, freeing non empty list\n");
assert(t);
assert(list_is_empty(t));
free(t);
}
void list_append(list_t *src, list_t *dest)
void list_append(list_t *dest, list_t *src)
{
list_iterator_t it;
for (list_it_init(src, &it); list_it_item(&it); list_it_next(&it))
list_add_last(dest, list_it_item(&it));
assert(dest && src);
if (src->last == NULL)
return;
if (dest->first == NULL) {
dest->first = src->first;
dest->last = src->last;
src->first = src->last = NULL;
return;
}
src->first->prev = dest->last;
dest->last->next = src->first;
dest->last = src->last;
src->first = src->last = NULL;
}
/*
@ -398,7 +591,7 @@ struct hash_item {
void *item;
};
static int hash_item_nocase_cmp(struct hash_item *a, char *b)
static int hash_item_nocase_cmp(const struct hash_item *a, const char *b)
{
return strcasecmp(a->key, b);
}
@ -411,16 +604,20 @@ static int hash_item_cmp(struct hash_item *a, char *b)
void hash_init(hash_t *h, int options)
{
int i;
assert(h);
memset(h, 0, sizeof(hash_t));
for (i = 0; i < 256; i++) {
switch (options) {
case HASH_NOCASE:
list_init(&h->lists[i],
(int (*)(void*,void*))hash_item_nocase_cmp);
(int (*)(const void *,
const void *))hash_item_nocase_cmp);
break;
case HASH_DEFAULT:
list_init(&h->lists[i],
(int (*)(void*,void*))hash_item_cmp);
(int (*)(const void *,
const void *))hash_item_cmp);
break;
default:
fatal("wrong hash option %d", options);
@ -431,14 +628,20 @@ void hash_init(hash_t *h, int options)
void hash_clean(hash_t *h)
{
int i;
struct hash_item *hi;
assert(h);
for (i = 0; i < 256; i++) {
while (list_remove_first(&h->lists[i]))
;
while ((hi = list_remove_first(&h->lists[i]))) {
free(hi->key);
free(hi);
}
}
}
void hash_free(hash_t *h)
{
assert(h);
hash_clean(h);
free(h);
}
@ -446,60 +649,75 @@ void hash_free(hash_t *h)
hash_t *hash_new(int options)
{
hash_t *h;
h = malloc(sizeof(hash_t));
if (!h)
fatal("malloc");
h = bip_malloc(sizeof(hash_t));
hash_init(h, options);
return h;
}
/* Now we have a real hash, but we use only the last byte of it :p */
static unsigned char hash_func(char *pkey)
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;
}
void hash_insert(hash_t *hash, char *key, void *ptr)
void hash_insert(hash_t *hash, const char *key, void *ptr)
{
struct hash_item *it;
assert(hash && key);
if (hash_get(hash, key))
fatal("Element with key %s already in hash %x\n", key, hash);
it = malloc(sizeof(struct hash_item));
if (!it)
fatal("malloc");
it->key = strdup(key);
it = bip_malloc(sizeof(struct hash_item));
it->key = bip_strdup(key);
it->item = ptr;
list_add_first(&hash->lists[hash_func(key)], it);
}
void *hash_get(hash_t *hash, char *key)
int hash_includes(hash_t *hash, const char *key)
{
struct hash_item *hi;
list_t *list = &hash->lists[hash_func(key)];
list_t *list;
assert(hash && key);
list = &hash->lists[hash_func(key)];
hi = list_get(list, key);
return hi != NULL;
}
void *hash_get(hash_t *hash, const char *key)
{
struct hash_item *hi;
list_t *list;
assert(hash && key);
list = &hash->lists[hash_func(key)];
hi = list_get(list, key);
if (!hi)
return NULL;
return hi->item;
}
void *hash_remove_if_exists(hash_t *hash, char *key)
void *hash_remove_if_exists(hash_t *hash, const char *key)
{
assert(hash && key);
if (hash_get(hash, key) == NULL)
return NULL;
return hash_remove(hash, key);
}
void *hash_remove(hash_t *hash, char *key)
void *hash_remove(hash_t *hash, const char *key)
{
struct hash_item *it;
void *ptr;
assert(hash && key);
it = (struct hash_item *)list_remove(&hash->lists[hash_func(key)], key);
if (!it)
return NULL;
@ -509,68 +727,121 @@ void *hash_remove(hash_t *hash, char *key)
return ptr;
}
int hash_is_empty(hash_t *h)
{
int i;
assert(h);
for (i = 0; i < 256; i++) {
if (!list_is_empty(&h->lists[i]))
return 0;
}
return 1;
}
void hash_it_init(hash_t *h, hash_iterator_t *hi)
{
assert(h);
memset(hi, 0, sizeof(hash_iterator_t));
hi->hash = h;
while (list_is_empty(&h->lists[hi->list]) && hi->list < 256)
while (hi->list < 256 && list_is_empty(&h->lists[hi->list]))
hi->list++;
if (hi->list < 256)
hi->cur = h->lists[hi->list].first;
else
hi->cur = NULL;
list_it_init(&h->lists[hi->list], &hi->lit);
}
void hash_it_next(hash_iterator_t *hi)
{
hash_t *hash = hi->hash;
hi->cur = hi->cur->next;
while (!hi->cur) {
hi->list++;
if (hi->list == 256) {
hi->cur = NULL;
return;
}
hi->cur = hash->lists[hi->list].first;
assert(hi);
list_it_next(&hi->lit);
if (!list_it_item(&hi->lit)) {
do {
hi->list++;
if (hi->list == 256)
return;
} while (list_is_empty(&hi->hash->lists[hi->list]));
list_it_init(&hi->hash->lists[hi->list], &hi->lit);
}
}
void *hash_it_item(hash_iterator_t *h)
{
if (!h->cur)
struct hash_item *hi;
assert(h);
hi = list_it_item(&h->lit);
if (!hi)
return NULL;
struct hash_item *hi = h->cur->ptr;
return hi->item;
}
char *hash_it_key(hash_iterator_t *h)
const char *hash_it_key(hash_iterator_t *h)
{
if (!h->cur)
struct hash_item *hi;
assert(h);
hi = list_it_item(&h->lit);
if (!hi)
return NULL;
struct hash_item *hi = h->cur->ptr;
return hi->key;
}
void *hash_it_remove(hash_iterator_t *hi)
{
struct hash_item *hitem;
void *ptr;
assert(hi);
hitem = list_it_remove(&hi->lit);
ptr = hitem->item;
free(hitem->key);
free(hitem);
return ptr;
}
void hash_dump(hash_t *h)
{
hash_iterator_t it;
for (hash_it_init(h, &it); hash_it_item(&it) ;hash_it_next(&it))
assert(h);
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));
}
char *strmaydup(char *s)
list_t *hash_keys(hash_t *hash)
{
hash_iterator_t hi;
list_t *ret;
assert(hash);
ret = list_new(NULL);
for (hash_it_init(hash, &hi); hash_it_item(&hi); hash_it_next(&hi))
list_add_last(ret, bip_strdup(hash_it_key(&hi)));
return ret;
}
void hash_rename_key(hash_t *h, const char *oldk, const char *newk)
{
assert(h && oldk && newk);
if (strcmp(oldk, newk) == 0)
return;
hash_insert(h, newk, hash_remove(h, oldk));
}
char *bip_strmaydup(char *s)
{
if (!s)
return s;
return strdup(s);
return bip_strdup(s);
}
void strucase(char *s)
{
while (*s) {
*s = toupper(*s);
*s = (char)toupper(*s); // toupper, safe to cast to char
s++;
}
}
@ -580,3 +851,81 @@ int ischannel(char p)
return (p == '#' || p == '&' || p == '+' || p == '!');
}
void array_init(array_t *a)
{
memset(a, 0, sizeof(array_t));
}
array_t *array_new(void)
{
array_t *a;
a = bip_malloc(sizeof(array_t));
array_init(a);
return a;
}
void array_ensure(array_t *a, int index)
{
assert(a && index >= 0);
if (array_includes(a, index))
return;
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;
}
const void *array_drop(array_t *a, int index)
{
int i;
const void *ret;
assert(a && array_includes(a, index));
ret = a->elemv[index];
for (i = index; i < array_count(a) - 1; i++)
a->elemv[i] = a->elemv[i + 1];
a->elemc--;
return ret;
}
array_t *array_extract(array_t *a, int index, int upto)
{
array_t *ret;
int i;
assert(a && array_includes(a, index));
if (upto == -1)
upto = a->elemc;
assert((index == 0 && upto == 0) || array_includes(a, upto - 1));
assert(index <= upto);
ret = array_new();
if (index == upto)
return ret;
/* here we have index < upto */
array_ensure(ret, upto - index - 1);
for (i = 0; i < ret->elemc; i++)
ret->elemv[i] = a->elemv[i + index];
return ret;
}
void array_deinit(array_t *a)
{
assert(a);
if (a->elemv)
free(a->elemv);
array_init(a);
}
void array_free(array_t *a)
{
assert(a);
if (a->elemv)
free(a->elemv);
free(a);
}

View File

@ -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
@ -15,9 +16,10 @@
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdlib.h>
/* Warning: must be in order, 0 = less output */
#define LOG_STD -1
#define LOG_FATAL 0
#define LOG_ERROR 1
#define LOG_WARN 2
@ -29,39 +31,93 @@
#define HASH_NOCASE 1
#define HASH_DEFAULT 0
#define SOFT_FAIL 0
#define HARD_FAIL 1
void mylog(int level, char *fmt, ...);
void _mylog(int level, char *fmt, va_list ap);
void fatal(char *fmt, ...);
char *timestamp(void);
struct list_item;
struct hash_item;
struct list_item {
struct list_item *next;
struct list_item *prev;
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;
struct list_item *cur;
struct list_item *next;
} list_iterator_t;
/* our hash is also a list */
typedef struct hash {
list_t lists[256];
} hash_t;
typedef struct hash_iterator {
int list;
struct list_item *cur;
list_iterator_t lit;
struct hash_item *cur;
hash_t *hash;
} hash_iterator_t;
void list_init(list_t *list, int (*cmp)(void*,void*));
int list_ptr_cmp(void *a, void *b);
list_t *list_new(int (*cmp)(void *, void *));
void *list_remove(list_t *list, void *ptr);
void *list_remove_if_exists(list_t *list, void *ptr);
void *list_get(list_t *list, void *ptr);
typedef struct array {
int elemc;
const void **elemv;
} array_t;
#define MOVE_STRING(dest, src) \
do { \
if (dest) \
free(dest); \
(dest) = (src); \
(src) = NULL; \
} while (0)
#define FREE(a) \
free(a); \
(a) = NULL;
#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_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 *));
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);
void *list_remove_if_exists(list_t *list, const void *ptr);
void *list_get(list_t *list, const void *ptr);
void list_add_first(list_t *list, void *ptr);
void list_add_first_uniq(list_t *list, void *ptr);
void list_add_last(list_t *list, void *ptr);
@ -70,31 +126,131 @@ void *list_get_last(list_t *list);
void *list_remove_first(list_t *list);
void *list_remove_last(list_t *list);
void list_it_init(list_t *list, list_iterator_t *ti);
void list_it_next(list_iterator_t *ti);
void *list_it_item(list_iterator_t *ti);
void list_it_init_last(list_t *list, list_iterator_t *ti);
void *list_it_remove(list_iterator_t *li);
void list_free(list_t *t);
void list_copy(list_t *src, list_t *dest);
void list_append(list_t *src, list_t *dest);
void list_append(list_t *dest, list_t *src);
int list_is_empty(list_t *l);
static inline void list_it_next(list_iterator_t *ti)
{
assert(ti);
if (ti->cur) {
if (ti->next)
fatal("list_it_next: inconsistent iterator state");
ti->cur = ti->cur->next;
} else if (ti->next) {
ti->cur = ti->next;
ti->next = NULL;
}
}
static inline void *list_it_item(list_iterator_t *ti)
{
assert(ti);
if (!ti->cur)
return NULL;
return ti->cur->ptr;
}
void hash_init(hash_t *h, int);
void hash_free(hash_t *h);
void hash_clean(hash_t *h);
hash_t *hash_new(int options);
void hash_insert(hash_t *hash, char *key, void *ptr);
void *hash_get(hash_t *, char *key);
void *hash_remove(hash_t *hash, char *key);
void *hash_remove_if_exists(hash_t *hash, char *key);
void hash_insert(hash_t *hash, const char *key, void *ptr);
int hash_includes(hash_t *hash, const char *key);
void *hash_get(hash_t *, const char *key);
void *hash_remove(hash_t *hash, const char *key);
void *hash_remove_if_exists(hash_t *hash, const char *key);
int hash_is_empty(hash_t *h);
void hash_it_init(hash_t *hash, hash_iterator_t *i);
void hash_it_next(hash_iterator_t *hi);
void *hash_it_item(hash_iterator_t *h);
char *hash_it_key(hash_iterator_t *h);
const char *hash_it_key(hash_iterator_t *h);
void *hash_it_remove(hash_iterator_t *li);
list_t *hash_keys(hash_t *hash);
void hash_rename_key(hash_t *h, const char *oldk, const char *newk);
int is_valid_nick(char *str);
int is_valid_username(char *str);
char *strmaydup(char *s);
char *bip_strmaydup(char *s);
void strucase(char *s);
int ischannel(char p);
char *hrtime(time_t t);
#ifdef HAVE_LIBSSL
char *checkmode2text(int v);
#endif
#define bool2text(v) ((v) ? "true" : "false")
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);
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);
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);
const void *array_drop(array_t *a, int index);
static inline int array_count(array_t *a)
{
assert(a);
return a->elemc;
}
static inline int array_includes(array_t *a, int index)
{
assert(a && index >= 0);
return a->elemc > index;
}
static inline void array_set(array_t *a, int index, void *ptr)
{
assert(a);
array_ensure(a, index);
a->elemv[index] = ptr;
}
static inline const void *array_get(array_t *a, int index)
{
assert(a && array_includes(a, index));
return a->elemv[index];
}
static inline void array_push(array_t *a, void *ptr)
{
int idx;
assert(a);
idx = a->elemc;
array_ensure(a, idx);
a->elemv[idx] = ptr;
}
static inline void *array_pop(array_t *a)
{
assert(a);
if (a->elemc == 0)
return NULL;
if (a->elemc == 1) {
void *ptr = bip_strdup(a->elemv[0]);
free(a->elemv);
a->elemv = NULL;
a->elemc = 0;
return ptr;
}
return (void *)bip_strdup(a->elemv[--a->elemc]);
}
#endif

93
src/utils/base64.c Normal file
View 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
View 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 */

View File

@ -1 +0,0 @@
timestamp

20
systemd/README Normal file
View File

@ -0,0 +1,20 @@
Notes about systemd unit files for bip.
Distro specific commandline configuration is provided by installing a script
named. A default script named bip_env.sh is provided.
This should write /run/sysconfig/bip based on configuration
information such as in /etc/sysconfig/bip or /etc/defaults/bip. It is run once
by bip-config.service.
Distro specific path for bip_env.sh script must be set using a
bip-config.service.d/distrib.conf unit file drop-in:
[Service]
ExecStart=/path/to/bip_env.sh
bip_env.sh try some default paths for the default configuration file: either
/etc/default/bip or /etc/sysconfig/bip.
Optionaly, the default configuration file path can be set too:
[Service]
ExecStart=/path/to/bip_env.sh
Environment=BIP_DEFAULT_CONFIG='/path/to/default/bip'

View File

@ -0,0 +1,12 @@
[Unit]
Description=Preprocess Bip configuration
After=local-fs.target
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=no
# Packagers must define:
# - ExecStart=/path/to/bip_env.sh
# - Environment='BIP_DEFAULT_CONFIG=/path/to/default/bip'
# using a unit file drop-in bip-config.service.d/<distrib>.conf

24
systemd/bip.service Normal file
View File

@ -0,0 +1,24 @@
[Unit]
Description=Bip IRC Proxy
Documentation=man:bip(1) man:bip.conf(5)
Requires=network.target
Wants=bip-config.service
After=bip-config.service
[Service]
EnvironmentFile=/run/sysconfig/bip
Type=forking
User=bip
Group=bip
ExecStartPre=/bin/sh -c '[ ${ENABLED:-1} != 0 ]'
ExecStart=/usr/bin/bip $DAEMON_ARGS
ExecReload=/bin/kill -HUP $MAINPID
RuntimeDirectory=bip
RuntimeDirectoryMode=0750
KillMode=process
Restart=on-abnormal
[Install]
WantedBy=multi-user.target

40
systemd/bip_env.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# Create /run/sysconfig/bip from default configuration file, for
# bip-config.service
# BIP_DEFAULT_CONFIG environment variable can be defined by packagers in a
# drop-in override of bip-config.service unit
if [ -n "${BIP_DEFAULT_CONFIG}" ]; then
# try some default paths
if [ -r /etc/default/bip ]; then
BIP_DEFAULT_CONFIG=/etc/default/bip
. "${BIP_DEFAULT_CONFIG}"
elif [ -r /etc/sysconfig/bip ]; then
BIP_DEFAULT_CONFIG=/etc/sysconfig/bip
. "${BIP_DEFAULT_CONFIG}"
fi
else
. "${BIP_DEFAULT_CONFIG}"
fi
ENABLED=${ENABLED:-1}
mkdir -p /run/sysconfig
{
echo ENABLED=${ENABLED}
DAEMON_HOME=${DAEMON_HOME:-/var/lib/bip}
DAEMON_CONFIG=${DAEMON_CONFIG:-/etc/bip/bip.conf}
echo "DAEMON_ARGS=${DAEMON_ARGS:--f '${DAEMON_CONFIG}' -s '${DAEMON_HOME}'}"
} > /run/sysconfig/bip
if [ ${ENABLED} = 0 ]; then
echo "INFO: BIP is explicitely disabled (ENABLED == 0) in" \
"'${BIP_DEFAULT_CONFIG}'."
else
if [ -n "${DAEMON_USER}" -o -n "${DAEMON_GROUP}" ]; then
echo "ERROR: Using systemd, DAEMON_USER and DAEMON_GROUP could not" \
"be defined using the default configuration file. A drop-in" \
"override of bip-config.service unit need to be created instead."
exit 1
fi
fi

5
tests/Makefile.am Normal file
View 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
View 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;
}

223
ylwrap
View File

@ -1,223 +0,0 @@
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
scriptversion=2005-05-14.22
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case "$1" in
'')
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
exit 1
;;
--basedir)
basedir=$2
shift 2
;;
-h|--h*)
cat <<\EOF
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
Wrapper for lex/yacc invocations, renaming files as desired.
INPUT is the input file
OUTPUT is one file PROG generates
DESIRED is the file we actually want instead of OUTPUT
PROGRAM is program to run
ARGS are passed to PROG
Any number of OUTPUT,DESIRED pairs may be used.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v|--v*)
echo "ylwrap $scriptversion"
exit $?
;;
esac
# The input.
input="$1"
shift
case "$input" in
[\\/]* | ?:[\\/]*)
# Absolute path; do nothing.
;;
*)
# Relative path. Make it absolute.
input="`pwd`/$input"
;;
esac
pairlist=
while test "$#" -ne 0; do
if test "$1" = "--"; then
shift
break
fi
pairlist="$pairlist $1"
shift
done
# The program to run.
prog="$1"
shift
# Make any relative path in $prog absolute.
case "$prog" in
[\\/]* | ?:[\\/]*) ;;
*[\\/]*) prog="`pwd`/$prog" ;;
esac
# FIXME: add hostname here for parallel makes that run commands on
# other machines. But that might take us over the 14-char limit.
dirname=ylwrap$$
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
mkdir $dirname || exit 1
cd $dirname
case $# in
0) $prog "$input" ;;
*) $prog "$@" "$input" ;;
esac
ret=$?
if test $ret -eq 0; then
set X $pairlist
shift
first=yes
# Since DOS filename conventions don't allow two dots,
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
y_tab_nodot="no"
if test -f y_tab.c || test -f y_tab.h; then
y_tab_nodot="yes"
fi
# The directory holding the input.
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
# Quote $INPUT_DIR so we can use it in a regexp.
# FIXME: really we should care about more than `.' and `\'.
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
while test "$#" -ne 0; do
from="$1"
# Handle y_tab.c and y_tab.h output by DOS
if test $y_tab_nodot = "yes"; then
if test $from = "y.tab.c"; then
from="y_tab.c"
else
if test $from = "y.tab.h"; then
from="y_tab.h"
fi
fi
fi
if test -f "$from"; then
# If $2 is an absolute path name, then just use that,
# otherwise prepend `../'.
case "$2" in
[\\/]* | ?:[\\/]*) target="$2";;
*) target="../$2";;
esac
# We do not want to overwrite a header file if it hasn't
# changed. This avoid useless recompilations. However the
# parser itself (the first file) should always be updated,
# because it is the destination of the .y.c rule in the
# Makefile. Divert the output of all other files to a temporary
# file so we can compare them to existing versions.
if test $first = no; then
realtarget="$target"
target="tmp-`echo $target | sed s/.*[\\/]//g`"
fi
# Edit out `#line' or `#' directives.
#
# We don't want the resulting debug information to point at
# an absolute srcdir; it is better for it to just mention the
# .y file with no path.
#
# We want to use the real output file name, not yy.lex.c for
# instance.
#
# We want the include guards to be adjusted too.
FROM=`echo "$from" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
TARGET=`echo "$2" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
# Check whether header files must be updated.
if test $first = no; then
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$2" is unchanged
rm -f "$target"
else
echo updating "$2"
mv -f "$target" "$realtarget"
fi
fi
else
# A missing file is only an error for the first file. This
# is a blatant hack to let us support using "yacc -d". If -d
# is not specified, we don't want an error when the header
# file is "missing".
if test $first = yes; then
ret=1
fi
fi
shift
shift
first=no
done
else
ret=$?
fi
# Remove the directory.
cd ..
rm -rf $dirname
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End: