1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-28 12:56:18 +00:00
Commit Graph

1816 Commits

Author SHA1 Message Date
Alexander Barton
e19ce437ca Fixed some spelling errors in documentation and code comments
Thanks to Christoph Biedl!
2011-12-30 00:50:27 +01:00
Alexander Barton
765c2f26ea Fixed typo in two error messages
Thanks to Christoph Biedl!
2011-12-30 00:32:11 +01:00
Alexander Barton
69fa6f268a LUSERS reply: only count "visible" channels
Rename Channel_Count() to Channel_CountVisible() and only count channels
that are visible to the requesting client, so the existence of secret
channels is no longer revealed by using LUSERS.

Reported by Cahata -- thanks!
2011-12-28 15:11:01 +01:00
Alexander Barton
43509fd22c IRC_Send_LUSERS(): Code cleanup 2011-12-28 14:52:21 +01:00
Alexander Barton
a71abfef4b Don't stop mode handling on unknown modes; skip it
Unknown user and channel modes no longer stop the mode parser, but are
simply ignored. Therefore modes after the unknown one are now handled.

This is how ircd2.10/ircd2.11/ircd-seven behave, at least.

Reported by Cahata -- thanks!
2011-12-28 14:46:17 +01:00
Alexander Barton
8a8e8a3a23 IRC_xLINE(): output an error message for unexpected "lines"
This fixes:

 irc-oper.c: In function ‘IRC_xLINE’:
 irc-oper.c:429: warning: ‘class’ may be used uninitialized in this function
 irc-oper.c:430: warning: ‘class_c’ may be used uninitialized in this function
2011-12-25 20:11:43 +01:00
Alexander Barton
15fec92ed7 Update list item, if it already exists
This updates the "validity" (timeout) as well as the "reason" text,
if given.
2011-12-25 19:43:00 +01:00
Alexander Barton
1e4a00f94f Lists_CheckDupeMask(): return pointer to already existing item
The old behavior of returning true/false is compatible to this change,
so there are no other code changes required.
2011-12-25 19:42:03 +01:00
Alexander Barton
338758799d Log better error messages when rejecting clients 2011-12-25 19:27:06 +01:00
Alexander Barton
164e15b8c6 Synchronize G-Lines on server login 2011-12-25 19:12:40 +01:00
Alexander Barton
32bfafafd9 Op_Check(): always accept commands from a remote server itself 2011-12-25 19:11:43 +01:00
Alexander Barton
6ef20e0f9a Class_GetList() now retuns a pointer to list_head structure 2011-12-25 19:11:07 +01:00
Alexander Barton
e86e193e01 Check G-Line and K-Line lists after authenticating clients 2011-12-25 18:03:35 +01:00
Alexander Barton
ae5ebfb9f0 New functions Lists_Expire() and Class_Expire()
GLINE and KLINE lists are cleared automatically now, not when they are
checked. So "STATS g" and "STATS k" no longer show expired entries :-)
2011-12-25 17:44:20 +01:00
Alexander Barton
e9e6224aae Implement IRC_xLINE(): handler for "GLINE" and "KLINE" commands 2011-12-25 16:57:36 +01:00
Alexander Barton
e23f025dd6 Op_Check(): return client that initiated the request or NULL
The old behavior of returning true/false is compatible to this change,
so there are no other code changes required.
2011-12-25 16:52:31 +01:00
Alexander Barton
3ca8703309 irc-oper.c: code cleanup; more documentation 2011-12-25 16:08:00 +01:00
Alexander Barton
fc82efc3e8 Implement IRC "STATS g" and "STATS k" command 2011-12-25 14:50:19 +01:00
Alexander Barton
dc9fcb0fb2 New function Class_GetList() 2011-12-25 14:49:52 +01:00
Alexander Barton
2b95c69ea1 lists.{c|h}: code cleanup; more documentation 2011-12-25 14:48:13 +01:00
Alexander Barton
af70c3dbc9 List and class handling: add optional "reason" text
Adjust Lists_Add() and Class_AddMask() accordingly, implement
Lists_GetReason() and Lists_GetValidity().
2011-12-25 14:19:45 +01:00
Alexander Barton
06a20b87c4 Add new class.{c|h} to project
Implement Class_{AddMask|DeleteMask|IsMember}() functions.
2011-12-24 13:40:27 +01:00
Alexander Barton
fea2194fc0 Lists: change "only once" property into "valid until"
The old "only once" true/false behavior is still supported, so there
are no other code changes required.
2011-12-24 13:34:25 +01:00
Alexander Barton
0a85c58878 Configuration: get rid of Conf_Oper_Count and Conf_Channel_Count
Count elements dynamically when needed.
2011-12-07 10:52:30 +01:00
Alexander Barton
8fa92f0a24 Suppress 'Can't create pre-defined channel: invalid name: ""' messages
Skip predefined channel structures that have configured no name,
like the "--configtest" does.
2011-12-04 22:35:20 +01:00
Alexander Barton
8e193df973 Only use poll() when poll.h exists as well 2011-11-25 22:06:44 +01:00
Alexander Barton
9e48f3f8f8 whois-test: handle local hostname = "localhost.localdomain"
Use the pattern "localhost*" for valid local hostnames.
2011-11-10 11:54:22 +01:00
Alexander Barton
13d9e0c5a7 Test for gai_strerror()
If gai_strerror() isn't available, use a macro that simply returns
a static error message (regardless of the real error code).

