From e3d5303849383787ba469a57c131d13db454fd08 Mon Sep 17 00:00:00 2001 From: zacheiss Date: Mon, 11 Aug 2003 05:08:26 +0000 Subject: [PATCH] Fix bug in removal of personal groups belonging to deactivated users. If we had a personal group of a deactivated user followed by a prefixless group, the prefixless group would incorrectly be removed. --- afssync/INSTRUCTIONS | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/afssync/INSTRUCTIONS b/afssync/INSTRUCTIONS index e76c9ae8..5a66081d 100644 --- a/afssync/INSTRUCTIONS +++ b/afssync/INSTRUCTIONS @@ -23,11 +23,41 @@ to extract and prepare the personal groups and special user entries in the old prdb for being reincorporated into the new prdb. awk -F\| '$9 == 3 {print $1}' /backup/backup_1/users > /tmp/deactivated - perl -e 'for(`cat /tmp/deactivated`) { chop; $ex{$_}=1;} \ - $punt=0; foreach $L (`cat prdb.extra.sort`){ \ - @w=split(/ /,$L); $_=$w[0]; if ( /:/ ) \ - {@x=split(/:/,$w[0]); if($ex{$x[0]}) {$punt=1;}else{$punt=0;}} \ - print $L unless $punt==1;}' > prdb.extra.trimmed + +and the following perl script: + +#!/usr/athena/bin/perl -w + +open(OUT, ">prdb.extra.trimmed"); + +for ( `cat /tmp/deactivated` ) { + chop; + $ex{$_} = 1; +} + +$punt = 0; + +foreach $L ( `cat prdb.extra.sort` ) { + @w = split(/ /,$L); + $_ = $w[0]; + if ( /:/ ) { + @x = split(/:/,$w[0]); + if ($ex{$x[0]}) { + $punt=1; + } else { + $punt=0; + } + } else { + # If we got here, we're either a user, a prefixless + # group, or a group member. + $punt = 0 if $w[0]; + } + print OUT $L unless $punt == 1; +} + +close(OUT); +exit 0; + to remove the personal groups for users who are deactivated awk '/^[^ ][^:]*@/ {printf "KERBEROS:%s\n",$1}' prdb.extra.trimmed \ -- 2.45.1