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XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
gsi_dn=''

if $regress/bin/am_I_gfarmadm; then
    :
else
    exit $exit_unsupported
fi

trap 'gfuser -d "$user" 2>/dev/null; rm -f $localtmp; exit $exit_trap' $trap_sigs

if gfuser -c "$user" "$real" "$home" "$gsi_dn" 2>$localtmp; then
    gfuser -d "$user"
else
    if grep ': invalid argument$' $localtmp >/dev/null; then
	exit_code=$exit_pass
    fi
fi

rm -f $localtmp
exit $exit_code
