Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: compaudit slow with many groups



On Fri, Mar 19, 2004 at 01:57:24PM -0800, Danek Duvall wrote:

>     local GROUP GROUPMEM _i_pw _i_gid _i_ulwdirs
>     if (( UID == EUID )); then
>     	getent group $UID | IFS=: read GROUP _i_pw _i_gid GROUPMEM
> 	[[ $GROUP == $LOGNAME ]] || unset GROUP GROUPMEM
>     else
>     	getent group $EGID | IFS=: read GROUP _i_pw _i_gid GROUPMEM
> 	(( _i_gid == EGID )) || unset GROUP GROUPMEM
>     fi

Hm.  That's pretty obviously broken.  But I think this is right:

    if ((UID == EUID )); then
      getent group $LOGNAME | IFS=: read GROUP _i_pw _i_gid GROUPMEM
    else
      getent group $EGID | IFS=: read GROUP _i_pw _i_gid GROUPMEM
    fi

Much quicker.  :)

Thanks,
Danek



Messages sorted by: Reverse Date, Date, Thread, Author