cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/src ChangeLog mkmodules.c sanity.sh server.c [cvs1-11-x-b


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog mkmodules.c sanity.sh server.c [cvs1-11-x-branch]
Date: Mon, 07 May 2007 13:14:32 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Branch:         cvs1-11-x-branch
Changes by:     Derek Robert Price <dprice>     07/05/07 13:14:30

Modified files:
        src            : ChangeLog mkmodules.c sanity.sh server.c 

Log message:
        * mkmodules.c (init): Assert that the server is not active.
        * server.c (serve_init): Send error message when the init command is
        received from a client.
        
        * sanity.sh (*): Avoid using remote init.
        (skip_always, localonly, restore_adm): New convenience functions.       

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.2336.2.480&r2=1.2336.2.481
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/mkmodules.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.66.6.8&r2=1.66.6.9
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/sanity.sh?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.752.2.208&r2=1.752.2.209
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/server.c?cvsroot=cvs&only_with_tag=cvs1-11-x-branch&r1=1.284.2.52&r2=1.284.2.53

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2336.2.480
retrieving revision 1.2336.2.481
diff -u -b -r1.2336.2.480 -r1.2336.2.481
--- ChangeLog   8 Mar 2007 15:27:11 -0000       1.2336.2.480
+++ ChangeLog   7 May 2007 13:14:28 -0000       1.2336.2.481
@@ -1,3 +1,12 @@
+2007-05-07  Derek Price  <address@hidden>
+
+       * mkmodules.c (init): Assert that the server is not active.
+       * server.c (serve_init): Send error message when the init command is
+       received from a client.
+
+       * sanity.sh (*): Avoid using remote init.
+       (skip_always, localonly, restore_adm): New convenience functions.       
+
 2007-03-08  Larry Jones  <address@hidden>
 
        * rcs.c (findmagictag): Cast node->data before doing arithmetic

Index: mkmodules.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/mkmodules.c,v
retrieving revision 1.66.6.8
retrieving revision 1.66.6.9
diff -u -b -r1.66.6.8 -r1.66.6.9
--- mkmodules.c 22 Jun 2006 18:17:04 -0000      1.66.6.8
+++ mkmodules.c 7 May 2007 13:14:28 -0000       1.66.6.9
@@ -10,6 +10,7 @@
  * You may distribute under the terms of the GNU General Public License as
  * specified in the README file that comes with the CVS kit.  */
 
+#include <assert.h>
 #include "cvs.h"
 #include "getline.h"
 #include "history.h"
@@ -868,6 +869,8 @@
 
     const struct admin_file *fileptr;
 
+    assert (!server_active);
+
     umask (cvsumask);
 
     if (argc == -1 || argc > 1)

Index: sanity.sh
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/sanity.sh,v
retrieving revision 1.752.2.208
retrieving revision 1.752.2.209
diff -u -b -r1.752.2.208 -r1.752.2.209
--- sanity.sh   1 Mar 2007 20:57:43 -0000       1.752.2.208
+++ sanity.sh   7 May 2007 13:14:28 -0000       1.752.2.209
@@ -803,6 +803,13 @@
   passed=`expr $passed + 1`
 }
 
+# Like skip(), but don't fail when $skipfail is set.
+skip_always ()
+{
+  echo "SKIP: $1${2+ ($2)}" >>$LOGFILE
+  skipped=`expr $skipped + 1`
+}
+
 skip ()
 {
   if $skipfail; then
@@ -823,6 +830,12 @@
   warnings=`expr $warnings + 1`
 }
 
+# Convenience function for skipping tests run only in local mode.
+localonly ()
+{
+  skip_always $1 "only tested in local mode"
+}
+
 fail ()
 {
   echo "FAIL: $1" | tee -a ${LOGFILE}
@@ -853,6 +866,13 @@
   fi
 }
 
+# Restore changes to CVSROOT admin files.
+restore_adm ()
+{
+    rm -rf $CVSROOT_DIRNAME/CVSROOT
+    cp -Rp $TESTDIR/CVSROOT.save $CVSROOT_DIRNAME/CVSROOT
+}
+
 # See dotest and dotest_fail for explanation (this is the parts
 # of the implementation common to the two).
 dotest_internal ()
