cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/src ChangeLog client.c rcs.c rcs.h sanity.... [signed-com


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog client.c rcs.c rcs.h sanity.... [signed-commits3]
Date: Tue, 10 Jan 2006 02:27:48 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Branch:         signed-commits3
Changes by:     Derek Robert Price <address@hidden>     06/01/10 02:27:47

Modified files:
        src            : ChangeLog client.c rcs.c rcs.h sanity.sh 
                         server.c subr.c subr.h verify.c verify.h 

Log message:
        * client.c (start_server): Suppress advertising OpenPGP-signatures
        response when base support suppressed.
        * rcs.c (RCS_get_openpgp_signatures): Support returning length for
        convenience.  Fully parse archives when necessary.
        (RCS_checkin): Don't sign dead revisions.
        * rcs.h (RCS_get_openpgp_signatures): Add len to API.
        * server.c (serve_wrapper_sendme_rcs_options): Remove extra semicolon.
        (server_send_signatures): Use cached signature len.
        (server_base_signatures): Check for option support before sending.
        * subr.c (force_write_file): New function factored from...
        (write_file): ...here.
        * subr.h (force_write_file): New proto.
        * verify.c (verify_fileproc): Handle local mode.
        (verify_signature): Remove function.
        * verify.h (verify_signature): Remove proto.
        
        * sanity.sh: Support --no-bases.  s/--noredirect/--no-redirect/g, for
        consistency.  Replace `test -z "$CVSNOBASES"' with boolean $bases.
        (import): Don't expect signature on dead revision.
        (openpgp): Skip without GPG and when bases are suppressed in remote
        mode.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ChangeLog.diff?only_with_tag=signed-commits3&tr1=1.3328.2.18&tr2=1.3328.2.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/client.c.diff?only_with_tag=signed-commits3&tr1=1.438.2.5&tr2=1.438.2.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.c.diff?only_with_tag=signed-commits3&tr1=1.356.6.4&tr2=1.356.6.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.h.diff?only_with_tag=signed-commits3&tr1=1.82.8.2&tr2=1.82.8.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/sanity.sh.diff?only_with_tag=signed-commits3&tr1=1.1105.2.7&tr2=1.1105.2.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/server.c.diff?only_with_tag=signed-commits3&tr1=1.453.2.3&tr2=1.453.2.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/subr.c.diff?only_with_tag=signed-commits3&tr1=1.148.6.2&tr2=1.148.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/subr.h.diff?only_with_tag=signed-commits3&tr1=1.7.6.2&tr2=1.7.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/verify.c.diff?only_with_tag=signed-commits3&tr1=1.1.2.5&tr2=1.1.2.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/verify.h.diff?only_with_tag=signed-commits3&tr1=1.1.2.2&tr2=1.1.2.3&r1=text&r2=text

Patches:
Index: ccvs/src/ChangeLog
diff -u ccvs/src/ChangeLog:1.3328.2.18 ccvs/src/ChangeLog:1.3328.2.19
--- ccvs/src/ChangeLog:1.3328.2.18      Mon Jan  9 14:59:53 2006
+++ ccvs/src/ChangeLog  Tue Jan 10 02:27:45 2006
@@ -1,5 +1,27 @@
 2006-01-09  Derek Price  <address@hidden>
 
+       * client.c (start_server): Suppress advertising OpenPGP-signatures
+       response when base support suppressed.
+       * rcs.c (RCS_get_openpgp_signatures): Support returning length for
+       convenience.  Fully parse archives when necessary.
+       (RCS_checkin): Don't sign dead revisions.
+       * rcs.h (RCS_get_openpgp_signatures): Add len to API.
+       * server.c (serve_wrapper_sendme_rcs_options): Remove extra semicolon.
+       (server_send_signatures): Use cached signature len.
+       (server_base_signatures): Check for option support before sending.
+       * subr.c (force_write_file): New function factored from...
+       (write_file): ...here.
+       * subr.h (force_write_file): New proto.
+       * verify.c (verify_fileproc): Handle local mode.
+       (verify_signature): Remove function.
+       * verify.h (verify_signature): Remove proto.
+
+       * sanity.sh: Support --no-bases.  s/--noredirect/--no-redirect/g, for
+       consistency.  Replace `test -z "$CVSNOBASES"' with boolean $bases.
+       (import): Don't expect signature on dead revision.
+       (openpgp): Skip without GPG and when bases are suppressed in remote
+       mode.
+
        * sanity.sh (errmsg4-1): Increase verbosity to preserve warning being
        tested.
 
Index: ccvs/src/client.c
diff -u ccvs/src/client.c:1.438.2.5 ccvs/src/client.c:1.438.2.6
--- ccvs/src/client.c:1.438.2.5 Fri Jan  6 20:37:13 2006
+++ ccvs/src/client.c   Tue Jan 10 02:27:46 2006
@@ -4750,6 +4750,8 @@
                    continue;
                if (suppress_bases && !strncmp (rs->name, "Base-", 5))
                    continue;
+               if (suppress_bases && !strcmp (rs->name, "OpenPGP-signatures"))
+                   continue;
                if (suppress_bases && !strcmp (rs->name, "Temp-checkout"))
                    continue;
 
Index: ccvs/src/rcs.c
diff -u ccvs/src/rcs.c:1.356.6.4 ccvs/src/rcs.c:1.356.6.5
--- ccvs/src/rcs.c:1.356.6.4    Fri Jan  6 20:37:13 2006
+++ ccvs/src/rcs.c      Tue Jan 10 02:27:46 2006
@@ -4771,11 +4771,14 @@
 
 
 const char *
-RCS_get_openpgp_signatures (RCSNode *rcs, const char *rev)
+RCS_get_openpgp_signatures (RCSNode *rcs, const char *rev, size_t *len)
 {
     RCSVers *vers;
     Node *n;
 
+    if (rcs->flags & PARTIAL)
+       RCS_reparsercsfile (rcs, NULL, NULL);
+
     n = findnode (rcs->versions, rev);
     if (!n)
        error (1, 0, "internal error: no revision information for %s", rev);
@@ -4786,6 +4789,7 @@
        return NULL;
     /* else */
 
+    if (len) *len = n->len;
     return n->data;
 }
 
@@ -5271,8 +5275,9 @@
     addnode (delta->other_delta, np);
 
     /* Save the OpenPGP signature.  */
-    if (get_sign_commits (server_active, true)
-       || have_sigfile (server_active, workfile))
+    if (!delta->dead
+       && (get_sign_commits (server_active, true)
+           || have_sigfile (server_active, workfile)))
     {
        char *rawsig;
        size_t rawlen;
Index: ccvs/src/rcs.h
diff -u ccvs/src/rcs.h:1.82.8.2 ccvs/src/rcs.h:1.82.8.3
--- ccvs/src/rcs.h:1.82.8.2     Fri Jan  6 20:04:38 2006
+++ ccvs/src/rcs.h      Tue Jan 10 02:27:46 2006
@@ -274,7 +274,8 @@
 void RCS_setexpand (RCSNode *, const char *);
 int RCS_checkout (RCSNode *, const char *, const char *, const char *,
                   const char *, const char *, RCSCHECKOUTPROC, void *);
-const char *RCS_get_openpgp_signatures (RCSNode *rcs, const char *rev);
+const char *RCS_get_openpgp_signatures (RCSNode *rcs, const char *rev,
+                                       size_t *len);
 void RCS_add_openpgp_signature (struct file_info *finfo, const char *rev);
 int RCS_checkin (RCSNode *rcs, const char *update_dir, const char *workfile,
                 const char *message, const char *rev, time_t citime,
Index: ccvs/src/sanity.sh
diff -u ccvs/src/sanity.sh:1.1105.2.7 ccvs/src/sanity.sh:1.1105.2.8
--- ccvs/src/sanity.sh:1.1105.2.7       Mon Jan  9 14:59:53 2006
+++ ccvs/src/sanity.sh  Tue Jan 10 02:27:46 2006
@@ -62,7 +62,7 @@
     echo "             --keep"
     echo "-l|--link-root"
     echo "             test CVS using a symlink to a real CVSROOT"
-    echo "-n|--noredirect"
+    echo "-n|--no-redirect"
     echo "              test a secondary/primary CVS server (writeproxy)"
     echo "              configuration with the Redirect response disabled"
     echo "              (implies --proxy)."
@@ -126,7 +126,7 @@
 unset fromtest
 unset remotehost
 unset rootoptions
-unset CVSNOBASES
+bases=:
 keep=false
 linkroot=false
 noredirect=false
@@ -177,7 +177,15 @@
                option=l
                OPTARG=
                ;;
-           n|no|nor|nore|nored|noredi|noredir|noredire|noredirec|noredirect)
+           no-*)
+               echo "Ambiguous option \`$LONGOPT'" >&2
+               exit 2
+               ;;
+           no-b|no-ba|no-bas|no-base|no-bases)
+               option=B
+               OPTARG=
+               ;;
+           no-r|no-re|no-red|no-redi|no-redir|no-redire|no-redirec|no-redirect)
                option=n
                OPTARG=
                ;;
