[apparmor] patch for aa-logprof -f given a special file

Steve Beattie steve at nxnw.org
Wed Nov 5 18:00:10 UTC 2014


On Wed, Nov 05, 2014 at 12:49:31AM +0100, Christian Boltz wrote:
> I propose the following pumpkin^Wpatch (in addition to your patch):
> 
> === modified file 'utils/aa-logprof'
> --- utils/aa-logprof    2014-11-04 20:55:26 +0000
> +++ utils/aa-logprof    2014-11-04 23:33:43 +0000
> @@ -35,6 +35,8 @@
>  if filename:
>      if not os.path.exists(filename):
>          raise apparmor.AppArmorException(_('The logfile %s does not exist. Please check the path') % filename)
> +    elif os.path.isdir(filename):
> +        raise apparmor.AppArmorException(_('%s is a directory. Please specify a file as logfile') % filename)
>      else:
>          apparmor.filename = filename
>  
> 
> BTW: aa-genprof has similar code, so it also needs a patch:
> 
> === modified file 'utils/aa-genprof'
> --- utils/aa-genprof    2014-10-08 20:07:18 +0000
> +++ utils/aa-genprof    2014-11-04 23:37:49 +0000
> @@ -65,8 +65,10 @@
>  
>  
>  if filename:
> -    if not os.path.isfile(filename):
> +    if not os.path.exists(filename):
>          raise apparmor.AppArmorException(_('The logfile %s does not exist. Please check the path') % filename)
> +    elif os.path.isdir(filename):
> +        raise apparmor.AppArmorException(_('%s is a directory. Please specify a file as logfile') % filename)
>      else:
>          apparmor.filename = filename
>  

For both patches, Acked-by: Steve Beattie <steve at nxnw.org>.

> (hmm, maybe we should move those checks into aa.py?)

Yeah.

Also, it'd be nice to not dump the stack trace by default, but rather
catch the exception at the top level and report just the message to the
user (unless perhaps a debugging flag is passed?).

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20141105/0f2df04e/attachment.pgp>


More information about the AppArmor mailing list