For example, GNU libc 2.0.7 doesn't implement gai_strerror().
2011-11-06 14:16:59 +01:00
Alexander Barton
a7911e35af Only use AI_NUMERICHOST if it is #define'd
It isn't using GNU libc 2.0.7, for example ...
2011-11-06 14:13:49 +01:00
Alexander Barton
60812b6fdf defines.h: fix comment: "lenth" -> "length"
Reported by Christoph Biedl in #ngircd. Thanks!
2011-11-05 00:35:18 +01:00
Alexander Barton
1ea6811616 Init_Server_Struct(): correctly zero Server->bind_addr
Don't use the size of the pointer, use the size of the variable!
2011-11-05 00:21:19 +01:00
Alexander Barton
d2f54abbed Clean up and fix comments of Check_ArgIsTrue()
Thanks to kaFux for pointing this out!
And fix code formatting as well ...
2011-11-03 09:54:28 +01:00
Alexander Barton
30796698a9 Only close "unrelated" sockets in forked child processes
This fixes the problem that ngIRCd can't do any IDENT lookups because
of the socket has already been closed in the child process.

The bug has been introduced starting with ngIRCd 17 ... :-(
(commit ID 6ebb31ab35)
2011-09-07 14:51:16 +02:00
Alexander Barton
8aac366802 Implemented user mode "R" and channel mode "R"
- User mode "R": indicates that the nick name of this user is "registered".
   This mode isn't handled by ngIRCd itself, but must be set and unset by
   IRC services like Anope.

 - Channel mode "R": only registered users (having the user mode "R" set)
   are allowed to join this channel.
2011-08-26 15:26:38 +02:00
Alexander Barton
69803d6ff1 Use Proc_Close() to remove no longer unused pipes to child processes
This removes spurious (but harmless) debug messages.
2011-08-23 12:32:05 +02:00
Alexander Barton
be6994aece New function Proc_Close() to shutdown pipes to child processes 2011-08-23 12:31:17 +02:00
Alexander Barton
1361b3742d Introduce DEBUG_BUFFER, rework some debug messages
DEBUG_BUFFER is off by default and therefore disables these messages:
 - "Handle_Write() called for connection XX, YY bytes pending ..."
 - "Connection XX: ZZ bytes left in read buffer."
2011-08-23 12:28:04 +02:00
Alexander Barton
d3036c74e9 Testsuite: bind to loopback (127.0.0.1) interface only 2011-08-22 16:54:24 +02:00
Alexander Barton
51d7674ee7 New 2nd message "Nickname too long" for error code 432 2011-08-19 11:09:40 +02:00
Alexander Barton
1189200d4a Client_CheckNick(), Client_IsValidNick(): code cleanup 2011-08-19 10:44:26 +02:00
Alexander Barton
7795b07c53 Merge branch 'ServerMode'
* ServerMode:
  Handle channel user modes 'a', 'h', and 'q' from remote servers
  Handle unknown channel modes on server links
  Handle unknown user modes on server links
  IRC_MODE(), Client_Mode(): code cleanup [2/2]
  Enlarge client user mode buffer, reduce client flags buffer
  Infom clients when other servers change their user modes
  IRC_MODE(), Client_Mode(): code cleanup [1/2]
2011-08-13 21:04:01 +02:00
Alexander Barton
d9325e8030 Merge branch 'bug113-SrvPrefix'
* bug113-SrvPrefix:
  Slightly change (and document!) IRC_KILL() calling convention
  Spoofed prefixes: close connection on non-server links only
2011-08-09 10:16:56 +02:00
Alexander Barton
160c52400f Cast getpid() and time() results for srand() input
This fixes:

src/ngircd/ngircd.c:596: warning: implicit conversion
 shortens 64-bit value into a 32-bit value

(i686-apple-darwin11-llvm-gcc-4.2)
2011-08-02 13:24:13 +02:00
Alexander Barton
88f6fc5fd8 IRC_QUIT(): disconnect directly linked servers sending QUIT
Without this patch, the server becomes removed from the network and
the client structures, but the connection isn't shut down at all ...
2011-08-02 00:56:49 +02:00
Alexander Barton
989c9fa531 Handle channel user modes 'a', 'h', and 'q' from remote servers
These channel user modes aren't used for anything at the moment, but
ngIRCd knows that these three modes are "channel user modes" and not
"channel modes", that is that these modes take an "nick name" argument.

Like unknown user and channel modes, these modes are saved and forwarded,
but ignored otherwise.
2011-08-01 23:30:55 +02:00
Alexander Barton
2fd42667c2 Handle unknown channel modes on server links 2011-08-01 22:30:00 +02:00
Alexander Barton
2dfa24d2fa Handle unknown user modes on server links 2011-08-01 22:09:40 +02:00
Alexander Barton
1ed602eb47 IRC_MODE(), Client_Mode(): code cleanup [2/2] 2011-08-01 21:51:31 +02:00
Alexander Barton
ea725b99b7 Enlarge client user mode buffer, reduce client flags buffer
We have to enlage our user mode buffer, so we can handle even unknown
user modes in the future; and reduce the client flags buffer, because
I can't imagine why we ever would need ~100 flags!?

Now we support up to 15 user modes (was: 8) and up to 15 flags (was: 99).

So in the end, we even save 99-15+8-15=77 bytes for each client structure!
2011-08-01 21:28:55 +02:00
Alexander Barton
3dc3a03538 Infom clients when other servers change their user modes 2011-08-01 21:10:16 +02:00
Alexander Barton
d692286d7a IRC_MODE(), Client_Mode(): code cleanup [1/2] 2011-08-01 09:07:32 +02:00
Alexander Barton
456e55921d Slightly change (and document!) IRC_KILL() calling convention 2011-07-30 19:48:48 +02:00
Alexander Barton
9f3690c39c Testsuite: make getpid.sh work even when run as root
Use ps(1) flag "-a" (as well as "-f"):
"Select all processes except both session leaders (see getsid(2)) and
processes not associated with a terminal."

Thanks to Götz Hoffart for reporting this problem!
2011-07-30 18:47:58 +02:00
Alexander Barton
6cbe13085d Spoofed prefixes: close connection on non-server links only
On server-links, spoofed prefixes can happen because of the asynchronous
nature of the IRC protocol. So don't break server-links, only log a message
and ignore the command.

This fixes bug 113, see:
<https://arthur.barton.de/bugzilla/show_bug.cgi?id=113>
2011-07-19 16:07:34 +02:00
Alexander Barton
e160121698 MorePrivacy: Don't register WHOWAS information
Citing an email from Florian to the ngIRCd mailing list:

"I wonder what the expected behaviour is when Conf_MorePrivacy is changed
 from 'yes' to 'no' and the config is reloaded.

 At the moment, WHOWAS will start giving out information on Users that
 were connected during Conf_MorePrivacy=yes period.  If this is not
 wanted, Client_RegisterWhowas() should be changed to not store a record
 when Conf_MorePrivacy is enabled."

And I think it is "not wanted" :-)
2011-07-10 14:45:33 +02:00
Alexander Barton
2d35731399 GnuTLS: use 1024 (DH_BITS_MIN) as minimum size of the DH prime
For outgoing connections, we use 2048 (DH_BITS) since commit 49b2d0e.