@@ -208,7 +216,7 @@
     fi
     case "$option" in
        B)
-           export CVSNOBASES=:
+           bases=false
            ;;
        c)
            configfile="$OPTARG"
@@ -422,6 +430,13 @@
   testcvs_server_support=false
 fi
 
+if $bases; then
+  unset CVSNOBASES
+else
+  # Force the client to not report base support to the server.
+  export CVSNOBASES=:
+fi
+
 
 
 dokeep() 
@@ -8877,7 +8892,7 @@
          else
            modify_repo ln -s Attic/file3,v $CVSROOT_DIRNAME/first-dir/file2,v
          fi
-         if $remote && test -z "$CVSNOBASES"; then
+         if $remote && $bases; then
            dotest_fail rcslib-symlink-3gr "$testcvs update file2" \
 "$SPROG \[update aborted\]: could not find desired version 1\.1\.2\.3 in 
$CVSROOT_DIRNAME/first-dir/file2,v"
          else
@@ -18065,7 +18080,7 @@
 
          # Check that the contents were right.  This isn't the hard case
          # (in which RCS_delete_revs does a diff), but might as well.
-         if $remote && test -z "$CVSNOBASES"; then
+         if $remote && $bases; then
            dotest_fail binfiles-o4r "$testcvs -q update binfile" \
 "$SPROG \[update aborted\]: could not find desired version 1\.5 in 
