Commit Graph

172 Commits

Author SHA1 Message Date
Al Beano 436240f3e1 custom cloak for tor HS users 2017-04-06 22:22:12 +01:00
Alexander Barton 9811223fb8 Whitespace fixes (no functional changes) 2015-08-01 15:15:30 +02:00
Alexander Barton bf2eae3249 Allow longer usernames for authentication 2014-09-11 22:04:31 +02:00
Alexander Barton a13bb78b1e Update copyright notices of recently changed files 2014-03-17 12:22:00 +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 fe73835666 Client_SetHostname(): Don't use strlen() to test for value 2014-01-10 19:57:05 +01:00
Federico G. Schwindt 62865f7e19 Add support for longer config lines
With the introduction of CipherList we could have longer config lines.
Handle up to 1024 bytes and warn if the line will be truncated.
2013-10-17 22:10:53 +01:00
Alexander Barton eccbd97e1f Remove CLIENT.oper_by_my, Client_SetOperByMe() and Client_OperByMe()
All places where Client_OperByMe() is used can either be converted to
Client_HasMode(Client, 'o') or Op_Check().

And Op_Check() itself can use the connection handle for deciding whether
the IRC Operator is a local user or not.
2013-09-25 01:29:23 +02:00
Federico G. Schwindt be2e611680 Change away to be allocated dynamically 2013-08-27 00:06:03 +01:00
Alexander Barton 0ff33777fe Introduce Free_Client() function to free CLIENT structure 2013-08-26 22:55:00 +02: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
Federico G. Schwindt 3b65f4e38d Change strdup() to strndup() 2013-08-26 12:18:46 +01:00
Federico G. Schwindt eb86d234f8 Plug memory leak 2013-08-25 05:24:11 +01:00
Federico G. Schwindt 3af0ece2bc Implement account login support
This is done via the `accountname' METADATA command and used to
automatically identify users after netsplits or across service
restarts.
2013-08-25 05:24:08 +01: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 672a167963 Use Client_HasMode and Client_HasFlag where appropriate 2013-08-04 17:25:24 +01: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 bb8d207efa Change cloaked hostname to be malloc'd on demand
This shaves a few bytes when cloaked hostnames are not used and
restricts the cloakhost announcement iif there is something to
send.
2013-08-04 10:15:11 +01:00
Federico G. Schwindt e03d8eb728 Add Client_HasFlag() to check if a client has certain flag 2013-08-04 04:00:34 +01:00
Federico G. Schwindt 646a97de5f Rename XXX_Fingerprint to XXX_CertFp 2013-08-04 03:14:27 +01:00
Federico G. Schwindt 8e60fac73b Improved client announcement
Move Announce_User() to client.c and rename it to Client_Announce().
Use this in cb_introduceClient() instead of duplicating the code.
This fix the certificate fingerprint announcement for new clients.
Also ensure the certificate fingerprint is only announced if the
client supports it (`M' flag).
2013-08-04 00:22:38 +01:00
Alexander Barton 0ad0fe207a Implement new function Client_SearchServer()
This function returns the server structure of a client or a given "mask";
it is useful for implemention handlers for commands like "COMMAND *.net",
which should work on a server matching "*.net".

Please note that the local server is always returned when it matches the
mask, but besides that, the order is completely arbitrary.
2013-02-05 13:06:08 +01:00
Alexander Barton d38d153f51 Streamline punctuation of log messages
Make sure that all log messages end with a correct punctuation mark.

The rules for formatting log messages are:

 1. Add punctuation marks to all messages passed to the actual logging
    functions like Log() and LogDebug().
 2. Don't add any punctuation marks to messages that are stored in
    variables for later use or are passed over the network.
 3. IP addresses, DNS host names and IRC server names should be quoted.
 4. Messages originating in the network should be quoted (at least if
    they are "untrusted" or variable).

Most probably this patch doesn't fix all mistakes, but it should be a
good starting point ...
2013-01-26 17:00:03 +01:00
Alexander Barton 35e2dcff88 Rework cloaked hostname handling, implement "METADATA cloakhost"
Now ngIRCd uses two fields internally, one to store the "real" hostname
and one to save the "cloaked" hostname. And both fields can be set
independently using the "METADATA host" and "METADATA cloakhost" commands.

