#!/bin/sh

# This script scans a datastore to find files which may have been assigned
# incorrect permissions as a result of bug 8984
# - https://www.illumos.org/issues/8984
# It produces a list of affected files

# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.

# Set the datastore variable to point to the area that you wish to check
datastore="/path/to/data"

find "$datastore" -acl -type f | while read f; do
        ls -V "$f" | egrep -s '(owner|grep|everyone)@.*I:' || continue
        ls -V "$f" | egrep -s '(group|everyone)@:.*:-------:allow' || continue

        echo $f
done