$CVSROOT_DIRNAME/first-dir/binfile,v"
          else
@@ -23359,7 +23374,7 @@
          #
          # Feel free to imagine the horrific scream of despair
          cd ../../1/first-dir
-         if $remote && test -z "$CVSNOBASES"; then
+         if $remote && $bases; then
            # FIXCVS
            # See the note above about lost data and a few other comments in
            # other tests.  At least with base files, no data is lost, but this
@@ -24181,7 +24196,6 @@
          dotest stamps-4kw \
 "$diff_u $TESTDIR/1/stamp.kw.touch $TESTDIR/1/stamp.kw.add"
          sleep 60
-export CVS_CLIENT_LOG=/tmp/cvsclientlog
          dotest stamps-5 "$testcvs -Q ci -m add"
 
          # Cygwin, *cough*, puts the year in the time column until the minute
@@ -24804,14 +24818,14 @@
 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
 "${SPROG} commit: sticky tag .1\.3. for file .file1. is not a branch
 ${SPROG} \[commit aborted\]: correct above errors first!"
-         if test -z "$CVSNOBASES"; then
+         if $bases; then
            dotest keywordlog-4b-2 "cat CVS/Base/.#file1.1.3" initial
          fi
          dotest keywordlog-4b-3 "cat file1" \
 'initial
 xx $''Log$'
          dotest keywordlog-4c "$testcvs -q update -A" "M file1"
-         if test -z "$CVSNOBASES"; then
+         if $bases; then
            dotest keywordlog-4c-2 "cat CVS/Base/.#file1.1.3" initial
          fi
          dotest keywordlog-4c-3 "cat file1" \
@@ -26664,7 +26678,7 @@
 ============================================================================="
 
          dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
-         if $remote && test -z "$CVSNOBASES"; then
+         if $remote && $bases; then
            # FIXCVS: The remote behavior is probably correct here.
            dotest_fail admin-22-o15ar "$testcvs update -rbr1 aaa" \
 "$SPROG \[update aborted\]: could not find desired version 1\.6 in 
$CVSROOT_DIRNAME/first-dir/aaa,v"
@@ -27138,7 +27152,7 @@
 revision 1\.1
 date: ${ISO8601DATE};  author: ${username};  state: dead;  commitid: 
${commitid};
 branches:  1\.1\.2;
-${log_keyid}file file3 was initially added on branch br\.
+file file3 was initially added on branch br\.
 ----------------------------
 revision 1\.1\.2\.1
 date: ${ISO8601DATE};  author: ${username};  state: Exp;  lines: ${PLUS}1 -0;  
commitid: ${commitid};
@@ -32701,6 +32715,18 @@
 
 
        openpgp)
