diff options
author | Linus Nordberg <linus@nordu.net> | 2011-03-21 13:33:22 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2011-03-21 13:33:22 +0100 |
commit | 217d24060890986d38848e0a9fd68ae6e7d1727f (patch) | |
tree | c198d491ae8d4da1965dd295d56e9d84eeee12e1 /lib/examples | |
parent | ab01223c4583cb5da93046b05baddc75a3b27bc8 (diff) |
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.
Diffstat (limited to 'lib/examples')
-rw-r--r-- | lib/examples/client-blocking.c | 14 | ||||
-rw-r--r-- | lib/examples/client-udp.conf | 10 | ||||
-rw-r--r-- | lib/examples/client.conf (renamed from lib/examples/client-tls.conf) | 17 |
3 files changed, 25 insertions, 16 deletions
diff --git a/lib/examples/client-blocking.c b/lib/examples/client-blocking.c index 718dc47..23cd674 100644 --- a/lib/examples/client-blocking.c +++ b/lib/examples/client-blocking.c @@ -23,13 +23,15 @@ blocking_client (const char *av1, const char *av2, int use_request_object_flag) struct rs_packet *req = NULL, *resp = NULL; struct rs_error *err = NULL; - if (rs_context_create (&h, "/usr/share/freeradius/dictionary")) + if (rs_context_create (&h)) return NULL; #if !defined (USE_CONFIG_FILE) { struct rs_peer *server; + if (rs_context_init_freeradius_dict (h, "/usr/share/freeradius/dictionary")) + goto cleanup; if (rs_conn_create (h, &conn, NULL)) goto cleanup; rs_conn_set_type (conn, RS_CONN_TYPE_UDP); @@ -42,12 +44,14 @@ blocking_client (const char *av1, const char *av2, int use_request_object_flag) if (rs_peer_set_secret (server, SECRET)) goto cleanup; } -#else +#else /* defined (USE_CONFIG_FILE) */ if (rs_context_read_config (h, av1)) goto cleanup; + if (rs_context_init_freeradius_dict (h, NULL)) + goto cleanup; if (rs_conn_create (h, &conn, av2)) goto cleanup; -#endif /* USE_CONFIG_FILE */ +#endif /* defined (USE_CONFIG_FILE) */ if (use_request_object_flag) { @@ -78,7 +82,9 @@ blocking_client (const char *av1, const char *av2, int use_request_object_flag) fprintf (stderr, "%s: no response\n", __func__); cleanup: - err = rs_err_conn_pop (conn); + err = rs_err_ctx_pop (h); + if (err == RSE_OK) + err = rs_err_conn_pop (conn); if (resp) rs_packet_destroy (resp); if (request) diff --git a/lib/examples/client-udp.conf b/lib/examples/client-udp.conf deleted file mode 100644 index 8578e8b..0000000 --- a/lib/examples/client-udp.conf +++ /dev/null @@ -1,10 +0,0 @@ -config blocking-udp { - type = "UDP" - timeout = 2 - retries = 2 - server { - hostname = "127.0.0.1" - service = "1820" - secret = "sikrit" - } -} diff --git a/lib/examples/client-tls.conf b/lib/examples/client.conf index 4d0904d..c9500e8 100644 --- a/lib/examples/client-tls.conf +++ b/lib/examples/client.conf @@ -1,9 +1,22 @@ -config blocking-tls { +dictionary = "/usr/share/freeradius/dictionary" + +realm blocking-udp { + type = "UDP" + timeout = 2 + retries = 2 + server { + hostname = "127.0.0.1" + service = "1820" + secret = "sikrit" + } +} + +realm blocking-tls { type = "TLS" timeout = 1 retries = 3 cacertfile = "/home/linus/nordberg-ca.crt" -# cacertfile = "/home/linus/p/moonshot/demoCA/cacert.pem" + #cacertfile = "/home/linus/p/moonshot/demoCA/cacert.pem" certfile = "/home/linus/p/moonshot/radsecproxy-test.crt" certkeyfile = "/home/linus/p/moonshot/radsecproxy-test.key" server { |