Commit Graph

614 Commits

Author SHA1 Message Date
Jan Vidar Krey 236daeae53 Assert if inserting an invalid timer. 2010-03-15 22:59:16 +01:00
Jan Vidar Krey 862c6a1baf Reduce timeout queue window size. 2010-03-13 00:16:15 +01:00
Jan Vidar Krey 59ed268f4d Added test cases for sid allocation.
This revealed a few bugs:
* when sid allocator is full, then uhub will loop indefinitely when allocating one more (unlikely to occur).
* looking up a user object based on a sid that is out of range (off by one) returns invalid memory.
2010-02-18 16:02:13 +01:00
Jan Vidar Krey 963416ad73 Cleanup reference adc message reference counting somewhat. 2010-02-16 20:51:10 +01:00
Jan Vidar Krey 29c162727c Added lots of new asserts which should trigger in case we double delete a ADC message. 2010-02-15 19:03:19 +01:00
Jan Vidar Krey 1ce258bccf Tidy up the certificate loading code somewhat. 2010-02-15 19:02:31 +01:00
Jan Vidar Krey 0de66286fa Partially fix bug #117 - tls_require ignored entirely in 0.3.0 released
If tls_require is enabled then the hub will simply close the connection if a
user connects without TLS.
In the future we should redirect the user either to another server or to the adcs server.
2010-02-15 19:00:48 +01:00
Jan Vidar Krey 5e6879dffb Fix for partial read operations. 2010-02-12 20:33:17 +01:00
Jan Vidar Krey 1b56adb8c0 Fix wrong IQUI message. Partially fixes bug #4. 2010-02-12 19:25:09 +01:00
Jan Vidar Krey 82eeaa1fba Fix bug #114: FreeBSD compile error. 2010-02-11 07:54:42 +01:00
Jan Vidar Krey 19b9f72337 Make sure !version agrees with the connect time banner (same format). 2010-02-11 01:19:58 +01:00
Jan Vidar Krey 915cb56448 Fix bug #106: Show OS/CPU info in !version.
This can be controlled by the configuration variable "show_banner_sys_info" which is enabled by default.
2010-02-10 23:45:51 +01:00
Jan Vidar Krey 6992043f9d Fix bug #113: crash when using epoll backend. 2010-02-10 22:06:49 +01:00
Jan Vidar Krey 896bbfcb5d Compile multiple network backends into the binary and choose which one to use at runtime.
This makes it possible to share more code between the backends and also work around
bugs of certain backends on some (versions of) operating systems.
2010-02-10 22:00:13 +01:00
Jan Vidar Krey 6ac78e1a10 Fix autotest 2010-02-08 00:35:58 +01:00
Jan Vidar Krey be8db21561 Fix bug #109: Confusing debug message for nat_ip. 2010-02-07 23:29:38 +01:00
Jan Vidar Krey 8065903604 Fix bug #108: share limits can be avoided.
This was due to updates to the share limit not being enforced after a succesful login.
2010-02-07 23:08:04 +01:00
Jan Vidar Krey 2dc95eca47 SunOS support. 2010-01-28 01:35:09 +01:00
Jan Vidar Krey 7637d9ba68 Added experimental Haiku OS support.
It compiles and it runs with some minor glitches.
2010-01-28 01:35:08 +01:00
Jan Vidar Krey 4e9488dd4d gcc 2.95 compile fixes. 2010-01-28 01:11:11 +01:00
Jan Vidar Krey e0003ebbb2 Only define MIN/MAX macros if not defined by the system. 2010-01-28 01:07:05 +01:00
Jan Vidar Krey 8e7e8c68f5 gcc v2.95 compile fixes. 2010-01-28 01:06:41 +01:00
Jan Vidar Krey 1599f63134 Make sure the autotests work. 2010-01-28 00:07:42 +01:00
Jan Vidar Krey c3ad006d07 Fix bug #76: added support for multiple server listen ports.
Use server_alt_ports and supply a comma separated list of ports.
2010-01-27 23:55:52 +01:00
Jan Vidar Krey 1faca92167 Added a generic string splitter utility function that is based on callbacks instead of populating a list. 2010-01-27 23:55:05 +01:00
Jan Vidar Krey ccd1c8f160 kqueue() BSD fixes 2010-01-27 17:50:02 +01:00
Jan Vidar Krey 41418f21e7 Winsock compile fix. 2010-01-27 17:48:16 +01:00
Jan Vidar Krey 7a8a737cad More kqueue work in progress. 2010-01-27 01:04:32 +01:00
Jan Vidar Krey ac48ad01fb Work in progress on the kqueue backend. 2010-01-27 00:43:10 +01:00
Jan Vidar Krey d7a1a52c1a Started working kqueue() backend for OSX and BSD. 2010-01-26 23:30:32 +01:00
Jan Vidar Krey f54e8dbbba Moved the timeout code to where it belongs, along with the network backend code. 2010-01-26 22:55:08 +01:00
Jan Vidar Krey 2d7ffa37fe Fix problem parsing configuration file if the last line is not empty 2010-01-26 16:16:41 +01:00
Jan Vidar Krey 928225fb7b On Mac OS X getrlimit() returns 2^(sizeof(size_t) * 8) instead of the actual number of available socket descriptors. 2010-01-26 08:40:10 +01:00
Jan Vidar Krey e3cf41cb97 BSD/OSX compile fix. 2010-01-25 14:23:22 +01:00
Jan Vidar Krey bfc7c184a7 Fix release build compile warnings. 2010-01-23 14:59:51 +01:00
Jan Vidar Krey 304ecda16a Enable the statistics timer again, so that !stats provide up to date network statistics. 2010-01-23 00:43:38 +01:00
Jan Vidar Krey c670d13369 Make sure we shutdown SSL connections when an error occurs. 2010-01-23 00:20:48 +01:00
Jan Vidar Krey b2e7a2848f Optimize epoll to never modify the epoll mask unless it actually changed. 2010-01-23 00:03:45 +01:00
Jan Vidar Krey 84bd2591d6 SSL fixes, seems to work with stunnel4 as a client but not linuxdcpp using SSL directly. 2010-01-22 23:43:23 +01:00
Jan Vidar Krey 4aa65733d0 Poll as long as possible until next timeout the earliest. 2010-01-22 23:18:59 +01:00
Jan Vidar Krey 230ca28b46 Some unfinished SSL work. 2010-01-22 18:52:38 +01:00
Jan Vidar Krey 68a26e1160 Added proper POSIX signal handler. 2010-01-22 16:57:30 +01:00
Jan Vidar Krey 4711d26c11 Fix broken net_address_to_string(). 2010-01-22 16:09:19 +01:00
Jan Vidar Krey 5e253e8442 Fix compile error. 2010-01-22 16:04:36 +01:00
Jan Vidar Krey 8b7f09c7f4 Fixed two cases of bad connection close. 2010-01-21 23:54:38 +01:00
Jan Vidar Krey b29da11f3b Make sure we call the timeout code. 2010-01-21 23:52:04 +01:00
Jan Vidar Krey 78ad9b8572 Fixed bad logic inside the timer scheduling. 2010-01-21 23:13:52 +01:00
Jan Vidar Krey b04a20c66e fixed off by one bug in due to message escape. 2010-01-21 22:20:26 +01:00
Jan Vidar Krey 21a5981905 Make sure start_listening_socket does everything, this will lead the way to multiple listen ports. 2010-01-21 17:31:55 +01:00
Jan Vidar Krey c47ea14047 Code cleanup for starting the listening socket. 2010-01-21 01:54:41 +01:00
Jan Vidar Krey 9f5aaf0148 Added a safe connection cleanup procedure for when a connection goes
down while it may be attempted to be used.
2010-01-21 01:12:57 +01:00
Jan Vidar Krey f645811f37 Merge branch 'master' of github.com:janvidar/uhub 2010-01-20 18:42:45 +01:00
Jan Vidar Krey 2f09fcea84 Added select() backend which can be used as a fallback if epoll is not available. 2010-01-20 18:39:55 +01:00
root efeb36c492 - update uhub.conf example after add !rules
- add example rules.txt
- fix compile warning in  src/util/timeout.c
- add example config file for rotate log file in RHEL\CentOS
2010-01-20 11:12:43 +03:00
Jan Vidar Krey 7e60919596 sorted the commands shown in help. 2010-01-20 00:24:57 +01:00
Jan Vidar Krey e7cb4cd277 remove extra space before !broadcast messages 2010-01-20 00:12:39 +01:00
Jan Vidar Krey e45511827f Added the +rules command.
Also added the +motd command to see the message of the day, which is sent while connecting.
2010-01-19 23:30:26 +01:00
Jan Vidar Krey 80c6ad9d76 Added mute/unmute functionality. 2010-01-19 23:07:55 +01:00
Jan Vidar Krey f84f3b1fff Merge branch 'master' of github.com:janvidar/uhub into sans_libevent 2010-01-19 19:35:20 +01:00
Jan Vidar Krey f84073f7cc Various fixes for epoll handling without libevent.
This should take care of most compile issues as well as busy loops caused by unhandled recv() calls returning 0 and general cleanups.
2010-01-19 17:52:58 +01:00
Jan Vidar Krey af8421fa47 Crash fix. 2010-01-18 21:57:51 +01:00
Jan Vidar Krey 001fa6739a Crash fix. 2010-01-18 19:38:07 +01:00
Jan Vidar Krey 7dfa3162cb Epoll fixes. 2010-01-18 19:34:18 +01:00
Jan Vidar Krey 314707f499 Epoll fixes. 2010-01-18 16:15:38 +01:00
Jan Vidar Krey 1c58a85de1 More work on epoll. 2010-01-17 23:00:28 +01:00
Jan Vidar Krey 6a4b9c58f4 Work on removing libevent completely as a mandatory dependency. 2010-01-07 20:55:13 +01:00
Jan Vidar Krey f35b2c35cb Fix some compile errors. 2009-12-14 16:17:59 +01:00
Jan Vidar Krey b3aa5332c8 Work on epoll backend, and removing dependency on libevent. 2009-12-10 23:12:04 +01:00
Jan Vidar Krey 1f9cfe58c4 No need to allow users not yet logged in to send special hub commands to the hub.
Nothing bad will happen, except the hub will try to answer them even though the user is not yet fully logged in. This fix ensures that these messages are simply dropped instead.
2009-12-09 19:40:12 +01:00
Jan Vidar Krey 50f5ce9d32 Fix bug #100 - Null pointer crash if sending a chat message without the message part. 2009-12-09 19:30:08 +01:00
Jan Vidar Krey 4a4de0f2ac Make sure we have libevent enabled for now, and add macro protection around the areas of the code that still depend on libevent. 2009-12-09 17:27:46 +01:00
Jan Vidar Krey 2e2f93d0a4 Started working on new timeout handling which can be used when we remove libevent.
This will probably be used by default on UNIX platforms at some point.

