This is a patch to optionally (configure --with-fermicvsuser) have
accounts for remote cvs access where the remote user name is used instead
of the local one -- in particular ones which begin or end with "cvs".

This was posted a while ago to the issue tracker on ccvs.cvshome.org, but
apparently no-one reads that.

-----
Marc Mengel <[EMAIL PROTECTED]>
Index: acconfig.h
===================================================================
RCS file: /cvs/oss/cvs/src/cvs/acconfig.h,v
retrieving revision 1.1.1.3
retrieving revision 1.4
diff -c -r1.1.1.3 -r1.4
*** acconfig.h  2001/08/17 20:31:18     1.1.1.3
--- acconfig.h  2001/08/17 21:06:43     1.4
***************
*** 48,50 ****
--- 48,53 ----
  
  /* Define to force lib/regex.c to define re_comp et al.  */
  #undef _REGEX_RE_COMP
+ 
+ /* Fermi cvsuser stuff */
+ #undef FERMICVSUSER
Index: config.h.in
===================================================================
RCS file: /cvs/oss/cvs/src/cvs/config.h.in,v
retrieving revision 1.1.1.3
retrieving revision 1.7
diff -c -r1.1.1.3 -r1.7
*** config.h.in 2001/08/17 20:31:18     1.1.1.3
--- config.h.in 2001/08/23 15:12:47     1.7
***************
*** 122,127 ****
--- 122,130 ----
  /* Define to force lib/regex.c to define re_comp et al.  */
  #undef _REGEX_RE_COMP
  
+ /* Fermi cvsuser stuff */
+ #undef FERMICVSUSER
+ 
  /* Define if you have the dup2 function.  */
  #undef HAVE_DUP2
  
Index: configure.in
===================================================================
RCS file: /cvs/oss/cvs/src/cvs/configure.in,v
retrieving revision 1.1.1.3
retrieving revision 1.5
diff -c -r1.1.1.3 -r1.5
*** configure.in        2001/08/17 20:31:18     1.1.1.3
--- configure.in        2001/08/17 21:06:43     1.5
***************
*** 337,342 ****
--- 337,357 ----
    AC_DEFINE(HAVE_SETMODE)
  fi
  
+ dnl
+ dnl Use --with-fermicvsuser to turn on fermi cvsh $REMOTEUSER support
+ dnl
+ AC_ARG_ENABLE(fermicvsuser,
+   [  --enable-fermicvsuser     enable fermi cvsh support],
+   [case "${enableval}" in
+     yes) fermicvsuser=true ;;
+     no) fermicvsuser=false ;;
+     *) AC_MSG_ERROR(bad value ${enableval} for encryption option) ;;
+    esac],
+   [fermicvsuser=false])
+ if test "$fermicvsuser" = "true"; then
+   AC_DEFINE(FERMICVSUSER)
+ fi
+ 
  test -f src/options.h && (
    AC_MSG_WARN(saving ./src/options.h in ./src/options.h-SAVED)
    AC_MSG_WARN(You may wish to check that local options have not been lost.)
Index: src/subr.c
===================================================================
RCS file: /cvs/oss/cvs/src/cvs/src/subr.c,v
retrieving revision 1.1.1.3
retrieving revision 1.13
diff -c -r1.1.1.3 -r1.13
*** subr.c      2001/08/17 20:31:24     1.1.1.3
--- subr.c      2001/10/03 14:42:38     1.13
***************
*** 373,380 ****
        cache = xstrdup (uidname);
        return cache;
      }
!     cache = xstrdup (pw->pw_name);
!     return cache;
  #endif
  }
  
--- 373,414 ----
        cache = xstrdup (uidname);
        return cache;
      }
! #ifdef FERMICVSUSER
!     /* modified for SDSS repository -- by Chih-Hao Huang at Fermilab
!      *
!      * in sdsscvs, all accesses to the repository are using remote cvs
!      * through cvsuser account, which owns everything and gives no
!      * access rights to group nor other.
!      * Therefore, the real (remote) user has to be picked up in LOGNAME
!      * or USER, which are set by cvsh, the restricted shell for cvsuser.
!      *
!      * of course, we could have set the uid of cvsuser to 0, but we are
!      * not convinced that it is safe ...
!      *
!      * modification -- by Chris Greene at Fermilab
!      * Check only the first three letters of login, so
!      * "cvsuser", "cvscdf", etc. all work without recompiling
!      * 
!      * one more mod -- by Marc Mengel, Fermilab, also check
!      * for "cvs" starting at last 'c'; to match "cdfcvs", etc.
!      */
!     {
!     char *p;
!     
!     p = strrchr(pw->pw_name, 'c');
!     if (!strncmp("cvs", pw->pw_name, 3) || (p && !strcmp("cvs",p)))
!     {
!       char *name;
!       if (((name = getenv("LOGNAME")) || (name = getenv("USER")))
!             && *name) {
!           cache = xstrdup(name);
!           return cache;
!       }
!     }
!     }
! #endif
!       cache = xstrdup (pw->pw_name);
!       return cache;
  #endif
  }
  

Reply via email to