From 59581dc2d31b2c7833115b35a4ec2fdc84a5cffb Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Wed, 11 Jun 2003 15:56:38 +0000 Subject: stat the user file before parsing. 2003-06-11 Mike Kestner * rule-context.c (load): stat the user file before parsing. svn path=/trunk/; revision=21408 --- filter/ChangeLog | 4 ++++ filter/rule-context.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'filter') diff --git a/filter/ChangeLog b/filter/ChangeLog index 2a3a45a8fb..9a660e60f6 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,7 @@ +2003-06-11 Mike Kestner + + * rule-context.c (load): stat the user file before parsing. + 2003-06-06 Jeffrey Stedfast Fixes some leaks from bug #43883. diff --git a/filter/rule-context.c b/filter/rule-context.c index a1751b6e62..f76d9fae89 100644 --- a/filter/rule-context.c +++ b/filter/rule-context.c @@ -290,6 +290,7 @@ load(RuleContext *rc, const char *system, const char *user) xmlNodePtr set, rule, root; struct _part_set_map *part_map; struct _rule_set_map *rule_map; + struct stat st; rule_context_set_error(rc, NULL); @@ -310,7 +311,9 @@ load(RuleContext *rc, const char *system, const char *user) return -1; } /* doesn't matter if this doens't exist */ - rc->user = xmlParseFile(user); + rc->user = NULL; + if (stat (user, &st) != -1 && S_ISREG (st.st_mode)) + rc->user = xmlParseFile(user); /* now parse structure */ /* get rule parts */ -- cgit