The timeout handling accomplishes O(1) inserts, removes and reschedules
but the accuracy is limited to whole seconds.
2009-12-09 17:12:33 +01:00
Jan Vidar Krey 7c093dc5da Fix for very long messages that get dropped if they are sent alone (no other message before it) and does not fit inside one TCP packet.
(Thanks FleetCommand!)
2009-12-04 08:12:54 +01:00
Jan Vidar Krey 8bcdbdc061 Removed assert. 2009-11-21 11:52:25 +01:00
Jan Vidar Krey 53536f191d Crash fix. 2009-11-21 11:47:26 +01:00
Jan Vidar Krey e994f23ea0 Crash fix part 2 2009-11-18 18:35:31 +01:00
Jan Vidar Krey f489e77602 Crash fix? 2009-11-18 18:27:31 +01:00
Jan Vidar Krey 2526c8a9ed Silly compile error. 2009-11-18 17:43:11 +01:00
Jan Vidar Krey 4556623a87 Clarify flags as unsigned. 2009-11-18 17:41:22 +01:00
Jan Vidar Krey 828c19cfc6 Fix a wrong open() if no motd is specified. 2009-11-18 17:41:55 +01:00
Jan Vidar Krey 00995a1946 Fix potential memory leaks and crashes. 2009-11-18 17:41:28 +01:00
Jan Vidar Krey f4e82ef503 Cleanup the net_event handler. 2009-11-18 17:40:28 +01:00
Jan Vidar Krey eb7bec585e Fix problems with write events not being processed due to a read event taking presendence.
Conflicts:

	src/core/netevent.c
