Commit Graph

816 Commits

Author SHA1 Message Date
Jan Vidar Krey cbe0b4e108 Potential crash fix for tools. 2014-07-29 17:35:14 +02:00
Jan Vidar Krey b85381c0f5 Added configuration options for TLS cipher suites and TLS versions. 2014-07-29 13:31:42 +02:00
Hector Martin 0426cb523a Fix: Rework SSL poll event handling to avoid infinite loops
The downstream connection callback must only be invoked when the event
that SSL requests for the connection to make progress has actually
occured. Otherwise, the downstream callback might do nothing but
re-queue an unrelated event (e.g. in user_net_io_want_write), and the
event loop comes around instantly while making no progress. Track the
SSL-requested events separately and deliver the required downstream
event when they fire.

Sample strace:

epoll_wait(0, {{EPOLLIN, {u32=96, u64=96}}}, 91, 10000) = 1
: net_ssl_callback in state tls_st_need_write calls cb NET_EVENT_WRITE
: User writes data, OpenSSL tries to write data
write(96, <snip>..., 170) = -1 EAGAIN (Resource temporarily unavailable)
: handle_openssl_error requests NET_EVENT_WRITE
epoll_ctl(0, EPOLL_CTL_MOD, 96, {EPOLLOUT, {u32=96, u64=96}}) = 0
: User callback then requests NET_EVENT_READ|NET_EVENT_WRITE
epoll_ctl(0, EPOLL_CTL_MOD, 96, {EPOLLIN|EPOLLOUT, {u32=96, u64=96}}) =
: Data available for *reading*
epoll_wait(0, {{EPOLLIN, {u32=96, u64=96}}}, 91, 10000) = 1
: net_ssl_callback in state tls_st_need_write calls cb NET_EVENT_WRITE
: again...
2014-07-29 12:09:07 +02:00
Jan Vidar Krey 9f78a2e85f Merge branch 'master' of github.com:janvidar/uhub 2014-05-30 15:06:23 +02:00
Jan Vidar Krey f472fc9424 Fix Clang compile warnings. 2014-05-14 21:00:42 +02:00
Jan Vidar Krey 7706e1cb8a Fix copyright year. 2014-05-14 11:39:18 +02:00
Jan Vidar Krey 24b98358d3 Remove usage of strcat, since OpenBSD does not like that. 2014-05-14 11:00:18 +02:00
Jan Vidar Krey 12ce522a6d Fix crashing autotest due to wrong initialization of the usermanager. 2014-05-14 11:00:14 +02:00
Jan Vidar Krey 5e06b46deb Fix compile warning due to missing newline at EOF. 2014-05-14 11:00:04 +02:00
Jan Vidar Krey a1f8c5bdbb Merge pull request #24 from tehnick/travis-ci
Add support of Travis CI.
2014-05-12 10:04:03 +02:00
Jan Vidar Krey 992aa8c4af Fix compile warning due to missing return value. 2014-05-12 00:05:07 +02:00
Jan Vidar Krey 60393ca9d0 Merge pull request #23 from tehnick/fix-clang
Fix build with Clang.
2014-05-12 00:01:50 +02:00
Boris Pek 89aef4ddaf Add support of Travis CI. 2014-05-11 16:07:38 +04:00
Boris Pek a38a82e318 Fix build with clang. 2014-05-11 15:22:14 +04:00
Jan Vidar Krey 3e8699ab24 Fix typo. 2014-05-10 01:08:32 +02:00
Jan Vidar Krey 3b38898045 Merge pull request #22 from tehnick/cmake-fix
Delete extra option from cmake rules.
2014-05-10 00:45:23 +02:00
Jan Vidar Krey 1b8762c7ee Merge pull request #20 from tehnick/cmake-sqlite3-fix
Fix cmake script for searching sqlite3 properly.
2014-05-10 00:44:28 +02:00
Boris Pek ce06269128 Delete extra option from cmake rules. 2014-05-10 02:03:04 +04:00
Boris Pek e75a759693 Fix cmake script for searching sqlite3 properly.
This is important for Debian, Ubuntu and other systems based on them. Details:
  https://wiki.debian.org/Multiarch
  https://wiki.ubuntu.com/MultiarchSpec

Have in mind that there are MIPS, ARM and many other architectures...
2014-05-08 22:52:10 +04:00
Jan Vidar Krey 7f2ffd7e1c Fix CMake/SQLite path issues on 64-bit Ubuntu 14.04 2014-05-08 13:33:45 +02:00
Jan Vidar Krey e2b0757f4a Improved flood control counting to strictly not allow more than
the given amount of messages in the configured interval.

The previous behavior allowed n+2 messages in the interval, due to
two off by one comparison rules.

