Commit Graph

149 Commits

Author SHA1 Message Date
Christoph Biedl ccc899c7f4 Reproducible builds
At the moment ngircd fails the tests for reproducible builds in Debian
since it uses the __DATE__ and __TIME__ macros for the INFO command.

Instead of patching this out I decided to implement an optional
constant BIRTHTIME that allows you to set a time stamp for the "Birth
Date" information, in seconds since the epoch, like in

    export CFLAGS += -DBIRTHTIME=$(shell date +%s --date="2015/08/15 23:42:22")

In the future, Debian will provide a SOURCE_DATE_EPOCH environment
variable, dealing with the situation until then will be my job.

The time format was taken from the NGIRCd_StartStr formatting in
ngircd.c so the "Birth Date" and "On-line since" lines in the INFO
output look similar:

    :irc.example.net 371 nick :ngIRCd 22.1-IDENT+IPv6+IRCPLUS+PAM+SSL+SYSLOG+ZLIB-x86_64/pc/linux-gnu
    :irc.example.net 371 nick :Birth Date: Tue Aug 25 2015 at 18:11:11 (CEST)
    :irc.example.net 371 nick :On-line since Tue Aug 25 2015 at 18:11:33 (CEST)
    :irc.example.net 374 nick :End of INFO list

The format of the time stamped is changed, but as far as I can tell, there's no
rule that is violated by that.

Bonus level: Reformat the messages so the time stamps are aligned.
2015-08-26 10:05:36 +02:00
Alexander Barton f8f7f83f5a Streamline effect of "MorePrivacy" option (WHOIS, LIST)
- Update documentation in ngircd.conf(5)
- LIST: Don't hide channels for IRC Ops when "MorePrivacy" is in effect
- WHOIS: Don't hide IP addresses/hostnames when "MorePrivacy" is in effect

Closes #198
2015-05-13 22:42:51 +02:00
LucentW a4af9024fd Fixed indents 2 2015-04-29 20:29:00 +02:00
LucentW 6fc53558ed Fixed indents and documentation
(also updated the copyright date on the txt I edited)
2015-04-29 20:25:18 +02:00
LucentW 21767c968d Implement +I (private channel list on whois)
Implements enhancement requested in issue #179
2015-04-29 14:04:06 +02:00
Alexander Barton 2196e945e4 Fix "WHO #<chan>" showing invisible users and hiding all visible
The logic is reversed ...

