Index: ccvs/src/cvs.h
diff -c ccvs/src/cvs.h:1.1 ccvs/src/cvs.h:1.2
*** ccvs/src/cvs.h:1.1	Wed Nov 27 15:53:10 2002
--- ccvs/src/cvs.h	Tue Sep  2 14:38:30 2003
***************
*** 187,192 ****
--- 187,193 ----
  #define CVSROOTADM_WRITERS	"writers"
  #define CVSROOTADM_PASSWD	"passwd"
  #define CVSROOTADM_CONFIG	"config"
+ #define CVSROOTADM_IMPORTALLOW  "importallow"
  
  #define CVSNULLREPOS		"Emptydir"	/* an empty directory */
  
Index: ccvs/src/import.c
diff -c ccvs/src/import.c:1.2 ccvs/src/import.c:1.3
*** ccvs/src/import.c:1.2	Thu Aug 28 16:49:38 2003
--- ccvs/src/import.c	Tue Sep  2 14:38:30 2003
***************
*** 69,74 ****
--- 69,83 ----
      List *ulist;
      Node *p;
      struct logfile_info *li;
+     /* "importallow" parsing */
+     FILE *fp;
+     int flen;
+     char *fname = NULL;
+     char *last, *uname;
+     char *line = NULL;
+     size_t line_allocated = 0;
+     char *current_user = NULL;
+     int allowed = 0;
  
      if (argc == -1)
  	usage (import_usage);
***************
*** 76,79 ****
      ign_setup ();
      wrap_setup ();
  
      vbranch = xstrdup (CVSBRANCH);
--- 85,175 ----
      ign_setup ();
      wrap_setup ();
  
+     if ( CVSroot_directory == NULL )
+     {
+       error (0, 0, "root directory value not set" );
+       return 0;
+     }
+ 
+     if ( CVSROOTADM == NULL )
+     {
+       error (0, 0, "CVS Root admin directory not set" );
+       return 0;
+     }
+ 
+     flen = strlen (CVSroot_directory)
+            + strlen (CVSROOTADM)
+            + strlen (CVSROOTADM_IMPORTALLOW)
+            + 3;
+  
+     fname = xmalloc (flen);
+     (void) sprintf (fname, "%s/%s/%s", CVSroot_directory,
+                     CVSROOTADM, CVSROOTADM_IMPORTALLOW);
+ 
+     fp = fopen (fname, "r");
+     if (fp)
+     {
+         current_user = CVS_Username;
+ 
+         /* CVS_Username is only set if "pserver" is the access method; this
+            will work if "ext" is the access method as well */
+         if (current_user == NULL) {
+           current_user = cuserid( NULL );
+         }
+ 
+ 	/*
+ 	 * File format:
+ 	 *  [<whitespace>]<user><whitespace><end-of-line>
+ 	 *
+ 	 * comment lines begin with '#'
+ 	 */
+ 	while (getline (&line, &line_allocated, fp) >= 0)
+ 	{
+ 	    /* skip lines starting with # */
+ 	    if (line[0] == '#')
+ 		continue;
+ 
+ 	    if ((last = strrchr (line, '\n')) != NULL)
+ 		*last = '\0';			/* strip the newline */
+ 
+ 	    /* Skip leading white space. */
+ 	    for (uname = line;
+ 		 *uname && isspace ((unsigned char) *uname);
+ 		 uname++)
+ 		;
+ 
+             /* compare the parsed user name with the current user */
+             if ( !strcmp( current_user, uname ) )
+             {
+               allowed = 1;
+               break;
+             }
+ 	}
+ 
+ 	if (line)
+ 	    free (line);
+ 	if (ferror (fp))
+ 	    error (0, 0, "cannot read %s", CVSROOTADM_CHECKOUTLIST);
+ 	if (fclose (fp) < 0)
+ 	    error (0, 0, "cannot close %s", CVSROOTADM_CHECKOUTLIST);
+     }
+     else
+     {
+       /* If file not found, assume everybody can run the import command. */
+       allowed = 1;
+     }
+ 
+     if ( fname )
+     {
+       free( fname );
+     }
+ 
+     if ( !allowed ) {
+       error( 0, 0, 
+         "You are not authorized to use this command, %s - did you maybe mean 'checkout'?", 
+         current_user );
+ 
+       return 0;
+     }
  
      vbranch = xstrdup (CVSBRANCH);
Index: ccvs/src/mkmodules.c
diff -c ccvs/src/mkmodules.c:1.1 ccvs/src/mkmodules.c:1.2
*** ccvs/src/mkmodules.c:1.1	Wed Nov 27 15:53:11 2002
--- ccvs/src/mkmodules.c	Tue Sep  2 14:38:30 2003
***************
*** 300,305 ****
--- 300,310 ----
      NULL
  };
  
+ static const char *const importallowed_contents[] = {
+     "# This file contains a list of users who are allowed to run the 'import' command\n",
+     NULL
+ };
+ 
  static const struct admin_file filelist[] = {
      {CVSROOTADM_LOGINFO, 
  	"no logging of 'cvs commit' messages is done without a %s file",
***************
*** 340,345 ****
--- 345,353 ----
  	NULL},
      {CVSROOTADM_WRITERS,
  	"a %s file specifies read/write users",
+ 	NULL},
+     {CVSROOTADM_IMPORTALLOW,
+ 	"a %s file specifying which users are allowed to run imports",
  	NULL},
  
      /* Some have suggested listing CVSROOTADM_PASSWD here too.  This