In addition, if flooding is detected then each new message after the flooding
is detected will reset the interval timer, which means the client
cannot send another message until the timeout interval expires.
2014-05-08 13:30:09 +02:00
Jan Vidar Krey c26e8aaefe Merge pull request #19 from Tilka/master
Bunch of fixes
2013-09-10 01:38:29 -07:00
Tillmann Karras c295461f4e mod_topic: check argument for NULL
Better safe than sorry.
2013-09-10 08:30:27 +02:00
Tillmann Karras 8b442018a7 Fix struct mixup 2013-09-06 21:17:43 +02:00
Tillmann Karras fa782e3d2c Fix memleak 2013-09-06 21:17:31 +02:00
Tilka 591d0ba5bb Support certificate chains 2013-09-06 01:44:25 +02:00
Tilka a81757c483 Merge remote-tracking branch 'upstream/master' 2013-09-06 01:43:10 +02:00
Jan Vidar Krey cf9be754aa Rewrote the configuration file parser generator.
Converted from Perl to Python for a better
and cleaner object oriented design.
2013-04-22 21:58:06 +02:00
Jan Vidar Krey 22292e493e fixup! Fix for #193 - Can't build on OpenBSD 2013-04-17 22:40:04 +02:00
Jan Vidar Krey 419e8888d0 Fix for #193 - Can't build on OpenBSD 2013-04-16 00:24:42 +02:00
Jan Vidar Krey 73b4d51393 fixup! fixup! Updated copyright year. 2013-03-24 20:17:51 +01:00
Jan Vidar Krey 50b6221874 fixup! Updated copyright year. 2013-03-24 20:17:51 +01:00
Jan Vidar Krey bb5865d368 Fix double free() 2013-03-24 09:47:32 +01:00
Jan Vidar Krey 550740f715 Fix bug #198 - Timers could cause infinite loops
This could essentially happen due to time drift,
high load, or the process being put in sleep for a while.

The reason is that recurring timers could be added to the same time slot
as the timeslot being handled.
2013-03-24 09:47:32 +01:00
Jan Vidar Krey d73d213bc4 Remove the chat_is_privileged_plugin because it fails to compile 2013-03-23 22:47:32 +01:00
mimicmod 5672ba14e3 Added mod_chat_history_sqlite and mod_chat_is_privileged.
Use file=/path/to/db to specify the database file where chat history should be stored. Other config variables are the same as those for mod_chat_history.

Code merged adapted and merged from Mimicmod's repository:
https://github.com/mimicmod/uhub.git
2013-03-23 22:47:32 +01:00
Jan Vidar Krey cd5c4ee622 Optimize lookups by CID and nick.
This used to be a linear search O(n), but is now done
as a red-black tree O(log n) instead.

These operations can be further opimized with a hash-table
which would acheive near constant time lookups.
2013-03-23 22:11:05 +01:00
Jan Vidar Krey 52211a6bac Updated copyright year. 2013-03-22 20:00:40 +01:00
Jan Vidar Krey f25015927a Clean up white space. 2013-03-22 20:00:40 +01:00
Jan Vidar Krey 5835a06676 Removed redundant debug printf. 2013-03-22 20:00:40 +01:00
Jan Vidar Krey 6c55ae1146 Simple compile fix. 2013-03-22 20:00:40 +01:00
Jan Vidar Krey 2d6f69d299 Cleaned up usage of linked lists and added missing functionality.
- Added a list_remove_first() which is generally better than list_remove()
  provided you want to remove the first element.
- Added a list_append_list() to append and move all nodes from one list to
  another.
2013-03-22 20:00:40 +01:00
Jan Vidar Krey b81bb2cbd9 Cleaned up all list iterations, added macro named LIST_FOREACH.
Previously you would have to do something like this:

for (type foo = (type) list_get_first(list); foo; foo = (type) list_get_next(list)
{
    /* code */
}

Now, you can instead write this as:

LIST_FOREACH(type, foo, list,
{
    /* code */
})

Basically, boilerplate stuff including the casting is gone.
2013-03-22 00:58:14 +01:00
Jan Vidar Krey 50e720861e Detect if system is big endian (e.g. PPC64) 2013-02-20 00:30:02 +01:00
Jan Vidar Krey d48ef710d8 Added an ADC hub redirector written in python. 2013-02-10 22:56:36 +01:00
Jan Vidar Krey cfa210b3f3 Added a python version of the NMDC redirector. 2013-02-10 21:25:34 +01:00
Jan Vidar Krey f6f7c7a3a4 Make sure we compile release builds with NDEBUG defined (to disable asserts). 2013-02-05 22:44:31 +01:00
Jan Vidar Krey 1fbde2b0fd Re-factored the ADC client code to use the new connection establishment API. 2013-02-05 22:43:59 +01:00
Jan Vidar Krey 92b65a0e14 Created a connection establishment API.
This API provides transparent asynchronous DNS lookups
with both IPv4 and IPv6 support, and in addition will try
to connect to all addresses until one of them work.

This implements the "happy eyeballs" algorithm provided that the client supports IPv6
and that the DNS records provides both IPv6 and IPv4 addresses.
2013-02-05 22:40:20 +01:00
Jan Vidar Krey 4d438e1e90 Don't poll the connection monitor if there are no connections added.
This caused the backends to return an error code, which
in turn ended the mainloop. However, several other things
also might occur in the main loop, such as DNS lookups which
come prior to creating any connections that in turn would be monitored.
2013-02-05 22:38:13 +01:00