2009-11-18 17:40:23 +01:00
Jan Vidar Krey 066b3f5243 Fix protocol probe. Will detect ADC and TLS handshake - any other request
will simply cause the hub to close the connection.

Conflicts:

	src/core/netevent.c
	src/core/probe.c
2009-11-18 17:38:25 +01:00
Jan Vidar Krey a51e8830ce Log dropped messages. 2009-10-30 18:31:27 +01:00
Jan Vidar Krey e6cc47070c A few minor TLS fixes 2009-10-09 21:38:14 +02:00
Jan Vidar Krey 0c5d98c671 TLS compile and crash fixes. 2009-10-09 21:11:11 +02:00
Jan Vidar Krey 0f30ebf045 Some stability fixes. Removed log messages. 2009-10-09 20:35:04 +02:00
Jan Vidar Krey 4919c8f2f9 Fix compile error. 2009-10-09 00:11:09 +02:00
Jan Vidar Krey 2910c571b0 Fix protocol probe. Will detect ADC and TLS handshake - any other request
will simply cause the hub to close the connection.
Fix problems with write events not being processed due to a read event taking presendence.
Fix bug #86: Windows does not have "getrlimit()".
2009-10-08 23:16:15 +02:00
Jan Vidar Krey 11e5683a79 Cleanup code somewhat. 2009-10-06 18:33:06 +02:00
Jan Vidar Krey 17416def35 Make sure we flag JOIN/LEAVE messages as really verbose debug output. 2009-10-06 18:28:16 +02:00
Jan Vidar Krey 234f04f495 Removed extra main block. 2009-10-06 18:25:50 +02:00
Jan Vidar Krey 4898454c91 Removed redundant and ununsed operation mode for adcrush. 2009-10-06 18:24:21 +02:00
Jan Vidar Krey 255255ff20 Allow for command line specified host. 2009-10-06 18:16:38 +02:00
Jan Vidar Krey f50b40fb92 Fix bug #85 - Do not broadcast unknown commands, but allow for commands to be broadcasted if they are double escaped with ++ or !!. 2009-10-06 18:02:37 +02:00
Jan Vidar Krey 40fc09a7ef Whitespace cleanups. 2009-10-06 17:40:09 +02:00
Jan Vidar Krey 582bb58ff9 Refactor the address parsing bits of adcrush. 2009-10-06 17:25:38 +02:00
Jan Vidar Krey 7472e9ae4a Removed some old unused macros. 2009-10-06 15:53:24 +02:00
Jan Vidar Krey f076c67c33 Added a configurable listen() backlog (defaults to: server_listen_backlog=50) 2009-10-06 15:50:42 +02:00
Jan Vidar Krey 7eef032584 Doc update. 2009-10-06 14:39:47 +02:00
Jan Vidar Krey de793ea9d2 Some compile fixes and memory leak fixes for ADCRush. 2009-10-06 14:36:49 +02:00
Jan Vidar Krey 20ef6f8e53 Fix to net_con_close() which allows us to either delete the connection immediately if that is safe, or delete it later. 2009-10-06 14:36:05 +02:00
Jan Vidar Krey 310ddf4e9d More work on the ADC client lib. 2009-10-06 12:39:31 +02:00
Jan Vidar Krey 8592aa80d4 Compile fix. 2009-10-06 12:24:44 +02:00
Jan Vidar Krey 69f6d811bf Added lots of asserts, and split out the ip address from the connection object.
Still a lot of work remains and a massive network connection cleanup is needed.
2009-09-29 00:30:52 +02:00
Jan Vidar Krey a53c219f05 Fix bug #82 - Crash writing a log larger than 2GB on a 32 bit system as _FILE_OFFSET_BITS was not declared to be 64. 2009-09-14 12:24:18 +02:00
Jan Vidar Krey 96ce64ee07 Fix memory issues in ADC client lib. 2009-09-04 17:18:52 +02:00
Jan Vidar Krey 4fd182c55e Fix compile warning. 2009-08-31 20:36:25 +02:00
Jan Vidar Krey 993d9ae33b Fix some issues regarding header extraction. 2009-08-31 19:45:47 +02:00
Jan Vidar Krey 1e380ecf0f Fix bug #77 - Error in ACL command parsing. 2009-08-31 19:39:09 +02:00
Jan Vidar Krey aeba7188c0 Added a macro that can keep the line count down. 2009-08-28 18:10:41 +02:00
Jan Vidar Krey 4ca5caa52b Various fixes, the admin tool at least compiles and runs. 2009-08-28 18:05:58 +02:00
Jan Vidar Krey 5203ecdadc Split uhub.h 2009-08-28 16:18:18 +02:00
Jan Vidar Krey 11b288a669 Various build fixes. 2009-08-28 16:04:45 +02:00
Jan Vidar Krey 52cbec24b6 Started splitting up ADC rush. Need a test client before we can proceed anyway. 2009-08-28 14:29:19 +02:00
Jan Vidar Krey 29d6d59d36 Misc connection changes. 2009-08-27 14:15:18 +02:00
Jan Vidar Krey 96c006ee13 Cleanup some code. 2009-08-23 14:36:52 +02:00
Jan Vidar Krey e67587b997 Fix output handling. 2009-08-23 14:36:17 +02:00
Jan Vidar Krey 1af613d9ce Fixed printf issues with size_t. Since Windows do not support %zu we have to use %Iu there instead.
Solved that with an ugly but needed macro.
2009-08-20 10:44:44 +02:00
Jan Vidar Krey 5bd258ca52 Move the network related flags from network.h to connection.h since that is where they are used. 2009-08-11 21:29:51 +02:00
Jan Vidar Krey 86ba3ca86f Complete moving all connection related data out of the hub_user object. 2009-08-07 00:22:30 +02:00
Jan Vidar Krey cfb450c3fc Added net_set_nonblocking for Solaris. 2009-08-06 23:28:44 +02:00
Jan Vidar Krey cd389742e6 Solaris fixes. 2009-08-06 23:15:55 +02:00
Jan Vidar Krey 4afa187f9a Expose SSL/TLS related config variables. 2009-08-06 23:05:53 +02:00
Jan Vidar Krey d45383fe4d Fix some asserts. 2009-08-04 04:58:55 +02:00
Jan Vidar Krey 1642b8dfbe Use new connection data structs. 2009-08-04 04:47:31 +02:00
Jan Vidar Krey ffd455474a Fix use of wrong event types. 2009-08-04 04:47:02 +02:00
Jan Vidar Krey 5baf277f5a Various fixes. 2009-08-04 04:46:24 +02:00
Jan Vidar Krey ab6eda2bbb Disabled SID allocation debug messages by default. 2009-08-04 03:38:12 +02:00
Jan Vidar Krey c17ae06b93 Added some memory debugging facilities to the adc_message structures. 2009-08-04 03:37:30 +02:00
Jan Vidar Krey faaa3d14e4 Dont clear the timer, instead set the TIMEOUT_IDLE when logging in (for now at least) 2009-08-04 01:07:12 +02:00
Jan Vidar Krey 9f784e808e Fix bug #70 - crash if client is in nat_ip zone, but does not provide an IP in the INF message. 2009-08-04 01:02:49 +02:00
Jan Vidar Krey b9adaa4f8b Fix libevent init. 2009-08-04 00:22:08 +02:00
Jan Vidar Krey 80dee0c020 Get rid of the event_base_set() calls. 2009-08-04 00:15:04 +02:00
Jan Vidar Krey eca0f931bd Fixes to shutdown... 2009-08-03 23:59:02 +02:00
Jan Vidar Krey fbe98d6011 Move the timeout handling to the connection object. 2009-08-03 21:57:18 +02:00
Jan Vidar Krey 4a5993ccc2 Added a generic SSL handshake mechanism. 2009-08-03 20:21:59 +02:00
Jan Vidar Krey a297c08bba Dont use DEBUG messages, instead a much lower level messages for SSL related debug messages. 2009-08-03 19:55:57 +02:00
Jan Vidar Krey 7229ad68ab Make sure we send with the same arguments again if SSL_write() fails with SSL_ERROR_WANT_READ. 2009-08-03 19:54:28 +02:00
Jan Vidar Krey 22f9be95d0 ensure we close the SSL connection if we get SSL_ERROR_ZERO_RETURN. 2009-08-03 18:20:08 +02:00
Jan Vidar Krey 4e43746c1b Moved the ipaddr object into the connection object. 2009-08-03 18:14:34 +02:00
Jan Vidar Krey 27c71a75ee Hook in the new connection work, also implemented some missing bits
and pieces of SSL.
SSL seems to work at some basic level, and is largely untested.
2009-08-03 17:25:52 +02:00
Jan Vidar Krey 1d363ed0b4 Expose the SSL_connect() and SSL_accept() functions. 2009-08-03 14:21:53 +02:00
Jan Vidar Krey 79cf5ee9db Some work on integrating OpenSSL. 2009-08-03 03:55:38 +02:00
Jan Vidar Krey 4666311516 Add a quit reason to the log messages printed by !log. 2009-08-02 22:53:25 +02:00
Jan Vidar Krey 0e1cd903da Make sure we create enough sids as there are socket descriptors. 2009-08-02 22:29:12 +02:00
Jan Vidar Krey 4931dc5dcb Added call functionality to figure out the maximum number of sockets (file descriptors) available on system. 2009-08-02 22:28:34 +02:00
Jan Vidar Krey 077bffd74f Fix capped whoip/history messages due to limit of 1024 bytes imposed wrongly on outgoing server generated messages. 2009-08-02 21:58:12 +02:00
Jan Vidar Krey cfb8a9f322 Started using the new connection abstraction. 2009-08-02 21:46:57 +02:00
Jan Vidar Krey 653cfb285e Started working on abstracting the connection data away from the user struct. 2009-08-02 21:37:55 +02:00
Jan Vidar Krey 9bd0286c01 Fix bug #3, sid allocation overflow. May lead to double SIDs being given out. 2009-08-02 21:04:10 +02:00
Jan Vidar Krey b78d48795b !history had a wrong help description. 2009-08-02 19:26:21 +02:00
Jan Vidar Krey 9b58ba6516 Use correct prefix for log command. 2009-07-28 02:17:57 +02:00
Jan Vidar Krey f322fbb197 Fix !log command, split it up into multiple messages, and allow for searches. 2009-07-28 02:02:19 +02:00
Jan Vidar Krey 80348044c3 Make sure history messages are not escaped. 2009-07-26 18:22:53 +02:00
Jan Vidar Krey 31d4b0f0b1 Fix history - do not cache private messages. 2009-07-26 15:08:34 +02:00
Jan Vidar Krey 10615a9a1a Whitespace 2009-07-26 06:32:15 +02:00
Jan Vidar Krey 7b44036480 print ip address when using whoip. 2009-07-26 06:30:48 +02:00
Jan Vidar Krey 444f991f44 Fix bug #44 - [Request] IP log in the memory 2009-07-26 06:03:43 +02:00
Jan Vidar Krey b125ffe3c1 Fix bug #52 - [Request] Chat history command 2009-07-26 05:23:56 +02:00
Jan Vidar Krey 76b84499bc Fix bug #46: [Request] A broadcast command.
Use !broadcast <message>
2009-07-26 04:47:43 +02:00
Jan Vidar Krey 6358c7f9cd Fix bug #45: [Request] Whoip command.
Rewrote patches from Zoltan to support ip ranges and multiple results per IP.
Needed to make sure IPv6 mapped IPv4 addresses were converted to proper IPv4 addresses after accept().
2009-07-26 04:31:36 +02:00
Jan Vidar Krey 041ce7a1fb Generalized the IP range and mask parsing code. 2009-07-26 03:56:55 +02:00
Jan Vidar Krey 78bb1d3527 Typo - compilefix. 2009-07-26 02:06:02 +02:00
Jan Vidar Krey 48f3cae22b Ensure we delete the global evtimer only if it is initialized. 2009-07-26 02:05:01 +02:00
Jan Vidar Krey 817250c528 Fix wrong #if to #ifdef 2009-07-26 01:53:53 +02:00
Jan Vidar Krey f176e790e2 Whitespace fixes. 2009-07-26 01:53:01 +02:00
Jan Vidar Krey 367871e476 Renamed all "struct user" to hub_user in order to resolve a naming conflict on OpenWRT.
Basically: sed -i 's/struct user/struct hub_user/g' `find -type f`
2009-07-26 01:47:17 +02:00
Jan Vidar Krey 2ac5cc19cb Removed plugin.h, not in use. 2009-07-26 01:39:16 +02:00
Jan Vidar Krey 6e5d28c2d4 Rework logging code to be able to turn it off completely. 2009-07-26 01:38:38 +02:00
Jan Vidar Krey 5048ff9ae5 Whitespace fixes. 2009-07-26 00:58:25 +02:00
Jan Vidar Krey 36a07e3f7e Reorganized sources slightly. 2009-07-25 20:05:27 +02:00
Jan Vidar Krey e281f61472 Add support for better pipelining of commands, in order to reduce the number of send() calls. 2009-07-25 03:54:59 +02:00
Jan Vidar Krey bb27ff617c Re-fix chat_is_privileged. 2009-07-25 03:33:36 +02:00
Jan Vidar Krey dc90245ade No need to store event mask in the user object since libevent already does it for us. 2009-07-25 03:26:59 +02:00
Jan Vidar Krey 0ec4913e15 Debug for send queue fix. 2009-07-25 03:24:06 +02:00
Jan Vidar Krey 61d639bfa2 Fix to hub_sendq_is_empty in order to prevent event_add calls. 2009-07-25 03:23:06 +02:00
Jan Vidar Krey adeaf23f9c Kept spinning in send() 2009-07-19 14:45:15 +02:00
Jan Vidar Krey 03d3ffd20f Fix socket error due to EWOULDBLOCK. 2009-07-19 14:29:33 +02:00
Jan Vidar Krey bbae2603b0 Make sure we detect send errors. 2009-07-19 03:39:11 +02:00
Jan Vidar Krey 5f0c84f46a Fix shutdown problem and reduce event_{add,del,set} calls. 2009-07-19 03:12:47 +02:00
Jan Vidar Krey b02618d19c Bad mistake - never added message to send queue. 2009-07-19 02:46:01 +02:00
Jan Vidar Krey 927faf70fc Re-enabled send queue fixes. This will more aggressively prevent unimportant messages (like searches) to be forwarded to slow clients that cannot swallow what is sent to it. This should reduce memory usage somewhat on really large hubs. 2009-07-19 02:31:23 +02:00
Jan Vidar Krey 4a173bf066 Fix some nasty bugs related to read/write events and timeout events.
This would have caused users not being able to log in, and in some cases
100% cpu usage.
2009-07-19 02:12:50 +02:00
Jan Vidar Krey abd097acf0 This is a somewhat risky patch, but it has been intended for quite some time:
Remove the libevent handler for write events, only use one common event handler for both reading and writing.
2009-07-09 17:03:31 +02:00
Jan Vidar Krey 3db2ec5e22 Added macros that can possibly make it easier to optimize functions using forced inlining and regparm. 2009-07-09 17:01:30 +02:00
Jan Vidar Krey e68cbd0cde Minor cleanups of old authentication stuff, and some documentation. 2009-07-03 01:29:04 +02:00
Jan Vidar Krey 98bffd93e9 Fix stupid crash on empty command. 2009-07-01 11:31:55 +02:00
Jan Vidar Krey e53119e92c Server did not answer due to wrong checks. 2009-07-01 09:50:46 +02:00
Jan Vidar Krey ee0ea5a427 Crash fix. 2009-06-30 22:15:08 +02:00
Jan Vidar Krey aa7be1dc4b Fix a command parse error output problem, plus some minor cleaning up. 2009-06-30 11:48:58 +02:00
Jan Vidar Krey 0ef248759c Minor cleanups.
Enabled !crash command if compiled with debug (not release).
2009-06-29 23:22:13 +02:00
Jan Vidar Krey 1f7f6a43f9 Fixed small memory leak. 2009-06-26 01:16:07 +02:00
Jan Vidar Krey 3cf005a08e Fixed command parsing for in hub user commands.
Added a framework for automatic syntax checks, and correct number
of arguments to commands.
2009-06-26 01:15:06 +02:00
Jan Vidar Krey f3c5fced47 Documentation 2009-06-25 22:05:40 +02:00
Jan Vidar Krey 9c49f07826 Fixed the format of the git revision.
Removed the product title.
2009-06-25 22:04:48 +02:00
Jan Vidar Krey 5f3f2d4f4d Autotest crash fix. 2009-06-25 17:31:39 +02:00
Jan Vidar Krey 7e3a26b0f3 Winsock fixes for shutdown() - typo 2009-06-25 17:07:21 +02:00
Jan Vidar Krey 9ebb38ae15 Winsock fixes for shutdown() 2009-06-25 17:05:59 +02:00
Jan Vidar Krey 75c4272a1b Fix problem with the !stats byte counter. 2009-06-25 09:29:23 +02:00
Jan Vidar Krey ddba669af0 Some basic work on getting bans working.
Basically now it can ban a user (nick + cid), it will be added to the
ban list temporarily, and will not be enabled if you restart the hub.
A banned user will automatically be kicked.

