⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config_grammar.y

📁 Linux上的802.1x 的supplicant的实现。很多supplicant程序都是基于它开发的
💻 Y
📖 第 1 页 / 共 5 页
字号:
%{/******************************************************************* * Grammar for configuration file *  * Licensed under a dual GPL/BSD license.  (See LICENSE file for more info.) * * File: config_grammar.y * * Authors: bdpayne@cs.umd.edu, npetroni@cs.umd.edu, Chris.Hessing@utah.edu * * $Id: config_grammar.y,v 1.12 2006/06/01 22:49:49 galimorerpg Exp $ * $Date: 2006/06/01 22:49:49 $ * $Log: config_grammar.y,v $ * Revision 1.12  2006/06/01 22:49:49  galimorerpg * Converted all instances of u_char to uint8_t * Fixed a bad #include in the generic frame handler. * * Revision 1.11  2006/05/31 05:10:51  chessing * Beginnings of EAP-TTLS-EAP-MD5, and added internet draft for EAP-TTLS to doc/standards. * * Revision 1.10  2006/05/26 22:04:58  chessing * Fixed some memory access errors, and cleaned up some wext stuff that was causing issues with the madwifi driver in wext mode. * * Revision 1.9  2006/05/17 22:18:10  chessing * A couple of small changes to Xsupplicant, and some major changes to the GUI configuration/monitor tool. * * Revision 1.8  2006/05/13 05:56:44  chessing * Removed last pieces of code that relied on SIGALRM.  Active scan timeout is now configurable so that people that wish to hammer on their cards now have the option to do that. ;) * * Revision 1.7  2006/04/17 03:56:23  chessing * Added some support to enable/disable TNC support both via the configuration file, and via IPC. * * Revision 1.6  2006/03/08 00:16:04  chessing * Fixed EAP hints code to work correctly when the request ID packet is padded out with null bytes.  (Observed in Aruba APs.)  Some changes/fixes for the EAP-AKA module. * * Revision 1.5  2006/02/23 22:26:50  chessing * Fix for bug id #1415020.  'Building Xsupplicant 1.2.3 Fails on FC4'. * * Revision 1.4  2006/01/03 04:02:35  chessing * Added the ability to store the PEAP password in a hashed format.  (Basically, an MS-CHAPv1 hash.)  Also added an 'ntpwdhash' program to the tools directory that will convert a cleartext password in to a hash that can be copied to the configuration file. * * Revision 1.3  2005/11/10 04:56:54  chessing * Added patch from Ben Gardner to add support for setting a specific WEP key prior to attempting to associte.  (With a few slight modifications by me to make it fit in the current CVS code, and get it supported in config-parse.)  Added patch from Pekka Savola to fix some header ordering issues, and a potential buffer overflow. * * Revision 1.2  2005/10/26 18:56:12  chessing * Some build fixes and small updates. * * Revision 1.1  2005/10/17 00:15:55  chessing * Moved the config parsing routines out to a new library called libxsupconfig.a, so that it will be easier to create third-party tools that can easily parse a config. * * Revision 1.65  2005/10/14 02:26:17  shaftoe * - cleanup gcc 4 warnings * - (re)add support for a pid in the form of /var/run/xsupplicant.<iface>.pid * * -- Eric Evans <eevans@sym-link.com> * * Revision 1.64  2005/09/08 16:27:01  chessing * Some small updates to the new state machine code.  First attempt at an auto association mode.  (It mostly works. ;) * * Revision 1.63  2005/08/25 02:20:20  chessing * Some cleanup in xsup_debug.c, added the ability to wait for an interface to come up if it is down when Xsupplicant is started.  Roughed in the ability to choose between having Xsupplicant auto associate you, or allow you to set the ssid manually.  The stale key timer can now be set in the config file.  The association timeout can be set in the config file, and will also be used once the functionality is in place to attempt to guess the key settings needed for association, as well as the functionality to auto associate. * * Revision 1.62  2005/08/20 19:06:53  chessing * Patch from Carsten Grohmann to fix a few things in xsup_get_state.c.  Also added the ability to define an empty network clause, that will set the card in to encryption disabled mode.  From there, anything short of changing the SSID will be ignored by Xsupplicant. * * Revision 1.61  2005/08/18 03:19:04  chessing * Added the ability to define an SSID with static WEP keys.  When we switch to a network that has this type of configuration we will set the keys, and stop the various association timers. * * Revision 1.60  2005/08/12 03:34:06  chessing * Fix to the TLS implementation, should help avoid some of the weird 'block cipher pad' errors.  Also includes a partial implementation of the ability to use static WEP keys based on the SSID in use. * * Revision 1.59  2005/08/09 01:39:13  chessing * Cleaned out old commit notes from the released version.  Added a few small features including the ability to disable the friendly warnings that are spit out.  (Such as the warning that is displayed when keys aren't rotated after 10 minutes.)  We should also be able to start when the interface is down.  Last, but not least, we can handle empty network configs.  (This may be useful for situations where there isn't a good reason to have a default network defined.) * *******************************************************************/    #include <stdlib.h>#include <stdio.h>#include <string.h>#include <stdarg.h>  #include <profile.h>#include "xsupconfig.h"#include <xsup_err.h>#include "xsup_debug.h"#include "wpa.h"#ifdef EAP_SIM_ENABLE#include "winscard.h"#endif#ifdef USE_EFENCE#include <efence.h>#endif#define CLEAN_EXIT cleanup_parse(); return XECONFIGPARSEFAILint yylex(void);  int yyerror(char *err);extern struct config_data *config_info;extern int config_linenum;extern int config_parse_debug;struct config_data *tmp_config = NULL;struct config_eap_tls *tmp_tls = NULL;struct config_eap_md5 *tmp_md5 = NULL;struct config_eap_ttls *tmp_ttls = NULL;struct config_eap_leap *tmp_leap = NULL;struct config_eap_mschapv2 *tmp_mschapv2 = NULL;struct config_eap_peap *tmp_peap = NULL; struct config_eap_sim *tmp_sim = NULL;struct config_eap_aka *tmp_aka = NULL;struct config_wpa_psk *tmp_wpa_psk = NULL;struct config_static_wep *tmp_static_wep = NULL;struct config_static_wep *tmp_initial_wep = NULL;struct config_pap *tmp_p2pap =NULL;struct config_chap *tmp_p2chap = NULL;struct config_mschap *tmp_p2mschap = NULL;struct config_mschapv2 *tmp_p2mschapv2 = NULL;struct config_network *tmp_network = NULL;void set_current_tls() {  if (tmp_tls == NULL)     initialize_config_eap_tls(&tmp_tls);} void set_current_static_wep() {  if (tmp_static_wep == NULL)    initialize_config_static_wep(&tmp_static_wep);}void set_current_initial_wep() {  if (tmp_initial_wep == NULL)    initialize_config_static_wep(&tmp_initial_wep);}void set_current_md5() {  if (tmp_md5 == NULL)     initialize_config_eap_md5(&tmp_md5);} void set_current_ttls() {  if (tmp_ttls == NULL)     initialize_config_eap_ttls(&tmp_ttls);} void set_current_leap() {  if (tmp_leap == NULL)     initialize_config_eap_leap(&tmp_leap);} void set_current_mschapv2() {  if (tmp_mschapv2 == NULL)     initialize_config_eap_mschapv2(&tmp_mschapv2);} void set_current_peap() {  if (tmp_peap == NULL)     initialize_config_eap_peap(&tmp_peap);} void set_current_sim() {  if (tmp_sim == NULL)     initialize_config_eap_sim(&tmp_sim);} void set_current_aka() {  if (tmp_aka == NULL)    initialize_config_eap_aka(&tmp_aka);}void set_current_wpa_psk() {  if (tmp_wpa_psk == NULL)    initialize_config_wpa_psk(&tmp_wpa_psk);}void set_current_p2pap() {  if (tmp_p2pap == NULL)    initialize_config_pap(&tmp_p2pap);}void set_current_p2chap() {  if (tmp_p2chap == NULL)    initialize_config_chap(&tmp_p2chap);}void set_current_p2mschap() {  if (tmp_p2mschap == NULL)    initialize_config_mschap(&tmp_p2mschap);}void set_current_p2mschapv2() {  if (tmp_p2mschapv2 == NULL)    initialize_config_mschapv2(&tmp_p2mschapv2);}void set_current_config() {  if (tmp_config == NULL)       initialize_config_data(&tmp_config);} void set_current_globals() {  set_current_config();  if (!tmp_config->globals)    initialize_config_globals(&(tmp_config->globals));}   void set_current_network() {  if (tmp_network == NULL)     initialize_config_network(&tmp_network);} void cleanup_parse(){  if (tmp_config)    delete_config_data(&tmp_config);  if (tmp_static_wep)    delete_config_static_wep(&tmp_static_wep);  if (tmp_initial_wep)    delete_config_static_wep(&tmp_initial_wep);  if (tmp_tls)    delete_config_eap_tls(&tmp_tls);  if (tmp_md5)    delete_config_eap_md5(&tmp_md5);  if (tmp_ttls)    delete_config_eap_ttls(&tmp_ttls);  if (tmp_leap)    delete_config_eap_leap(&tmp_leap);  if (tmp_mschapv2)    delete_config_eap_mschapv2(&tmp_mschapv2);  if (tmp_peap)    delete_config_eap_peap(&tmp_peap);  if (tmp_sim)    delete_config_eap_sim(&tmp_sim);  if (tmp_aka)    delete_config_eap_aka(&tmp_aka);  if (tmp_wpa_psk)    delete_config_wpa_psk(&tmp_wpa_psk);  if (tmp_p2pap)    delete_config_pap(&tmp_p2pap);  if (tmp_p2chap)    delete_config_chap(&tmp_p2chap);  if (tmp_p2mschap)    delete_config_mschap(&tmp_p2mschap);  if (tmp_p2mschapv2)    delete_config_mschapv2(&tmp_p2mschapv2);  if (tmp_network)    delete_config_network(&tmp_network);}/* function to check if debug is on and if so print the message */void parameter_debug(char *fmt, ...) {  va_list ap;  va_start(ap, fmt);#ifndef PARSE_DEBUG  return;#endif  vprintf(fmt, ap);  va_end(ap);}%}%union {        char    *str;        int     num;}%token        TK_NETWORK_LIST%token        TK_DEFAULT_NETNAME%token<str>   TK_GENSTR%token        TK_DEFAULT_INT%token        TK_LOGFILE%token        TK_LOG_FACILITY%token        TK_AUTH_PERIOD%token        TK_HELD_PERIOD%token        TK_MAX_STARTS%token        TK_STALE_KEY_TIMEOUT%token        TK_ALLMULTI%token        TK_IPC_GROUP%token        TK_DESTINATION%token        TK_BSSID%token        TK_MULTICAST%token        TK_SOURCE%token        TK_AUTO%token        TK_MANUAL%token        TK_ASSOCIATION%token        TK_ASSOC_TIMEOUT%token        TK_ROAMING%token        TK_FIRMWARE%token        TK_XSUPPLICANT%token        TK_PASSIVE_SCANNING%token        TK_PASSIVE_TIMEOUT%token        TK_SCAN_TIMEOUT%token        TK_USE_EAP_HINTS%token        TK_ALL%token        TK_FRIENDLY_WARNINGS%token        TK_TYPE%token        TK_ALLOW_TYPES%token        TK_FORCE_EAPOL_VER%token        TK_WIRELESS%token        TK_WIRED%token        TK_CONTROL_WIRELESS%token        TK_WPA_GROUP_CRYPT%token        TK_WPA_PAIRWISE_CRYPT%token        TK_WEP40%token        TK_TKIP%token        TK_WRAP%token        TK_CCMP%token        TK_WEP104%token        TK_ANY%token        TK_PRIORITY%token        TK_IDENTITY%token<str>   TK_IDENTITY_VAL%token        TK_DEST_MAC%token<str>   TK_MACADDRESS%token        TK_SSID%token<str>   TK_SSID_VAL%token        TK_USE_TNC%token        TK_WPA_PSK%token        TK_WPA_PSK_KEY%token        TK_WPA_PSK_HEX_KEY%token        TK_EAP_TLS%token        TK_USER_CERT%token        TK_USER_KEY%token        TK_USER_KEY_PASS%token        TK_SESSION_RESUME%token        TK_CNCHECK%token        TK_CNEXACT%token        TK_ROOT_CERT%token        TK_ROOT_DIR%token        TK_CRL_DIR%token        TK_CHUNK_SIZE%token        TK_RANDOM_FILE%token        TK_EAP_MD5%token        TK_USERNAME%token<str>   TK_USERNAME_VAL%token        TK_PASSWORD%token        TK_EAP_LEAP%token        TK_EAP_TTLS%token        TK_PHASE2_TYPE%token        TK_PAP%token        TK_CHAP%token        TK_MSCHAP%token        TK_MSCHAPV2%token        TK_EAP_MSCHAPV2%token        TK_MSCHAPV2_HASH_PWD%token        TK_IAS_QUIRK%token        TK_EAP_PEAP%token        TK_PEAPV1_PROPER_KEYING%token        TK_INNER_ID%token        TK_EAP_SIM%token        TK_EAP_AKA%token        TK_AUTO_REALM%token        TK_YES%token        TK_NO%token        TK_EAP_GTC%token        TK_EAP_OTP%token        TK_SMARTCARD%token        TK_ENGINE_ID%token        TK_OPENSC_SO_PATH%token        TK_KEYID%token        TK_STATIC_WEP%token        TK_INITIAL_WEP%token        TK_STATIC_KEY1%token        TK_STATIC_KEY2%token        TK_STATIC_KEY3%token        TK_STATIC_KEY4%token        TK_WEP_TX_KEY

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -