[apparmor] [PATCH v2 05/42] split the policy cache handling fns into their own file

Seth Arnold seth.arnold at canonical.com
Fri Mar 13 00:25:56 UTC 2015


On Wed, Mar 11, 2015 at 07:53:45PM -0700, Seth Arnold wrote:
> On Fri, Mar 06, 2015 at 03:48:21PM -0600, Tyler Hicks wrote:
> > From: John Johansen <john.johansen at canonical.com>
> > 
> > Signed-off-by: John Johansen <john.johansen at canonical.com>
> > [tyhicks: Don't move globals in favor of lifting those out later]
> > Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
> 

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> Most of this looks good, though policy_cache.o needs to also depend upon
> lib.h in the Makefile:
> 
> Thanks
> 
> > --- a/parser/Makefile
> > +++ b/parser/Makefile
> > @@ -75,10 +75,10 @@ SRCS = parser_common.c parser_include.c parser_interface.c parser_lex.c \
> >         parser_yacc.c parser_regex.c parser_variable.c parser_policy.c \
> >         parser_alias.c common_optarg.c lib.c network.c \
> >         mount.cc dbus.cc profile.cc rule.cc signal.cc ptrace.cc \
> > -       af_rule.cc af_unix.cc features.c
> > +       af_rule.cc af_unix.cc features.c policy_cache.c
> >  HDRS = parser.h parser_include.h immunix.h mount.h dbus.h lib.h profile.h \
> >         rule.h common_optarg.h signal.h ptrace.h network.h af_rule.h af_unix.h \
> > -       features.h
> > +       features.h policy_cache.h
> >  TOOLS = apparmor_parser
> >  
> >  OBJECTS = $(patsubst %.cc, %.o, $(SRCS:.c=.o))
> > @@ -115,7 +115,8 @@ TEST_OBJECTS = $(filter-out \
> >  			parser_lex.o \
> >  			parser_yacc.o \
> >  			common_optarg.o \
> > -			parser_main.o, ${OBJECTS}) \
> > +			parser_main.o \
> > +			policy_cache.o, ${OBJECTS}) \
> >                 $(AAREOBJECTS)
> >  TEST_LDFLAGS = $(AARE_LDFLAGS)
> >  
> > @@ -187,7 +188,7 @@ apparmor_parser: $(OBJECTS) $(AAREOBJECTS) $(LIBAPPARMOR_A)
> >  parser_yacc.c parser_yacc.h: parser_yacc.y parser.h profile.h
> >  	$(YACC) $(YFLAGS) -o parser_yacc.c parser_yacc.y
> >  
> > -parser_lex.c: parser_lex.l parser_yacc.h parser.h profile.h mount.h dbus.h
> > +parser_lex.c: parser_lex.l parser_yacc.h parser.h profile.h mount.h dbus.h policy_cache.h
> >  	$(LEX) ${LEXFLAGS} -o$@ $<
> >  
> >  parser_lex.o: parser_lex.c parser.h parser_yacc.h
> > @@ -199,7 +200,7 @@ parser_misc.o: parser_misc.c parser.h parser_yacc.h profile.h cap_names.h $(APPA
> >  parser_yacc.o: parser_yacc.c parser_yacc.h $(APPARMOR_H)
> >  	$(CXX) $(EXTRA_CFLAGS) -c -o $@ $<
> >  
> > -parser_main.o: parser_main.c parser.h parser_version.h libapparmor_re/apparmor_re.h $(APPARMOR_H)
> > +parser_main.o: parser_main.c parser.h parser_version.h policy_cache.h libapparmor_re/apparmor_re.h $(APPARMOR_H)
> >  	$(CXX) $(EXTRA_CFLAGS) -c -o $@ $<
> >  
> >  parser_interface.o: parser_interface.c parser.h profile.h libapparmor_re/apparmor_re.h
> > @@ -238,6 +239,9 @@ common_optarg.o: common_optarg.c common_optarg.h parser.h libapparmor_re/apparmo
> >  features.o: features.c features.h parser.h libapparmor_re/apparmor_re.h
> >  	$(CXX) $(EXTRA_CFLAGS) -c -o $@ $<
> >  
> > +policy_cache.o: policy_cache.c policy_cache.h parser.h
> > +	$(CXX) $(EXTRA_CFLAGS) -c -o $@ $<
> > +
> >  lib.o: lib.c lib.h parser.h
> >  	$(CXX) $(EXTRA_CFLAGS) -c -o $@ $<
> >  
> 
> > diff --git a/parser/policy_cache.c b/parser/policy_cache.c
> > new file mode 100644
> > index 0000000..f2909b9
> > --- /dev/null
> > +++ b/parser/policy_cache.c
> > @@ -0,0 +1,151 @@
> > +/*
> > + *   Copyright (c) 2014
> > + *   Canonical, Ltd. (All rights reserved)
> > + *
> > + *   This program is free software; you can redistribute it and/or
> > + *   modify it under the terms of version 2 of the GNU General Public
> > + *   License published by the Free Software Foundation.
> > + *
> > + *   This program is distributed in the hope that it will be useful,
> > + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + *   GNU General Public License for more details.
> > + *
> > + *   You should have received a copy of the GNU General Public License
> > + *   along with this program; if not, contact Novell, Inc. or Canonical
> > + *   Ltd.
> > + */
> > +
> > +#include <ctype.h>
> > +#include <dirent.h>
> > +#include <libintl.h>
> > +#include <locale.h>
> > +#include <stdio.h>
> > +#include <string.h>
> > +#include <stdlib.h>
> > +#include <stdarg.h>
> > +#include <sys/types.h>
> > +#include <unistd.h>
> > +#include <sys/stat.h>
> > +#define _(s) gettext(s)
> > +
> > +#include "lib.h"
> > +#include "parser.h"
> > +#include "policy_cache.h"
> 



> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150312/63b3b22a/attachment.pgp>


More information about the AppArmor mailing list