unban does not work correctly.
2009-06-23 23:16:09 +02:00
Jan Vidar Krey ca33461851 Suppress send() or recv() errors from logs. They happen quite often and are not considered errors. 2009-06-23 01:57:55 +02:00
Jan Vidar Krey 4abdc3edbd Cleanup read/write socket handling somewhat. 2009-06-23 01:57:26 +02:00
Jan Vidar Krey 90078ad4b6 Minor cleanups and some work to prepare SSL. 2009-06-23 01:56:37 +02:00
Jan Vidar Krey 3bd5c36455 SSL work. 2009-06-23 01:09:55 +02:00
Jan Vidar Krey 8f0943621e Dont set socket buffers. 2009-06-22 21:13:41 +02:00
Jan Vidar Krey 155350b61b Fixed crash bug #33 2009-06-22 21:05:02 +02:00
Jan Vidar Krey 1c58120c03 Oportunistic write. 2009-06-22 20:25:22 +02:00
Jan Vidar Krey 1d9acece34 Ensure we set a max recv and send buffer per user, and that it does not
exceed the one used internally by the application.
2009-06-22 19:50:10 +02:00
Jan Vidar Krey 57fd872f14 Added a state check for protocol negotiation.
Will be used to negotiate SSL.
2009-06-22 19:38:24 +02:00
Jan Vidar Krey ca7544df9b Cleanups. 2009-06-22 19:37:56 +02:00
Jan Vidar Krey c7777e2624 Added functions:
* net_get_recvbuf_size
* net_set_recvbuf_size
* net_get_sendbuf_size
* net_set_sendbuf_size

