From ae8d8a84ef0187a3d732e43c459182ed15536dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Feb 2014 22:57:26 +0100 Subject: [PATCH] Make sure 'ftw' allows directory traversal when running as root. * module/ice-9/ftw.scm (stat-dir-readable?-proc): Return #t when UID is zero. Reported Frank Terbeck . --- module/ice-9/ftw.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm index 9c9694fd7..133e9c9b5 100644 --- a/module/ice-9/ftw.scm +++ b/module/ice-9/ftw.scm @@ -1,6 +1,6 @@ ;;;; ftw.scm --- file system tree walk -;;;; Copyright (C) 2002, 2003, 2006, 2011, 2012 Free Software Foundation, Inc. +;;;; Copyright (C) 2002, 2003, 2006, 2011, 2012, 2014 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -259,7 +259,8 @@ (let* ((perms (stat:perms s)) (perms-bit-set? (lambda (mask) (not (= 0 (logand mask perms)))))) - (or (and (= uid (stat:uid s)) + (or (zero? uid) + (and (= uid (stat:uid s)) (perms-bit-set? #o400)) (and (= gid (stat:gid s)) (perms-bit-set? #o040))