[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LDM Feature or Bug
- Subject: Re: LDM Feature or Bug
- Date: Wed, 12 Dec 2001 16:13:39 -0700
Hi Daryl,
> Has my collegue and I stumbled accross a LDM feature or bug???
>
> in ldmd.conf have line like
>
> request EXP "rwis.sao" mesonet.agron.iastate.edu
>
> -> server will not start, so try
>
> request EXP "rwis" mesonet.agron.iastate.edu
>
> -> server will no start, so try
>
> request EXP ".*" mesonet.agron.iastate.edu
>
> -> server starts, scratch head, so try
>
> request EXP "^rwis.sao" mesonet.agron.iastate.edu
>
> -> server starts
Anne let me look at this, and it turns out to be a bug in the way
rpc.ldmd parses the ldmd.conf configuration file. Thanks for
reporting it. In the current LDM, constant strings can't be used as
the "pattern" part of ACCEPT and REQUEST statements:
ACCEPT feedtype pattern hostset
REQUEST feedtype pattern hostname
For example "SDUS" can't be used as a pattern, but "^SDUS" or "[S]DUS"
are OK.
I have appended a fix for the problem, which will be in the next
release. If you want to try it before then, just use "patch" to apply
the appended fix to the files server/conf.l and server/conf.y, remake
rpc.ldmd, and you should then be able to use constant strings as
regular expression patterns.
--Russ
$ cvs patch -t ldm5/server/conf.l ldm5/server/conf.y
Index: ldm5/server/conf.l
diff -c ldm5/server/conf.l:1.14 ldm5/server/conf.l:1.15
*** ldm5/server/conf.l:1.14 Thu Apr 29 17:33:47 1999
--- ldm5/server/conf.l Tue Dec 11 09:44:12 2001
***************
*** 1,6 ****
%e 256
%p 1152
! %n 128
%k 384
%a 2176
%o 4352
--- 1,6 ----
%e 256
%p 1152
! %n 300
%k 384
%a 2176
%o 4352
***************
*** 10,16 ****
* Copyright 1995, University Corporation for Atmospheric Research
* See ../COPYRIGHT file for copying and redistribution conditions.
*/
! /* $Id: conf.l,v 1.14 1999/04/29 23:33:47 davis Exp $ */
/*
* Lexer for ldm5 configuration file.
--- 10,16 ----
* Copyright 1995, University Corporation for Atmospheric Research
* See ../COPYRIGHT file for copying and redistribution conditions.
*/
! /* $Id: conf.l,v 1.15 2001/12/11 16:44:12 russ Exp $ */
/*
* Lexer for ldm5 configuration file.
***************
*** 29,34 ****
--- 29,35 ----
extern int yydebug;
#endif
+ int keyword; /* global used to select next lex start condition */
%}
alpha [A-Za-z]
***************
*** 45,66 ****
/* pretty much anything can be in a quoted regular expression */
qregexp ([^"]|{escquote})*
! /* characters in an hostname */
hostnchars ([\.\_\-]|{alphanum})
/* component of a dotted quad */
nnn ([0-2]?[0-9]?[0-9])
! /* expecting a feedtype */
! %start FT
! /* expecting a feedtype */
! %start CP
%%
\#.* {/*comment */;}
! ([Aa][Ll][Ll][Oo][Ww]) {
! BEGIN FT;
#if YYDEBUG
if(yydebug)
udebug("ALLOW");
--- 46,71 ----
/* pretty much anything can be in a quoted regular expression */
qregexp ([^"]|{escquote})*
! /* characters in a hostname */
hostnchars ([\.\_\-]|{alphanum})
/* component of a dotted quad */
nnn ([0-2]?[0-9]?[0-9])
! /* Start conditions */
! /* expecting a feedtype expression, command/parameters, pattern, hostset,
hostname */
! %start Feedtype
! %start Command
! %start Pattern
! %start Hostset
! %start Hostname
%%
\#.* {/*comment */;}
! ^[Aa][Ll][Ll][Oo][Ww] {
! BEGIN Feedtype;
! keyword = ALLOW_K;
#if YYDEBUG
if(yydebug)
udebug("ALLOW");
***************
*** 68,75 ****
return (ALLOW_K);
}
! ([Aa][Cc][Cc][Ee][Pp][Tt]) {
! BEGIN FT;
#if YYDEBUG
if(yydebug)
udebug("ACCEPT");
--- 73,81 ----
return (ALLOW_K);
}
! ^[Aa][Cc][Cc][Ee][Pp][Tt] {
! BEGIN Feedtype;
! keyword = ACCEPT_K;
#if YYDEBUG
if(yydebug)
udebug("ACCEPT");
***************
*** 78,85 ****
}
! ([Rr][Ee][Qq][Uu][Ee][Ss][Tt]|POLL|poll) {
! BEGIN FT;
#if YYDEBUG
if(yydebug)
udebug("REQUEST");
--- 84,92 ----
}
! ^[Rr][Ee][Qq][Uu][Ee][Ss][Tt]|POLL|poll {
! BEGIN Feedtype;
! keyword = REQUEST_K;
#if YYDEBUG
if(yydebug)
udebug("REQUEST");
***************
*** 89,96 ****
! ([Ee][Xx][Ee][Cc]) {
! BEGIN CP;
#if YYDEBUG
if(yydebug)
udebug("EXEC");
--- 96,104 ----
! ^[Ee][Xx][Ee][Cc] {
! BEGIN Command;
! keyword = EXEC_K;
#if YYDEBUG
if(yydebug)
udebug("EXEC");
***************
*** 99,110 ****
}
! <FT>\"{ftchars}+({white}{ftchars}+{white}?)*\" {
const char *cp = yytext + 1;
yytext[yyleng-1] = 0;
{
const int status = strfeedtypet(cp, &yylval.ft);
! BEGIN 0;
if(status == FEEDTYPE_OK)
{
#if YYDEBUG
--- 107,121 ----
}
! <Feedtype>\"({ftchars}|{white})+\" {
const char *cp = yytext + 1;
yytext[yyleng-1] = 0;
{
const int status = strfeedtypet(cp, &yylval.ft);
! if(keyword == ALLOW_K)
! BEGIN Hostset;
! else
! BEGIN Pattern;
if(status == FEEDTYPE_OK)
{
#if YYDEBUG
***************
*** 121,129 ****
}}
! <FT>{ftchars}+ {
const int status = strfeedtypet(yytext, &yylval.ft);
! BEGIN 0;
if(status == FEEDTYPE_OK)
{
#if YYDEBUG
--- 132,143 ----
}}
! <Feedtype>{ftchars}+ {
const int status = strfeedtypet(yytext, &yylval.ft);
! if(keyword == ALLOW_K)
! BEGIN Hostset;
! else
! BEGIN Pattern;
if(status == FEEDTYPE_OK)
{
#if YYDEBUG
***************
*** 140,146 ****
}
! <CP>\"{qregexp}\" {
int status;
BEGIN 0;
yytext[yyleng-1] = 0;
--- 154,160 ----
}
! <Command>\"{qregexp}\" {
int status;
BEGIN 0;
yytext[yyleng-1] = 0;
***************
*** 162,169 ****
return (COMMAND);
}
! {alpha}{hostnchars}* {
yylval.hsp = new_host_set(HS_NAME, yytext, NULL);
if(yylval.hsp == NULL)
{
serror("yylex:new_host_set");
--- 176,184 ----
return (COMMAND);
}
! <Hostname>{alpha}{hostnchars}* {
yylval.hsp = new_host_set(HS_NAME, yytext, NULL);
+ BEGIN 0;
if(yylval.hsp == NULL)
{
serror("yylex:new_host_set");
***************
*** 176,185 ****
return (HOST);
}
! \"{alpha}({hostnchars}*)\" {
/* this could be ambiguous */
yytext[yyleng-1] = 0;
yylval.hsp = new_host_set(HS_NAME, yytext+1, NULL);
if(yylval.hsp == NULL)
{
serror("yylex:new_host_set");
--- 191,201 ----
return (HOST);
}
! <Hostname>\"{alpha}({hostnchars}*)\" {
/* this could be ambiguous */
yytext[yyleng-1] = 0;
yylval.hsp = new_host_set(HS_NAME, yytext+1, NULL);
+ BEGIN 0;
if(yylval.hsp == NULL)
{
serror("yylex:new_host_set");
***************
*** 192,199 ****
return (HOST);
}
! {nnn}\.{nnn}\.{nnn}\.{nnn}\.? {
yylval.hsp = new_host_set(HS_DOTTED_QUAD, yytext, NULL);
if(yylval.hsp == NULL)
{
serror("yylex:new_host_set");
--- 208,216 ----
return (HOST);
}
! <Hostname>{nnn}\.{nnn}\.{nnn}\.{nnn}\.? {
yylval.hsp = new_host_set(HS_DOTTED_QUAD, yytext, NULL);
+ BEGIN 0;
if(yylval.hsp == NULL)
{
serror("yylex:new_host_set");
***************
*** 207,214 ****
return (HOST);
}
! {regexp} {
yylval.rg.cp = strdup(yytext);
if(yylval.rg.cp == NULL)
{
serror("yylex:strdup");
--- 224,237 ----
return (HOST);
}
! <Pattern>{regexp} {
yylval.rg.cp = strdup(yytext);
+ if(keyword == ACCEPT_K)
+ BEGIN Hostset;
+ else if(keyword == REQUEST_K)
+ BEGIN Hostname;
+ else
+ BEGIN 0;
if(yylval.rg.cp == NULL)
{
serror("yylex:strdup");
***************
*** 228,236 ****
return (REGEXP);
}
! \"{qregexp}\" {
yytext[yyleng-1] = 0;
yylval.rg.cp = strdup(yytext +1);
if(yylval.rg.cp == NULL)
{
serror("yylex:strdup");
--- 251,265 ----
return (REGEXP);
}
! <Pattern>\"{qregexp}\" {
yytext[yyleng-1] = 0;
yylval.rg.cp = strdup(yytext +1);
+ if(keyword == ACCEPT_K)
+ BEGIN Hostset;
+ else if(keyword == REQUEST_K)
+ BEGIN Hostname;
+ else
+ BEGIN 0;
if(yylval.rg.cp == NULL)
{
serror("yylex:strdup");
***************
*** 248,253 ****
--- 277,339 ----
udebug("qregexp: \"%s\"", yylval.rg.cp);
#endif
return (REGEXP);
+ }
+
+ <Hostset>{regexp} {
+ yylval.rg.cp = strdup(yytext);
+ if(yylval.rg.cp == NULL)
+ {
+ serror("yylex:strdup");
+ return -1;
+ }
+ if( regcomp(&yylval.rg.rgx, yylval.rg.cp,
+ REG_EXTENDED|REG_ICASE|REG_NOSUB) != 0)
+ {
+ uerror("yylex:regcomp failed \"%s\"",
+ yylval.rg.cp);
+ return -1;
+ }
+ yylval.hsp = new_host_set(HS_REGEXP, yytext,
&yylval.rg.rgx);
+ BEGIN 0;
+ if(yylval.hsp == NULL)
+ {
+ serror("yylex:new_host_set");
+ return -1;
+ }
+ #if YYDEBUG
+ if(yydebug)
+ udebug("hostset: \"%s\"", yylval.hsp->cp);
+ #endif
+ return (HOSTSET);
+ }
+
+ <Hostset>\"{qregexp}\" {
+ yytext[yyleng-1] = 0;
+ yylval.rg.cp = strdup(yytext + 1);
+ if(yylval.rg.cp == NULL)
+ {
+ serror("yylex:strdup");
+ return -1;
+ }
+ if( regcomp(&yylval.rg.rgx, yylval.rg.cp,
+ REG_EXTENDED|REG_ICASE|REG_NOSUB) != 0)
+ {
+ uerror("yylex:regcomp failed \"%s\"",
+ yylval.rg.cp);
+ return -1;
+ }
+ yylval.hsp = new_host_set(HS_REGEXP, yytext+1,
&yylval.rg.rgx);
+ BEGIN 0;
+ if(yylval.hsp == NULL)
+ {
+ serror("yylex:new_host_set");
+ return -1;
+ }
+ #if YYDEBUG
+ if(yydebug)
+ udebug("qhostset: \"%s\"", yylval.hsp->cp);
+ #endif
+ return (HOSTSET);
}
{white} {/* whitespace */;}
Index: ldm5/server/conf.y
diff -c ldm5/server/conf.y:1.21 ldm5/server/conf.y:1.22
*** ldm5/server/conf.y:1.21 Thu Apr 29 17:33:47 1999
--- ldm5/server/conf.y Tue Dec 11 09:44:12 2001
***************
*** 7,13 ****
* Copyright 1995, University Corporation for Atmospheric Research
* See ../COPYRIGHT file for copying and redistribution conditions.
*/
! /* $Id: conf.y,v 1.21 1999/04/29 23:33:47 davis Exp $ */
#include <ldmconfig.h>
#include <string.h>
--- 7,13 ----
* Copyright 1995, University Corporation for Atmospheric Research
* See ../COPYRIGHT file for copying and redistribution conditions.
*/
! /* $Id: conf.y,v 1.22 2001/12/11 16:44:12 russ Exp $ */
#include <ldmconfig.h>
#include <string.h>
***************
*** 59,65 ****
%token EXEC_K
%token <ft> FEEDTYPE
! %token <hsp> HOST
%token <rg> REGEXP
%token <wrdexp> COMMAND
--- 59,65 ----
%token EXEC_K
%token <ft> FEEDTYPE
! %token <hsp> HOST HOSTSET
%token <rg> REGEXP
%token <wrdexp> COMMAND
***************
*** 76,84 ****
| exec_entry
;
! allow_entry: ALLOW_K FEEDTYPE hostset
{
! status = allow_acl_add($2, $<hsp>3);
if(status != ENOERR)
{
uerror("allow_acl_add: %s",
--- 76,84 ----
| exec_entry
;
! allow_entry: ALLOW_K FEEDTYPE HOSTSET
{
! status = allow_acl_add($2, $3);
if(status != ENOERR)
{
uerror("allow_acl_add: %s",
***************
*** 89,98 ****
;
! accept_entry: ACCEPT_K FEEDTYPE REGEXP hostset
{
status = accept_acl_add($2,
! $3.cp, &$3.rgx, $<hsp>4);
if(status != ENOERR)
{
uerror("accept_acl_add: %s",
--- 89,98 ----
;
! accept_entry: ACCEPT_K FEEDTYPE REGEXP HOSTSET
{
status = accept_acl_add($2,
! $3.cp, &$3.rgx, $4);
if(status != ENOERR)
{
uerror("accept_acl_add: %s",
***************
*** 124,148 ****
strerror(status));
return 1;
}
- }
- ;
-
- hostset: HOST {}
- | host_regexp
- ;
-
- host_regexp: REGEXP
- {
- /* transform the regexp to a host_set */
- const char *cp = $1.cp;
- const regex_t *rgxp = &$1.rgx;
- $<hsp>1 = new_host_set(HS_REGEXP, cp, rgxp);
- if($<hsp>1 == NULL)
- {
- serror("yyparse: new_host_set");
- return 1;
- }
- $<hsp>$ = $<hsp>1;
}
;
--- 124,129 ----