When a signal is caught we want to exit from the boost::asio loop.
However, we can't do this by pusing another handler onto the io_service,
since this will involve a malloc call, and this can cause a deadlock (if
the signal handler is invoked from within a malloc call).
Therefore we instead need to use the signal_set functionality of
boost::asio, which guarantees that signal handling is done without
issue.
When reporting the segfault we can't allocate any memory, since the
stack might have become corrupted. Using std::string allocates memory,
so we'll opt for the lower level fprintf().
* common/system.cpp, common/system.h: Add security_init(), a
function to initialise any security or crypto related libraries
used. This is required by recent version of libgcrypt when
using hash functions.
* server/server.cpp, tests/systemtest.cpp, tools/cypasswd.cpp:
Call security_init() in all programs that use security related
functions.
* common/system.h: Add a new exit status code indicating that no
ports were available in the dynamic range.
* server/server.cpp, common/system.cpp: When there are no ports
available, write an appropriate message, and a hint describing
how to allocate more.
* configure.ac: Add tests for more optional functions and headers.
* client/ObserverClient.cpp: Use alternative on systems which don't
have usleep().
* common/system.cpp: Implement gettimeofday for systems which don't
have it.
* server/CommListener.cpp: Add a note about supporting alternatives
to inet_ntop.
* server/CommUnixListener.cpp, server/server.cpp: Disable the unix
listen socket on systems which don't have it.
* tests/systemtest.cpp: Fix the test to work on systems without fork()
or kill(), and add a test for the substitute gettimeofday
implementation.
* common/system.h: Add prototypes for required C library functions
we implement on systems where they are missing.
* common/system.cpp: Adapt the system specific code for systems
which are missing libc functions are system calls, including
uname, getuid, nice, fork, kill and some of the signals.
* common/log.h, common/log.cpp: Add a new function to rotate
the logs, eliminate duplicate code by breaking out log opening
code into a static function.
* common/system.cpp: Add a HUP system call handler to rotate the logs.
* common/system.cpp: When creating a daemon, create the new session
earilier, and change current working directory to / to ensure the
daemon does not interfere with the system.
* common/system.cpp: Return 0 on security check fail, as -1 is
signed.
* server/Connection.cpp: Re-order logging messages so that messages
reflect the fact the a broken connection occurs before the
subscriptions associated with that connection can be dropped.
Implement logging out just specific objects without closing the
connection.
* common/system.cpp, common/system.h: Add a function to increment nice
value for the server. Change security check to return unsigned, as
the magic number is in fact unsigned.
* server/server.cpp: Call system function to increment nice, thus
reducing priority once setup is complete.
* common/system.h, common/system.cpp: Add security check function
which for now just ensures cyphesis is not run as root.
* server/server.cpp: Use security check function when starting
the server.
* common/system.cpp: Make sure cassert is included before assert
macro is used.
* common/Makefile.am: Add missing header.
* data/Makefile.am: Install copies of the config files in
the documentation directory for reference.
* common/system.cpp, common/system.h: Add new functions for handling
encrypted password hashes with a salt, based on gcrypt rather
than openssl. Include legacy support for hashes without a salt.
* common/const.cpp: Add a salt to the default admin password.
* tests/systemtest.cpp: Modify the password tests to use the new
functions.
* server/Connection.cpp, server/Connection.h,
server/TrustedConnection.cpp, server/TrustedConnection.h:
Update the login code to use the new password functions.
* server/server.cpp, common/globals.cpp, client/client.cpp:
Workaround C++s nasty implicit conversion behavoir.
* common/system.cpp: Be smarted about POSIX signal handling for
segfaults and aborts.
* Update TODO.
* common/system.h, common/system.cpp: Add code to md5 hash
strings, like passwords.
* server/Connection.cpp: Use md5 hash code for storing and
verifying passwords.
* Use " instead of < when including application headers.
* Re-work the interface between server and worldrouter objects
so that the are less tied together, and more flexible.