From 90d731aef9e9b204920f5e94f7e28c2728bfbc5f Mon Sep 17 00:00:00 2001 From: Hugo Doria Date: Wed, 21 Jan 2009 17:41:42 -0300 Subject: [PATCH] Add rule to check *.a files with 777 permissions. Signed-off-by: Hugo Doria --- Namcap/__init__.py | 2 +- Namcap/afiles.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletions(-) create mode 100644 Namcap/afiles.py diff --git a/Namcap/__init__.py b/Namcap/__init__.py index 48e0919..c26842c 100644 --- a/Namcap/__init__.py +++ b/Namcap/__init__.py @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -__tarball__ = ['depends', 'directoryname', 'fileownership', 'gnomemenu', 'perllocal', 'permissions', 'symlink', 'urlpkg', 'capsnamespkg', 'emptydir', 'scrollkeeper', 'libtool', 'gnomemime', 'licensepkg', 'infodirectory', 'fhsmanpages'] +__tarball__ = ['depends', 'directoryname', 'fileownership', 'gnomemenu', 'perllocal', 'permissions', 'symlink', 'urlpkg', 'capsnamespkg', 'emptydir', 'scrollkeeper', 'libtool', 'gnomemime', 'licensepkg', 'infodirectory', 'fhsmanpages', 'afiles'] __pkgbuild__ = ['md5sums', 'tags', 'url', 'invalidstartdir', 'capsnames', 'carch', 'sfurl', 'badbackups', 'license', 'arrays'] diff --git a/Namcap/afiles.py b/Namcap/afiles.py new file mode 100644 index 0000000..8993286 --- /dev/null +++ b/Namcap/afiles.py @@ -0,0 +1,37 @@ +# +# namcap rules - afiles +# Copyright (C) 2009 Hugo Doria +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +import tarfile + +class package: + def short_name(self): + return "afiles" + def long_name(self): + return "Checks for *.a files with 755 permissions" + def prereq(self): + return "tar" + def analyze(self, pkginfo, tar): + ret = [[],[],[]] + for i in tar.getmembers(): + if str(i.name).endswith('.a') and i.mode == 0755: + ret[1].append("File (" + i.name + ") has permission set to 755.") + return ret + def type(self): + return "tarball" +# vim: set ts=4 sw=4 noet: -- 1.6.1