hostapd: Fix deinit on initialization failure
[hostap-gosc2009.git] / hostapd / eap_register.c
blobae9bf9d38de952c756b3c994c48af082be9885c7
1 /*
2 * EAP method registration
3 * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
12 * See README and COPYING for more details.
15 #include "includes.h"
17 #include "common.h"
18 #include "eap_server/eap_methods.h"
19 #include "eap_register.h"
22 /**
23 * eap_server_register_methods - Register statically linked EAP server methods
24 * Returns: 0 on success, -1 or -2 on failure
26 * This function is called at program initialization to register all EAP
27 * methods that were linked in statically.
29 int eap_server_register_methods(void)
31 int ret = 0;
33 #ifdef EAP_SERVER_IDENTITY
34 if (ret == 0)
35 ret = eap_server_identity_register();
36 #endif /* EAP_SERVER_IDENTITY */
38 #ifdef EAP_SERVER_MD5
39 if (ret == 0)
40 ret = eap_server_md5_register();
41 #endif /* EAP_SERVER_MD5 */
43 #ifdef EAP_SERVER_TLS
44 if (ret == 0)
45 ret = eap_server_tls_register();
46 #endif /* EAP_SERVER_TLS */
48 #ifdef EAP_SERVER_MSCHAPV2
49 if (ret == 0)
50 ret = eap_server_mschapv2_register();
51 #endif /* EAP_SERVER_MSCHAPV2 */
53 #ifdef EAP_SERVER_PEAP
54 if (ret == 0)
55 ret = eap_server_peap_register();
56 #endif /* EAP_SERVER_PEAP */
58 #ifdef EAP_SERVER_TLV
59 if (ret == 0)
60 ret = eap_server_tlv_register();
61 #endif /* EAP_SERVER_TLV */
63 #ifdef EAP_SERVER_GTC
64 if (ret == 0)
65 ret = eap_server_gtc_register();
66 #endif /* EAP_SERVER_GTC */
68 #ifdef EAP_SERVER_TTLS
69 if (ret == 0)
70 ret = eap_server_ttls_register();
71 #endif /* EAP_SERVER_TTLS */
73 #ifdef EAP_SERVER_SIM
74 if (ret == 0)
75 ret = eap_server_sim_register();
76 #endif /* EAP_SERVER_SIM */
78 #ifdef EAP_SERVER_AKA
79 if (ret == 0)
80 ret = eap_server_aka_register();
81 #endif /* EAP_SERVER_AKA */
83 #ifdef EAP_SERVER_AKA_PRIME
84 if (ret == 0)
85 ret = eap_server_aka_prime_register();
86 #endif /* EAP_SERVER_AKA_PRIME */
88 #ifdef EAP_SERVER_PAX
89 if (ret == 0)
90 ret = eap_server_pax_register();
91 #endif /* EAP_SERVER_PAX */
93 #ifdef EAP_SERVER_PSK
94 if (ret == 0)
95 ret = eap_server_psk_register();
96 #endif /* EAP_SERVER_PSK */
98 #ifdef EAP_SERVER_SAKE
99 if (ret == 0)
100 ret = eap_server_sake_register();
101 #endif /* EAP_SERVER_SAKE */
103 #ifdef EAP_SERVER_GPSK
104 if (ret == 0)
105 ret = eap_server_gpsk_register();
106 #endif /* EAP_SERVER_GPSK */
108 #ifdef EAP_SERVER_VENDOR_TEST
109 if (ret == 0)
110 ret = eap_server_vendor_test_register();
111 #endif /* EAP_SERVER_VENDOR_TEST */
113 #ifdef EAP_SERVER_FAST
114 if (ret == 0)
115 ret = eap_server_fast_register();
116 #endif /* EAP_SERVER_FAST */
118 #ifdef EAP_SERVER_WSC
119 if (ret == 0)
120 ret = eap_server_wsc_register();
121 #endif /* EAP_SERVER_WSC */
123 #ifdef EAP_SERVER_IKEV2
124 if (ret == 0)
125 ret = eap_server_ikev2_register();
126 #endif /* EAP_SERVER_IKEV2 */
128 #ifdef EAP_SERVER_TNC
129 if (ret == 0)
130 ret = eap_server_tnc_register();
131 #endif /* EAP_SERVER_TNC */
133 return ret;