Commit Graph

53 Commits

Author SHA1 Message Date
Sam Hocevar
13d8d29093 Merge handleCloseFromLocal() and handleCloseFromRemote(). 2016-02-06 14:58:31 +01:00
Sam Hocevar
bbf92c9e85 OS X compilation fixes in getAddress().
Also change the semantics for this function to return 0 on success.
2016-02-06 14:28:54 +01:00
Sam Hocevar
cefb09eddd Use FD_SETSIZE instead of __FD_SETSIZE. 2016-02-06 14:23:02 +01:00
Sam Hocevar
cd1de600aa Get rid of ConnectionInfo::coClosed.
What we actually care about is whether the socket file descriptors
are valid.
2016-02-06 14:20:21 +01:00
Sam Hocevar
990a368df0 Get rid of ConnectionInfo::loClosed. 2016-02-06 14:20:21 +01:00
Sam Hocevar
10935c8dc6 Get rid of ConnectionInfo::reClosed.
The variable ConnectionInfo::reFd already tells us whether the
connection is closed. This seems safer to me.
2016-02-06 14:20:20 +01:00
Sam Hocevar
4feb1ecd4f Minor refactoring in getAddress(). 2016-02-06 14:20:20 +01:00
Sam Hocevar
ed7fe3ce9d Fix patternBad() behaviour.
This function was only ever checking the first character in the string.
2016-02-06 14:20:20 +01:00
Sam Hocevar
77548712d1 Fix a memory leak on configuration reload.
This old bug was apparently introduced in rinetd 0.52.
2016-02-06 14:20:20 +01:00
Sam Hocevar
6c385facd2 Various code improvements.
Remove useless if() statements, try to factor common code, use
NULL instead of 0 where it seems to make sense, fix indentation
in switch/case for readability.
2016-02-06 14:20:20 +01:00
Sam Hocevar
bf11a9a4b5 Do the configuration parsing in a single pass. 2016-02-06 14:20:20 +01:00
Sam Hocevar
f0e2370747 Forgot to upgrade package version. 2016-02-06 14:20:20 +01:00
Sam Hocevar
1a4306008c Add Travis CI configuration file. 2016-02-06 14:20:20 +01:00
Sam Hocevar
b1d6ce5356 Fix a possible inconsistency in configuration reading.
The configuration is read in two passes (which we should stop doing one
day) and there was no check that we found the same number of forward rules
during each pass.
2016-02-03 18:54:33 +01:00
Sam Hocevar
bf40f07764 Declare a few variables closer to their actual use. 2016-02-03 18:37:19 +01:00
Sam Hocevar
51d251776b Merge pull request #4 from iwebhosting/gnu_source
Change _DEFAULT_SOURCE for _GNU_SOURCE to enable building on glibc 2.15
2016-02-03 17:35:57 +01:00
Aaron Brady
fb7eb33697 Change _DEFAULT_SOURCE for _GNU_SOURCE to enable building on glibc 2.15 2016-02-03 14:47:01 +00:00
Sam Hocevar
b7c30a067e Handle more than __FD_SETSIZE file descriptors. Fixes #1. 2016-01-13 07:47:12 +01:00
Sam Hocevar
edeb1685d2 Improve connection reallocation code.
Merge allocation and reallocation as they’re pretty much the same
thing. Make the growing factor less aggressive. Remove a goto for
immediate good karma.
2016-01-13 06:36:14 +01:00
Sam Hocevar
64a9c56c36 Reduce allocation count for connection buffers. 2016-01-13 06:12:43 +01:00
Sam Hocevar
a01d7520ec Fix a small error in the manual. 2016-01-13 05:24:44 +01:00
Sam Hocevar
9f490d550e Clean up manpage and HTML documentation.
Mostly a refactoring of HTML tags, removal of trailing spaces,
some CSS styles…
2016-01-13 05:20:45 +01:00
Sam Hocevar
54cf9badb2 Group all signal handlers together. 2016-01-12 11:46:31 +01:00
Sam Hocevar
e69b28d9a0 Get rid of safeRealloc().
This function was only used in one place, had a memory leak, and is not
type-safe. It’s better to avoid it altogether.
2016-01-12 11:44:32 +01:00
Sam Hocevar
401a67b569 Fix error reporting for out-of-range port numbers.
This was found by simply adding -Wextra to the compilation flags.
2016-01-12 11:39:36 +01:00
Sam Hocevar
9ceb167e51 Try to declare more variable in a tighter scope.
This reduces the chances of a variable being reused by an unrelated
piece of code without proper initialisaion.
2016-01-12 11:36:42 +01:00
Sam Hocevar
0090b40252 Compile with -std=c99. 2016-01-12 11:35:08 +01:00
Sam Hocevar
15ed538dcc Add indentation to preprocessor directives and remove macros. 2016-01-12 11:35:08 +01:00
Sam Hocevar
8890e03ae9 Use “srv” and “cnx” for servers and connections instead of “s” and “c”. 2016-01-12 02:54:28 +01:00
Sam Hocevar
54ca0fbd34 Better memory initialisation. 2016-01-12 02:49:29 +01:00
Sam Hocevar
dcfd95d14e Prepare a 0.62.0sam release. 2016-01-11 03:12:57 +01:00
Sam Hocevar
82e731b797 Improve type safety of many function calls. 2016-01-11 03:09:05 +01:00
Sam Hocevar
88e3fff7a4 Reduce the number of global variables. 2016-01-11 03:09:05 +01:00
Sam Hocevar
6e862b6306 Fix uninitialised socket handling structures.
This bug would cause crashes simply upon receiving SIGHUP.
2016-01-11 03:09:04 +01:00
Sam Hocevar
80db9e344e Log accepted connections, not only denied ones.
Patch courtesy of Flavio Stanchina, through the Debian bug tracker
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=628061).
2016-01-11 03:09:04 +01:00
Sam Hocevar
24f6bc5548 Update README file with more modern information. 2016-01-11 03:09:04 +01:00
Sam Hocevar
568da70b3b Use socklen_t type for accept() if available. 2016-01-11 03:09:04 +01:00
Sam Hocevar
30d2573264 Rename log() to logEvent() due to builtin redefinition. 2016-01-11 03:09:04 +01:00
Sam Hocevar
b46ea689b9 Remove trailing spaces and mismatched tabs/spaces. 2016-01-11 03:09:04 +01:00
Sam Hocevar
e39369a364 Use strdup() instead of strlen()+malloc()+strcpy(). 2016-01-11 03:09:04 +01:00
Sam Hocevar
21af463eae Log DNS errors.
This patch is imported from the rinetd Debian package.
2016-01-11 03:09:04 +01:00
Sam Hocevar
90d1655c74 Various bug fixes imported from the Debian package. 2016-01-11 03:09:04 +01:00
Sam Hocevar
b6ded86fe5 Fix context line number in error reporting.
This patch is imported from the rinetd Debian package.
2016-01-11 03:09:04 +01:00
Sam Hocevar
7330c19177 Properly close the configuration file.
This patch is imported from the rinetd Debian package.
2016-01-11 03:09:04 +01:00
Sam Hocevar
0f574db5b4 Use syslog() instead of fprintf(stderr) if available.
This patch is imported from the rinetd Debian package.
2016-01-11 03:09:04 +01:00
Sam Hocevar
35e4ac0497 Use sigaction() instead of signal() when available.
This patch is imported from the rinetd Debian package.
2016-01-11 03:09:04 +01:00
Sam Hocevar
acb00a89f9 Use autoconf and automake and remove MSVC projects.
This patch is imported from the rinetd Debian package.
2016-01-11 03:09:04 +01:00
Sam Hocevar
39e4d7a0e8 Add a -f flag to run in the foreground.
This patch is imported from the rinetd Debian package.
2016-01-10 21:31:08 +01:00
Sam Hocevar
13f2f7f854 Fix deprecated use of text literals as char*.
This patch is imported from the rinetd Debian package.
2016-01-10 21:22:36 +01:00
Sam Hocevar
1c95abb27d Import old rinetd 0.62.
Taken from the Debian archive:
  http://archive.debian.org/debian/pool/main/r/rinetd/
2016-01-10 20:55:51 +01:00