radsecproxy.git
13 years agoReady for libradsec-0.0.1. libradsec-0.0.1
Linus Nordberg [Thu, 24 Mar 2011 16:22:38 +0000 (17:22 +0100)]
Ready for libradsec-0.0.1.

13 years agoHarmonise with radsecproxy licensing.
Linus Nordberg [Thu, 24 Mar 2011 15:29:48 +0000 (16:29 +0100)]
Harmonise with radsecproxy licensing.

Dual license the library by adding GPL v2 or later.
Change the 2-clause BSD to a 3-clause.

13 years agoUpdate README and HACKING.
Linus Nordberg [Thu, 24 Mar 2011 15:26:55 +0000 (16:26 +0100)]
Update README and HACKING.

13 years agoDefine RS_FREERADIUS_DICT and use it when missing "dictionary" in config.
Linus Nordberg [Mon, 21 Mar 2011 13:58:52 +0000 (14:58 +0100)]
Define RS_FREERADIUS_DICT and use it when missing "dictionary" in config.

13 years agoMemory alloc/free cleanup for contexts.
Linus Nordberg [Mon, 21 Mar 2011 13:32:31 +0000 (14:32 +0100)]
Memory alloc/free cleanup for contexts.

(rs_context_create): Don't touch *ctx on failure.  Keep allocation and
zeroing of allocated memory together.

(rs_context_destroy): Fix typo.
(rs_context_destroy): Don't rs_free the context since it's allocated
with calloc.

13 years ago(rs_context_destroy): Use free() rather than rs_free() for realm->name.
Linus Nordberg [Mon, 21 Mar 2011 13:17:55 +0000 (14:17 +0100)]
(rs_context_destroy): Use free() rather than rs_free() for realm->name.

13 years agoAPI AND CONFIG CHANGE: rs_context_create() doesn't take DICT any more.
Linus Nordberg [Mon, 21 Mar 2011 12:33:22 +0000 (13:33 +0100)]
API AND CONFIG CHANGE: rs_context_create() doesn't take DICT any more.

Use rs_context_create() to read FreeRADIUS dictionary, possibly by
taking dict file from configuration file.

CONFIG CHANGE: s/config/realm/g.

13 years agoDon't touch TLS specific things w/o RS_ENABLE_TLS.
Linus Nordberg [Tue, 15 Mar 2011 09:43:22 +0000 (10:43 +0100)]
Don't touch TLS specific things w/o RS_ENABLE_TLS.

13 years agoVerify result in example program. Also, don't leak a package.
Linus Nordberg [Mon, 14 Mar 2011 14:20:52 +0000 (15:20 +0100)]
Verify result in example program.  Also, don't leak a package.

13 years ago[TLS] Do free SSL and SSL_CTX objects.
Linus Nordberg [Mon, 14 Mar 2011 14:20:17 +0000 (15:20 +0100)]
[TLS] Do free SSL and SSL_CTX objects.

13 years ago(rs_packet_destroy): Free unconditionally.
Linus Nordberg [Mon, 14 Mar 2011 12:32:59 +0000 (13:32 +0100)]
(rs_packet_destroy): Free unconditionally.

13 years agoRemove struct rs_attr and all use of it.
Linus Nordberg [Mon, 14 Mar 2011 12:27:39 +0000 (13:27 +0100)]
Remove struct rs_attr and all use of it.

A new API for attributes will be added once we've decided how to deal
with RADIUS packets internally.  For now, removing the half baked
wrapping seems more sensible than trying to free rs_attr objects and
their VALUE_PAIR's.

13 years agoAdd short blurb about bug hunting in HACKING.
Linus Nordberg [Mon, 14 Mar 2011 12:23:24 +0000 (13:23 +0100)]
Add short blurb about bug hunting in HACKING.

13 years agoAvoid potential double free.
Linus Nordberg [Sun, 13 Mar 2011 23:45:18 +0000 (00:45 +0100)]
Avoid potential double free.

(udp_init): Set conn.rev = NULL in fault case.

