projects
/
ircu2.10.12-pk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added basic ssl support to ircu
[ircu2.10.12-pk.git]
/
ircd
/
ircd_lexer.l
diff --git
a/ircd/ircd_lexer.l
b/ircd/ircd_lexer.l
index bb41a592b1c643147885d44a38a89eb07fbf8bf7..c149a63241ecca1cecfb77957db1664a25e7aed0 100644
(file)
--- a/
ircd/ircd_lexer.l
+++ b/
ircd/ircd_lexer.l
@@
-24,8
+24,11
@@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "config.h"
#include "config.h"
+#include "fileio.h"
#include "ircd.h"
#include "ircd.h"
+#include "ircd_alloc.h"
#include "ircd_string.h"
#include "s_debug.h"
#include "y.tab.h"
#include "ircd_string.h"
#include "s_debug.h"
#include "y.tab.h"
@@
-99,9
+102,17
@@
static struct lexer_token {
TOKEN(PREPEND),
TOKEN(USERMODE),
TOKEN(FAST),
TOKEN(PREPEND),
TOKEN(USERMODE),
TOKEN(FAST),
+ TOKEN(AUTOCONNECT),
+ TOKEN(PROGRAM),
+ TOKEN(DNS),
+ TOKEN(SSL),
+ TOKEN(CERTFILE),
+ TOKEN(KEYFILE),
+ TOKEN(CAFILE),
#undef TOKEN
{ "administrator", ADMIN },
{ "apass_opmode", TPRIV_APASS_OPMODE },
#undef TOKEN
{ "administrator", ADMIN },
{ "apass_opmode", TPRIV_APASS_OPMODE },
+ { "auto", AUTOCONNECT },
{ "b", BYTES },
{ "badchan", TPRIV_BADCHAN },
{ "chan_limit", TPRIV_CHAN_LIMIT },
{ "b", BYTES },
{ "badchan", TPRIV_BADCHAN },
{ "chan_limit", TPRIV_CHAN_LIMIT },
@@
-111,9
+122,14
@@
static struct lexer_token {
{ "file", TFILE },
{ "force_local_opmode", TPRIV_FORCE_LOCAL_OPMODE },
{ "force_opmode", TPRIV_FORCE_OPMODE },
{ "file", TFILE },
{ "force_local_opmode", TPRIV_FORCE_LOCAL_OPMODE },
{ "force_opmode", TPRIV_FORCE_OPMODE },
+ { "gb", GBYTES },
+ { "gigabytes", GBYTES },
{ "gline", TPRIV_GLINE },
{ "gline", TPRIV_GLINE },
+ { "ipv4", TOK_IPV4 },
+ { "ipv6", TOK_IPV6 },
{ "kb", KBYTES },
{ "kilobytes", KBYTES },
{ "kb", KBYTES },
{ "kilobytes", KBYTES },
+ { "list_chan", TPRIV_LIST_CHAN },
{ "local_badchan", TPRIV_LOCAL_BADCHAN },
{ "local_gline", TPRIV_LOCAL_GLINE },
{ "local_jupe", TPRIV_LOCAL_JUPE },
{ "local_badchan", TPRIV_LOCAL_BADCHAN },
{ "local_gline", TPRIV_LOCAL_GLINE },
{ "local_jupe", TPRIV_LOCAL_JUPE },
@@
-122,8
+138,6
@@
static struct lexer_token {
{ "mb", MBYTES },
{ "megabytes", MBYTES },
{ "mode_lchan", TPRIV_MODE_LCHAN },
{ "mb", MBYTES },
{ "megabytes", MBYTES },
{ "mode_lchan", TPRIV_MODE_LCHAN },
- { "gb", GBYTES },
- { "gigabytes", GBYTES },
{ "operator", OPER },
{ "opmode", TPRIV_OPMODE },
{ "password", PASS },
{ "operator", OPER },
{ "opmode", TPRIV_OPMODE },
{ "password", PASS },
@@
-176,22
+190,44
@@
find_token(char *token)
return tok ? tok->value : 0;
}
return tok ? tok->value : 0;
}
-void
+static FBFILE *lexer_input;
+
+#undef YY_INPUT
+#define YY_INPUT(buf, res, size) res = (fbgets(buf, size, lexer_input) ? strlen(buf) : 0)
+
+int
init_lexer(void)
{
init_lexer(void)
{
-
yyin = f
open(configfile, "r");
- if (
yyin
== NULL)
+
lexer_input = fb
open(configfile, "r");
+ if (
lexer_input
== NULL)
{
#ifdef YY_FATAL_ERROR
YY_FATAL_ERROR("Could not open the configuration file.");
#else
fprintf(stderr, "Could not open the configuration file.");
#endif
{
#ifdef YY_FATAL_ERROR
YY_FATAL_ERROR("Could not open the configuration file.");
#else
fprintf(stderr, "Could not open the configuration file.");
#endif
+ return 0;
}
#ifdef YY_NEW_FILE
YY_NEW_FILE;
#endif
lineno = 1;
}
#ifdef YY_NEW_FILE
YY_NEW_FILE;
#endif
lineno = 1;
+ return 1;
+}
+
+void deinit_lexer(void)
+{
+ if (lexer_input != NULL)
+ {
+ fbclose(lexer_input);
+ lexer_input = NULL;
+ }
+}
+
+int
+yywrap(void)
+{
+ return 1;
}
%}
}
%}
@@
-202,11
+238,11
@@
NUMBER [0-9]+
QSTRING \"[^"\n]+[\"\n]
%%
QSTRING \"[^"\n]+[\"\n]
%%
-{QSTRING} {yytext[yyleng-1] = 0;
yylval.text = yytext+1
; return QSTRING;}
+{QSTRING} {yytext[yyleng-1] = 0;
DupString(yylval.text, yytext+1)
; return QSTRING;}
{NUMBER} {yylval.num = strtoul(yytext, NULL, 10); return NUMBER;}
{WHITE} ;
{SHCOMMENT} ;
{NUMBER} {yylval.num = strtoul(yytext, NULL, 10); return NUMBER;}
{WHITE} ;
{SHCOMMENT} ;
-[a-zA-Z_]
+
{ int res = find_token(yytext); if (res) return res; else REJECT; }
+[a-zA-Z_]
[a-zA-Z_0-9]*
{ int res = find_token(yytext); if (res) return res; else REJECT; }
\n lineno++;
. return yytext[0];
\n lineno++;
. return yytext[0];