This bug has been introduced by commit c74115f2, "Simplify mode checking on
channels and users within a channel", ngIRCd releases 21, 21.1, and 22 are
affected :-(

Problem reported by Cahata in #ngircd, Thanks!
2015-03-14 10:16:16 +01:00
Alexander Barton b130b35f48 Update #include's: remove unused and add missing ones
The "deheader" tool (<http://www.catb.org/~esr/deheader/>) has been
used to find unused #include directives as well as missing ones.

Tested on:

- A/UX 3.1.1
- ArchLinux (2014-03-17)
- Debian GNU/Hurd
- Debian GNU/Linux 6.0.9
- Debian GNU/Linux 7.4
- Fedora 20
- FreeBSD 9.2
- OpenBSD 4.8
- OpenBSD 5.1
- OS X 10.9
- Solaris 11
2014-03-17 11:37:25 +01:00
Alexander Barton 259c314d14 Remove imp.h and exp.h header files
These include files don't have a function any more, remove them.
2014-03-17 00:17:02 +01:00
Alexander Barton 0fc822d8c4 Use correct sender as target for ISUPPORT replies on "VERSION"
This fixes commit 2e168c78 ("Return ISUPPORT(005) numerics on
'VERSION'") and make sure, that the 005 numerics are correctly
routed back to the sender.
2014-01-27 22:23:47 +01:00
Alexander Barton 2e168c7809 Return ISUPPORT(005) numerics on "VERSION"
This is how ircd-seven, Charybdis, Hybrid, and InspIRCd behave,
for example.
2014-01-26 23:41:59 +01:00
Mantas Mikulėnas e273bd226a Show account name in WHOIS
This uses the same numeric as Charybdis and ircu families.
2014-01-20 14:25:11 +02:00
Alexander Barton 86bdf6e1d4 Implement new configuration option "Network"
The new configuration variable "Network" is used to set the (completely
optional) "network name", to which this instance of the daemon belongs.
When set, this name is used in the ISUPPORT(005) numeric which is sent to
all clients connecting to the server after logging in.

Closes bug #165.
2013-12-27 23:16:11 +01:00
Federico G. Schwindt 9ee3760493 Add comments around some IRC_SetPenalty() calls 2013-11-07 18:17:58 +00:00
Federico G. Schwindt 344185b1bd Rework the penalty handling slightly
Increase the penalty for a command before checking its arguments.  This
makes the handling more consistent and allow us to move more penalties to
Handle_Request().
2013-11-07 16:53:29 +00:00
Federico G. Schwindt fcf61e9e02 Move IRC_SetPenalty() to Handle_Request() when possible
This centralizes the penalty handling. It also exposes some commands that
lack it for our attention.
2013-11-07 16:29:21 +00:00
Federico G. Schwindt ec5ab4fcd1 Add support to show user links using "STATS L"
Change "stats L" to show servers and user links and restrict it to
IRC Operators.
2013-09-24 21:17:35 +02:00
Federico G. Schwindt bcb45da1b4 Add more penalty times
Ensure before every numeric 461 there is a call to IRC_SetPenalty().
2013-09-06 23:02:01 +01:00
Federico G. Schwindt 08f9d31d60 Rework check for number of parameters
Move most of the checks that return numeric 461 into Handle_Request().
2013-09-06 23:01:59 +01:00
Federico G. Schwindt 37609d6a4f Reorder checks
Move oper and Conf_MorePrivacy checks after checking the number of
parameters.
2013-09-05 17:31:57 +01:00
Federico G. Schwindt 33c2d5e4e2 Move the IRC_SetPenalty() call after the asserts 2013-09-05 17:31:57 +01:00
Federico G. Schwindt a98bbc8e0b Correct numeric returned by whois
As per RFC whois should return 431 if no nick is provided.  While
here convert upper check to use irc-macros. As a bonus we get to set
the penalty for free.
2013-09-05 17:31:56 +01:00
Alexander Barton 1dc93286a0 Save client IP address text for "WebIRC" users
This patch introduces a new field in the CLIENT structure, "ipa_text",
which points to an optional textual representation of the client IP
address (or NULL) which can be used to store the "real" IP address
information of a client using the "WEBIRC" protocol.

Without this patch, ngIRCd ignored the <ip-address> paramater ...

In addition, the functions Client_SetIPAText() and Client_IPAText()
have been introduced to set and get the textual representation of the
client IP address.

Client_IPAText() can be used even when no "IP address text" has been
set before, it then returns the real IP address of the connection.

Closes bug #159.
2013-08-26 22:54:00 +02:00
Alexander Barton 904c8a4375 Introduce new function IRC_WriteErrClient()
This function is used to send "error messages", including numerics,
back to clients and to automatically enforce a 2 second penalty. With
this patch, all error results enforces a delay for the client.

All callers of IRC_WriteStrClient(ERR_xxx) have been converted.

Please note that this patch prolongs the time "make check" needs
to complete its tests, because of lots of new enforced penalties ...
2013-08-07 00:10:50 +02:00
Federico G. Schwindt 7db8481500 Inline who_flags_status 2013-08-05 11:05:12 +01:00
Federico G. Schwindt c74115f25c Simplify mode checking on channels and users within a channel
Add Channel_HasMode() and Channel_UserHasMode() and use it where
possible.
2013-08-04 18:28:04 +01:00
Alexander Barton 139f5961a0 Merge branch 'bug152-AllowedChannelTypes'
* bug152-AllowedChannelTypes:
  Implement new configuration option "AllowedChannelTypes"
  Introduce "CHANTYPES" #define
2013-08-04 14:11:12 +02:00
Federico G. Schwindt 15dfdaac82 More spelling fixes
Remove superflous comments, mostly in German. Fix spelling and
use american variants for consistency.
2013-08-04 12:45:11 +01:00
Federico G. Schwindt 646a97de5f Rename XXX_Fingerprint to XXX_CertFp 2013-08-04 03:14:27 +01:00
Alexander Barton 5e775a3fae Introduce "CHANTYPES" #define
This #define lists all the prefix characters of all supported channel
types, this is "#&+" at the moment.
2013-08-04 00:35:08 +02:00
Federico G. Schwindt bf8e03c466 Simplify MOTD handling
Merge Show_MOTD_Start, Show_MOTD_Sendline and Show_MOTD_End into
IRC_Show_MOTD.
2013-08-02 23:24:18 +01:00
Federico G. Schwindt 1254d315b9 Add certificate fingerprint support 2013-08-02 23:24:06 +01:00
Federico G. Schwindt 7adc4b8e99 Handle services in IRC_WHOIS_SendReply()
If the target is a service, advertise it as such and ignore operator mode.
2013-07-18 19:52:17 +01:00
Yecheng Fu 4f525d39d4 LINE_LEN -> COMMAND_LEN
LINE_LEN is configuration file line length
2013-05-30 13:53:33 +08:00
Alexander Barton 65359ff8f7 Merge branch 'bug153-ServerMask' into master
* bug153-ServerMask:
  Update irc-info.c to use irc-macros.h
  Add new irc-macros.h to project
  irc-info.c: add/streamline function documentation comments
  irc-info: move static functions at the top of the file
  Implement new function Client_SearchServer()

Conflicts:
	src/ngircd/irc-info.c
2013-02-15 21:59:06 +01:00
Alexander Barton 5dce3301bd Update irc-info.c to use irc-macros.h
This includes:

 - move IRC_SetPenalty() at the beginning of the handler functions,
 - use macros provided by irc-macros.h,
 - code cleanup.

The main benefits of this patch are core size reduction, streamlined
structure of the handler functions, and enhanced functionality:
because of the _IRC_GET_TARGET_SERVER_OR_RETURN_() macro using the
Client_SearchServer() function, the target of the specific IRC command
can now be given server names, server mask, or the nickname of a user
connected to the server.

Closes bug #153.
2013-02-09 23:58:11 +01:00
Alexander Barton 4dc940f59e irc-info.c: add/streamline function documentation comments
Add missing comments, streamline wording, and remove references to the
RFCs: this will be added to ./doc/Commands.txt with an other patch and
we want to avoid redundancy ...
2013-02-09 23:33:29 +01:00
Alexander Barton 5facf5c15e irc-info: move static functions at the top of the file 2013-02-09 23:18:49 +01:00
Alexander Barton 1e8b775a7a "WHO <hostmask>": use displayed hostname for matching
Use the currently "displayed hostname" (which can be cloaked!) for
hostname matching, not the real one. In other words: don't display
all the cloaked users on a specific real hostname!

Thanks to DNS <dns@rbose.org> for reporting this issue.
2013-02-08 17:18:43 +01:00
Alexander Barton 84a599ece4 Enable WHOIS to display information about IRC Services
This patch introduces the new numeric 310(RPL_WHOISSERVICE) and enables
WHOIS to display information about IRC services. This numeric is used
for this purpose by InspIRCd, for example -- but as usual, other numerics
are in use, too, like 613 in UltimateIRCd ...

Please note that neither the Operator (+o) not the "bot status" (+B)
of an IRC service id displayed in the output.

Change suggested by Federico G. Schwindt <fgsch@lodoss.net>, Thanks.
2013-02-03 21:32:53 +01:00
Alexander Barton 8d8201502f IRC_WHO_Channel(): Use strlcpy() instead of strcpy()
This fixes the following warning, at least on OpenBSD 4.8:

 irc-info.o(.text+0x2427): In function `IRC_WHO':
 src/ngircd/irc-info.c:896: warning: strcpy() is almost always misused,
                            please use strlcpy()
2013-01-27 01:00:32 +01:00
Alexander Barton 4a2d74c9ab Client_HostnameCloaked() -> Client_HostnameDisplayed() 2012-11-24 13:37:56 +01:00
Alexander Barton d11a700589 irc-info.c: Use strlcpy() instead of strcpy()
This fixes the following warning of gcc (tested on OpenBSD 5.0:)
  irc-info.c:990: warning: strcpy() is almost always misused,
                  please use strlcpy
2012-11-11 16:46:57 +01:00
Alexander Barton 48326e061a Spelling fix: "nick name" -> "nickname" 2012-11-02 14:30:19 +01:00
Alexander Barton 161adbb1aa WHOIS: show RPL_WHOISHOST_MSG to all IRC Ops in the network
Not only show RPL_WHOISHOST_MSG to local IRC opreators, but show
it to all IRC operators in the network. And don't show it to anybody
if the "more privacy" configuration option is enabled.

This closes bug #134.
2012-10-07 00:05:25 +02:00
DNS777 56cdc2175c Show active user modes in WHOIS reply
Implement numeric RPL_WHOISMODES_MSG(379) and show user modes in the
reply of the WHOIS command for the user himself or, if MorePrivacy
isn't set, for request initiated by an IRC operator.

Numeric 379 is used by Unreal and InspIRCd for this purpose, too.

Closes bug #129.
2012-10-06 21:56:59 +02:00
Alexander Barton 1f2aa4da6f Fix NAMES/WHO response when client has multi-prefix
This has been fixed by commit 16f94546 "Fix NAMES response when
client has multi-prefix" in the master branch, fix it in this patch
series, too.
2012-09-23 19:37:06 +02:00
Alexander Barton fc39146f48 Fix prefix of "halfop" when "multi-prefix" is active 2012-09-23 19:23:23 +02:00
Alexander Barton 0d67be3f30 Fix some "whitespace glitches"
Some have been introduced by commit 7b01bb83, some are older.
2012-09-11 12:48:51 +02:00
Alexander Barton f37600ee01 Merge branch 'xop' of https://github.com/kart0ffelsack/ngircd into bug92-xop
* 'xop' of https://github.com/kart0ffelsack/ngircd:
  Tests and documentation for xop
  Implemented xop support

Conflicts (because of merge of the 'cmode-M' branch):
	src/ngircd/channel.c
	src/ngircd/defines.h
	src/ngircd/messages.h
2012-09-11 12:30:19 +02:00
Alexander Barton 2205227c3b WHO #channel: don't limit list size
It makes no sense to limit the list size when doing WHO for a channel
and not to return all the users in that channel, so I removed the check.
But if there are more than MAX_RPL_WHO(25) replies, the client requesting
the list will be "penalized" one second more (then 2 in total).

This fixes bug #125.
2012-09-10 12:43:44 +02:00