Commit Graph

188 Commits

Author SHA1 Message Date
Alexander Barton 2bb917f05a 2017! 2017-01-15 22:07:11 +01:00
Alexander Barton 6a5569c27d Update copyright notices for 2016 2016-01-04 22:43:58 +01:00
Alexander Barton 9811223fb8 Whitespace fixes (no functional changes) 2015-08-01 15:15:30 +02:00
Alexander Barton 2fc61ce8a6 Make setgroups(3) function optional
For example, Interix is missing this function, which prevented
ngIRCd to build on this platform. When setgroups(3) isn't available,
a warning message is issued when ngIRCd starts up.
2015-06-06 22:19:47 +02: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 43fb18f2f5 Code cleanup, remove blank lines 2014-03-16 22:11:26 +01:00
Alexander Barton 788da901ee Update Copyright notices for 2014 2014-01-02 15:27:07 +01:00
Federico G. Schwindt 17589534d0 Add support for arc4random
If arc4random is present it will be used over the srand/rand interface.
This fixes some warnings in OpenBSD-current.
2013-10-16 16:32:06 +01:00
Federico G. Schwindt ea26fd2840 Fix another strcat warning missed in commit 4c5b43 2013-10-16 10:41:40 +01:00
Alexander Barton 4c5b439992 ngircd.c, main(): use strlcat() instead of strcat()
This fixes the following warning on OpenBSD 5.3:

 ngircd.o(.text+0xeb4): In function `main':
  src/ngircd/ngircd.c:300: warning: strcat() is almost always misused,
                                    please use strlcat()

Thanks to Götz Hoffart for reporting this!
2013-10-07 21:56:09 +02:00
Alexander Barton 13a5358a3d Log an error (not info) when working directory can't be changed 2013-09-24 00:04:54 +02:00
Alexander Barton de3e5fa77c Don't ignore SSL-related errors during startup
Without this patch, ngIRCd ignores SSL-related messages and continues
to start up but only listens on plain text communication ports -- and
this most probably isn't what the administrator wanted ...

Closes bug #163.
2013-09-16 00:31:03 +02:00
Florian Westphal f8f8a9a041 ngircd: use setgid/setuid errno value in error path
Need to use saved errno value as strerror argument, else you
get bogus output ('success') in the log message.
2013-08-31 22:42:56 +02:00
Alexander Barton 41f75b6974 Ignore "operation not permitted" while dropping groups
Without this exception, you can't start ngIRCd as user any more,
it is analog to setting the user and group ID.
2013-08-27 00:41:36 +02:00
Florian Westphal e009ccbe66 ngircd: discard supplementary group ids on startup
The intention was to switch to JUST uid:gid, but setgid is not
sufficient.

Reported-by:  Michael Scherer <misc@zarb.org>
2013-08-27 00:19:31 +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
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 1f59821270 Update Copyright notices for 2013 2013-01-01 19:23:56 +01:00
Alexander Barton e0da56fc7b Disable UID/GID checks on "single user OS"
Don't abort on "single user operating systems" that don't know more than
one user account and therefore can't change user and group IDs.

Currently, the only such system supported by ngIRCd is Haiku, a BeOS
clone.
2012-10-11 14:54:13 +00:00
Alexander Barton 46b0eef721 Merge branch 'bug109-CHARCONV'
This closes bug #109.

* bug109-CHARCONV:
  Debian: require "telnet" or "telnet-ssl" for building
  Debian ngircd-full[-dbg]: enable CHARCONV
  Add "CHARCONV" to "feature string" when enabled
  Implement new IRC+ "CHARCONV" command
  Added new configure option "--with-iconv"

Conflicts:
	src/ngircd/messages.h
2012-10-06 18:26:25 +02:00
Alexander Barton bb20aeb9bc Initialize SSL when needed only, and disable SSL on errors
With this patch, the SSL subsystem will only be initialized if at least
one SSL ports is configured; so you won't get "SSL initialization failed"
messages if you didn't configured it at all.

And if SSL initialization fails, no SSL listen ports will be enabled
later which never could establish a working SSL connection at all ...
2012-09-21 10:36:09 +02:00
Alexander Barton e9d0b2f039 Add "CHARCONV" to "feature string" when enabled 2012-09-17 01:00:05 +02:00
Alexander Barton 1413a4886f Sort "feature string" alphabetically 2012-09-17 00:55:30 +02:00
Alexander Barton 107bfdc821 Merge branch 'autoconf-update'
Update GNU autoconf and automake infrastructure.
Tested on modern systems as well as Apple A/UX :-)

* autoconf-update:
  AUTOMAKE_OPTIONS: fix ansi2knr option, include path
  Don't use AC_FUNC_MALLOC and AC_FUNC_REALLOC
  Make our own targets "silent", if enabled
  configure.in: use AC_CHECK_{FUNCS|HEADERS}_ONCE
  Updated config.{guess|sub} to version 2012-08-14
  Make autogen.sh more verbose when VERBOSE=1 is set
  configure.in: use AC_SEARCH_LIBS (not AC_CHECK_LIB)
  configure.in: use AS_HELP_STRING macro
  configure.in: use AC_CANONICAL_HOST (not AC_CANONICAL_TARGET)
  configure.in: inttypes.h is an optional header file
  Use HAVE_SETSID #define when testing for setsid()
  Don't include <stdint.h>, it is included by "portab.h"
  Don't check type.h availability, it is required
  configure.in: Use AC_CONFIG_FILES macro
  configure.in: Don't use AC_C_PROTOTYPES
  configure.in: Update checks for required and optional features
  configure.in: require autoconf 2.67 and automake 1.11
  configure.in: sort some lists (templates, output, ...)
2012-09-16 13:05:23 +02:00
Alexander Barton 82bf4eb059 configure.in: use AC_CANONICAL_HOST (not AC_CANONICAL_TARGET)
See the autoconf manual for details:
http://www.gnu.org/software/autoconf/manual/autoconf.html#Specifying-Target-Triplets
2012-09-13 00:06:08 +02:00
Alexander Barton 0fd9a8505a Correctly re-initialize signal handlers on RESTART
This fixes part 2 of bug #127 :-)
2012-09-11 15:44:31 +02:00
Alexander Barton b2482b39e4 Use HAVE_SETSID #define when testing for setsid() 2012-09-11 14:38:19 +02:00
Alexander Barton 7faa3ed7d6 Pidfile_Create(): Don't leak file descriptor on error path
Detected by cppcheck:
 [src/ngircd/ngircd.c:502]: (error) Resource leak: pidfd
2012-05-22 13:31:08 +02:00
Alexander Barton 88c3d4896a Don't ignore "permission denied" errors when enabling chroot
Up to now, ngIRCd silently ignored permission denied errors when trying
to enable a chroot setup: only the "not running chrooted" message became
logged later on.

This patch lets ngIRCd exit with a fatal error when the chroot can't
be enabled on startup -- this is the much safer bevahiour!
2012-03-28 11:30:48 +02:00
Alexander Barton 3641e51109 Correctly re-open syslog logging after reading of configuration
Syslog logging has been initialized before reading the configuraton
file, so ngIRCd always used the default facility and ignored the
"SyslogFacility" configuration option.

Thanks to Patrik Schindler for reporting this issue!
2012-02-14 11:01:13 +01:00
Alexander Barton 1bb2fbedcc Enhance log messages when setting user and group 2012-01-03 21:05:35 +01:00
Alexander Barton 3193d5477c NGIRCd_getNobodyID(): Code cleanup 2012-01-03 20:49:42 +01:00
Alexander Barton e4006a93e3 NGIRCd_Init(): Code cleanup 2012-01-03 19:34:54 +01:00
Alexander Barton 9069380ddf main(): Code cleanup 2012-01-03 19:25:31 +01:00
Alexander Barton 5eb9f2e717 Update Copyright notices for 2012 2012-01-03 11:30: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 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 7f8d0ea5a3 Use srand()/rand() instead of srandom()/random(); seems to be more portable 2011-06-26 23:39:20 +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 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 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 f3ec90f3f0 Doxygen'ify and update comments in ngircd.{c|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 4a6d44dce2 Remove support for ZeroConf/Bonjour/Rendezvous service registration 2011-01-09 23:51:30 +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 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 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 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