#!/bin/bash # Alex Dehnert --- 2009-04-24, 2009-06-27, and later # Check the ownership and other properties of various mailing lists # Takes a list-of-lists and allowed owners on the commandline cont=$1 #ownerslist=$2 publicpat=${3:-"-listeners$"} #owners=$(blanche $ownerslist -m | grep LIST | cut -d : -f 2) owners=$2 echo Allowed owners: $owners owners="GUARD $owners GUARD" for list in $(blanche $cont | grep LIST | cut -d : -f 2); do hidden=$(athrun ops qy -s -f hidden glin $list) if [[ "x$hidden" == "x" ]]; then echo $list is probably hidden else if [[ "$hidden" == 1 ]]; then echo $list is definitely hidden, but I can see it, so continuing fi info=$(blanche $list -i) public=$(athrun ops qy -s -f publicflg glin $list) owner=$(athrun ops qy -s -f ace_name glin $list) towner=$(athrun ops qy -s -f ace_type glin $list) macl=$(athrun ops qy -s -f memace_name glin $list) tmacl=$(athrun ops qy -s -f memace_type glin $list) if [[ "$towner" == "USER" ]]; then echo "$list is owned by a user ($owner)" elif [[ "$tmacl" == "USER" ]]; then echo "$list is memacl'd by a user ($macl)" elif [[ "$towner" == "KERBEROS" || "$tmacl" == "KERBEROS" ]]; then echo "$list is owned or memacl'd by a Kerberos principal" elif [[ "$towner" == "LIST" && ( "$tmacl" == "LIST" || "$tmacl" == "NONE" ) ]]; then true else echo "$list is owned or memacl'd by something funky" fi if [[ "$towner" == "LIST" ]]; then if [[ "$owner" == "GUARD" ]]; then echo "$list owned by GUARD, which shouldn't even exist" elif ( echo $owners | grep -q -- " $owner " ); then # Owned by standard owner true elif [[ "$owner" == "$list-chairs" || "$owner" == "$list-request" ]]; then # Chair / request owned true #elif ( echo "$list" | sed -e 's/-\(listeners\|members\)$/-chairs/' | grep -q --fixed-strings --line-regexp -- "$owner" ); then # # Chair owned, for a listeners/members structure # true else echo $list owned by $owner, not one of the allowed owners fi fi if [[ "$public" == "1" ]]; then if ( echo $list | grep -q -- "$publicpat" ); then # We're allowed to be public true else echo $list is public fi fi fi # hidden heuristic end done