This patch enables ngIRCd to accept incoming connections from other servers
and clients that use at least 1024 bits (and no longer requires 2048 for
incoming connections, too).

Patch proposed by Florian Westphal.
2011-06-28 13:48:33 +02:00
Alexander Barton
14afdaee08 hash: Use UINT32 instead of uint32_t 2011-06-27 10:27:07 +02:00
Florian Westphal
1765f0ae0b hash: use more recent lookup3 algorithm instead of lookup2
Bob Jenkins published a newer hash function in May 2006, it has
better distribution.

See http://burtleburtle.net/bob/hash/doobs.html for lengthy
comparisions.
2011-06-27 00:16:37 +02:00
Alexander Barton
7f8d0ea5a3 Use srand()/rand() instead of srandom()/random(); seems to be more portable 2011-06-26 23:39:20 +02:00
Alexander Barton
d99edb7728 Merge branch 'MorePrivacy'
* MorePrivacy:
  New configuration opion "MorePrivacy" to "censor" some user information
2011-06-26 15:41:27 +02:00
Alexander Barton
269310f04b Merge branch 'ScrubCTCP'
* ScrubCTCP:
  Add documentation for "ScrubCTCP" configuration option
  New option to scrub incoming CTCP commands
2011-06-26 15:38:53 +02:00
Alexander Barton
946d838de4 Move SSL-related configuration variables to new [SSL] section 2011-06-26 00:09:36 +02:00
Alexander Barton
a085444035 CheckFileReadable(): only check when a filename is given ... 2011-06-26 00:07:47 +02:00
Alexander Barton
449ad1eeea PAM: make clear which "Password" config option is ignored 2011-06-25 23:55:54 +02:00
xor
b80e115f39 New configuration opion "MorePrivacy" to "censor" some user information
this patch contains:

  * Fix for Conf_CloakUserToNick to make it conceal user details
  * Adds MorePrivacy-feature

MorePrivacy censors some user information from being reported by the
server. Signon time and idle time is censored. Part and quit messages
are made to look the same. WHOWAS requests are silently dropped. All
of this is useful if one wish to conceal users that access the ngircd
servers from TOR or I2P.
2011-06-25 22:21:20 +02:00
xor
f087c68a99 New option to scrub incoming CTCP commands
This patch makes it possible to scrub incomming CTCP commands from
other servers and clients alike. The ngircd oper can enable it from
the config file, by adding "ScrubCTCP = yes" under [OPTIONS]. It is
default off.

CTCP can be used to profile IRC users (get user clients name and
version, and also their IP addresses). This is not something we like
to happen when user pseudonymity/secrecy is important.

The server silently drops incomming CTCP requests from both other
servers and from users. The server that scrubs CTCP will not forward
the CTCP requests to other servers in the network either, which can
spell trouble if not every oper knows about the CTCP-scrubbing.
Scrubbing CTCP commands also means that it is not possible to send
files between users.