13 years ago[UDP] Free the event base _after_ freeing the read and write events.
Linus Nordberg [Sun, 13 Mar 2011 23:44:00 +0000 (00:44 +0100)]
[UDP] Free the event base _after_ freeing the read and write events.

Duh!

13 years agoRemove unused resp_msg from struct request.
Linus Nordberg [Sun, 13 Mar 2011 23:27:54 +0000 (00:27 +0100)]
Remove unused resp_msg from struct request.

13 years agoAdd rs_request_get_reqmsg() and update documentation.
Linus Nordberg [Sun, 13 Mar 2011 23:26:05 +0000 (00:26 +0100)]
Add rs_request_get_reqmsg() and update documentation.

13 years agoDon't free connection on error, just close it.
Linus Nordberg [Sun, 13 Mar 2011 23:22:41 +0000 (00:22 +0100)]
Don't free connection on error, just close it.

13 years ago[UDP] Free read/write events when destroying connection.
Linus Nordberg [Sun, 13 Mar 2011 14:30:36 +0000 (15:30 +0100)]
[UDP] Free read/write events when destroying connection.

13 years agoDon't double free in example code.
Linus Nordberg [Sun, 13 Mar 2011 14:28:17 +0000 (15:28 +0100)]
Don't double free in example code.

13 years agoChange user name in example code.
Linus Nordberg [Sun, 13 Mar 2011 14:28:06 +0000 (15:28 +0100)]
Change user name in example code.

13 years agoFormatting changes.
Linus Nordberg [Sun, 13 Mar 2011 14:27:48 +0000 (15:27 +0100)]
Formatting changes.

13 years agoAdd Doxygen documentation for public API.
Linus Nordberg [Sun, 13 Mar 2011 14:26:31 +0000 (15:26 +0100)]
Add Doxygen documentation for public API.

13 years agoUpdate README and HACKING.
Linus Nordberg [Sat, 12 Mar 2011 13:43:36 +0000 (14:43 +0100)]
Update README and HACKING.

13 years agoMerge branch 'udp' into libradsec.
Linus Nordberg [Sat, 12 Mar 2011 11:41:19 +0000 (12:41 +0100)]
Merge branch 'udp' into libradsec.

13 years agoFix crash bug in _rs_peer_destroy(). udp
Linus Nordberg [Sat, 12 Mar 2011 00:03:43 +0000 (01:03 +0100)]
Fix crash bug in _rs_peer_destroy().

Don't expect a peer to always have a connection.

13 years agoFree the realm name which is strdup'd when config is read.
Linus Nordberg [Fri, 11 Mar 2011 12:19:39 +0000 (13:19 +0100)]
Free the realm name which is strdup'd when config is read.

13 years agoDo free the connection object.
Linus Nordberg [Fri, 11 Mar 2011 12:19:01 +0000 (13:19 +0100)]
Do free the connection object.

13 years agoHandle an ENOMEM case in conf.c.
Linus Nordberg [Fri, 11 Mar 2011 12:18:44 +0000 (13:18 +0100)]
Handle an ENOMEM case in conf.c.

13 years agoRemove -Werror since we still have some warnings in radsecproxy.
Linus Nordberg [Thu, 10 Mar 2011 09:56:08 +0000 (10:56 +0100)]
Remove -Werror since we still have some warnings in radsecproxy.

13 years ago[UDP] Don't crash on second packet.
Linus Nordberg [Thu, 10 Mar 2011 07:08:32 +0000 (08:08 +0100)]
[UDP] Don't crash on second packet.

[UDP] Set the user_data member for the write callback in
rs_packet_send() -- the one from udp_init() doesn't do much good at
this point.

13 years agoDon't miscompile without --enable-tls.
Linus Nordberg [Wed, 9 Mar 2011 23:20:25 +0000 (00:20 +0100)]
Don't miscompile without --enable-tls.

Include err.h and debug.h even w/o RS_ENABLE_TLS.

13 years agoDisable DEBUG.
Linus Nordberg [Wed, 9 Mar 2011 23:16:59 +0000 (00:16 +0100)]
Disable DEBUG.

