applied fixed patch from Chris
This commit is contained in:
49
parse.yacc
49
parse.yacc
@@ -76,7 +76,7 @@ int top = 0;
|
|||||||
|
|
||||||
#define push \
|
#define push \
|
||||||
if (top > MATCHSTACKSIZE) \
|
if (top > MATCHSTACKSIZE) \
|
||||||
yyerror("matching stack overflow\n"); \
|
yyerror("matching stack overflow"); \
|
||||||
else {\
|
else {\
|
||||||
match[top].user = -1; \
|
match[top].user = -1; \
|
||||||
match[top].cmnd = -1; \
|
match[top].cmnd = -1; \
|
||||||
@@ -85,7 +85,7 @@ int top = 0;
|
|||||||
}
|
}
|
||||||
#define pop \
|
#define pop \
|
||||||
if (top == 0) \
|
if (top == 0) \
|
||||||
yyerror("matching stack underflow\n"); \
|
yyerror("matching stack underflow"); \
|
||||||
else \
|
else \
|
||||||
top--;
|
top--;
|
||||||
|
|
||||||
@@ -141,18 +141,11 @@ entry : COMMENT
|
|||||||
{ ; }
|
{ ; }
|
||||||
| error COMMENT
|
| error COMMENT
|
||||||
{ yyerrok; }
|
{ yyerrok; }
|
||||||
| NAME {
|
| { push; } user privileges {
|
||||||
push;
|
while (top && user_matches != TRUE) {
|
||||||
user_matches = strcmp(user, $1) == 0;
|
pop;
|
||||||
} privileges
|
}
|
||||||
| ALIAS {
|
}
|
||||||
push;
|
|
||||||
user_matches = find_alias($1, USER) != 0;
|
|
||||||
} privileges
|
|
||||||
| ALL {
|
|
||||||
push;
|
|
||||||
user_matches = TRUE;
|
|
||||||
} privileges
|
|
||||||
| USERALIAS useraliases
|
| USERALIAS useraliases
|
||||||
{ ; }
|
{ ; }
|
||||||
| HOSTALIAS hostaliases
|
| HOSTALIAS hostaliases
|
||||||
@@ -167,9 +160,7 @@ privileges : privilege
|
|||||||
;
|
;
|
||||||
|
|
||||||
privilege : hostspec '=' opcmndlist {
|
privilege : hostspec '=' opcmndlist {
|
||||||
if (!user_matches) {
|
if (user_matches == TRUE) {
|
||||||
pop;
|
|
||||||
} else {
|
|
||||||
push;
|
push;
|
||||||
user_matches = TRUE;
|
user_matches = TRUE;
|
||||||
}
|
}
|
||||||
@@ -199,7 +190,7 @@ hostspec : ALL {
|
|||||||
if (strcmp($1, host) == 0)
|
if (strcmp($1, host) == 0)
|
||||||
host_matches = TRUE;
|
host_matches = TRUE;
|
||||||
#endif /* HAVE_STRCASECMP */
|
#endif /* HAVE_STRCASECMP */
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
fqdn : NAME '.' NAME {
|
fqdn : NAME '.' NAME {
|
||||||
@@ -294,6 +285,10 @@ user : NAME {
|
|||||||
if (strcmp($1, user) == 0)
|
if (strcmp($1, user) == 0)
|
||||||
user_matches = TRUE;
|
user_matches = TRUE;
|
||||||
}
|
}
|
||||||
|
| ALIAS {
|
||||||
|
if (find_alias($1, USER))
|
||||||
|
user_matches = TRUE;
|
||||||
|
}
|
||||||
| ALL {
|
| ALL {
|
||||||
user_matches = TRUE;
|
user_matches = TRUE;
|
||||||
}
|
}
|
||||||
@@ -400,10 +395,22 @@ dumpaliases()
|
|||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
for (n = 0; n < naliases; n++)
|
for (n = 0; n < naliases; n++) {
|
||||||
printf("%s\t%s\n", aliases[n].type == HOST ? "HOST" : "CMND",
|
switch (aliases[n].type) {
|
||||||
aliases[n].name);
|
case HOST:
|
||||||
|
puts("HOST");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CMND:
|
||||||
|
puts("CMND");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USER:
|
||||||
|
puts("USER");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf("\t%s\n", aliases[n].name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user