bug-cvs
[Top][All Lists]
Advanced

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

[PATCH] Configure option to disable import


From: Mark
Subject: [PATCH] Configure option to disable import
Date: Sat, 15 Mar 2003 11:25:16 -0800 (PST)

Here is a patch to provide a configure option to disable import on the server
binary. When CVS is setup with triggers in a CM environment, import command can
provide ways for users to add new files and maintain them outside the normal
commit process. But the main reason I am submitting this patch is becuase of
the number of people trying out the import command on the client to see what it
does or thinking thats a fast way to get there changes in. I know all about
educating the user, but it doesn't always work and CM can't pick those that
Development hires, thus this patch. It leaves import on by default, but
provides a way to disable it. (fyi, the admin account will have a cvs binary
and local access to the repository to run any needed imports)

Just removing import from the requests struct didn't work. Even though the
client doesn't recieve import in the valid request list, the client still
allows an import call. If import is taken out of the requests struct, then the
import transfer has to complete before the server repsonds with invalid
request. Calling the error() routine right before the do_cvs_command routine
for import seems to provide timely and immediate feedback that import is
disable.

Thanks,

Mark


Index: server.c
===================================================================
RCS file: /cvsroot/ccvs/src/server.c,v
retrieving revision 1.289
diff -u -r1.289 server.c
--- server.c    14 Mar 2003 09:57:49 -0000      1.289
+++ server.c    15 Mar 2003 19:09:19 -0000
@@ -3676,7 +3676,11 @@
 serve_import (arg)
     char *arg;
 {
+#ifdef DISABLE_IMPORT
+    error (1, 0, "cannot fill request, import has been disabled");
+#else
     do_cvs_command ("import", import);
+#endif
 }
 
 static void

Index: configure.in
===================================================================
RCS file: /cvsroot/ccvs/configure.in,v
retrieving revision 1.181
diff -c -r1.181 configure.in
*** configure.in        4 Mar 2003 22:47:08 -0000       1.181
--- configure.in        15 Mar 2003 19:22:23 -0000
***************
*** 631,636 ****
--- 631,652 ----
      [Define if you want CVS to be able to be a remote repository client.])
  fi
  
+ # Check for option requesting the import command be disabled
+ AC_ARG_ENABLE(
+   [import],
+   AC_HELP_STRING(
+     [--disable-import],
+     [Disable the server import command]))
+ 
+ if test no = "$enable_import"; then
+     AC_DEFINE(
+       [DISABLE_IMPORT], [1],
+       [Define to 1 to disable the server import command. This can be used
+        with a server binary to prevent file adds that avoid commit trigger
+        checks. Also can be used to prevent accidental imports of user's local

+        harddrives.])
+ fi
+ 
  AC_ARG_ENABLE(
    [password-authenticated-client],
    AC_HELP_STRING(




__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com




reply via email to

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