1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 05:30:21 +02:00

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 <ft@bewatermyfriend.org>.
This commit is contained in:
Ludovic Courtès 2014-02-20 22:57:26 +01:00
parent 8f5dbecb4b
commit ae8d8a84ef

View file

@ -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))