diff options
author | Linus Nordberg <linus@nordu.net> | 2010-10-01 00:14:05 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2010-10-01 00:14:05 +0200 |
commit | b1437bde86daa8826a8eeb1437cca11dda88283e (patch) | |
tree | 2dd210d9b424a8511a102e25d1abb9f78a9153fb /lib/examples | |
parent | 727af5678906c03eedff8d8262d39fad788973a6 (diff) |
WIP -- example client sending and receiving Access-Request/Accept.
Diffstat (limited to 'lib/examples')
-rw-r--r-- | lib/examples/client.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/examples/client.c b/lib/examples/client.c index d7e7270..1e9f209 100644 --- a/lib/examples/client.c +++ b/lib/examples/client.c @@ -6,7 +6,6 @@ #include <stdlib.h> #include <event2/event.h> #include "../libradsec.h" -#include "../debug.h" #define SECRET "sikrit" #define USER_NAME "bob" @@ -18,7 +17,7 @@ rsx_client (const char *srvname, int srvport) struct rs_handle *h; struct rs_connection *conn; struct rs_peer *server; - struct rs_packet *req; + struct rs_packet *req, *resp; if (rs_context_create (&h, "/usr/share/freeradius/dictionary")) return NULL; @@ -39,13 +38,19 @@ rsx_client (const char *srvname, int srvport) req = NULL; #if 0 - if (rs_packet_recv (conn, &resp)) + if (rs_packet_create_acc_request (conn, &req, USER_NAME, USER_PW)) return rs_conn_err_pop (conn); -#if defined (DEBUG) - rs_dump_packet (resp); -#endif + + if (rs_packet_send (conn, req, NULL)) + return rs_conn_err_pop (conn); + req = NULL; #endif + if (rs_packet_receive (conn, &resp)) + return rs_conn_err_pop (conn); + /* TODO: do something interesting with the response */ + rs_packet_destroy (resp); + rs_conn_destroy (conn); rs_context_destroy (h); return NULL; |