There is one exception to the CTCP scrubbing performed: ACTION ("/me
commands") requests are not scrubbed. ACTION is not dangerous to users
(unless they use OTR, which does not encrypt CTCP requests) and most
users would be confused if they were just dropped.

A CTCP request looks like this:

ctcp_char, COMMAND, arg0, arg1, arg2, .. argN, ctcp_char

ctcp_char is 0x01. (just like bold is 0x02 and color is 0x03.)

They are sent as part of a message and can be delivered to channels
and users alike.
2011-06-25 21:37:17 +02:00
Alexander Barton
c438c227b5 Testsuite: update configuration files for new config file format 2011-06-25 14:57:26 +02:00
Alexander Barton
d41f4d6d20 Display configuration errors more prominent on "--configtest" 2011-06-25 14:56:27 +02:00
Alexander Barton
391cf4e2a1 conf.c: code cleanup 2011-06-25 14:55:34 +02:00
Alexander Barton
7ef6cb4584 Check for redability of SSL-related files like for MOTD file
Remove functions ssl_print_configvar() and ConfSSL_Puts(), introduce
new function CheckFileReadable().
2011-06-25 14:50:52 +02:00
Alexander Barton
e7256bb8ac Restructure ngIRCd configuration, introduce [Limits] and [Options]
The intention of this restructuring is to make the [Global] section much
cleaner, so that it only contains variables that most installations must
adjust to the local requirements.

All the optional variables are moved to [Limits], for configurable limits
and timers of ngIRCd, and [Options], for optional features.

The old variables in the [Global] section are deprecated now, but still
recognized.
2011-06-25 14:45:36 +02:00
Florian Westphal
42b32f8a2a conn: fix error handling when connecting to server
The io_event_create error handling seems to miss a 'return'
statement.

Fix this by moving io_event_create() call around so we do not
need the Conn_Close/Init calls in the error case.
2011-06-05 15:00:32 +02:00
Florian Westphal
49b2d0ec98 ssl: gnutls: bump dh bitsize to 2048
problem is that some clients refuse to connect to severs that only offer
1024.  For interoperability it would be best to just use 4096, but that
takes minutes, even on current hardware.
2011-06-04 22:57:29 +02:00
Florian Westphal
605b6a67bc fix clang warning about dead stores
clang 'scan-build':
Value stored to 'r' is never read
Value stored to 'fd' is never read
2011-05-06 20:31:56 +02:00
Florian Westphal
05748aa5ee parse: fix logical expression testing for non RFC1459 links
parse.c:284: warning: suggest parentheses around operand of '!' or
change '&' to '&&' or '!' to '~'

The expression looks dubious, this should probably be
an if-not-set, then... test.
2011-04-29 23:27:56 +02:00
Florian Westphal
0bb892bb5f conn: avoid needlesly scary 'buffer overflow' messages
When the write buffer space grows too large, ngircd has to disconnect
the client to avoid wasting too much memory.

ngircd logs this with a scary 'write buffer overflow' message.
Change this to a more descriptive wording.
2011-04-29 23:10:01 +02:00
Alexander Barton
c26ca7773b Only require server prefixes on non RFC1459 links
Not all servers (and services!) using the RFC1459 protocol style send
prefixes on all commands; so don't require them to do so.

This relaxes the requirements introduced by commit 15775e679.
2011-04-29 12:33:58 +02:00
Alexander Barton
160f5725a6 Do reverse lookups using the AF of the incoming connection
This fixes errors like this one:
  Address mismatch: 2001🔢abcd:1::1 != 192.168.1.1
2011-04-26 11:10:50 +02:00
Florian Westphal
e4e1595bff resolve: fix reverse lookups of client connections with ConnectIPv6=no
We re-use the same helper function for both forward lookups
(when we want to connect to a peer server) and for validation of reverse
loopups (where we make a lookup on the hostname returned
by a reverse lookup on the IP address that connected).

Problem:

When ConnectIPv6=no, the forward lookup helper sets the adderss family
to AF_INET, and, if out client connected via ipv6, we fail to validate
the result.

Thus move the ConnectIPvX check out of the helper.
2011-04-25 18:00:10 +02:00
Alexander Barton
1cd8d7f386 Doxygen'ify conf.c 2011-04-12 23:15:29 +02:00
Alexander Barton
9a102ca96b New function Config_Error_Section(); and code cleanup 2011-04-12 21:55:32 +02:00
Alexander Barton
e70e81460b Add some type casts to random() and srandom() functions
This fixes two gcc warnings (on Mac OS X):
 "warning: implicit conversion shortens 64-bit value into a 32-bit value"
2011-04-12 21:23:14 +02:00
Florian Westphal
5acb90fafc ngircd: improve rng initialisation
we do not need this for cryptographic purposes, but we can do better
than plain srandom(getpid()).

Also, keep in mind that rng state is inherited across fork(), so re-init
it in the child.
2011-03-28 00:29:58 +02:00
Alexander Barton
d61fbfc6e3 Merge branch 'AuthPing'
* AuthPing:
  Add documentation for "RequireAuthPing" configuration option
  New configuration option "RequireAuthPing": PING-PONG on login
2011-03-27 20:58:18 +02:00
Alexander Barton
162433398e New configuration option "RequireAuthPing": PING-PONG on login
When enabled, this configuration option lets ngIRCd send a PING with an
numeric "token" to clients logging in; and it will not become registered
in the network until the client responds with the correct PONG.

This is used by QuakeNet for example (ircu/snircd), and looks like this:

  NICK nick
  :irc.example.net PING :1858979527
  USER user . . :real name
  PONG 1858979527
  :irc.example.net 001 nick :Welcome to the Internet Relay Network ...
2011-03-27 19:33:48 +02:00
Alexander Barton
f99d33ddd9 Configuration: move "NoticeAuth" to GLOBAL section 2011-03-26 17:11:44 +01:00
Alexander Barton
d29e389779 New configuration option "NoticeAuth": send NOTICE AUTH on connect
When enabling "NoticeAuth" in the [Features] section, ngircd will send
"NOTICE AUTH" messages on client connect like e.g. snircd (QuakeNet) does.
2011-03-25 12:15:11 +01:00
Alexander Barton
f1a4a4dc88 Warn when unknown variables are found in [Features] section 2011-03-25 12:12:20 +01:00
Alexander Barton
770a58ac6d Generate WALLOPS message on SQUIT from IRC operator
So SQUIT now behaves like CONNECT and DISCONNECT commands, when called
by an IRC operator (and not received from an other server).
2011-03-21 23:52:42 +01:00
Alexander Barton
15775e6790 Commands received from other servers must have prefixes
Make sure that all commands received from other servers do have
valid prefixes.

Only exceptions are PING and ERROR commands that can occure without
prefixes when generated by the remote peer itself.
2011-03-21 10:46:09 +01:00
Alexander Barton
62f705f97e Allow servers to send more commands in the first 10 secods
This helps to speed up server login and network synchronisation.
2011-03-21 09:42:01 +01:00
Alexander Barton
a39e2f22c9 IRC_CHANINFO(): Code cleanup 2011-03-19 17:29:19 +01:00
Alexander Barton
dcb1951efd Handle_GLOBAL(): don't use multi-line strings
They aren't supported by elder C compilers ...
2011-03-19 17:28:38 +01:00
Alexander Barton
fa8b83e69b Merge branches 'CloakUserHost', 'QuitOnHTTP' and 'bug72-WHOIS-List'
* CloakUserHost:
  Add a note not to use a percent sign ("%") in CloakHost variable
  Rename ClientHost to CloakHost, and ClientUserNick to CloakUserToNick
  Don't use "the.net" in sample-ngircd.conf, use "example.net"
  ngircd.conf.5: document "ClientHost" and "ClientUserNick"
  Move "ClientHost" and "ClientUserNick" to end of [Global] section
  ClientUserNick setting
  ClientHost setting

* QuitOnHTTP:
  Only "handle" HTTP commands on unregistered connections
  Don't use IRC_QUIT_HTTP() if STRICT_RFC is #define'd
  IRC_QUIT_HTTP(): enhance error message
  Move IRC_QUIT_HTTP() below IRC_QUIT()
  quit on HTTP commands: GET & POST

* bug72-WHOIS-List:
  Add "whois-test" to testsuite and distribution archive
  Add support for up to 3 targets in WHOIS queries.
2011-03-19 17:16:14 +01:00
Alexander Barton
ae7470ceb5 Rename ClientHost to CloakHost, and ClientUserNick to CloakUserToNick 2011-03-19 16:58:29 +01:00
Alexander Barton
d1f604ab89 Add "whois-test" to testsuite and distribution archive
Test script proposed by Dana Dahlstrom, 2008-02-17.
See <https://arthur.barton.de/bugzilla/show_bug.cgi?id=72> ...
2011-03-19 15:03:15 +01:00
Florian Westphal
ff2a425ab8 Add support for up to 3 targets in WHOIS queries.
also allow up to one wildcard query from local hosts.
Follows ircd 2.10 implementation rather than RFC 2812.
At most 10 entries are returned per wildcard expansion.

WHOIS test cases by Dana Dahlstrom.
2011-03-19 15:03:15 +01:00
Alexander Barton
b19f7d73cb Only "handle" HTTP commands on unregistered connections 2011-03-17 00:03:10 +01:00
Alexander Barton
38747b40dc Don't use IRC_QUIT_HTTP() if STRICT_RFC is #define'd 2011-03-16 23:58:39 +01:00
Alexander Barton
dbb66695c9 IRC_QUIT_HTTP(): enhance error message 2011-03-16 23:58:01 +01:00
Alexander Barton
77cff9e47c Move IRC_QUIT_HTTP() below IRC_QUIT() 2011-03-16 23:56:27 +01:00
Alexander Barton
25dd193e9b Move "ClientHost" and "ClientUserNick" to end of [Global] section 2011-03-16 23:43:29 +01:00
Gabor Adam Toth
71d8c37171 ClientUserNick setting 2011-03-16 23:15:50 +01:00
Gabor Adam Toth
52f59149ad ClientHost setting 2011-03-16 23:15:50 +01:00
Gabor Adam Toth
33e8c24806 quit on HTTP commands: GET & POST 2011-03-16 22:59:57 +01:00
Florian Westphal
5417a72536 channel: always reject zero-length channel key
previously, any client could join in this configuration:

[Channel]
  Name = #test
  Modes = tnk
  KeyFile = /tmp/foobar

fix this by checking for zero-length key before comparing
key to channel key.
2011-02-28 23:28:24 +01:00
Alexander Barton
94e4562c1c PAM-Auth child: log if result can't be reported
This fixes the followin GCC warning on modern Linux systems as well:

irc-login.c:     In function ‘Hello_User’:
irc-login.c:876: warning: ignoring return value of ‘write’,
                 declared with attribute warn_unused_result
2011-02-23 22:55:45 +01:00
Alexander Barton
adfa968f99 Correctly detect errors when handling "MODE x" commands 2011-02-14 01:44:40 +01:00
Alexander Barton
07f241ff6d Enhance documentation for the WEBIRC command 2011-02-13 17:52:39 +01:00
Alexander Barton
53fecf5a2b Doxygen'ify irc-login.c 2011-02-13 17:52:39 +01:00
Alexander Barton
8a674c3263 Doxygen'ify irc-channel.c 2011-02-13 17:52:39 +01:00
Alexander Barton
1f5fbd5992 Doxygen'ify conn.c 2011-02-13 17:52:39 +01:00
Alexander Barton
5858dc3886 Doxygen'ify proc.h 2011-02-13 17:52:39 +01:00
Alexander Barton
af6ac0fa41 Doxygen'ify parse.h 2011-02-13 17:52:39 +01:00
Alexander Barton
f3ec90f3f0 Doxygen'ify and update comments in ngircd.{c|h} 2011-02-13 17:52:39 +01:00
Alexander Barton
c6a7de869c Doxygen'ify and update comments in match.c 2011-02-13 17:52:39 +01:00
Alexander Barton
4ef23df813 Update and translate comments in hash.c 2011-02-13 17:52:39 +01:00
Alexander Barton
5555b6cc86 Doxygen'ify conf.h 2011-02-13 17:52:39 +01:00
Alexander Barton
72a982ae7e Add missong Doxygen @file tags to ngircd.h and irc-op.h 2011-02-13 17:52:39 +01:00
Alexander Barton
2a7dd06ebd Code cleanup: mostly removing empty lines 2011-02-13 17:52:38 +01:00
Alexander Barton
03628dbeaf Add Doxygen @file documentation to each source and header file 2011-02-13 17:52:38 +01:00
Alexander Barton
f732c7117e Make write buffers bigger, but flush early
This patch
 - makes the server write buffer bigger: 64k,
 - makes the regular write buffer bigger: 32k,
 - tries to flush the write buffer starting at 4K.

Before this patch, a client got disconnected if the buffer flushing at 4k
failed, now regular clients can store up to 32k and servers up 64k even
if flushing is not possible at the moment (e.g. on slow links).
2011-02-12 23:24:56 +01:00
Alexander Barton
477224be5c Enhance logging on "write buffer overflow" 2011-02-12 23:24:26 +01:00
Alexander Barton
493ccd57f4 Clean up Validate_Prefix(); don't send punctuation in ERROR commands 2011-01-29 16:05:55 +01:00
Alexander Barton
8700f4d93c Better check for invalid IRC+ PASS command
Don't do a NULL-pointer dereference when a remote server using the
IRC+ protocol sends an invalid PASS command without the required
<serverversion> parameter ...
2011-01-23 18:38:36 +01:00
Alexander Barton
765dc320f1 Read_Request(): don't access possibly free'd CLIENT structure
Handle_Buffer() can shut down connections and remove clients, so after
calling it, we have to make sure that our CLIENT pointer is still valid.
2011-01-23 15:14:18 +01:00
Alexander Barton
9fff9f6a2b ngircd-test2.conf: really disable Ident and PAM ... 2011-01-19 01:19:40 +01:00
Alexander Barton
b856a58051 Log "Can't read MOTD file" as "configuration error"
Now this error message is displayed in the console without debug prefix
when running the configuration test (--configtest).
2011-01-18 23:44:07 +01:00
Alexander Barton
8927700b22 Allow "Port = 0" in [Server] blocks
Port number 0 marks remote servers that try to connect to this
daemon, but where this daemon never tries to establis a connection
on its own: only incoming connections are allowed.
2011-01-18 22:45:01 +01:00
Alexander Barton
58a4dae56d conf: fix 'Value of "..." is not a number!' for negative values
Don't use isdigit() function any more, because it only checks the
first character of the variable value and because it doesn't know
about the minus sign which is required e.g. for "Group = -1".
2011-01-18 22:41:27 +01:00
Alexander Barton
914d6a26d8 Don't read MOTD file twice
The MOTD file is read in Read_Config(), so don't read it when handling
the "MotdFile" configuration variable. Instead make sure that it is
initialized properly when (re-)reading the configuration.
2011-01-18 22:01:27 +01:00
Alexander Barton
c98e794b38 Add [Features] section to ngircd-test{1|2}.conf
Fix commit 5a34bb203a:
It is not enough to strip the "No" prefix from "Ident" and "PAM",
but we have to introduce the new [Features] section to fix all
warning messages of ngIRCd.

Variables "Ident" and "PAM" in [Global] are completely wrong :-(
2011-01-18 21:39:48 +01:00
Alexander Barton
a990bd72ec Enable WHOIS command to return information about services 2011-01-18 21:04:55 +01:00
Alexander Barton
5a34bb203a Update testsuite configuration: strip No... prefixes 2011-01-18 14:28:39 +01:00
Alexander Barton
d3ef2239e1 Add connection/socket information to some log messages 2011-01-16 23:24:41 +01:00
Alexander Barton
a57748e1a1 Implement channel mode 'O': "IRC operators only"
This channel mode is used on DALnet (bahamut), for example.
2011-01-10 12:15:05 +01:00
Alexander Barton
4a6d44dce2 Remove support for ZeroConf/Bonjour/Rendezvous service registration 2011-01-09 23:51:30 +01:00
Alexander Barton
5ed7a4ea57 TOPIC command: test for channel admin rights correctly
This enables other servers, services and IRC operators to change
channel topics, even when the client is not joined to this channel.

Now the handler for TOPIC behaves like the one for MODE.
2011-01-09 23:08:15 +01:00
Alexander Barton
ba32d594fd Channel_CheckAdminRights(): test if client can admin a channel
This generic function tests if a client is allowed to do administrative
tasks to a specific channel:

 - servers and services are always truested ("allowed everything"),
 - channel operators are allowed,
 - IRC operarors are allowed if OperCanUseMode is set in the config.
2011-01-09 22:40:11 +01:00
Florian Westphal
3460c87c58 conf: fix 'unknown section' FEATURES parse error
pointed out by Alex:
ngircd.conf, line 105: Unknown section "[Features]"!
2011-01-09 22:19:17 +01:00
Alexander Barton
02592f912e IRC_TOPIC(): code cleanup 2011-01-09 22:10:30 +01:00
Florian Westphal
1964bda252 conf: move 'run-time-feature-disable' options to new FEATURE section 2011-01-09 19:42:42 +01:00
Florian Westphal
23ce0393b2 array: remove check for allocated == 0
allocated can only be zero if ->mem is NULL.
2011-01-09 19:40:54 +01:00
Florian Westphal
994a003aba array: remove alignment of requested size
libc should know better than us.
Also, this helps debugging with tools like valgrind:
When you allocate an array of size x, and then erronoulsy
use x+1 valgrind cannot detect the bug because due to ALIGN_()
made by array.c we might have allocated more than size x...
2011-01-09 19:28:50 +01:00
Florian Westphal
eda2556e09 conf: Warn if PAM=true when ngircd was built without PAM support 2011-01-09 18:17:35 +01:00
Florian Westphal
9402bcaa73 conf: add missing static qualifier
internal helper, so it should be static.

also, add UNUSED to 'Line'.
2011-01-09 17:54:21 +01:00
Alexander Barton
6d11fb1497 Update copyright notices for 2010 :)
And update the NEWS and ChangeLog file as well.
2011-01-09 16:11:12 +01:00
Alexander Barton
28bbd7e27a Make NoZeroConf option work with Howl 2011-01-09 14:31:18 +01:00
Florian Westphal
1dca082fc6 config: deprecate NoXX-Options
ngircd unfortunately uses several options using double-negation, e.g.

NoIdent = No, NoPam = No, etc.

This renames all options by dropping the "No" prefix, e.g.
"NoIdent = no" becomes "Ident = yes".

The old options will continue to work, but will cause a warning
message.

Also update man pages and default config.

To prevent silly
'Ident = yes' from appearing in  --configtest output in the
'ident support not compiled in and Ident Option not used' case,
make default value depend on feature availability.
If feature is available, enable by default, otherwise disable.

We might consider moving these options to a new
[Feature]

section, or something like that, because none of these options are
essential.

Another possible improvement:

'Ident = yes' option in ngircd.conf causes a warning if ngircd was
built without ident support.

This does not happen with e.g. zeroconf....
2011-01-09 13:59:33 +01:00
Florian Westphal
4a5dfcc3ac channel: fix confusing "adding to invite list" debug output
adding entries to ban list produced 'invite list' debug output...
2010-12-31 11:35:40 +01:00
Alexander Barton
f37e495a2b Command throttling: introduce MAX_COMMANDS_SERVICE
New MAX_COMMANDS_SERVICE (currently set to MAX_COMMANDS_SERVER[10]),
so that services are handled like servers (and not regular users).
2010-12-29 14:19:51 +01:00
Alexander Barton
21cbf37db5 Don't throttle services and servers beeing registered 2010-12-29 14:12:34 +01:00
Alexander Barton
36d4f6c601 Don't assert() when serching a client for an invalid server token
This is only relevant when a trusted server on a server-server link
sends invalid commands.
2010-12-24 12:48:03 +01:00
Alexander Barton
8ea1c5bb82 --configtest: remember if MOTD is configured by file or phrase
Configuration variables "MotdFile" and "MotdPhrase" are mutually
exclusive; so don't display content in both of them when running
"ngircd --configtest": instead remember which one is beeing used.
2010-12-02 16:51:21 +01:00
Alexander Barton
79ca5fe04d Enhance log messages when establishing server links a little bit 2010-12-02 13:40:08 +01:00
Alexander Barton
60bb40d67a Reset ID of outgoing server link on DNS error correctly
Not resetting the ID prevents the daemon from trying to re-establish
outgoing server links when the DNS resolver failed to resole a hostname.
2010-12-02 13:38:42 +01:00
Alexander Barton
5da98ec389 Don't log critical (or worse) messages to stderr
stderr isn't redirected to the "error file" any more, so there is
no point in trying to log to it ...
2010-12-02 13:36:19 +01:00
Alexander Barton
790fa89e67 Remove "error file" when compiled with debug code enabled
The information written to the "error file" (/tmp/ngircd-<PID>.err) when
ngIRCd is compiled with debug code enabled isn't that usefule, so don't
create this file at all.
2010-12-01 21:22:20 +01:00
Alexander Barton
7321be2ccd New numeric 329: get channel creation time on "MODE #chan" commands 2010-11-11 12:39:49 +01:00
Alexander Barton
9bc5d565bb Save channel creation time; new function Channel_CreationTime() 2010-11-11 12:39:19 +01:00
Alexander Barton
d7ad956a06 Fix connect attempts to further IP addresses of outgoing server links
If a hostname resolves to more than one IP address (round-robin DNS,
IPv4 and IPv6) and an attempt to connect to the first address fails,
ngIRCd should try to connect to the 2nd address, 3rd address etc.

But because of a wrong variable used in the call to New_Server(),
the wrong server structure has been used in further connection attemps
which possibly lead to connection attempts to already connected servers.
2010-10-27 21:59:51 +02:00
Alexander Barton
76f40bdb98 Xcode builds ("make xcode"): disable pam_fail_delay()
disable pam_fail_delay() only is available starting with Mac
OS X 10.6; but we use the 10.5 SDK for campatibility, so don't use
this function at all when building using Xcode.
2010-10-26 15:13:24 +02:00
Alexander Barton
0c0cac641d ZeroConf: include header files missing since commit a988bbc86a 2010-10-25 00:17:46 +02:00
Alexander Barton
596bc096b0 Make sourcecode compatible with ansi2knr again
This allows to compile ngIRCd using a pre-ANSI K&R C compiler again:
all source files are automatically converted by the included ansi2knr
program (of GNU automake/autoconf) before compiling them with the
K&R C compiler, but a few coding standards must be met.

Tested on Apple A/UX 3.x.
Regression testing on Linux and Mac OS X.
2010-10-24 21:48:32 +02:00
Alexander Barton
f1267ca375 Don't use PARAMS() macro for function implementations
The PARAMS() macro is only needed for function prototypes;
don't use it for the actual implementations.
2010-10-24 13:41:51 +02:00
Alexander Barton
99e08eaced Only try to set FD_CLOEXEC if this flag is defined
A/UX 3.x doesn't implement this constant, for example.
2010-10-19 22:17:12 +02:00
Alexander Barton
5f2bc55d36 Only use "__attribute__ ((unused))" if GCC >=2.8 is used
At least GCC 2.7.2 doesn't support this attribute.
2010-10-19 22:13:48 +02:00
Alexander Barton
a988bbc86a New configuration option "NoZeroConf" to disable ZeroConf registration
If ngIRCd is compiled to register its services using ZeroConf (e.g. using
Howl, Avahi or on Mac OS X) this parameter can be used to disable service
registration at runtime.
2010-10-11 16:54:49 +02:00
Alexander Barton
ade8902b88 Make sure sighandlers.h is listed in noinst_HEADERS
... because it must be included in the distribution archive :-)
2010-10-05 21:57:01 +02:00
Alexander Barton
3a826b774a const'ify ngt_SyslogFacilityName() function
This fixes the following gcc compiler warning:

tool.c: In function 'ngt_SyslogFacilityName':
tool.c:195: warning: return discards qualifiers from pointer target type
2010-10-05 20:16:35 +02:00
Alexander Barton
5e82a91d13 New configuration option "SyslogFacility"
The new option "SyslogFacility" deines the syslog "facility" to which
ngIRCd should send log messages.

Possible values are system dependant, but most probably "auth", "daemon",
"user" and "local1" through "local7" are possible values; see syslog(3).
Default is "local5" for historical reasons.
2010-09-24 17:39:11 +02:00
Alexander Barton
4943bbb066 New functions ngt_SyslogFacilityName() and ngt_SyslogFacilityID()
These both functions translate syslog facility names to ID numbers
and vice versa. On systems that don't define the facilitynames[] array
in syslog.h, we try to build one ourself.
2010-09-24 16:29:55 +02:00
Alexander Barton
e2ba7e08b4 Explicitly cast return value of read(2) to "int"
This fixes the following gcc warning, emitted by Xcode:

src/ngircd/sighandlers.c: In function 'Signal_Callback':
src/ngircd/sighandlers.c:239: warning: implicit conversion shortens 64-bit value into a 32-bit value
2010-09-22 14:15:46 +02:00
Alexander Barton
4a770e8e2d Don't call sigaction() if it is not available on the system 2010-09-22 14:10:09 +02:00
Florian Westphal
ba720fcbae Fix signalpipe file descriptor leak on RESTART
Signals_Init() must only be called once.
This does not affect any ngircd release version.