+         if $gpg; then :; else
+           skip openpgp "No OpenPGP tool configured."
+           continue
+         fi
+
+         if $remote; then
+           if $bases; then :; else
+             skip openpgp "OpenPGP signatures require support for Base files."
+             continue
+           fi
+         fi
+
          # More tests of basic/miscellaneous openpgp functionality.
          mkdir openpgp; cd openpgp
          mkdir top; cd top
@@ -32716,7 +32742,11 @@
          dotest openpgp-1 "$testcvs verify file1" \
 "$DOTSTAR Good signature from \"CVS Test Script $DOTSTAR"
          dotest openpgp-2 "$testcvs verify -p file1 >tmp"
-         dotest openpgp-3 "cmp tmp CVS/Base/.#file1.1.1.sig"
+
+         if $remote; then
+           # CVS/Base files are not used in local mode.
+           dotest openpgp-3 "cmp tmp CVS/Base/.#file1.1.1.sig"
+         fi
 
          dotest openpgp-4 "$testcvs sign file1"
          dotest openpgp-5 "$testcvs verify file1" \
Index: ccvs/src/server.c
diff -u ccvs/src/server.c:1.453.2.3 ccvs/src/server.c:1.453.2.4
--- ccvs/src/server.c:1.453.2.3 Fri Jan  6 20:37:13 2006
+++ ccvs/src/server.c   Tue Jan 10 02:27:46 2006
@@ -5792,7 +5792,7 @@
     {
        buf_output0 (buf_to_net, "Wrapper-rcsOption ");
        buf_output0 (buf_to_net, wrapper_line);
-       buf_output0 (buf_to_net, "\012");;
+       buf_output0 (buf_to_net, "\012");
        free (wrapper_line);
     }
 
@@ -8215,15 +8215,16 @@
 server_send_signatures (RCSNode *rcs, const char *rev)
 {
     const char *signatures;
+    size_t siglen;
 
     if (!supported_response ("OpenPGP-signatures"))
        return;
 
-    if (!(signatures = RCS_get_openpgp_signatures (rcs, rev)))
+    if (!(signatures = RCS_get_openpgp_signatures (rcs, rev, &siglen)))
        return;
 
     buf_output0 (protocol, "OpenPGP-signatures ");
-    buf_output0 (protocol, signatures);
+    buf_output (protocol, signatures, siglen);
     buf_output (protocol, "\n", 1);
     buf_send_counted (protocol);
 }