This allows "foreign servers" (aka "IRC services") to alter the real and
cloaked hostnames of clients without problems, even when the user itself
issues additional "MODE +x" and "MODE -x" commands.
2012-11-24 16:15:35 +01:00
Alexander Barton 4a2d74c9ab Client_HostnameCloaked() -> Client_HostnameDisplayed() 2012-11-24 13:37:56 +01:00
Alexander Barton 44b7ff02fd Don't cloak already cloaked hostname when using METADATA
A client for which a METADATA command has been received from one of
its peers got the client flag "M" set. So it's safe to assume that
such a client gets "METADATA host" commands for its cloaked hostname
and the server must not cloak the hostname on its own, even when the
client mode "+x" is set.
2012-11-05 23:46:26 +01:00
Alexander Barton 48326e061a Spelling fix: "nick name" -> "nickname" 2012-11-02 14:30:19 +01:00
Alexander Barton 33fae67579 Always cloak client hostname, if needed
Not only cloak the hostname in Client_MaskCloaked(), but also in
Client_HostnameCloaked() -- so move the actual cloaking to this function
and call it in Client_MaskCloaked() to get the (cloaked) hostname.

This fixes USERHOST not displaying the correctly cloaked hostname,
for example.
2012-08-28 23:26:43 +02:00
Alexander Barton bcefdef1ea Merge branch 'move-connection-password' of git://arthur.barton.de/ngircd-alex
This patch series converts the statically allocated password buffer in the
CLIENT structure into a dynamically (and only when needed) allocated buffer
which is referenced by the CONNECTION structure.

This a) saves memory for clients not using passwords at all and b) allows
for "arbitrarily" long passwords.

By Brett Smith (5) and Alexander Barton (2).

* 'move-connection-password' of git://arthur.barton.de/ngircd-alex:
  Login_User(): use "conn" insted of calling Client_Conn(Client)
  Free already saved password when storing a new one
  Indentation and style fixes.
  Connection password is not constant.
  Implementation clean-ups.
  Dynamically allocate memory for connection password.
  Move client password from the Client to the Connection struct.
2012-08-26 19:14:29 +02:00
Alexander Barton a6dd2e33c2 Block nicknames that are reserved for services
This patch introduces the new function Conf_NickIsBlocked() which checks
if a given nick name matches with the "service mask" of a configured server.
And Client_CheckNick() uses this information to deny such names for regular
IRC users.

So nick names intended for IRC services are more protected and can't be used
by regular users even when the "services pseudo-server" isn't connected to
the network.

But please note:

Up to now, there can be only one "ServiceMask" pattern per server, which
most probably blocks much more nick names than really required ...
So "ServiceMask" should allow more than one pattern which can be more
specific, and most probably it should be possible to block nick names in
the global server configuration as well.

Nick names introduced by other servers/services are never restricted.
2012-08-26 12:33:21 +02:00
Alexander Barton 9d8974d509 Rename Conf_IsService() to Conf_NickIsService() 2012-08-26 12:27:51 +02:00
Brett Smith 0d5de60584 Move client password from the Client to the Connection struct.
This is a relatively naive implementation, basically doing the bare minimum
necessary to make the switchover go.  Subsequent commits can focus on
improving the implementation.
2012-08-23 11:07:08 -04:00
Sebastian Köhler d0bb185cf5 Hashed hostnames for CloakHost
Implemented support for hashed hostnames for CloakHost. The admin can
use '%x' in both the CloakHost and CloakHostModeX setting. The config
option CloakHostModeX was renamed to CloakHostSalt. This salt is used
for both cloaking options.
2012-08-03 04:10:11 +02:00
Sebastian Köhler 49385a98b2 Implemented hashed cloaked hostnames for +x
CloakHostModeX can now contain '%x'. It will be replace by the hash of
the original client hostname. The new config option CloakHostModeXSalt
defines the salt for the hash function. When CloakHostModeXSalt is not
set a random salt will be generated after each server restart.

Spelling fix in defines.h
2012-08-03 04:09:37 +02:00
Alexander Barton 7b6b492bdd Rename "CloakModeHost" option to "CloakHostModeX" 2012-06-09 01:58:40 +02:00
Christoph Biedl aa7db2c0e9 Introduce new configuration option "CloakModeHost"
This closes bug #124.
2012-06-09 01:58:25 +02:00
Alexander Barton ee362b3bd2 Introduce_Client() => Client_Introduce(), and move it to client.c 2012-03-31 15:24:30 +02:00
Alexander Barton c16133c5ee New_Connection(): don't set the client hostname twice
Setting the hostname twice doesn't do much harm a lot, but isn't elegant.
And for IPv6 addresses, it isn't correct the first time (missing []) ...
2012-01-25 17:11:44 +01:00
Alexander Barton 4888984429 Client_SetHostname(): Code cleanup, more debug logging 2012-01-25 17:11:00 +01:00
Alexander Barton 51a6a33056 New function Client_Reject() to reject clients on connect 2012-01-22 18:17:28 +01:00
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 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 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
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
Alexander Barton ae7470ceb5 Rename ClientHost to CloakHost, and ClientUserNick to CloakUserToNick 2011-03-19 16:58: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
Alexander Barton 2a7dd06ebd Code cleanup: mostly removing empty lines 2011-02-13 17:52:38 +01:00