Merged the hostap_2.6 updates, and the Leap of Faith work, from the hostap_update...
[mech_eap.git] / libeap / radius_example / radius_example.c
index fd7dbae..8b0f475 100644 (file)
@@ -2,14 +2,8 @@
  * Example application using RADIUS client as a library
  * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 #include "includes.h"
@@ -19,8 +13,6 @@
 #include "radius/radius.h"
 #include "radius/radius_client.h"
 
-extern int wpa_debug_level;
-
 struct radius_ctx {
        struct radius_client_data *radius;
        struct hostapd_radius_servers conf;
@@ -69,7 +61,7 @@ static void start_example(void *eloop_ctx, void *timeout_ctx)
                return;
        }
 
-       radius_msg_make_authenticator(msg, (u8 *) ctx, sizeof(*ctx));
+       radius_msg_make_authenticator(msg);
 
        if (!radius_msg_add_attr(msg, RADIUS_ATTR_USER_NAME,
                                 (u8 *) "user", 4)) {
@@ -94,7 +86,8 @@ static void start_example(void *eloop_ctx, void *timeout_ctx)
                return;
        }
 
-       radius_client_send(ctx->radius, msg, RADIUS_AUTH, NULL);
+       if (radius_client_send(ctx->radius, msg, RADIUS_AUTH, NULL) < 0)
+               radius_msg_free(msg);
 }