[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
checkininfo administrative file
From: |
Andrey Aristarkhov |
Subject: |
checkininfo administrative file |
Date: |
Tue, 13 Aug 2002 00:25:36 +0400 |
Hi all!
I've seen a lot of messages about how to control which users can do
checkouts (exports) of particular modules. I have a small enhancements
proposal. There could be file in $CVSROOT/CVSROOT named, say,
checkoutinfo where administrators could place scripts to control
checkout persmissions. Format of the file is the same as for commitinfo.
The same about behaviour of checkout/export operations: if filter script
returns non-zero result operation will be aborted.
There is a patch for checkout.c file at the bottom of this message.
Of course, we need #define CVSROOTADM_CHECKOUTINFO checkoutinfo line in
cvs.h header file.
Regards,
Andrey Aristarkhov
BiTechnology
Index: checkout.c
===================================================================
RCS file: /cvs/ccvs/src/checkout.c,v
retrieving revision 1.106
diff -u -r1.106 checkout.c
--- checkout.c 19 Jul 2001 16:35:32 -0000 1.106
+++ checkout.c 12 Aug 2002 20:24:04 -0000
@@ -576,6 +576,31 @@
* process_module calls us back here so we do the actual checkout stuff
*/
/* ARGSUSED */
+
+static int precheckout_proc(char * repository, char * filter) {
+ /* see if the filter is there, only if it's a full path */
+ if (isabsolute (filter)) {
+ char *s, *cp;
+
+ s = xstrdup (filter);
+ for (cp = s; *cp; cp++)
+ if (isspace ((unsigned char) *cp)) {
+ *cp = '\0';
+ break;
+ }
+ if (!isfile (s))
+ {
+ error (0, errno, "cannot find pre-commit filter %s'", s);
+ free (s);
+ return (1); /* so it fails! */
+ }
+ free (s);
+ }
+ run_setup(filter);
+ run_arg(repository);
+ return run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY);
+}
+
static int
checkout_proc (argc, argv, where_orig, mwhere, mfile, shorten,
local_specified, omodule, msg)
@@ -607,6 +632,12 @@
* omodule is the original arg to do_module()
*/
+ /* Added by Andrey Aristarkhov */
+ /* run pre-checkout checks for the repository */
+ if (Parse_Info (CVSROOTADM_CHECKOUTINFO, argv[0], precheckout_proc,
1) > 0) {
+ error (1, 0, "Pre-checkout check failed");
+ }
+
/* Set up the repository (maybe) for the bottom directory.
Allocate more space than we need so we don't need to keep
reallocating this string. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- checkininfo administrative file,
Andrey Aristarkhov <=