@@ -8443,6 +8444,9 @@
 void
 server_base_signatures (struct file_info *finfo, const char *rev)
 {
+    if (!supported_response ("Base-signatures"))
+       return;
+
     server_send_signatures (finfo->rcs, rev);
 
     buf_output0 (protocol, "Base-signatures ");
Index: ccvs/src/subr.c
diff -u ccvs/src/subr.c:1.148.6.2 ccvs/src/subr.c:1.148.6.3
--- ccvs/src/subr.c:1.148.6.2   Sun Jan  1 23:12:37 2006
+++ ccvs/src/subr.c     Tue Jan 10 02:27:47 2006
@@ -731,17 +731,16 @@
 
 
 
+/* Write DATA of length LEN to FILE, ignoring NOEXEC.  */
 void
-write_file (const char *file, const char *data, size_t len)
+force_write_file (const char *file, const char *data, size_t len)
 {
     FILE *fp;
 
     TRACE (TRACE_FUNCTION,
-          "write_file (%s, %s, %u)", file, data, (unsigned int)len);
-
-    if (noexec) return;
+          "force_write_file (%s, %s, %u)", file, data, (unsigned int)len);
 
-    if (!(fp = fopen (file, "w")))
+    if (!(fp = fopen (file, "wb")))
        error (1, errno, "cannot create `%s'", file);
 
     if (len > 0)
@@ -756,6 +755,20 @@
 
 
 
+/* Write DATA of length LEN to FILE, honoring NOEXEC.  */
+void
+write_file (const char *file, const char *data, size_t len)
+{
+    TRACE (TRACE_FUNCTION,
+          "write_file (%s, %s, %u)", file, data, (unsigned int)len);
+
+    if (noexec) return;
+
+    force_write_file (file, data, len);
+}
+
+
+
 /* Follow a chain of symbolic links to its destination.  FILENAME
    should be a handle to a malloc'd block of memory which contains the
    beginning of the chain.  This routine will replace the contents of
Index: ccvs/src/subr.h
diff -u ccvs/src/subr.h:1.7.6.2 ccvs/src/subr.h:1.7.6.3
--- ccvs/src/subr.h:1.7.6.2     Sun Jan  1 23:12:37 2006
+++ ccvs/src/subr.h     Tue Jan 10 02:27:47 2006
@@ -52,6 +52,7 @@
 bool file_contains_keyword (const struct file_info *finfo);
 void get_file (const char *, const char *, const char *,
                char **, size_t *, size_t *);
+void force_write_file (const char *file, const char *data, size_t len);
 void write_file (const char *file, const char *data, size_t len);
 void resolve_symlink (char **filename);
 char *backup_file (const char *file, const char *suffix);
Index: ccvs/src/verify.c
diff -u ccvs/src/verify.c:1.1.2.5 ccvs/src/verify.c:1.1.2.6
--- ccvs/src/verify.c:1.1.2.5   Fri Jan  6 20:37:13 2006
+++ ccvs/src/verify.c   Tue Jan 10 02:27:47 2006
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 /* GNULIB headers.  */
+#include "base64.h"
 #include "error.h"
 #include "xalloc.h"
 
@@ -239,12 +240,15 @@
 
 /* Verify a signature, returning true or false.
  *
+ * INPUTS
+ *   finfo     File information on the file being signed.
+ *
  * ERRORS
  *   Exits with a fatal error when FATAL and a signature cannot be verified.
  */
 static bool
 iverify_signature (const char *srepos, const char *filename, bool bin,
-                 bool fatal)
+                  bool fatal)
 {
     char *cmdline;
     char *sigfile = Xasprintf ("%s%s", filename, ".sig");
@@ -346,23 +350,6 @@
 
 
 
-/* Verify a signature, returning true or false.
- *
- * ERRORS
- *   Exits with a fatal error when the verify mode is VERIFY_FATAL and a
- *   signature cannot be verified.
- */
-bool
-verify_signature (const char *srepos, const char *filename, bool bin,
-                 bool server_active, bool server_support)
-{
-    bool fatal = iget_verify_checkouts (server_active, server_support)
-                == VERIFY_FATAL;
-    return iverify_signature (srepos, filename, bin, fatal);
-}
-
-
-
 static const char *const verify_usage[] =
 {
     "Usage: %s %s [-lR]\n",
@@ -381,16 +368,28 @@
 
 
 
+/*
+ * GLOBALS
+ *   CURRENT_PARSED_ROOT->ISREMOTE
+ *
+ * NOTES
+ *   Need to deal with all 4 combinations of USERARGS->PIPEOUT &
+ *   CURRENT_PARSED_ROOT->ISREMOTE.
+ */
 static int
 verify_fileproc (void *callerdat, struct file_info *finfo)
 {
     struct verify_closure *userargs = callerdat;
-    const char *srepos = Short_Repository (finfo->repository);
     Node *n;
     bool bin;
     Entnode *e;
-    bool retval;
-    char *basefn;
+    bool errors = false;
+    char *basefn, *basesigfn;
+    char *tmpfn = NULL, *tmpsigfn = NULL;
+    const char *signedfn = NULL, *sigfn = NULL;
+    char *sigdata = NULL;
+    size_t buflen;
+    size_t siglen;
 
     n = findnode (finfo->entries, finfo->file);
     assert (n);
@@ -399,29 +398,124 @@
     bin = !strcmp (e->options, "-kb");
 
     basefn = make_base_file_name (finfo->file, e->version);
+    basesigfn = Xasprintf ("%s%s", basefn, ".sig");
 
-    if (userargs->pipeout)
+    if (current_parsed_root->isremote)
     {
-       char *sigfile = Xasprintf ("%s%s", basefn, ".sig");
-       char *fullsigfile = Xasprintf ("%s/%s", finfo->update_dir, sigfile);
-       char *sigdata;
-       size_t buflen;
-       size_t siglen;
-       
-       get_file (sigfile, fullsigfile, "rb", &sigdata, &buflen, &siglen);
-       if (siglen)
-           cvs_output (sigdata, siglen);
-       if (sigdata)
-           free (sigdata);
-       free (sigfile);
-       free (fullsigfile);
-       retval = false;
+       char *updateprefix = finfo->update_dir
+                            ? Xasprintf ("%s/", finfo->update_dir) : "";
+       char *fullbasefn = Xasprintf ("%s%s", updateprefix, basefn);
+       char *fullsigfn = Xasprintf ("%s%s", updateprefix, basesigfn);
+
+       /* FIXME: These errors should refetch instead.  */
+       if (!isfile (basefn))
+           error (1, 0, "Base file missing `%s'", fullbasefn);
+       if (!isfile (basesigfn))
+           error (1, 0, "Signature file missing `%s'", fullsigfn);
+
+       /* FIXME: Once a "soft" connect to the server is possible, then when
+        * the server is available, the signatures should be updated here.
+        */
+
+       if (userargs->pipeout)
+           get_file (basesigfn, fullsigfn, "rb", &sigdata, &buflen, &siglen);
+       else
+       {
+           signedfn = basefn;
+           sigfn = basesigfn;
+       }
+
+       free (updateprefix);
+       free (fullbasefn);
+       free (fullsigfn);
     }
     else
-       retval = !iverify_signature (srepos, basefn, bin, false);
+    {
+       /* In local mode, the signature data is still in the archive.  */
+
+       const char *b64sig;
+       size_t b64len;
+
+       assert (finfo->rcs);
+       if ((b64sig = RCS_get_openpgp_signatures (finfo->rcs, e->version,
+                                                 &b64len)))
+       {
+           if (!base64_decode_alloc (b64sig, b64len, &sigdata, &siglen))
+           {
+               error (0, 0, "Failed to decode base64 signature for `%s'",
+                      finfo->fullname);
+               errors = true;
+           }
+           /* else, got usable signature data in SIGDATA... fall out.  */
+       }
+       else if (!b64sig)
+           error (1, ENOMEM, "Memory allocation failed");
+       else
+       {
+           error (0, 0, "No signature available for `%s'",
+                  finfo->fullname);
+           errors = true;
+       }
+    }
+
+    /* In the remote/non-pipeout case, the signed data and the signature are
+     * still in the base file and its signature counterpart, respectively.  In
+     * the other three cases, the signature is in SIGDATA or ERRORS is true
+     * (on error).
+     */
+
+    if (!errors && sigdata)
+    {
+       if (!siglen)
+       {
+           error (0, 0, "No signature data found for `%s'",
+                  finfo->fullname);
+           errors = true;
+       }
+       else if (userargs->pipeout)
+           /* First deal with both the piped cases - it's easy.  */
+           cvs_output (sigdata, siglen);
+       else
+       {
+           /* This must be the local case, where the signature had to be
+            * loaded from the archive.  Write the clean file and the signature
+            * to temp files.
+            */
+           assert (!current_parsed_root->isremote);
+
+           signedfn = tmpfn = cvs_temp_name ();
+
+           if (RCS_checkout (finfo->rcs, NULL, e->version, e->tag, e->options,
+                             tmpfn, NULL, NULL))
+               errors = true;
+           else
+           {
+               sigfn = tmpsigfn = Xasprintf ("%s.sig", tmpfn);
+               force_write_file (tmpsigfn, sigdata, siglen);
+           }
+       }
+    }
 
+    if (!errors && !userargs->pipeout)
+       errors = !iverify_signature (Short_Repository (finfo->repository),
+                                    signedfn, bin, false);
+
+    if (tmpfn)
+    {
+       if (CVS_UNLINK (tmpfn))
+           error (0, 0, "Failed to remove temp file `%s'", tmpfn);
+       free (tmpfn);
+    }
+    if (tmpsigfn)
+    {
+       if (CVS_UNLINK (tmpsigfn))
+           error (0, 0, "Failed to remove temp file `%s'", tmpsigfn);
+       free (tmpsigfn);
+    }
+    if (sigdata) free (sigdata);
     free (basefn);
-    return retval;
+    free (basesigfn);
+    return errors;
 }
 
 
Index: ccvs/src/verify.h
diff -u ccvs/src/verify.h:1.1.2.2 ccvs/src/verify.h:1.1.2.3
--- ccvs/src/verify.h:1.1.2.2   Sun Jan  1 23:12:37 2006
+++ ccvs/src/verify.h   Tue Jan 10 02:27:47 2006
@@ -45,8 +45,6 @@
 
 /* Get values.  */
 bool get_verify_checkouts (bool server_active, bool server_support);
-bool verify_signature (const char *srepos, const char *filename, bool bin,
-                      bool server_active, bool server_support);
 
 /* User command.  */
 int verify (int argc, char **argv);




reply via email to

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