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 */ 30243730Srwatson 31243734Srwatson#include <config/config.h> 32243730Srwatson 33243730Srwatson#include <stdio.h> 34243730Srwatson#include <string.h> 35243730Srwatson 36243730Srwatson#ifndef HAVE_STRNDUP 37243730Srwatson#include "strndup.h" 38243730Srwatson#endif 39243730Srwatson 40243730Srwatson#include "auditdistd.h" 41243730Srwatson 42243730Srwatson#include "parse.h" 43243730Srwatson 44243730Srwatson#define SECTION_GLOBAL 0 45243730Srwatson#define SECTION_SENDER 1 46243730Srwatson#define SECTION_RECEIVER 2 47243730Srwatson 48243730Srwatsonint cursection; 49243730Srwatsonint depth; 50243730Srwatsonint lineno; 51243730Srwatson 52243730Srwatson#define DP do { } while (0) 53250926Sjkim#define YY_DECL int yylex(void) 54243730Srwatson%} 55243730Srwatson 56243730Srwatson%option noinput 57243730Srwatson%option nounput 58243730Srwatson%option noyywrap 59243730Srwatson 60243730Srwatson%% 61243730Srwatsoncertfile { DP; return CERTFILE; } 62243730Srwatsondirectory { DP; return DIRECTORY; } 63243730Srwatsonfingerprint { DP; return FINGERPRINT; } 64243730Srwatsonhost { DP; return HOST; } 65243730Srwatsonkeyfile { DP; return KEYFILE; } 66243730Srwatsonlisten { DP; return LISTEN; } 67243730Srwatsonname { DP; return NAME; } 68243730Srwatsonpassword { DP; return PASSWORD; } 69243730Srwatsonpidfile { DP; return PIDFILE; } 70243730Srwatsonreceiver { DP; return RECEIVER; } 71243730Srwatsonremote { DP; return REMOTE; } 72243730Srwatsonsender { DP; return SENDER; } 73243730Srwatsonsource { DP; return SOURCE; } 74243730Srwatsontimeout { DP; return TIMEOUT; } 75243730Srwatson[0-9]+ { DP; yylval.num = atoi(yytext); return NUM; } 76246925Spjd\"[a-zA-Z0-9_/ !@#\$%\^\&\*\(\)\+\=\|\;\?\,\.\[\]\-\:]*\" { DP; yylval.str = strndup(yytext + 1, strlen(yytext) - 2); return STR; } 77243730Srwatson\{ { DP; depth++; return OB; } 78243730Srwatson\} { DP; depth--; return CB; } 79243730Srwatson#.*$ /* ignore comments */; 80243730Srwatson\n { lineno++; } 81243730Srwatson[ \t]+ /* ignore whitespace */; 82243730Srwatson%% 83