13 years agoChange default configuration to do RadSec rather than UDP.
Linus Nordberg [Wed, 9 Mar 2011 22:10:08 +0000 (23:10 +0100)]
Change default configuration to do RadSec rather than UDP.

13 years agoGet UDP working.
Linus Nordberg [Wed, 9 Mar 2011 22:09:26 +0000 (23:09 +0100)]
Get UDP working.

For UDP, activate retransmit timer before receiving rather than
sending makes the event loop break nicely after sending a message
(which is important for blocking mode).  Not quite sure that this is
really accurate wrt to retransmission timing though but it should do
for now.

For UDP, set the user_data member for the read callback in
rs_conn_receive_packet -- the one from udp_init() doesn't do much good
now.

For UDP, implement receiving message.

Add compat_recv().

13 years agoDon't add Message-Authenticator more than once.
Linus Nordberg [Wed, 9 Mar 2011 18:51:59 +0000 (19:51 +0100)]
Don't add Message-Authenticator more than once.

Retransmiting the packet showed that we added another
Message-Authenticator attribute every time we sent it.

13 years agoFormatting changes.
Linus Nordberg [Wed, 9 Mar 2011 18:49:54 +0000 (19:49 +0100)]
Formatting changes.

13 years agoRemove superfluous assignment.
Linus Nordberg [Wed, 9 Mar 2011 12:12:20 +0000 (13:12 +0100)]
Remove superfluous assignment.

This is done in rs_packet_create().

13 years agoAdd missing header files.
Linus Nordberg [Wed, 9 Mar 2011 11:48:00 +0000 (12:48 +0100)]
Add missing header files.

13 years agoUse retransmisison timer in request object.
Linus Nordberg [Wed, 9 Mar 2011 09:24:22 +0000 (10:24 +0100)]
Use retransmisison timer in request object.

13 years agoAdd retransmission timer support (UDP).
Linus Nordberg [Wed, 9 Mar 2011 09:18:06 +0000 (10:18 +0100)]
Add retransmission timer support (UDP).

13 years agoAdd RSE_DISCO.
Linus Nordberg [Wed, 9 Mar 2011 09:16:27 +0000 (10:16 +0100)]
Add RSE_DISCO.

13 years agoRename and move around a few helper functions.
Linus Nordberg [Wed, 9 Mar 2011 09:14:20 +0000 (10:14 +0100)]
Rename and move around a few helper functions.

13 years agoDon't make UDP write event persistant.
Linus Nordberg [Wed, 9 Mar 2011 09:10:04 +0000 (10:10 +0100)]
Don't make UDP write event persistant.

rs_packet_send() adds the event again when there's a packet to send
and the write callback does the same if it doesn't drain the queue.

13 years agoAdd (disabled) linkage to libefence.
Linus Nordberg [Tue, 8 Mar 2011 13:29:39 +0000 (14:29 +0100)]
Add (disabled) linkage to libefence.

13 years agoZap a double free.
Linus Nordberg [Tue, 8 Mar 2011 13:29:09 +0000 (14:29 +0100)]
Zap a double free.

13 years agoUpdate rs_err_msg() prototype.
Linus Nordberg [Tue, 8 Mar 2011 13:27:59 +0000 (14:27 +0100)]
Update rs_err_msg() prototype.

Also, rename enum rs_err_code to not collide with the function named
the same.

13 years agoexamples/client-blocking: pull out the error before freeing conn.
Linus Nordberg [Tue, 8 Mar 2011 13:24:30 +0000 (14:24 +0100)]
examples/client-blocking: pull out the error before freeing conn.

13 years agoTimeout implemented in request objects, supported by TCP.
Linus Nordberg [Tue, 8 Mar 2011 12:37:46 +0000 (13:37 +0100)]
Timeout implemented in request objects, supported by TCP.

TODO: UDP.

13 years agoClean up struct rs_error somewhat.
Linus Nordberg [Tue, 8 Mar 2011 12:32:10 +0000 (13:32 +0100)]
Clean up struct rs_error somewhat.

More to be done here!

13 years agoDon't return -1 to user but rather an error code.
Linus Nordberg [Tue, 8 Mar 2011 12:20:20 +0000 (13:20 +0100)]
Don't return -1 to user but rather an error code.

NOTE: Changes rs_conn_receive_packet() and rs_packet_send() only.

13 years agoCrash bug. Zap a double free.
Linus Nordberg [Tue, 8 Mar 2011 09:51:41 +0000 (10:51 +0100)]
Crash bug.  Zap a double free.

The config object owns peer.secret so don't free it.

13 years agoexamples/client-blocking.c: Clean up and improve error handling.
Linus Nordberg [Mon, 7 Mar 2011 14:26:12 +0000 (15:26 +0100)]
examples/client-blocking.c: Clean up and improve error handling.

13 years agoRequests are now high level, i.e. not for user doing the dispatching.
Linus Nordberg [Mon, 7 Mar 2011 14:25:33 +0000 (15:25 +0100)]
Requests are now high level, i.e. not for user doing the dispatching.

13 years agoMove verification of response packets up to a level where it makes sense.
Linus Nordberg [Mon, 7 Mar 2011 14:23:40 +0000 (15:23 +0100)]
Move verification of response packets up to a level where it makes sense.

Replace the user_dispatch_flag on connections with
conn_user_dispatch_p().

Remove the 'original' member from packet and instead have an upper
layer verify.

Rename packet valid_flag --> received_flag to reflect that we don't
verify.

Move _close_conn() --> conn_close().

Move packet flags into a single unsigned int, for portability.

(_read_packet): Don't verify packet.

(rs_conn_receive_packet): Don't touch PKT_OUT if there isn't a packet.

(rs_conn_receive_packet): Verify packet using packet_verify_response().

13 years agoFormatting changes.
Linus Nordberg [Mon, 7 Mar 2011 08:53:40 +0000 (09:53 +0100)]
Formatting changes.

13 years agoRemove lib/radsec.h.
Linus Nordberg [Mon, 7 Mar 2011 08:38:01 +0000 (09:38 +0100)]
Remove lib/radsec.h.

1. Two radsec.h is icky.
2. Its contents fit nicely in send.c.

13 years agoMove event_set_timeout --> tcp_set_connect_timeout.
Linus Nordberg [Sun, 6 Mar 2011 16:08:41 +0000 (17:08 +0100)]
Move event_set_timeout --> tcp_set_connect_timeout.

13 years agorequest: Save callers user_data and do invoke callers callbacks.
Linus Nordberg [Sun, 6 Mar 2011 16:04:54 +0000 (17:04 +0100)]
request: Save callers user_data and do invoke callers callbacks.

13 years agoReplace asserts with EINVAL checks.
Linus Nordberg [Sun, 6 Mar 2011 15:44:43 +0000 (16:44 +0100)]
Replace asserts with EINVAL checks.

13 years agoRestructure code, moving most code out of packet.c
Linus Nordberg [Sun, 6 Mar 2011 14:53:58 +0000 (15:53 +0100)]
Restructure code, moving most code out of packet.c

Also, move copyright notice out of COPYING and into every file.

13 years agoUDP w/o bufferevents, part 1.
Linus Nordberg [Sun, 6 Mar 2011 13:46:57 +0000 (14:46 +0100)]
UDP w/o bufferevents, part 1.

Sending, no retransmitting and no receiving.

13 years agoCosmetic changes.
Linus Nordberg [Sun, 6 Mar 2011 13:44:27 +0000 (14:44 +0100)]
Cosmetic changes.

13 years agoDon't free config object until we destroy the context.
Linus Nordberg [Sun, 6 Mar 2011 13:30:14 +0000 (14:30 +0100)]
Don't free config object until we destroy the context.

13 years agoDon't free config object until we destroy the context.
Linus Nordberg [Sun, 6 Mar 2011 13:30:14 +0000 (14:30 +0100)]
Don't free config object until we destroy the context.

13 years agoRevert 578e3551 -- double free in second invocation of dict_free().
Linus Nordberg [Fri, 4 Mar 2011 12:27:57 +0000 (13:27 +0100)]
Revert 578e3551 -- double free in second invocation of dict_free().

13 years agoDo _copy_ the strings from the config object.
Linus Nordberg [Fri, 4 Mar 2011 12:00:42 +0000 (13:00 +0100)]
Do _copy_ the strings from the config object.

13 years agoDo free the config object.
Linus Nordberg [Fri, 4 Mar 2011 11:51:42 +0000 (12:51 +0100)]
Do free the config object.

13 years ago_evlog_cb: Use rs_debug().
Linus Nordberg [Sun, 6 Mar 2011 12:39:54 +0000 (13:39 +0100)]
_evlog_cb: Use rs_debug().

13 years agoRevert 578e3551 -- double free in second invocation of dict_free().
Linus Nordberg [Fri, 4 Mar 2011 12:27:57 +0000 (13:27 +0100)]
Revert 578e3551 -- double free in second invocation of dict_free().

13 years agoDo _copy_ the strings from the config object.
Linus Nordberg [Fri, 4 Mar 2011 12:00:42 +0000 (13:00 +0100)]
Do _copy_ the strings from the config object.

13 years agoDo free the config object.
Linus Nordberg [Fri, 4 Mar 2011 11:51:42 +0000 (12:51 +0100)]
Do free the config object.

13 years ago_init_evb: Don't crash on socket errors.
Linus Nordberg [Thu, 3 Mar 2011 15:05:48 +0000 (16:05 +0100)]
_init_evb: Don't crash on socket errors.

13 years agoCorrect an error code.
Linus Nordberg [Thu, 3 Mar 2011 13:02:40 +0000 (14:02 +0100)]
Correct an error code.

13 years agoCorrect an error string.
Linus Nordberg [Thu, 3 Mar 2011 10:50:35 +0000 (11:50 +0100)]
Correct an error string.

13 years agoBe consistent with naming of formal arguments.
Linus Nordberg [Wed, 2 Mar 2011 09:23:12 +0000 (10:23 +0100)]
Be consistent with naming of formal arguments.

13 years agoError handling cleanup 3.
Linus Nordberg [Tue, 1 Mar 2011 12:56:49 +0000 (13:56 +0100)]
Error handling cleanup 3.

Split timeout errors in connecting and I/O.

13 years agoError handling cleanup 2.
Linus Nordberg [Tue, 1 Mar 2011 12:53:34 +0000 (13:53 +0100)]
Error handling cleanup 2.

RSE_NOSYS doesn't need a string.

13 years agoError handling cleanup
Linus Nordberg [Tue, 1 Mar 2011 12:51:35 +0000 (13:51 +0100)]
Error handling cleanup

Remove RSE_SOME_ERROR.
rs_tls_init: Push SSL error stack on libradsec error stack.

13 years agors_context_destroy: Free freeradius dictionary.
Linus Nordberg [Tue, 1 Mar 2011 10:02:45 +0000 (11:02 +0100)]
rs_context_destroy: Free freeradius dictionary.

13 years agoDon't have the connection freeing peers -- it's the contexts responsibility.
Linus Nordberg [Tue, 1 Mar 2011 00:00:47 +0000 (01:00 +0100)]
Don't have the connection freeing peers -- it's the contexts responsibility.

Also, let _rs_peer_destroy() free secret.

13 years agors_request_send: Check arguments and that we have a packet to send.
Linus Nordberg [Mon, 28 Feb 2011 23:41:34 +0000 (00:41 +0100)]
rs_request_send: Check arguments and that we have a packet to send.

13 years agoAdd RSE_INVAL.
Linus Nordberg [Mon, 28 Feb 2011 23:40:56 +0000 (00:40 +0100)]
Add RSE_INVAL.

13 years agoAdd asserts to request object.
Linus Nordberg [Mon, 28 Feb 2011 21:39:29 +0000 (22:39 +0100)]
Add asserts to request object.

13 years agoUpdate status in HACKING.
Linus Nordberg [Mon, 28 Feb 2011 16:49:49 +0000 (17:49 +0100)]
Update status in HACKING.

