[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Commitinfo Script Error Message
From: |
Mark D. Baushke |
Subject: |
Re: Commitinfo Script Error Message |
Date: |
Wed, 30 Aug 2006 02:03:25 -0700 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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.
Good luck,
-- Mark
> exit 1;
>
> -------------------------------------------------------
>
> The script works but if the user is denied, the message from the echo does
> not get sent back to the user. Instead, the user gets the error:
>
> -------------------------------------------------------
>
> The server reported an error while performing the "cvs commit" command.
> MyProject: cvs commit: warning: commitinfo line contains no format
> strings:
> MyProject: "/var/lib/cvs/myrepository/CVSROOT/grant-access.sh
> admin-list.txt"
> MyProject: Appending defaults (" %r/%p %s"), but please be aware that this
> usage is
> MyProject: deprecated.
> MyProject: cvs commit: Pre-commit check failed
> MyProject: cvs [commit aborted]: correct above errors first!
>
> --------------------------------------------------------
>
> This error is not very informative to the user. Is there a way have the
> grant-access.sh script generate a message that CVS sends back to the user?
>
> Thanks!
>
> ==================================================================
> Aaron Bono
> Aranya Software Technologies, Inc.
> http://www.aranya.com
> http://codeelixir.com
> ==================================================================
> _______________________________________________
> info-cvs mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/info-cvs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)
iD8DBQFE9VRdCg7APGsDnFERAgK2AJ9y9ukDpfTJfRnULyes0R/Z/3FziwCgj7rg
K9Olg6HoBprHwRw2oDrxDQ0=
=7G/s
-----END PGP SIGNATURE-----