Did some minor cleanups.
2009-06-22 19:36:55 +02:00
Jan Vidar Krey b2d543d433 Started work on SSL 2009-06-22 18:44:07 +02:00
Jan Vidar Krey ff47281197 Added a generic way to reset last read/write variables. 2009-06-22 18:38:39 +02:00
Jan Vidar Krey ddc91d1640 Make sure we close stdout, stdin and stderr after forking to background in order to properly detach from the TTY. 2009-06-22 18:36:48 +02:00
Jan Vidar Krey e6e26a02e7 Added a known crash for the admin only to use if compiled with CRASH_DEBUG enabled. 2009-06-22 01:18:51 +02:00
Jan Vidar Krey ea3cd1bd90 Work on optimizing send(), to use fewer send function calls. 2009-06-21 14:21:34 +02:00
Jan Vidar Krey 7f24238ab5 Disable sendq debugging. 2009-06-20 22:46:11 +02:00
Jan Vidar Krey 1d2d4e74f6 !stats did not work. 2009-06-18 01:46:17 +02:00
root 5250fdaf57 Fix bug #38 - Pid file support. 2009-06-17 12:52:49 +02:00
Jan Vidar Krey 513ab422f2 Compile fix. 2009-06-01 14:34:23 +02:00
Jan Vidar Krey 0eb91763fa Potential crash fix. 2009-06-01 01:52:57 +02:00
Jan Vidar Krey 507f429035 Fix send queue issue. 2009-05-28 23:44:28 +02:00
Jan Vidar Krey b1ab64242e Renamed a function. 2009-05-28 01:48:31 +02:00
Jan Vidar Krey 8b90f79bac Work in progress on optimizing the send() function calls, to use as few as possible.
(Although, this does not enable that code).
2009-05-28 01:47:48 +02:00
Jan Vidar Krey 8f7cc0b7a7 Fixed MAX and MIN macros. 2009-05-28 01:45:36 +02:00
Jan Vidar Krey 860310caff Massive restructuring. 2009-05-26 21:05:06 +02:00
Jan Vidar Krey 8167d79f5a Large reorganizations of the code base. 2009-05-26 19:46:51 +02:00
Jan Vidar Krey 9706a0a501 Fix compiler warning (bug #30) 2009-05-24 21:07:16 +02:00
Jan Vidar Krey 9309c925d3 Started working on new pipelines for sending and receiving data.
This will be useful for the next step; SSL.

(NOTE: This code is very chatty about debug messages)
2009-05-19 22:57:50 +02:00
Jan Vidar Krey 9a3a5bc2de Make sure the send() signature is correct, buf should be const. 2009-05-19 22:36:45 +02:00
Jan Vidar Krey e382e24337 Fix crash due to user->hub deref in acl handling. 2009-05-19 16:40:14 +02:00
Jan Vidar Krey be4ff1d8cc Fix command parsing for in-hub commands. 2009-05-19 11:22:57 +02:00
Jan Vidar Krey aa18ac047d Crash fix 2009-05-19 09:38:57 +02:00
Jan Vidar Krey e120d5c76d Minor cleanup - this code crashes. 2009-05-19 09:15:14 +02:00
Jan Vidar Krey 6853e92f89 Move user_is_protected() and user_is_registered() into user.h/.c 2009-05-18 17:52:30 +02:00
Jan Vidar Krey 1dbf2640d2 More API fixes; remove implicit relationship between hub and user
in APIs.
2009-05-18 16:30:17 +02:00
Jan Vidar Krey caec28f63f Warn on bad UTF-8 in the configuration file. 2009-05-16 12:48:17 +02:00
Jan Vidar Krey 5ea5efb875 Smome user manager functions did not have the uman_ prefix. 2009-05-16 12:42:30 +02:00
Jan Vidar Krey 326fcc467c Moved the update_user_info code into user_update_info 2009-05-16 12:32:48 +02:00
Jan Vidar Krey 078470ce64 Minor cleanup 2009-05-16 12:25:28 +02:00
Jan Vidar Krey 82ac450b4b Fixed further memory leaks in autotests. 2009-05-16 04:03:00 +02:00
Jan Vidar Krey b4f24b21f9 Document bandwidth optimization potential. 2009-05-16 03:45:05 +02:00
Jan Vidar Krey 548867de10 Removed ADC_UDP_OPERATION code as it is not used or needed. on_kick is also gone. 2009-05-16 03:14:20 +02:00
Jan Vidar Krey 953db2dcbc Fixed some autotest memory leaks. 2009-05-16 03:06:14 +02:00
Jan Vidar Krey 604364ffa5 Fixed various code deprecations
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-05-15 18:45:26 +02:00
Jan Vidar Krey 6cc1af5671 Disable code to prevent warnings. 2009-05-15 16:52:55 +02:00
Jan Vidar Krey 15e2053699 Fix #28 - Request: +/! characters for command handling (FleetCommand) 2009-05-15 16:52:04 +02:00
Jan Vidar Krey df1e832a3c Started working on a red-black tree implementation, need to speed up
certain operations, such as SID to user lookups, and nick to user.
2009-05-01 17:07:38 +02:00
Jan Vidar Krey 4c4cb4fb36 Dont allow clients that do not support BASE
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-04-13 05:31:41 +02:00
Jan Vidar Krey e49f9d4d30 Added kick support
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-04-09 00:48:00 +02:00
Jan Vidar Krey e73a931243 Ensure we do not allow update of certain elements.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-27 11:12:50 +01:00
Jan Vidar Krey ae017af758 Log version and method of libevent()
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-24 23:32:39 +01:00
Jan Vidar Krey 26f1864c1f Don't crash if one specify '-S' or '-s' and an invalid configuration file. 2009-03-24 23:10:51 +01:00
Jan Vidar Krey c14fa3c3a9 Added more debugging info for mainloop bug #16 - In addition to small fixes to it.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-24 22:06:26 +01:00
Jan Vidar Krey 8af965c0ca Fixed utf8 parse issue.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-24 00:21:38 +01:00
Jan Vidar Krey 3a270564d2 Fixed up admin scripts.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 22:36:45 +01:00
Jan Vidar Krey 7aeb8651ba Fix bug #12: asserts in adc_msg_parse -> enabled strict utf8 parsing.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 21:47:05 +01:00
Jan Vidar Krey 13a8700554 Make sure logs do not output configured messages, but rather code names.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 15:47:54 +01:00
Jan Vidar Krey 5d5dda2f9b Always obtain IP address during accept(), and not do it later as a call to getsockname().
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 15:05:27 +01:00
Jan Vidar Krey 90abf64e3a Do explicit logging in src/message.c 2009-03-23 08:18:25 +01:00
Jan Vidar Krey e9915df87c remove timezone from logs, as it screws up on windows.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-21 04:11:14 +01:00
Jan Vidar Krey 1a1b5bdb38 Fixed nasty crash if a user sends a very large command to the hub.
Will overwrite heap memory.
Thanks to Toast who found this bug.

Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-21 02:58:53 +01:00
Jan Vidar Krey 7738baf38e Log configuration reloads.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:09:55 +01:00
Jan Vidar Krey 3c4c52d0f9 Log configuration reloads.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:08:24 +01:00
Jan Vidar Krey 76588fb1bd Don't print OK or ERROR when dumping config.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:05:25 +01:00
Jan Vidar Krey f9e95ec582 Minor cleanups
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:02:32 +01:00
Jan Vidar Krey 7985d4fed0 Cleanup credentials to string handling
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 18:54:05 +01:00
Jan Vidar Krey 77343d3c21 Remove duplicate access_denied checks.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 18:38:42 +01:00
Jan Vidar Krey f8d5b72a89 Cleanup command list, automatically generate help list depending on user credentials. 2009-03-20 18:37:38 +01:00
Jan Vidar Krey cf2994b570 Fix whitespace 2009-03-20 18:37:05 +01:00
Jan Vidar Krey b1f84b5b4a Cleanup logging.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 17:40:50 +01:00
Jan Vidar Krey 998c6c36ce Fix indentation 2009-03-20 16:40:59 +01:00
Jan Vidar Krey 4112b8111a Fix problems with clients sending multiple INF messages during the login stage. Only the first one will be checked. 2009-03-20 16:40:34 +01:00
Jan Vidar Krey 1929f2fae7 Fix bug #9 - net_get_peer_address() failure on CentOS/Xen configurations.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 15:07:52 +01:00
Jan Vidar Krey 0266c8bb9c Libevent fixes, and memory leak fix.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 17:57:04 +01:00
Jan Vidar Krey 5e3eabb677 Fix help message typo
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 01:30:46 +01:00
Jan Vidar Krey 669ab14022 Minor cleanups and stack reduction.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 01:27:34 +01:00
Jan Vidar Krey 1d491055c5 Do not use event_loopexit with new event loop.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 01:13:02 +01:00
Jan Vidar Krey 08351ea8e7 Merge branch 'event_queue_work' 2009-03-19 01:08:57 +01:00
Jan Vidar Krey e2ac690164 Reindented code. 2009-03-19 01:01:36 +01:00
Jan Vidar Krey 3bb563b432 Cleaned up command system somewhat. Added admin commands for reload and shutdown. 2009-03-19 00:55:11 +01:00
Jan Vidar Krey e10582fec2 Cleaned up command system slightly.
Added admin commands for reload and shutdown.
2009-03-19 00:53:44 +01:00
Jan Vidar Krey 84e278658b Libevent changes. 2009-03-19 00:43:43 +01:00
Jan Vidar Krey c671851be8 Cleaned up local event queue.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-18 02:56:49 +01:00
Jan Vidar Krey 4f8edfe9c8 Started working on an updated libevent and event queue implementation that would not require timers.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-18 02:32:00 +01:00
Jan Vidar Krey b8a0b45245 Dump configuration does not quote integer and boolean settings.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-16 14:40:17 +01:00
Jan Vidar Krey 1e6f0a392a Don't produce errors if a user is already logged in and trying again. 2009-03-16 12:46:29 +01:00
Jan Vidar Krey f396902c57 Do not use socket call to print IP address when we do have a cached representation. 2009-03-16 12:45:13 +01:00
Jan Vidar Krey acc697c33a Do not use socket call to print IP address when we do have a cached representation. 2009-03-16 12:43:45 +01:00
Jan Vidar Krey c29815ed62 Fixed compile warning. 2009-03-16 12:40:12 +01:00
Jan Vidar Krey e74d2be318 Be more explicit when queueing.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-16 12:33:10 +01:00
Jan Vidar Krey 58e2982675 Fixed bug #1: Excessive send queue bug (corruption of the offset variable).
Low priority messages are not relayed if soft limit send queue is reached.

Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-16 12:28:58 +01:00
Jan Vidar Krey 4797d5ee90 SendQ debugging
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-14 02:09:45 +01:00
Jan Vidar Krey 5a0f01d1ec Don't assert, rather print error messages.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 17:07:06 +01:00
Jan Vidar Krey f6af8cf389 Merged changes from github.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 16:54:39 +01:00
Jan Vidar Krey 7337d9e1d1 Ensure the send queue offset is calculated correctly in case of a partial queued write.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 16:51:27 +01:00
Jan Vidar Krey 5a978d361c Added asserts in case send queue size goes below zero.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 01:29:21 +01:00
Jan Vidar Krey 62d489130c Dont do double I4/I6 records.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 01:10:13 +01:00
Jan Vidar Krey 3aecd67134 Re-fix #5: Always provide IP-address to all users, not just for active clients.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 00:54:37 +01:00
Jan Vidar Krey a3520fbf09 Always provide IP address to all clients.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-12 16:24:44 +01:00
Jan Vidar Krey 18b0dc713f Better dynamic send queue handling for large hubs at the cost of more memory use.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-12 16:00:56 +01:00
Jan Vidar Krey 6cf6e38a60 Document config default variables correctly. 2009-03-12 16:00:31 +01:00
Jan Vidar Krey 9770eaf559 Ensure admins and super users are also listed as operators
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-10 11:13:26 +01:00
Jan Vidar Krey fcd532fd4b Wrong stats, peak rx never calculated.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-10 00:17:49 +01:00
Jan Vidar Krey dd5986c05f Better help message formatting. 2009-03-08 22:17:41 +01:00
Jan Vidar Krey 990fc31296 Added +myip command. 2009-03-08 17:11:10 +01:00
Jan Vidar Krey 6511761991 Fixed uptime output formatting to be less verbose. 2009-03-06 00:46:45 +01:00
Jan Vidar Krey c02c45f2d0 Escalate user_disconnect to an error in case of a "ghost login". I want to see them in logs. 2009-03-04 18:44:53 +01:00
Jan Vidar Krey d4c8b657bf Better "!stats"; can display peak and current bandwidth usage.
Network stats are now updated every minute, so that we have them handy for
printing in logs, or by issuing the !stats command.

Note: this checkin disables the once-per-hour stats logging.
I do not know wether or not that is useful functionality.
2009-03-04 18:36:45 +01:00
Jan Vidar Krey bcbcf89e38 Use proper formatting for uptime command. 2009-03-04 14:49:33 +01:00
Jan Vidar Krey 26766d8332 Optimization: Removed unneeded strlen() calls several places. 2009-03-02 19:41:49 +01:00
Jan Vidar Krey ac56e7a5b9 First git commit. 2009-02-19 17:14:09 +01:00