1243730Srwatson%{ 2243730Srwatson/*- 3243730Srwatson * Copyright (c) 2012 The FreeBSD Foundation 4243730Srwatson * All rights reserved. 5243730Srwatson * 6243730Srwatson * This software was developed by Pawel Jakub Dawidek under sponsorship from 7243730Srwatson * the FreeBSD Foundation. 8243730Srwatson * 9243730Srwatson * Redistribution and use in source and binary forms, with or without 10243730Srwatson * modification, are permitted provided that the following conditions 11243730Srwatson * are met: 12243730Srwatson * 1. Redistributions of source code must retain the above copyright 13243730Srwatson * notice, this list of conditions and the following disclaimer. 14243730Srwatson * 2. Redistributions in binary form must reproduce the above copyright 15243730Srwatson * notice, this list of conditions and the following disclaimer in the 16243730Srwatson * documentation and/or other materials provided with the distribution. 17243730Srwatson * 18243730Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 19243730Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20243730Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21243730Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 22243730Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23243730Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24243730Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25243730Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26243730Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27243730Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28243730Srwatson * SUCH DAMAGE. 29243730Srwatson * 30243734Srwatson * $P4: //depot/projects/trustedbsd/openbsm/bin/auditdistd/token.l#2 $ 31243730Srwatson */ 32243730Srwatson 33243734Srwatson#include <config/config.h> 34243730Srwatson 35243730Srwatson#include <stdio.h> 36243730Srwatson#include <string.h> 37243730Srwatson 38243730Srwatson#ifndef HAVE_STRNDUP 39243730Srwatson#include "strndup.h" 40243730Srwatson#endif 41243730Srwatson 42243730Srwatson#include "auditdistd.h" 43243730Srwatson 44243730Srwatson#include "parse.h" 45243730Srwatson 46243730Srwatson#define SECTION_GLOBAL 0 47243730Srwatson#define SECTION_SENDER 1 48243730Srwatson#define SECTION_RECEIVER 2 49243730Srwatson 50243730Srwatsonint cursection; 51243730Srwatsonint depth; 52243730Srwatsonint lineno; 53243730Srwatson 54243730Srwatson#define DP do { } while (0) 55252181Smarius#define YY_DECL int yylex(void) 56243730Srwatson%} 57243730Srwatson 58243730Srwatson%option noinput 59243730Srwatson%option nounput 60243730Srwatson%option noyywrap 61243730Srwatson 62243730Srwatson%% 63243730Srwatsoncertfile { DP; return CERTFILE; } 64243730Srwatsondirectory { DP; return DIRECTORY; } 65243730Srwatsonfingerprint { DP; return FINGERPRINT; } 66243730Srwatsonhost { DP; return HOST; } 67243730Srwatsonkeyfile { DP; return KEYFILE; } 68243730Srwatsonlisten { DP; return LISTEN; } 69243730Srwatsonname { DP; return NAME; } 70243730Srwatsonpassword { DP; return PASSWORD; } 71243730Srwatsonpidfile { DP; return PIDFILE; } 72243730Srwatsonreceiver { DP; return RECEIVER; } 73243730Srwatsonremote { DP; return REMOTE; } 74243730Srwatsonsender { DP; return SENDER; } 75243730Srwatsonsource { DP; return SOURCE; } 76243730Srwatsontimeout { DP; return TIMEOUT; } 77243730Srwatson[0-9]+ { DP; yylval.num = atoi(yytext); return NUM; } 78243730Srwatson\"[a-zA-Z0-9_/ !@#\$%\^\&\*\(\)\+\=\|\;\?\,\.\-\:]*\" { DP; yylval.str = strndup(yytext + 1, strlen(yytext) - 2); return STR; } 79243730Srwatson\{ { DP; depth++; return OB; } 80243730Srwatson\} { DP; depth--; return CB; } 81243730Srwatson#.*$ /* ignore comments */; 82243730Srwatson\n { lineno++; } 83243730Srwatson[ \t]+ /* ignore whitespace */; 84243730Srwatson%% 85