%{ /** * A client-side 802.1x implementation supporting EAP/TLS * * This code is released under both the GPL version 2 and BSD licenses. * Either license may be used. The respective licenses are found below. * * Copyright (C) 2002 Bryan D. Payne & Nick L. Petroni Jr. * All Rights Reserved * * --- GPL Version 2 License --- * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * --- BSD License --- * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * Maryland at College Park and its contributors. * - Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /******************************************************************* * Grammar for configuration file * * File: config_grammar.y * * Authors: bdpayne@cs.umd.edu, npetroni@cs.umd.edu * * $Id: config_grammar.y,v 1.4 2003/03/11 00:13:07 npetroni Exp $ * $Date: 2003/03/11 00:13:07 $ * $Log: config_grammar.y,v $ * Revision 1.4 2003/03/11 00:13:07 npetroni * allow number-only ssids * * Revision 1.3 2003/03/05 21:18:41 npetroni * migration to libdnet. Please notify developers of build problems AFTER doing a cvs update. * * Revision 1.2 2003/03/04 06:10:08 npetroni * changes to allow a program to be run after successful authentication * * Revision 1.1 2003/03/01 06:55:39 npetroni * modified config parse to use lex and yacc for parsing. this may break stuff temporarily, but is good in the long run * * * *******************************************************************/ #include #include #include #include "userconf.h" int yylex(void); int yyerror(char *err); char *config_netname; char *tmpstring; int tmpnum; %} %union { char *str; int num; } %token TK_ID %token TK_CERT %token TK_KEY %token TK_ROOT %token TK_AUTH %token TK_FIRST_AUTH %token TK_AFTER_AUTH %token TK_TYPE %token TK_PREF %token TK_CHUNK_SIZE %token TK_RAND_FILE %token TK_NUMBER %token TK_STRING %token TK_COMMAND %type netname %type tagvalpair %type idpair %type certpair %type keypair %type rootpair %type authpair %type typepair %type prefpair %type chunkpair %type randpair %type firstauthpair %type afterauthpair %% statements : /* empty */ | statements statement | error { return -1; } ; statement : netname ':' tagvalpair { if (strcmp($1, config_netname) == 0) { switch($3) { case TK_ID: set_username(tmpstring) ; break; case TK_CERT: set_client_cert(tmpstring); break; case TK_KEY: set_key_file(tmpstring); break; case TK_ROOT: set_root_cert(tmpstring); break; case TK_AUTH: set_auth(tmpstring); break; case TK_TYPE: set_client_type(tmpstring); break; case TK_PREF: set_preferred_auth(tmpstring); break; case TK_CHUNK_SIZE: set_chunk_size(tmpnum); break; case TK_RAND_FILE: set_random_file(tmpstring); break; case TK_FIRST_AUTH: set_first_auth(tmpstring); break; case TK_AFTER_AUTH: set_after_auth(tmpstring); break; } } } ; netname : TK_NUMBER { $$ = $1; } | TK_STRING { $$ = $1; } ; tagvalpair : idpair { $$ = $1; } | certpair {$$ = $1; } | keypair { $$ = $1; } | rootpair { $$ = $1; } | authpair { $$ = $1; } | typepair { $$ = $1; } | prefpair { $$ = $1; } | chunkpair { $$ = $1; } | randpair { $$ = $1; } | firstauthpair { $$ = $1;} | afterauthpair { $$ = $1; } ; idpair : TK_ID '=' TK_STRING { tmpstring = $3; $$ = TK_ID; } ; certpair : TK_CERT '=' TK_STRING { tmpstring = $3; $$ = TK_CERT; } ; keypair : TK_KEY '=' TK_STRING { tmpstring = $3; $$ = TK_KEY; } ; rootpair : TK_ROOT '=' TK_STRING { tmpstring = $3; $$ = TK_ROOT; } ; authpair : TK_AUTH '=' TK_STRING { tmpstring = $3; $$ = TK_AUTH; } ; typepair : TK_TYPE '=' TK_STRING { tmpstring = $3; $$ = TK_TYPE; } ; prefpair : TK_PREF '=' TK_STRING { tmpstring = $3; $$ = TK_PREF; } ; chunkpair : TK_CHUNK_SIZE '=' TK_NUMBER { tmpnum = atoi($3); $$ = TK_CHUNK_SIZE; } ; randpair : TK_RAND_FILE '=' TK_STRING { tmpstring = $3; $$ = TK_RAND_FILE; } ; firstauthpair : TK_FIRST_AUTH '=' TK_COMMAND { tmpstring = $3; $$ = TK_FIRST_AUTH; } ; afterauthpair : TK_AFTER_AUTH '=' TK_COMMAND { tmpstring = $3; $$ = TK_AFTER_AUTH; } ; %%