radsecproxy.git
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 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 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.

13 years agoUse AM_CFLAGS when setting CFLAGS.
Linus Nordberg [Sat, 19 Feb 2011 17:22:39 +0000 (18:22 +0100)]
Use AM_CFLAGS when setting CFLAGS.

13 years agoMerge branch 'libradsec' of /tmp/radsecproxy into libradsec
Linus Nordberg [Tue, 15 Feb 2011 14:02:46 +0000 (15:02 +0100)]
Merge branch 'libradsec' of /tmp/radsecproxy into libradsec

13 years agoAdd comments.
Linus Nordberg [Tue, 15 Feb 2011 14:02:41 +0000 (15:02 +0100)]
Add comments.

13 years agoInclude debug.h regardless if DEBUG -- rs_debug needs to be declared.
Linus Nordberg [Tue, 15 Feb 2011 14:01:15 +0000 (15:01 +0100)]
Include debug.h regardless if DEBUG -- rs_debug needs to be declared.

13 years agoMake autogen.sh actually work -- were missing ltmain.sh.
Linus Nordberg [Tue, 15 Feb 2011 13:49:47 +0000 (14:49 +0100)]
Make autogen.sh actually work -- were missing ltmain.sh.

Add Automake/Libtool files to biuld-aux and set AC_CONFIG_AUX_DIR.

Use LT_INIT rather than deprecated AC_PROG_LIBTOOL.

13 years agoDo build examples with -Wall -g.
Linus Nordberg [Fri, 4 Feb 2011 12:59:58 +0000 (13:59 +0100)]
Do build examples with -Wall -g.

13 years agoAdd comments on some error codes.
Linus Nordberg [Fri, 4 Feb 2011 12:59:40 +0000 (13:59 +0100)]
Add comments on some error codes.

13 years agoInitialize pointer in example program before trusting it.
Linus Nordberg [Fri, 4 Feb 2011 12:59:19 +0000 (13:59 +0100)]
Initialize pointer in example program before trusting it.

13 years agoHandle more read, write and packet verification errors.
Linus Nordberg [Fri, 4 Feb 2011 12:54:15 +0000 (13:54 +0100)]
Handle more read, write and packet verification errors.

Still some aborts left.

13 years agoAdd and use rs_debug() instead of fprintf to stderr.
Linus Nordberg [Fri, 4 Feb 2011 12:44:19 +0000 (13:44 +0100)]
Add and use rs_debug() instead of fprintf to stderr.

13 years agoDon't consume sent packets.
Linus Nordberg [Fri, 4 Feb 2011 12:29:12 +0000 (13:29 +0100)]
Don't consume sent packets.

A sent packet is a fine thing to have when you're verifying the
Response Authenticator.  We could solve this by having an upper layer
saving only the Request Authenticator somewhere instead the whole
packet and we might just do that at some point which is not now.

13 years agoPick usage of struct request in example code at run time.
Linus Nordberg [Wed, 2 Feb 2011 14:19:40 +0000 (15:19 +0100)]
Pick usage of struct request in example code at run time.

13 years agoReorder function prototypes.
Linus Nordberg [Wed, 2 Feb 2011 09:55:27 +0000 (10:55 +0100)]
Reorder function prototypes.

13 years agoDisable some debug printout in tests.
Linus Nordberg [Wed, 2 Feb 2011 09:54:54 +0000 (10:54 +0100)]
Disable some debug printout in tests.

13 years agoReplace some code for debug printouts.
Linus Nordberg [Wed, 2 Feb 2011 09:54:11 +0000 (10:54 +0100)]
Replace some code for debug printouts.

13 years agoUpdate release info to avoid confusion.
Linus Nordberg [Tue, 1 Feb 2011 14:50:25 +0000 (15:50 +0100)]
Update release info to avoid confusion.

13 years agoRemove unused Makefile.
linus [Fri, 21 Jan 2011 15:35:54 +0000 (16:35 +0100)]
Remove unused Makefile.

13 years agoNew versions of config.guess and config.sub.
linus [Fri, 21 Jan 2011 15:35:07 +0000 (16:35 +0100)]
New versions of config.guess and config.sub.

13 years agoGenerate tests/Makefile.
linus [Fri, 21 Jan 2011 15:33:43 +0000 (16:33 +0100)]
Generate tests/Makefile.

13 years agoCompile with -Wall and -g.
linus [Fri, 21 Jan 2011 15:33:26 +0000 (16:33 +0100)]
Compile with -Wall and -g.

13 years agoSome more UDP tests.
linus [Fri, 21 Jan 2011 15:32:28 +0000 (16:32 +0100)]
Some more UDP tests.

13 years agoFollow API changes.
linus [Fri, 21 Jan 2011 15:31:13 +0000 (16:31 +0100)]
Follow API changes.

13 years agoAPI breakage -- rename rs_packet_create_acc_request().
linus [Fri, 21 Jan 2011 15:30:17 +0000 (16:30 +0100)]
API breakage -- rename rs_packet_create_acc_request().

13 years agoFix bug where one or two stanzas in a config file would be but not more.
linus [Fri, 21 Jan 2011 12:09:00 +0000 (13:09 +0100)]
Fix bug where one or two stanzas in a config file would be but not more.

Also restructure error handling in rs_context_create().

13 years agoCosmetic changes to conf.c.
linus [Thu, 20 Jan 2011 16:29:42 +0000 (17:29 +0100)]
Cosmetic changes to conf.c.

13 years agoImprove error message.
linus [Thu, 20 Jan 2011 16:28:12 +0000 (17:28 +0100)]
Improve error message.

Differentiate between an invalid connection type string in config file
when parsing and unknown connection type (number) when connecting.

13 years agoRename external functions in UDP test files.
linus [Thu, 20 Jan 2011 09:02:52 +0000 (10:02 +0100)]
Rename external functions in UDP test files.

13 years agoAdd basic testing code.
linus [Wed, 19 Jan 2011 15:47:37 +0000 (16:47 +0100)]
Add basic testing code.

13 years agoCosmetic changes.
linus [Mon, 17 Jan 2011 15:27:57 +0000 (16:27 +0100)]
Cosmetic changes.

13 years agoUpdate copyright years.
linus [Mon, 17 Jan 2011 15:25:29 +0000 (16:25 +0100)]
Update copyright years.

13 years agoUse standard RadSec port in example config.
Linus Nordberg [Thu, 11 Nov 2010 14:12:15 +0000 (15:12 +0100)]
Use standard RadSec port in example config.