13 years agoMake tests run again.
Linus Nordberg [Mon, 28 Feb 2011 16:49:29 +0000 (17:49 +0100)]
Make tests run again.

NOTE: 2 exceptions ATM.

13 years agoRemove last trace of server and client in API.
Linus Nordberg [Mon, 28 Feb 2011 13:50:04 +0000 (14:50 +0100)]
Remove last trace of server and client in API.

13 years agoRename relevant functions to reflect authn as opposed to authz.
Linus Nordberg [Mon, 28 Feb 2011 12:15:13 +0000 (13:15 +0100)]
Rename relevant functions to reflect authn as opposed to authz.

Also add a "bare" create request function.

13 years agoAPI changes: rs_client* --> rs_peer.
Linus Nordberg [Mon, 28 Feb 2011 10:46:14 +0000 (11:46 +0100)]
API changes: rs_client* --> rs_peer.

Move peer (former server) things to new file peer.c.
Update examples.

13 years agoCosmetic header file changes.
Linus Nordberg [Mon, 28 Feb 2011 09:55:41 +0000 (10:55 +0100)]
Cosmetic header file changes.

13 years agoTime out on connect and break event loop on errors.
Linus Nordberg [Fri, 25 Feb 2011 13:20:19 +0000 (14:20 +0100)]
Time out on connect and break event loop on errors.

13 years agoAPI change. Have the request object create its own request message.
Linus Nordberg [Fri, 25 Feb 2011 12:05:46 +0000 (13:05 +0100)]
API change.  Have the request object create its own request message.

13 years agoGet rid of loopbreak as a mean for signalling successful packet handling.
Linus Nordberg [Fri, 25 Feb 2011 11:48:26 +0000 (12:48 +0100)]
Get rid of loopbreak as a mean for signalling successful packet handling.

In blocking mode, breaking the event loop with loopbreak will probably
be needed for exceptions like timeout so we shouldn't use it for
breaking the loop and signalling success.

In the user callbaks used in blocking mode (_rcb and _wcb), disable
read and write events on the event buffer.  This will stop the loop.
Also, set a flag in the packet struct to signal success.

In the "low level callbacks" (_read_cb and _write_cb), enable read or
write, accordingly.

13 years agoConfig file changes and small API changes.
Linus Nordberg [Thu, 24 Feb 2011 21:25:22 +0000 (22:25 +0100)]
Config file changes and small API changes.

'timeout' and 'tries' move from 'server' stanza to top.  'tries' is
now 'retries'.
Moving around in internal data structs, making struct peer strictly config.
Bug fixes in configuration code.
Adding some more cleanup code, freeing allocated memory (still not done!).

13 years agoSplit example config in two files.
Linus Nordberg [Thu, 24 Feb 2011 20:57:46 +0000 (21:57 +0100)]
Split example config in two files.

13 years agoSplit example config in two files.
Linus Nordberg [Thu, 24 Feb 2011 20:56:47 +0000 (21:56 +0100)]
Split example config in two files.

13 years agoReport SSL errors with error string rather than an integer.
Linus Nordberg [Sun, 20 Feb 2011 16:17:54 +0000 (17:17 +0100)]
Report SSL errors with error string rather than an integer.

13 years agoPush an ENOMEM error on the connection rather than the context.
Linus Nordberg [Sun, 20 Feb 2011 15:44:58 +0000 (16:44 +0100)]
Push an ENOMEM error on the connection rather than the context.

13 years agoHandle another ENOMEM case.
Linus Nordberg [Sun, 20 Feb 2011 15:42:51 +0000 (16:42 +0100)]
Handle another ENOMEM case.

13 years agoImprove protocol robustness and invoke user callbacks.
Linus Nordberg [Sat, 19 Feb 2011 17:55:51 +0000 (18:55 +0100)]
Improve protocol robustness and invoke user callbacks.

All aborts are removed, as well as all asserts which aren't
programming errors.

When an invalid packet is received, the connection is closed, as per
draft-ietf-radext-tcp-transport-08 (2.6.4).

Use new rs_debug() macro rather than fprintf() for debug printouts.

Coding style overhaul.