[EMAIL PROTECTED] writes:

> Does anyone have a command to list all the group entries defined in the
> protection database?

----------------------------------------------------------------------

#!/usr/bin/perl
#
# listgroups - list all AFS groups
#
# -l gives long output including owner, creator, and numeric id
#
# Dan Bloch <[EMAIL PROTECTED]>
#

$LONG = (@ARGV[0] eq "-l");

$listmax = `pts listmax`;
$listmax =~ /^Max user id is \d+ and max group id is (-\d+)\.$/
    || die "unexpected pts listmax output: $listmax";

$maxgroup = $1;

print STDERR "Running pts examine...\n";        # takes a minute or two
$cmd = "pts examine " .  join(" ", $maxgroup..0);
@examine = `$cmd 2> /dev/null`;

for (@examine) {
    next if /membership: .*, flags: .*, group quota: .*/;
    if (/^Name: /) {
        s/Name: (\S+),.*/\1/ unless $LONG;
        push(@groups, $_);
    } else {
        print(STDERR $_);
    }
}

print sort(@groups);


Reply via email to