info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Commitinfo Script Error Message


From: Aaron Bono
Subject: Re: Commitinfo Script Error Message
Date: Wed, 30 Aug 2006 13:01:08 -0500

On 8/30/06, Mark D. Baushke <address@hidden> wrote:

Aaron Bono <address@hidden> writes:

> I have written a script called grant-access.sh which goes through a text
> file that contains a list of users and allows a commit if the user is in the
> file and denies the access if they are not.  Here is the script:
>
> -------------------------------------------------------
>
> #!/bin/sh
> listFile=$1
> list=`cat ${CVSROOT}/CVSROOT/${listFile}`
>
> for user in $list
> do
>     if [ "${CVS_USER}" = "${user}" ];
>     then
>         exit 0;
>     fi
> done
> echo "User ${CVS_USER} is not allowed to commit to this resource"

You probably want to write that message to stderr like this:

echo "User ${CVS_USER} is not allowed to commit to this resource" >&2

Hmmm... Is the repository is only ever used in client/server mode?
(and at that only in :pserver:, :gserver: or :kserver: modes).

To the best of my recollection...

If :local: mode is used, then CVS_USER will not be set.
If :ext: mode is used, then CVS_USER will not be set.

So, you may wish to have a check if the variable is set or not.

    if [ -z "$CVS_USER" ]; then
        echo Only :pserver: mode with a valid user is alloed to commit" >&2
        exit 1
    fi

In any case, you may find it useful to look at the contrib/cvs_acls.*
file that comes with your cvs 1.12.x source distribution.

 
That did the trick.

I will be looking over the cvs_acls though as it may work much better for my needs.  The problem I will have is that USER is always cvs - probably because we are using pserver or, more likely, because of the way we have set up the passwd file.  That is why I am using CVS_USER instead.  I am looking into switching to ext or extssh but for now we just pass CVS pserver through an SSH tunnel right now.

Thanks!

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================
reply via email to

[Prev in Thread] Current Thread [Next in Thread]