Earlier version of this patch moved the io and sighandler
initialization before the while() loop, but as Alexander
Barton noticed that broke all systems without builtin select
support in io.c...
2010-09-14 23:53:59 +02:00
Alexander Barton
b3cfbc3d28 sighandlers.{c|h}: Code cleanup
- declare signals_catch[] array not between the function implementations.
 - rename now local function NGIRCd_Rehash() to Rehash().
 - remove empty and therefore not used "catch SIGHUP; break;".
2010-09-14 00:30:45 +02:00
Alexander Barton
74578890b7 Make sighandlers.{c|h} compatible with ansi2knr 2010-09-14 00:29:34 +02:00
Alexander Barton
3600dc60fc Output connection status when dumping the internal server state 2010-09-14 00:05:31 +02:00
Alexander Barton
cd954ee7e9 Reformat "server state" debug messages a little bit 2010-09-14 00:04:04 +02:00
Alexander Barton
355828e64f Enable the daemon to dump its internal state in debug-mode.
This patch allows ngIRCd to dump its internal state (connected clients,
actual configuration) when compiled with --enable-debug. The daemon
catches two more signals:

 - SIGUSR1: toggle debug mode (on/off),
 - SIGUSR2: dump internal state to console/syslog.
2010-09-14 00:02:02 +02:00
Florian Westphal
755f54b150 signalhandlers: add fallback to deprecated sysv API 2010-09-11 11:36:12 +02:00
Florian Westphal
ef3dbf96eb remove NGIRCd_SignalRehash
now that the main signal handling is done from the dispatcher
loop we can call NGIRCD_Rehash() directly.

