WPS UPnP: Throttle WLANEvent notifications to 5 per second
[libeap.git] / radius_example / radius_example.c
index 1b27efc..fd7dbae 100644 (file)
@@ -39,12 +39,13 @@ static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
 /* Process the RADIUS frames from Authentication Server */
 static RadiusRxResult receive_auth(struct radius_msg *msg,
                                   struct radius_msg *req,
-                                  u8 *shared_secret, size_t shared_secret_len,
+                                  const u8 *shared_secret,
+                                  size_t shared_secret_len,
                                   void *data)
 {
        /* struct radius_ctx *ctx = data; */
        printf("Received RADIUS Authentication message; code=%d\n",
-              msg->hdr->code);
+              radius_msg_get_hdr(msg)->code);
 
        /* We're done for this example, so request eloop to terminate. */
        eloop_terminate();
@@ -74,7 +75,6 @@ static void start_example(void *eloop_ctx, void *timeout_ctx)
                                 (u8 *) "user", 4)) {
                printf("Could not add User-Name\n");
                radius_msg_free(msg);
-               os_free(msg);
                return;
        }
 
@@ -84,7 +84,6 @@ static void start_example(void *eloop_ctx, void *timeout_ctx)
                    ctx->conf.auth_server->shared_secret_len)) {
                printf("Could not add User-Password\n");
                radius_msg_free(msg);
-               os_free(msg);
                return;
        }
 
@@ -92,7 +91,6 @@ static void start_example(void *eloop_ctx, void *timeout_ctx)
                                 (u8 *) &ctx->own_ip_addr, 4)) {
                printf("Could not add NAS-IP-Address\n");
                radius_msg_free(msg);
-               os_free(msg);
                return;
        }
 
@@ -113,7 +111,7 @@ int main(int argc, char *argv[])
        os_memset(&ctx, 0, sizeof(ctx));
        inet_aton("127.0.0.1", &ctx.own_ip_addr);
 
-       if (eloop_init(&ctx)) {
+       if (eloop_init()) {
                printf("Failed to initialize event loop\n");
                return -1;
        }
@@ -153,6 +151,7 @@ int main(int argc, char *argv[])
 
        radius_client_deinit(ctx.radius);
        os_free(srv->shared_secret);
+       os_free(srv);
 
        eloop_destroy();
        os_program_deinit();