Florian Westphal
c997e04325
Fix handling of MaxConnections option
...
Config option claimed to be 'number of connections' but in reality this
was treated as 'largest file descriptor allowed'.
This also fixes another bug in New_connection, where the
ng_ipaddr_tostr_r error path was missing a return statement.
2008-08-30 15:37:19 +02:00
Alexander Barton
a84f7dcee5
Allow mixed line terminations (CR+LF/CR/LF) in non-RFC-compliant mode
...
Up to now ngIRCd accepted CR+LF as well as a single CR or LF in "non RFC
compliant" mode (the default). But ngIRCd became confused when it received
data containing mixed line endings (e. g. "111\r222\n333\r\n").
This patch enables ngIRCd (in "non RFC compliant" mode) to detect CR+LF,
CR, and LF as equally good line termination sequences and to always end the
command after the first one detected.
Some clients (for exmaple Trilian) are that ... broken to send such mixed
line terminations ...
First patch proposed by Scott Perry <scperry@ucsd.edu>,
Thanks to Ali Shemiran <ashemira@ucsd.edu> for testing!
2008-06-11 16:00:38 +02:00
Alexander Barton
951314cb79
Handle_Buffer(): code cleanup.
...
Both callers ignore the return code of this function, so get rid of it,
but make sure that the client is disconnected on errors.
2008-05-26 23:38:32 +02:00
Alexander Barton
d360871394
Conn_Handler(): cleanup code, add/translate comments.
...
In addition, the "timeout" variable has been removed because it is
unnecessary today: Handle_Buffer() handles all the data it can handle,
and io_dispatch() returns immediately when new data is available. So
we don't have to double-check but better sleep. Pointed out by Florian.
2008-05-26 21:38:27 +02:00
Florian Westphal
4ed2cb1a02
make Listen parameter a comma-seperated list of addresses.
...
this also obsoletes ListenIPv4 and ListenIPv6 options.
If Listen is unset, it is treated as Listen="::,0.0.0.0".
Note: ListenIPv4 and ListenIPv6 options are still recognized,
but ngircd will print a warning if they are used in the config file.
Also, some plattforms require that ai_socktype
is set in the getaddrinfo() hints structure.
2008-05-19 14:27:35 +02:00
Florian Westphal
b1d38de4d2
If bind() fails, also print ip address and not just the port number.
2008-05-12 18:46:55 +02:00
Alexander Barton
2a790861a1
Handle 1-character messages terminated with CR or LF correctly
...
Code cleanup and fix for Bug #83 , "ngIRCd chokes on 1-character messages" in
function Handle_Buffer(): the buffer is now correctly cleared when ngIRCd
receives 1-character messages terminated with either CR or LF (in violation
to RFC 2812, section 2.3 "Messages", 5th paragraph).
2008-05-02 02:14:15 +02:00
Florian Westphal
22fa782be7
IPv6: Add config options to disabe ipv4/ipv6 support.
...
This also enables ipv6-only setups.
2008-04-21 00:45:19 +02:00
Florian Westphal
feb31e4200
IPv6 support.
...
all references to struct sockaddr/in_addr have been
removed from src/ngircd.
libngipaddr (in src/ipaddr/) hides all the gory details.
See src/ipaddr/ng_ipaddr.h for API description.
2008-02-26 23:50:35 +01:00
Florian Westphal
f99f9a8f02
Fix format arg: ListenAddress was printed instead of Bind address.
2007-12-13 01:30:16 +00:00
Florian Westphal
4715ccf9ca
Fix format string in error path: didn't print strerror(errno)
2007-12-13 01:05:01 +00:00
Florian Westphal
2fe13f0a45
Fix fmt string: int, not long
2007-12-07 21:19:01 +00:00
Florian Westphal
20ce56cc5b
include <arpa/inet.h> inside tool.h
...
In file included from hash.c:24:
../tool/tool.h:27: warning: `struct in_addr' declared inside parameter list
2007-11-25 18:42:37 +00:00
Florian Westphal
47a0379e2b
remove ip-string from Conf_Server struct
...
struct Conf_Server stored the ip address to connect to
in dotted-decimal notation; but we only need this for connect()
so long-time storage isn't necessary.
2007-11-23 16:28:37 +00:00
Florian Westphal
82d32ffb28
bind ListenAddress for outgoing connections
...
ngircd would always use INADDR_ANY for outgoing connections;
which might not be desirable. Added new [Server] option
"Bind" to set source ip.
2007-11-23 16:26:03 +00:00
Alexander Barton
06bfb3adfb
Fix code to compile using K&R C compiler and ansi2kr again.
2007-11-18 15:05:35 +00:00
Florian Westphal
001c00b273
New config option NoDNS: disables all DNS queries.
2007-10-25 11:01:19 +00:00
Alexander Barton
d4ed056147
Numeric 317: implemented "signon time" (displayed in WHOIS result).
2007-10-04 15:03:55 +00:00
Florian Westphal
efcca62a35
last fix accidentially broke reconnect timer.
2007-07-21 18:46:28 +00:00
Florian Westphal
cd65e0a56e
Don't connect to a server if a connection to another server within the same group
...
is in progress.
2007-06-28 15:13:38 +00:00
Alexander Barton
255edf7eab
Reworked read and write buffer handling, introduced WRITEBUFFER_SLINK_LEN.
2007-05-17 23:34:24 +00:00
Florian Westphal
a073bc89c4
there is no need to treat servers differently than clients on the read side.
2007-05-17 12:39:25 +00:00
Florian Westphal
63e89ceb21
make needlesly global function Conn_Write static.
2007-05-09 13:21:11 +00:00
Florian Westphal
09416f36bf
remove ZBUFFER constants and increase max buffer size of server links
2007-05-09 08:55:14 +00:00
Florian Westphal
508b55126f
fix compressed server links
2007-05-02 12:34:30 +00:00
Florian Westphal
09deb857ce
- change return type of Conn_InitListeners to unsigned
...
- remove minor whitespace damage
2007-04-04 21:52:12 +00:00
Florian Westphal
99eab1e216
if we can't bind a socket we now Log the port number, too.
2007-02-21 11:06:06 +00:00
Alexander Barton
429f85b77a
Remove Client_DestroyNow() to keep semantik "every CONNECTON has a CLIENT".
2007-01-23 16:07:19 +00:00
Florian Westphal
4243cae985
register io handler before creating new local client structure
2006-12-25 01:11:12 +00:00
Florian Westphal
40226d26b2
revert to last good revision again 8-/
2006-12-17 23:04:45 +00:00
Florian Westphal
d2f7d3087d
do not call Conn_Close when io_event_create fails
2006-12-17 22:55:07 +00:00
Alexander Barton
5ce6bf28d1
Removed (theoretically) division by zero; reformated some code.
2006-07-23 23:05:20 +00:00
Alexander Barton
9a2d4eef44
"Enhanced" debug message for Handle_Write(), only print when data in buffer.
2006-07-23 15:22:56 +00:00
Alexander Barton
00ab67dcdb
The third parameter of bind() is of type "socklen_t", not "int".
2006-05-12 11:53:04 +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
Alexander Barton
2af87e9152
Handle time shifts backwards gracefully.
2006-05-09 14:49:08 +00:00
Florian Westphal
5d0ba011c7
Fix Connection Pool resizing.
2006-04-29 16:19:46 +00:00
Florian Westphal
87f4b1c6f6
Client_GetFromConn() removed and replaced with new function Conn_GetClient()
2006-04-23 10:37:27 +00:00
Florian Westphal
2a9ffe7037
use strlcat return value; don't call time() repeatedly.
2006-03-18 22:27:09 +00:00
Florian Westphal
93df629b69
changed connection structure to array-api
2006-02-16 19:21:57 +00:00
Florian Westphal
66060dbce9
new Function: LogDebug()
2006-02-08 17:33:28 +00:00
Florian Westphal
a17745d6d7
Make connid same as connection fd.
2006-02-08 15:20:21 +00:00
Florian Westphal
1249acfdba
removed obsolete "int Conn_MaxFD"
2006-02-02 21:00:21 +00:00
Florian Westphal
4b2f966b7e
Fix Bugzilla #64 -- ngicrd did not reconnect to other servers after failed forward dns lookup.
2005-12-09 09:26:55 +00:00
Alexander Barton
6b21249151
Remove direct call of Conf_UnsetServer(): it's already indirectly called
...
by Conn_Close() a few lines above.
2005-11-21 15:06:37 +00:00
Alexander Barton
bc09a3e487
Changed Handle_Write() to not close sockets itself but to call Conn_Close.
2005-10-11 19:29:23 +00:00
Florian Westphal
b65358b17c
avoid 2nd time() call in Check_Servers(), improve comments
2005-09-24 02:48:46 +00:00
Florian Westphal
e9f3e69f36
use io_close instead of plain close in Conn_ExitListeners()
2005-09-24 02:20:00 +00:00
Florian Westphal
5b2364b236
merge new resolver code
2005-09-12 19:10:20 +00:00
Florian Westphal
4db29b0076
Minimal changes (needed for merging resolver changes)
2005-09-11 11:42:48 +00:00
Florian Westphal
468a1c7767
Handle_Write(): Report write attempts on closed sockets when in debug mode.
2005-09-05 09:10:08 +00:00
Florian Westphal
cae9a3aee5
small formatting change
2005-09-02 17:01:23 +00:00
Alexander Barton
af9123fd82
Cleaned up some code, comments and log/debug messages.
2005-09-02 13:28:30 +00:00
Florian Westphal
c65343e719
reformatted a few lines.
2005-08-30 22:08:00 +00:00
Alexander Barton
c12dc45f17
Added prefix to connection statistic NOTICE.
2005-08-29 11:11:15 +00:00
Florian Westphal
58b8fb5d12
remove unneeded variable "bool action"
2005-08-28 16:51:20 +00:00
Florian Westphal
2f105b1c0a
if the request is empty, remove \r\n (or single \n or \r) from receive buffer.
2005-08-28 00:19:29 +00:00
Florian Westphal
a2cdc08c39
fix handling of empty requests
2005-08-27 23:42:23 +00:00
Alexander Barton
e728bd2e1a
Changed handling of timeouts for unregistered connections: don't reset
...
the counter if data is received and disconnect clients earlier.
2005-08-27 23:33:10 +00:00
Alexander Barton
c2f5399b51
Fixed format string bug in "connection statistics" message; code cleanups.
2005-08-15 23:02:40 +00:00
Alexander Barton
1c14e2e0a2
Removed some line feeds in debug statements.
2005-08-02 22:48:57 +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
51ccb5928a
internal changes needed for future ssl support
2005-07-29 09:29:47 +00:00
Florian Westphal
46a191caf6
changed RES_STAT buffer to array
2005-07-28 16:13:09 +00:00
Alexander Barton
74cb2e2768
Eliminate some compiler warnings ("unused parameter").
2005-07-22 21:31:05 +00:00
Florian Westphal
efbfe4ae83
removed unneeded variable "bsize"
2005-07-13 16:06:55 +00:00
Florian Westphal
c92e57fec3
add better error checks for io_ routines
2005-07-12 20:44:46 +00:00
Florian Westphal
248d75e566
fix embarassing buffer-off-by one
2005-07-11 20:58:05 +00:00
Florian Westphal
4715b17106
make Conn_NewListener local to conn.c
2005-07-11 14:56:38 +00:00
Florian Westphal
70facb7f6e
made a few config options unsigned.
2005-07-11 14:11:35 +00:00
Florian Westphal
e50d049074
minor cosmetic changes
2005-07-09 21:35:20 +00:00
Alexander Barton
02b0a51517
Renamed "Rendezvous" to "Zeroconf".
2005-07-08 16:18:38 +00:00
Florian Westphal
0d180a913f
use new io event API.
2005-07-07 18:49:04 +00:00
Alexander Barton
9a6b6f527b
Handle oversized messages which should be sent to the network better.
2005-07-02 14:36:03 +00:00
Alexander Barton
0e3ce63ec1
Fix compiler warning "comparision between signed and unsigned".
2005-06-26 13:43:59 +00:00
Florian Westphal
1cf8ccd8fe
Make sure SimpleMessage() sends <= 512 chars
2005-06-12 17:21:46 +00:00
Alexander Barton
5195555c5a
Removed CONNECTION[].starttime, now saved in CLIENT structure.
2005-06-12 16:28:55 +00:00
Florian Westphal
ae98008c1c
remove Try_Write(), Call Handle_Write() directly instead.
2005-06-04 11:49:20 +00:00
Florian Westphal
8ac701d6c8
add FreeRes_stat(), wait for resolver timeout.
2005-06-01 21:28:50 +00:00
Alexander Barton
cd0dc8627d
Don't exit server if closing of a socket fails; instead ignore it and
...
pray that this will be "the right thing" ...
2005-05-22 23:55:57 +00:00
Florian Westphal
e7c2c86aee
removed "my_connects" fd_set.
2005-04-23 14:28:44 +00:00
Florian Westphal
8304210c06
fix spelling
2005-04-16 20:50:03 +00:00
Florian Westphal
b4363162ce
s/malloc(x*y)/calloc(x,y)/
2005-04-16 09:19:49 +00:00
Florian Westphal
326607eea1
changed type of Conf_ListenPorts[] from "unsigned int" to UINT16.
2005-03-20 13:54:06 +00:00
Florian Westphal
bfba1f37ed
Init_Conn_Struct(): Zero structure using memset().
2005-03-20 11:00:31 +00:00
Florian Westphal
8adff59223
Remove INT, LONG, BOOLEAN, STATIC, CONST, CHAR datatypes.
...
use stdbool.h / inttypes.h if available.
2005-03-19 18:43:48 +00:00
Alexander Barton
a40a026d15
Fixed detection of IRC lines which are too long to send. Detected by
...
Florian Westphal, <westphal@foo.fh-furtwangen.de>.
2005-01-19 23:33:53 +00:00
Alexander Barton
429b5f3ec9
Fixed a memory leak when resizing the connection pool and realloc() failed.
...
Now we don't fall back to malloc(), which should be sane anyway.
Patch from Florian Westphal, <westphal@foo.fh-furtwangen.de>.
2005-01-17 11:57:39 +00:00
Alexander Barton
58736b3902
Fixed indentation and added some more debug code.
2004-12-22 17:37:41 +00:00
Alexander Barton
c1f32e8214
Made ngIRCd compile on HP/UX 10.20 with native HP pre-ANSI C compiler and
...
most probably other older C compilers on other systems.
2004-10-20 13:47:32 +00:00
Alexander Barton
eee2762852
Changed "read buffer" to "receive buffer" as suggested by Goetz.
2004-10-04 23:23:41 +00:00
Alexander Barton
c79fa28a66
Added some missing words: "address" :-)
2004-10-04 23:09:04 +00:00
Alexander Barton
a49a580a77
Fixed wrong buffer size calculation for resolver results.
2004-05-30 16:25:51 +00:00
Alexander Barton
c23bbe6b65
Fixed a warning message of the compiler when not using IDENT lookups.
2004-05-11 00:53:14 +00:00
Alexander Barton
3012c232eb
Fixed resolver when using IDENT lookups, cleaned up code.
2004-05-11 00:01:11 +00:00
Alexander Barton
1d8da4b525
Fixed a wrong assert() which could cause the daemon to exit spuriously
...
when closing down connections.
2004-04-25 14:06:11 +00:00
Alexander Barton
cb76d96efb
Fixed some warnings of non-gcc-compilers (e. g. original Apple compiler on
...
A/UX): "warning: illegal pointer combination, op =".
2004-03-11 22:16:31 +00:00
Alexander Barton
33f4e6763b
Better logging while establishing and shutting down connections.
...
Results of the resolver are now discarded after the client is registered.
2004-02-28 02:01:01 +00:00
Alexander Barton
b90bedbcb2
Fixed (optional) TCP Wrapper test which was broken and could result in
...
false results. Thanks to Fuminori Tanizaki <tany@mcnet.ad.jp>!
2004-02-03 20:28:30 +00:00
Alexander Barton
bb98fd8c85
The type of service (TOS) of all sockets is set to "interactive" now.
2004-01-25 16:06:34 +00:00