@@ -2075,10 +2095,25 @@
 
 
 ###
+### Init the repository.
+###
+dotest init-1 "$testcvs -d$CVSROOT_DIRNAME init"
+
+# Copy the admin files for restore_adm.
+cp -Rp $CVSROOT_DIRNAME/CVSROOT $TESTDIR/CVSROOT.save
+
+
+
+###
 ### The tests
 ###
-dotest 1 "${testcvs} init" ''
-dotest 1a "${testcvs} init" ''
+if $remote; then
+       localonly init-1a
+else
+       dotest init-1a "$testcvs init"
+fi
+
+
 
 ### The big loop
 for what in $tests; do
@@ -15459,12 +15494,7 @@
            exit 0
          fi
 
-         # restore the default loginfo script
-         rm -f ${CVSROOT_DIRNAME}/CVSROOT/loginfo,v \
-                ${CVSROOT_DIRNAME}/CVSROOT/loginfo \
-                ${CVSROOT_DIRNAME}/CVSROOT/commitlog
-         dotest editor-emptylog-continue-cleanup-1 "${testcvs} init" ''
-
+         restore_adm
          cd ../..
          rm -r 1
          rm ${TESTDIR}/editme
@@ -19919,16 +19949,6 @@
 ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:ext:${hostname}:\.\./crerepos.\."
            cd ..
            rm -r 1
