From f736facb472249d05f8c94d961c9827ee317f443 Mon Sep 17 00:00:00 2001 From: Abhishek Dasgupta Date: Sun, 2 Aug 2009 15:32:23 +0530 Subject: [PATCH] Fix rpath: /usr/lib/* and /lib are valid Signed-off-by: Abhishek Dasgupta --- Namcap/rpath.py | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Namcap/rpath.py b/Namcap/rpath.py index 530771c..d52d922 100644 --- a/Namcap/rpath.py +++ b/Namcap/rpath.py @@ -24,7 +24,8 @@ process = lambda s: re.search("/tmp/namcap\.[0-9]*/(.*)", s).group(1) def checkrpath(insecure_rpaths, dirname, names): "Checks if secure RPATH." - allowed = ['/usr/lib'] + allowed = ['/usr/lib','/lib'] + allowed_toplevels = map(lambda s: s + '/', allowed) warn = ['/usr/local/lib'] for i in names: @@ -42,7 +43,11 @@ def checkrpath(insecure_rpaths, dirname, names): else: rpaths=[n.group(1)] for path in rpaths: - if path not in allowed: + path_ok = path in allowed + for allowed_toplevel in allowed_toplevels: + if path.startswith(allowed_toplevel): + path_ok = True + if not path_ok: insecure_rpaths[0].append(process(dirname+'/'+i)) break if path in warn and process(dirname + "/" + i) not in insecure_rpaths: -- 1.6.4