the /REHASH handler can queue the Rehash() function for
execution by sending a SIGHUP.  It will be run when we
return back to the dispatch loop.
2010-09-11 11:36:12 +02:00
Florian Westphal
1fe17e246c Add new 'delayed' signal handlers.
Allows to defer/queue signal processing for execution on the next
event dispatch call, i.e. we can perform any signal action in
normal, non-signal context.

Example uses:
- Reload everything on HUP without writing a global "SIGHUP_received"
  variable
- Dump status of internal Lists on SIGUSR1, etc.
2010-09-11 11:36:12 +02:00
Florian Westphal
c135d0dded io: add io_cloexec to set close-on-exec flag. 2010-09-11 11:36:12 +02:00
Florian Westphal
1e281a8baa ng_ipaddr.h: include assert.h
We use assert() in this header, so we should include assert.h.
2010-09-11 11:35:01 +02:00
Alexander Barton
6349ec8bb3 Conn_SyncServerStruct(): test all connections; and work case insensitive
Fix synchronization of established connections and configured server
structures after a configuration update:

 - Not only test servers that already have a connection, but also check
   and update configured servers to which a new connection is beeing
   established (SERVER_WAIT state).

 - And do the server name comparision case-insensitive.
2010-09-08 02:02:01 +02:00
Alexander Barton
8d68fe3f86 Check_Servers(): skip servers already beeing connected
Let CheckServers() not only skip servers that already have a
connection, but also skip servers to which a new connection is
already beeing established (SERVER_WAIT state).
2010-09-08 00:45:23 +02:00
Alexander Barton
4f6c19712e Check_Servers(): Code cleanup 2010-09-08 00:42:57 +02:00
Alexander Barton
04e38f17ae Don't reset My_Connections[Idx].lastping when reading data
This fixes PING-PONG lag calculation (which resulted in "0" before).

