Commit Graph

28 Commits

Author SHA1 Message Date
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
5136525abc Added API to construct ADC messages with source and destination. 2012-10-02 23:59:11 +02:00
Jan Vidar Krey
a599b29b9d Added more complete API for dealing with ADC messages.
- Added a construct method which would take a fourcc and a source.
- Added an unescape function that would write into pre-allocated memory.
2012-09-28 15:49:46 +02:00
Blair Bonnett
3f777ce5e2 Fix msg_check_escapes() so it allows escaped backslashes.
If a valid escape (\n, \s, or \\) is found, increment the pointer
marking the start of the next search so we don't start looking at the
escaped character. The old behaviour was a problem for messages
containing slashes -- the escaped slash would be looked at in the next
pass and so the following character would be treated as an escape,
causing the message to be dropped for having "an invalid ADC escape".
2012-09-17 23:31:20 +12:00
Jan Vidar Krey
fb11589bb0 Drop all ADC messages containing illegal ADC escapes. 2012-08-07 11:55:29 +02:00
Jan Vidar Krey
cba0121574 ADCH++ had a security bug that allowed UCMD extension to be relayed.
uhub did not have this security bug since the hub did not advertise support for the
UCMD extension, but the message was still correctly relayed as specified in the
protocol specification.

However, this commit adds support for the UCMD extension, but only to the extent
that uhub will advertise it and uhub will also drop any such CMD message
generated by a client and will (currently) never issues a CMD message by itself.
2012-07-30 00:08:12 +02:00
Jan Vidar Krey
3aaabbc543 Fix issue with QUI messages being allowed through the hub 2012-05-06 23:09:02 +02:00
Tilka
d49127b507 changed all calls to assert() to uhub_assert() 2012-05-02 21:06:46 +02:00
Jan Vidar Krey
eee2636582 Added a chat only hub plugin that disables searching and connection setup.
This also deprecates the built-in chat_only configuration option.
If you need this functionality, then load the mod_chat_only plugin (if it is loaded then only operators
are able to search, connect, etc).
2012-01-09 20:58:19 +01:00
Jan Vidar Krey
318163c066 Added support for dynamic commands.
Dynamic commands are user commands that can be added dynamically to
the hub by a plugin.

The example plugin (mod_example.c) adds a !example command that when
invoked send a message to the user who invoked it.
2011-12-09 10:29:50 +01:00
Jan Vidar Krey
f13bcd8c28 Minor compile fixes. 2011-08-16 12:08:21 +02:00
Jan Vidar Krey
6becadc984 Compile fix for gcc. 2011-02-05 17:18:08 +01:00
Jan Vidar Krey
9b57279628 Many Visual C++ compile warnings and errors fixed. 2011-01-03 00:03:07 +01:00
Jan Vidar Krey
b3ed3a5526 Fix a silly invalid read operation 2010-05-28 15:23:44 +02:00
Jan Vidar Krey
076492f1b9 Fix some small memory leaks. 2010-04-21 18:34:55 +02:00
Jan Vidar Krey
b6fb2b41bd Fix a potential crash 2010-04-21 18:34:39 +02: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
00995a1946 Fix potential memory leaks and crashes. 2009-11-18 17:41:28 +01: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
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
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
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
6e5d28c2d4 Rework logging code to be able to turn it off completely. 2009-07-26 01:38:38 +02:00
Jan Vidar Krey
36a07e3f7e Reorganized sources slightly. 2009-07-25 20:05:27 +02:00