Commit Graph

71 Commits

Author SHA1 Message Date
Alexander Barton 02c8887543 Log privilege violations and failed OPER as "error" and to &server 2016-12-08 01:34:33 +01:00
Alexander Barton f5ff22d98f G-LINES: Forbid remote modifications if "AllowRemoteOper" is not set
Explicitely forbid remote servers to modify "x-lines" (G-LINES) when the
"AllowRemoteOper" configuration option isn't set, even when the command
seems to originate from the remote server itself: this prevents GLINE's
to become set during server handshake in this case (what wouldn't be
possible during regular runtime when a remote IRC Op sends the command)
and what can't be undone by IRC Ops later on (because of the missing
"AllowRemoteOper" option) ...
2016-12-08 00:14:00 +01:00
Alexander Barton eb9929e82c Make server-to-server protocol more robust
Now ngIRCd catches more errors on the server-to-server (S2S) protocol
that could crash the daemon before. This hasn't been a real problem
because the IRC S2S protocol is "trusted" by design, but the behavior
is much better now.

Thanks to wowaname on #ngircd for pointing this out!
2015-09-03 16:22:36 +02:00
Alexander Barton a534e71e8d Re-add #include's for header files of the C file itself
This partially reverts commit b130b35f4, "Update #include's: remove
unused and add missing ones", but fixes the following compiler and
analyzer warnings of Apple Xcode 5:

 "Semantic issue: No previous prototype for function 'yyy'"
2014-03-17 18:02:57 +01: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 ccc9e1baa4 Streamline punctuation of log messages
See commit d38d153f for details.
2014-02-09 16:01:13 +01:00
Federico G. Schwindt 9230f2fff1 Fix permanent k/gline
Reported by Toni Spets (hifi - at - jnz - dot - fi).
2013-12-29 01:14:28 +01:00
Federico G. Schwindt 9ee3760493 Add comments around some IRC_SetPenalty() calls 2013-11-07 18:17:58 +00:00
Federico G. Schwindt 925b4de298 On bad /oper set the penalty to 10 seconds
This helps against brute-force attempts.
2013-11-06 21:46:53 +00:00
Federico G. Schwindt 48ea69d778 Remove unneded IRC_SetPenalty() calls
IRC_WriteErrClient() already calls IRC_SetPenalty().  While here convert
some IRC_SetPenalty() + IRC_WriteStrClient() to IRC_WriteErrClient().
2013-11-06 18:28:09 +00:00
Alexander Barton 2798a12444 Actually KILL clients on GLINE/KLINE
Kill all clients that match a new GLINE/KLINE mask and genrate apropriate
KILL commands. These KILL commands can be superfluous, but are required
when the IRC Operator isn't allowd to set remote G-Lines or if there are
older servers in the network that don't kill clients on GLINE/KLINE.

Closes bug #156.
2013-10-01 12:26:34 +02: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 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
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
Alexander Barton 78c8212280 Update irc-oper.c to use irc-macros.h 2013-08-02 23:27:11 +02:00
Alexander Barton 771e539c18 Show IRC Operator name when logging a successful OPER command 2013-08-01 00:24:10 +02:00
Federico G. Schwindt d8ee498a65 Send RPL_REHASHING if rehash was accepted
(cherry picked from commit f1b171a09cd076f743a7fff221fa7aa752abb374)
2012-09-27 00:07:40 +02: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 e9e6224aae Implement IRC_xLINE(): handler for "GLINE" and "KLINE" commands 2011-12-25 16:57:36 +01:00
Alexander Barton 3ca8703309 irc-oper.c: code cleanup; more documentation 2011-12-25 16:08:00 +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
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
Alexander Barton 5462c6c50f Don't #include client.h when conn.h/conn-func.h is already included
conn.h and cinn-func.h both already #include client.h, so it is
not needed to do it twice.
2010-06-30 23:49:52 +02:00
Alexander Barton cc336b7558 Only #include resolve.h if it is really needed 2010-06-29 22:55:27 +02:00
Florian Westphal 28ca31e576 Remove limit on max number of configured irc operators. 2009-11-07 17:42:54 +01:00
Alexander Barton 55c04e691d Make sure forwarded CONNECT commands are handled correctly 2009-09-30 16:00:06 +02:00
Alexander Barton 9918dfc1d5 Use functions provided by op.c "module"
Local functions Check_Oper() and No_Privileges() have been replaced by
global functions in op.c "module": Op_Check() and Op_NoPrivileges().
2009-09-30 16:00:06 +02:00
Alexander Barton 113bd34878 Allow forwarding of CONNECT commands.
The syntax of the CONNECT command now is:

  - CONNECT <server-id>
  - CONNECT <server-id> <port>
  - CONNECT <server-id> <port> <target>
  - CONNECT <server-id> <port> <host> <my-pwd> <peer-pwd>
  - CONNECT <server-id> <port> <host> <my-pwd> <peer-pwd> <target>

Note: the configuration option "AllowRemoteOper" mus be enabled on the
target server to allow forwarding of CONNECT commands.
2009-09-30 16:00:06 +02:00
Alexander Barton 4a3e40bc95 Check_Oper(): check origin of forwarded messages instead of server. 2009-09-30 16:00:05 +02:00
Alexander Barton 45b1a45c97 No_Privileges(): handle forwarded messages. 2009-09-30 16:00:05 +02:00
Alexander Barton 7d6de7c352 IRC_SendWallops(): support format string and variable parameter lists. 2009-09-30 16:00:05 +02:00
Alexander Barton 30b584c2e8 CONNECT, DISCONNECT: generate WALLOPS messages 2009-09-30 16:00:05 +02:00
Alexander Barton eaaf0c3bd5 New function IRC_SendWallops().
Implement new global function IRC_SendWallops() that can be called by
other functions to generate WALLOPS messages to users with +w mode.
2009-09-30 16:00:05 +02:00
Alexander Barton 9a7499af8b Code cleanup of IRC_DISCONNECT(). 2009-09-30 16:00:05 +02:00
Alexander Barton 926204cacd New local functions Check_Oper() and No_Privileges(). 2009-09-30 16:00:05 +02:00
Alexander Barton 3bf0c6f3b9 Bad_OperPass(): code cleanup. 2009-09-30 16:00:05 +02:00
Florian Westphal 544b9884f4 remove or translate old comments 2009-04-21 20:58:30 +02:00
Florian Westphal 4b9e52eb4d implement /WALLOPS as described in RFC 2812, section 4.7. 2007-08-02 10:14:26 +00:00
Florian Westphal 2275add327 Add new server config option to disable automatic connect. (Tassilo Schweyer) 2007-06-28 05:15:12 +00:00
Alexander Barton 3e8978d836 Allow DIE to send a message to all locally connected clients. Closes bug #48. 2006-07-23 15:43:18 +00:00
Alexander Barton dd3a3bc603 Use some more specific data types (e. g. pid_t vs. int), make "SPLint" happy :-) 2006-05-10 21:24:01 +00:00
Florian Westphal 87f4b1c6f6 Client_GetFromConn() removed and replaced with new function Conn_GetClient() 2006-04-23 10:37:27 +00:00
Alexander Barton 77f54693ef Removed unnecessary #define of "LOCAL", now use plain C "static" instead. 2005-07-31 20:13:07 +00:00
Florian Westphal 70facb7f6e made a few config options unsigned. 2005-07-11 14:11:35 +00:00
Florian Westphal fcf65beea4 changed formatting to match ngircd coding style 2005-06-12 18:02:09 +00:00