From fc41cf7214c2c6ea3200c695a728e73afc74dc83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 18 May 2022 01:22:15 +0200 Subject: [PATCH] acl detection in updated meta blocks --- acl.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/acl.sh b/acl.sh index 74fc8dc..d232ea0 100755 --- a/acl.sh +++ b/acl.sh @@ -1,7 +1,7 @@ #!/bin/sh # ACL_OVERRIDE="${ACL_OVERRIDE:-Admin:read,write}" -ACL_DEFAULT="${ACL_DEFAULT:-All:read${BR}Known:read,write}" +ACL_DEFAULT="${ACL_DEFAULT:-Known:read,write${BR}All:read}" acl_cachepath='' acl_collection='' @@ -34,16 +34,21 @@ acl_collect(){ continue fi - n=20; while read -r head acl; do - if [ "$head" = "%acl" ]; then - acl_collection="${acl%${CR}}${BR}" - printf "%s\n" "${acl%${CR}}" - n=$((n+1)) - fi + acl="$(sed -En ' + s;\r$;;; + /^%acl([\t ]+.*)?$/bACL; + 20q; + b; - n="$((n - 1))" - [ "$n" -eq 0 ] && break - done <"$pagefile" + :ACL + s;(%(acl)?)?[\t ]*;; + p; n; s;\r$;;; + /^(%[ \t]+|%acl[ \t]+|[ \t]+)[^ \t\r]+$/bACL; + /^(%[ \t]*|%acl[ \t]*)$/bACL; + ' <"$pagefile")" + + printf %s\\n "${acl}" + acl_collection="${acl_collection}${acl}${BR}" done printf '%s\n' "$ACL_DEFAULT" -- 2.39.2