-
-           mkdir 1; cd 1
-           dotest_fail crerepos-6b-r \
-"${testcvs} -d :ext:`hostname`:crerepos init" \
-"${PROG} [a-z]*: CVSROOT requires a path spec:
-${PROG} [a-z]*: 
:(gserver|kserver|pserver):\[\[user\]\[:address@hidden:\[port\]\]/path
-${PROG} [a-z]*: \[:(ext|server):address@hidden:\]/path
-${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:ext:${hostname}:crerepos.\."
-           cd ..
-           rm -r 1
          else # local
            # Test that CVS rejects a relative path in CVSROOT.
 
@@ -26771,9 +26791,9 @@
          testcvs1="${testcvs} -d ${CVSROOT1}"
          testcvs2="${testcvs} -d ${CVSROOT2}"
 
-         dotest multiroot-setup-1 "mkdir ${CVSROOT1_DIRNAME} 
${CVSROOT2_DIRNAME}" ""
-         dotest multiroot-setup-2 "${testcvs1} init" ""
-         dotest multiroot-setup-3 "${testcvs2} init" ""
+         dotest multiroot-setup-1 "mkdir $CVSROOT1_DIRNAME $CVSROOT2_DIRNAME"
+         dotest multiroot-setup-2 "$testcvs -d$CVSROOT1_DIRNAME init"
+         dotest multiroot-setup-3 "$testcvs -d$CVSROOT2_DIRNAME init"
 
          #
          # create some directories in root1
@@ -27902,8 +27922,8 @@
          CVSROOT1=`newroot $CVSROOT1_DIRNAME`
          CVSROOT2=`newroot $CVSROOT2_DIRNAME`
 
-         dotest multiroot2-1 "${testcvs} -d ${CVSROOT1} init" ""
-         dotest multiroot2-2 "${testcvs} -d ${CVSROOT2} init" ""
+         dotest multiroot2-1 "$testcvs -d$CVSROOT1_DIRNAME init"
+         dotest multiroot2-2 "$testcvs -d$CVSROOT2_DIRNAME init"
 
          mkdir imp-dir; cd imp-dir
          echo file1 >file1
@@ -28045,12 +28065,12 @@
          CVSROOT2=`newroot ${TESTDIR}/root2`
 
          mkdir 1; cd 1
-         dotest multiroot3-1 "${testcvs} -d ${CVSROOT1} init" ""
+         dotest multiroot3-1 "$testcvs -d$TESTDIR/root1 init"
          dotest multiroot3-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
          mkdir dir1
          dotest multiroot3-3 "${testcvs} add dir1" \
 "Directory ${TESTDIR}/root1/dir1 added to the repository"
-         dotest multiroot3-4 "${testcvs} -d ${CVSROOT2} init" ""
+         dotest multiroot3-4 "$testcvs -d$TESTDIR/root2 init"
          rm -r CVS
          dotest multiroot3-5 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
          mkdir dir2
@@ -28170,7 +28190,7 @@
          CVSROOT2=`newroot ${TESTDIR}/root2`
 
          mkdir 1; cd 1
-         dotest multiroot4-1 "${testcvs} -d ${CVSROOT1} init" ""
+         dotest multiroot4-1 "$testcvs -d$TESTDIR/root1 init"
          dotest multiroot4-2 "${testcvs} -d ${CVSROOT1} -q co -l ." ""
          mkdir dircom
          dotest multiroot4-3 "${testcvs} add dircom" \
@@ -28189,7 +28209,7 @@
 done"
          cd ../..
          mkdir 2; cd 2
-         dotest multiroot4-6 "${testcvs} -d ${CVSROOT2} init" ""
+         dotest multiroot4-6 "$testcvs -d$TESTDIR/root2 init"
          dotest multiroot4-7 "${testcvs} -d ${CVSROOT2} -q co -l ." ""
          mkdir dircom
          dotest multiroot4-8 "${testcvs} add dircom" \
@@ -28276,7 +28296,7 @@
          CVSROOT1=`newroot ${TESTDIR}/root1`
          CVSROOT_MOVED=`newroot ${TESTDIR}/root-moved`
 
-         dotest reposmv-setup-1 "${testcvs} -d ${CVSROOT1} init" ""
+         dotest reposmv-setup-1 "$testcvs -d$TESTDIR/root1 init"
          mkdir imp-dir; cd imp-dir
          echo file1 >file1
          dotest reposmv-setup-2 \
@@ -28474,31 +28494,18 @@
 noop
 EOF
 
-           dotest pserver-5a "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-E Protocol error: init says \"${TESTDIR}/2\" but pserver says 
\"${CVSROOT_DIRNAME}\"
+           dotest pserver-5a "$testcvs --allow-root=$CVSROOT_DIRNAME pserver" \
+"$DOTSTAR LOVE YOU
+E init may not be run remotely
 error  " <<EOF
 BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-testme
-Ay::'d
-END AUTH REQUEST
-init ${TESTDIR}/2
-EOF
-           dotest_fail pserver-5b "test -d ${TESTDIR}/2" ''
-
-           dotest pserver-5c "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-E init xxx must be an absolute pathname
-error  " <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
+$CVSROOT_DIRNAME
 testme
 Ay::'d
 END AUTH REQUEST
-init xxx
+init $TESTDIR/2
 EOF
-           dotest_fail pserver-5d "test -d xxx" ''
+           dotest_fail pserver-5b "test -d $TESTDIR/2"
 
            dotest_fail pserver-6 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
 "I HATE YOU" <<EOF
@@ -28600,18 +28607,6 @@
 version
 EOF
 
-           dotest pserver-15 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
-error  " <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-anonymous
-Ay::'d
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            dotest pserver-16 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
 "${DOTSTAR} LOVE YOU
 M Concurrent Versions System (CVS) .*
@@ -28625,17 +28620,6 @@
 version
 EOF
 
-           dotest pserver-17 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-ok" <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-testme
-Ay::'d
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            dotest pserver-18 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
 "${DOTSTAR} LOVE YOU
 M Concurrent Versions System (CVS) .*
@@ -28649,17 +28633,6 @@
 version
 EOF
 
-           dotest pserver-19 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-ok" <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-${username}
-Anything
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            # Check that writers can write, everyone else can only read
            # even if not listed in readers
 
@@ -28680,18 +28653,6 @@
 version
 EOF
 
-           dotest pserver-21 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
-error  " <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-anonymous
-Ay::'d
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            dotest pserver-22 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
 "${DOTSTAR} LOVE YOU
 M Concurrent Versions System (CVS) .*
@@ -28705,17 +28666,6 @@
 version
 EOF
 
-           dotest pserver-23 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-ok" <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-testme
-Ay::'d
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            dotest pserver-24 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
 "${DOTSTAR} LOVE YOU
 M Concurrent Versions System (CVS) .*
@@ -28729,18 +28679,6 @@
 version
 EOF
 
-           dotest pserver-25 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
-error  " <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-${username}
-Anything
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            # Should work the same without readers
 
            rm ${CVSROOT_DIRNAME}/CVSROOT/readers
@@ -28758,18 +28696,6 @@
 version
 EOF
 
-           dotest pserver-27 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
-error  " <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-anonymous
-Ay::'d
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            dotest pserver-28 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
 "${DOTSTAR} LOVE YOU
 M Concurrent Versions System (CVS) .*
@@ -28783,17 +28709,6 @@
 version
 EOF
 
-           dotest pserver-29 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-ok" <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-testme
-Ay::'d
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            dotest pserver-30 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
 "${DOTSTAR} LOVE YOU
 M Concurrent Versions System (CVS) .*
@@ -28807,18 +28722,6 @@
 version
 EOF
 
-           dotest pserver-31 "${testcvs} --allow-root=${CVSROOT_DIRNAME} 
pserver" \
-"${DOTSTAR} LOVE YOU
-E ${PROG} \\[server aborted\\]: .init. requires write access to the repository
-error  " <<EOF
-BEGIN AUTH REQUEST
-${CVSROOT_DIRNAME}
-${username}
-Anything
-END AUTH REQUEST
-init ${CVSROOT_DIRNAME}
-EOF
-
            # pserver used to try and print from the NULL pointer 
            # in this error message in this case
            dotest_fail pserver-bufinit "${testcvs} pserver" \
@@ -28851,12 +28754,16 @@
 
            # Could also test for relative pathnames here (so that crerepos-6a
            # and crerepos-6b can use :fork:).
-           dotest server-2 "${testcvs} server" "ok" <<EOF
+           dotest server-2 "$testcvs server" \
+"E init may not be run remotely
+error  " <<EOF
 Set OTHER=variable
 Set MYENV=env-value
 init ${TESTDIR}/crerepos
 EOF
-           dotest server-3 "test -d ${TESTDIR}/crerepos/CVSROOT" ""
+           dotest_fail server-3 "test -d $TESTDIR/crerepos/CVSROOT"
+
+           dotest server-3a "$testcvs -d$TESTDIR/crerepos init"
 
            # Now some tests of gzip-file-contents (used by jCVS).
            ${AWK} 'BEGIN { \
@@ -29549,7 +29456,7 @@
          CVSROOT_DIRNAME=${TESTDIR}/cvs.root
          CVSROOT=`newroot ${CVSROOT_DIRNAME}`
 
-         dotest dottedroot-init-1 "${testcvs} init" ""
+         dotest dottedroot-init-1 "$testcvs -d$CVSROOT_DIRNAME init"
          mkdir dir1
          mkdir dir1/dir2
          echo version1 >dir1/dir2/file1

Index: server.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/server.c,v
retrieving revision 1.284.2.52
retrieving revision 1.284.2.53
diff -u -b -r1.284.2.52 -r1.284.2.53
--- server.c    23 Jun 2006 18:58:47 -0000      1.284.2.52
+++ server.c    7 May 2007 13:14:30 -0000       1.284.2.53
@@ -3986,38 +3986,11 @@
 serve_init (arg)
     char *arg;
 {
-    cvsroot_t *saved_parsed_root;
-
-    if (!isabsolute (arg))
-    {
        if (alloc_pending (80 + strlen (arg)))
-           sprintf (pending_error_text,
-                    "E init %s must be an absolute pathname", arg);
-    }
-#ifdef AUTH_SERVER_SUPPORT
-    else if (Pserver_Repos != NULL)
-    {
-       if (strcmp (Pserver_Repos, arg) != 0)
-       {
-           if (alloc_pending (80 + strlen (Pserver_Repos) + strlen (arg)))
-               /* The explicitness is to aid people who are writing clients.
-                  I don't see how this information could help an
-                  attacker.  */
-               sprintf (pending_error_text, "\
-E Protocol error: init says \"%s\" but pserver says \"%s\"",
-                        arg, Pserver_Repos);
-       }
-    }
-#endif
+       sprintf (pending_error_text, "E init may not be run remotely", arg);
 
     if (print_pending_error ())
        return;
-
-    saved_parsed_root = current_parsed_root;
-    current_parsed_root = local_cvsroot (arg);
-    do_cvs_command ("init", init);
-    free_cvsroot_t (current_parsed_root);
-    current_parsed_root = saved_parsed_root;
 }
 
 static void serve_annotate PROTO ((char *));




reply via email to

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