The "lastping" time is still reset it if a time shift backwards has
been detected to prevent the daemon from miscalculating ping timeouts.
2010-08-19 15:58:55 +02:00
Alexander Barton
32188d821b write_whoreply(): respect hostname cloaking 2010-08-18 00:01:14 +02:00
Alexander Barton
6f4a348b75 IRC_USERHOST(): respect hostname cloaking 2010-08-17 23:56:36 +02:00
Alexander Barton
a51670005f IRC_USERHOST(): Code cleanup & some documentation 2010-08-17 23:55:40 +02:00
Alexander Barton
0263fa4c66 Send_Message(): respect hostname cloaking 2010-08-17 21:16:46 +02:00
Alexander Barton
31ea0f8ee9 IRC_WriteStrClientPrefix() / Get_Prefix(): respect hostname cloaking 2010-08-17 21:14:51 +02:00
Alexander Barton
fd4dfccc30 Refactor IRC_WriteStr{Channel|Related}Prefix(); support cloaking
Move common code to new local function Send_Marked_Connections()
and respect hostname cloaking.
2010-08-17 21:11:37 +02:00
Alexander Barton
2a4bf67aac Implement user mode "x": hostname cloaking (closes: #102)
When a client has user mode "x" set, its real hostname is cloaked
by substituting it with the server name (as configured in ngircd.conf).

Restricted clients (user mode "r") aren't allowed to change mode "x".

Please note that hostname cloaking is only in effect in server-client
communication! The server still uses the real hostname for its own
logging and for all server-server communication -- therefore all servers
in the network must support user mode "x" to prevent older servers
from leaking the real hostname of a cloaked client!
2010-08-17 21:05:06 +02:00
Alexander Barton
575485eb82 WHOWAS: respect hostname cloaking
Store cloaked hostname if user mode "x" is set when the client
disconnects from the server.
2010-08-17 21:02:39 +02:00
Alexander Barton
3fd4f320b7 WHOIS: respect hostname cloaking 2010-08-17 21:00:47 +02:00
Alexander Barton
6fdd3479f1 Implement Client_HostnameCloaked() and Client_MaskCloaked()
These two functions return the cloaked hostname, if the client has
enabled hostname cloaking indicated by the -- still to implement --
user mode "x". See furter patches :-)
2010-08-17 20:54:33 +02:00
Alexander Barton
617640e0a3 Clean up an document Client_Hostname() and Client_Mask() 2010-08-17 20:51:14 +02:00