[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] ccvs/src ChangeLog base.c client.c rcs.c rcs.h ... [signed-com
From: |
Derek Robert Price |
Subject: |
[Cvs-cvs] ccvs/src ChangeLog base.c client.c rcs.c rcs.h ... [signed-commits2] |
Date: |
Wed, 14 Dec 2005 00:06:58 +0000 |
CVSROOT: /cvsroot/cvs
Module name: ccvs
Branch: signed-commits2
Changes by: Derek Robert Price <address@hidden> 05/12/14 00:06:57
Modified files:
src : ChangeLog base.c client.c rcs.c rcs.h sanity.sh
server.c
Log message:
Send signature files to client with base files.
* base.c (base_checkout): Comment where the signature verification
will take place.
(ibase_copy): Suppress warning.
(base_remove): Add header comment. Remove signature files with bases.
* client.c: Include base64.h.
(handle_openpgp_signatures): New function.
(client_base_checkout): Remove ugly comment. Save stored signatures to
a file.
(responses): Add OpenPGP-signatures.
* rcs.c (RCS_get_openpgp_signatures): New function.
* rcs.h: Add proto for same.
* sanity.sh (basica): Force remove directory when done.
* server.c: Reorder headers for consistency.
(server_send_signatures): New function.
(ibase_server_checkout): Use new function to send signatures.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ChangeLog.diff?only_with_tag=signed-commits2&tr1=1.3306.2.46&tr2=1.3306.2.47&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/base.c.diff?only_with_tag=signed-commits2&tr1=1.1.2.13&tr2=1.1.2.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/client.c.diff?only_with_tag=signed-commits2&tr1=1.433.4.21&tr2=1.433.4.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.c.diff?only_with_tag=signed-commits2&tr1=1.356.4.5&tr2=1.356.4.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.h.diff?only_with_tag=signed-commits2&tr1=1.82.6.2&tr2=1.82.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/sanity.sh.diff?only_with_tag=signed-commits2&tr1=1.1095.4.34&tr2=1.1095.4.35&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/server.c.diff?only_with_tag=signed-commits2&tr1=1.452.2.15&tr2=1.452.2.16&r1=text&r2=text
Patches:
Index: ccvs/src/ChangeLog
diff -u ccvs/src/ChangeLog:1.3306.2.46 ccvs/src/ChangeLog:1.3306.2.47
--- ccvs/src/ChangeLog:1.3306.2.46 Mon Dec 12 19:37:32 2005
+++ ccvs/src/ChangeLog Wed Dec 14 00:06:56 2005
@@ -1,3 +1,22 @@
+2005-12-13 Derek Price <address@hidden>
+
+ Send signature files to client with base files.
+ * base.c (base_checkout): Comment where the signature verification
+ will take place.
+ (ibase_copy): Suppress warning.
+ (base_remove): Add header comment. Remove signature files with bases.
+ * client.c: Include base64.h.
+ (handle_openpgp_signatures): New function.
+ (client_base_checkout): Remove ugly comment. Save stored signatures to
+ a file.
+ (responses): Add OpenPGP-signatures.
+ * rcs.c (RCS_get_openpgp_signatures): New function.
+ * rcs.h: Add proto for same.
+ * sanity.sh (basica): Force remove directory when done.
+ * server.c: Reorder headers for consistency.
+ (server_send_signatures): New function.
+ (ibase_server_checkout): Use new function to send signatures.
+
2005-12-12 Derek Price <address@hidden>
Simplify protocol slightly.
Index: ccvs/src/base.c
diff -u ccvs/src/base.c:1.1.2.13 ccvs/src/base.c:1.1.2.14
--- ccvs/src/base.c:1.1.2.13 Mon Dec 12 19:37:33 2005
+++ ccvs/src/base.c Wed Dec 14 00:06:56 2005
@@ -274,6 +274,8 @@
xchmod (basefile, false);
free (basefile);
+ /* FIXME: Verify the signature in local mode. */
+
if (server_active && strcmp (cvs_cmd_name, "export"))
server_base_checkout (rcs, finfo, prev, rev, ptag, tag,
poptions, options);
@@ -402,7 +404,7 @@
ibase_copy (struct file_info *finfo, const char *rev, const char *flags,
const char *tempfile)
{
- char *basefile;
+ const char *basefile;
TRACE (TRACE_FUNCTION, "ibase_copy (%s, %s, %s, %s)",
finfo->fullname, rev, flags,
@@ -438,7 +440,7 @@
if ((suppress_bases || tempfile) && CVS_UNLINK (basefile) < 0)
error (0, errno, "Failed to remove temp file `%s'", basefile);
if (!tempfile)
- free (basefile);
+ free ((char *)basefile);
}
@@ -459,10 +461,13 @@
+/* Remove the base file for FILE & REV, and any sigfile present for the same.
+ */
void
base_remove (const char *file, const char *rev)
{
char *basefile;
+ char *sigfile;
TRACE (TRACE_FUNCTION, "base_remove (%s, %s)", file, rev);
@@ -470,6 +475,10 @@
basefile = make_base_file_name (file, rev);
if (unlink_file (basefile) < 0 && !existence_error (errno))
error (0, errno, "Failed to remove `%s'", basefile);
+ sigfile = Xasprintf ("%s.sig", basefile);
+ if (unlink_file (sigfile) < 0 && !existence_error (errno))
+ error (0, errno, "Failed to remove `%s'", sigfile);
+ free (sigfile);
free (basefile);
}
Index: ccvs/src/client.c
diff -u ccvs/src/client.c:1.433.4.21 ccvs/src/client.c:1.433.4.22
--- ccvs/src/client.c:1.433.4.21 Mon Dec 12 19:37:33 2005
+++ ccvs/src/client.c Wed Dec 14 00:06:56 2005
@@ -15,6 +15,7 @@
#endif /* HAVE_CONFIG_H */
/* GNULIB */
+#include "base64.h"
#include "getline.h"
#include "save-cwd.h"
@@ -2138,6 +2139,28 @@
+/*
+ * The OpenPGP-signatures response gives the signature for the file to be
+ * transmitted in the next Base-checkout or Temp-checkout response.
+ */
+static char *stored_signatures;
+static size_t stored_signatures_len;
+static void
+handle_openpgp_signatures (char *args, size_t len)
+{
+ if (stored_signatures)
+ error (1, 0, "OpenPGP-signatures received before last one was used");
+
+ if (!base64_decode_alloc (args, len, &stored_signatures,
+ &stored_signatures_len))
+ error (1, 0, "Bad signature received from server.");
+
+ if (!stored_signatures)
+ error (1, errno, "Failed to allocate memory");
+}
+
+
+
static void
client_base_checkout (void *data_arg, List *ent_list,
const char *short_pathname, const char *filename)
@@ -2253,30 +2276,6 @@
else
patch_failed = false;
- //if (!patch_failed)
- //{
- /* FIXME - OPENPGP: Send and verify checksums for base files. */
- //if (stored_checksum_valid)
- //{
- // unsigned char checksum[16];
-
- /* We have a checksum. Check it before writing
- the file out, so that we don't have to read it
- back in again. */
- // md5_buffer (buf, size, checksum);
- // if (memcmp (checksum, stored_checksum, 16) != 0)
- // {
- // error (0, 0,
-//"checksum failure after patch to %s; will refetch",
-// short_pathname);
-//
-// patch_failed = true;
-// }
-//
-// stored_checksum_valid = 0;
-// }
- //}
-
if (!patch_failed)
{
FILE *e;
@@ -2293,6 +2292,33 @@
status = change_mode (basefile, mode_string, 1);
if (status != 0)
error (0, status, "cannot change mode of `%s'", fullbase);
+
+ if (stored_signatures)
+ {
+ char *sigfile = Xasprintf ("%s.sig", basefile);
+
+ if (!*istemp && isfile (sigfile))
+ xchmod (sigfile, true);
+ e = xfopen (sigfile, FOPEN_BINARY_WRITE);
+ if (fwrite (stored_signatures, sizeof *stored_signatures,
+ stored_signatures_len, e) != stored_signatures_len)
+ error (1, errno, "cannot write signature file `%s'", sigfile);
+ if (fclose (e) == EOF)
+ error (0, errno, "cannot close signature file `%s'", sigfile);
+
+ if (!*istemp)
+ xchmod (sigfile, false);
+
+ /* FIXME: Verify the signature here, when configured to do so. */
+
+ if (*istemp && CVS_UNLINK (sigfile) < 0)
+ error (0, errno, "Failed to remove temp sig file `%s'",
+ sigfile);
+
+ free (sigfile);
+ free (stored_signatures);
+ stored_signatures = NULL;
+ }
}
/* FIXME: When enabled, verify base file via openpgp signature. */
@@ -3688,6 +3714,9 @@
RSP_LINE("Base-merged", handle_base_merged, response_type_normal,
rs_optional),
+ RSP_LINE("OpenPGP-signatures", handle_openpgp_signatures,
+ response_type_normal, rs_optional),
+
/* Possibly should be response_type_error. */
RSP_LINE(NULL, NULL, response_type_normal, rs_essential)
Index: ccvs/src/rcs.c
diff -u ccvs/src/rcs.c:1.356.4.5 ccvs/src/rcs.c:1.356.4.6
--- ccvs/src/rcs.c:1.356.4.5 Fri Dec 2 23:50:49 2005
+++ ccvs/src/rcs.c Wed Dec 14 00:06:56 2005
@@ -4770,6 +4770,28 @@
+const char *
+RCS_get_openpgp_signatures (RCSNode *rcs, const char *rev)
+{
+ RCSVers *vers;
+ Node *n;
+
+ n = findnode (rcs->versions, rev);
+ if (!n)
+ error (1, 0, "internal error: no revision information for %s", rev);
+ vers = n->data;
+
+ /* First we look for symlinks, which are simplest to handle. */
+ n = findnode (vers->other_delta, "openpgp-signatures");
+ if (!n)
+ return NULL;
+ /* else */
+
+ return n->data;
+}
+
+
+
/* Find the delta currently locked by the user. From the `ci' man page:
"If rev is omitted, ci tries to derive the new revision
Index: ccvs/src/rcs.h
diff -u ccvs/src/rcs.h:1.82.6.2 ccvs/src/rcs.h:1.82.6.3
--- ccvs/src/rcs.h:1.82.6.2 Sat Oct 29 04:35:00 2005
+++ ccvs/src/rcs.h Wed Dec 14 00:06:57 2005
@@ -274,6 +274,7 @@
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);
int RCS_checkin (RCSNode *rcs, const char *update_dir, const char *workfile,
const char *message, const char *rev, time_t citime,
int flags);
Index: ccvs/src/sanity.sh
diff -u ccvs/src/sanity.sh:1.1095.4.34 ccvs/src/sanity.sh:1.1095.4.35
--- ccvs/src/sanity.sh:1.1095.4.34 Sat Dec 10 16:40:28 2005
+++ ccvs/src/sanity.sh Wed Dec 14 00:06:57 2005
@@ -3306,7 +3306,7 @@
cd ..
modify_repo rm -rf $CVSROOT_DIRNAME/first-dir
- rm -r first-dir
+ rm -rf first-dir
;;
Index: ccvs/src/server.c
diff -u ccvs/src/server.c:1.452.2.15 ccvs/src/server.c:1.452.2.16
--- ccvs/src/server.c:1.452.2.15 Thu Dec 8 15:02:37 2005
+++ ccvs/src/server.c Wed Dec 14 00:06:57 2005
@@ -16,8 +16,15 @@
#include "server.h"
+/* GNULIB */
+#include "getline.h"
+#include "getnline.h"
+#include "setenv.h"
+#include "wait.h"
+
/* CVS */
#include "base.h"
+#include "buffer.h"
#include "gpg.h"
#include "cvs.h"
@@ -25,13 +32,6 @@
#include "fileattr.h"
#include "watch.h"
-/* GNULIB */
-#include "buffer.h"
-#include "getline.h"
-#include "getnline.h"
-#include "setenv.h"
-#include "wait.h"
-
int server_active = 0;
#if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
@@ -8145,6 +8145,25 @@
+static void
+server_send_signatures (RCSNode *rcs, const char *rev)
+{
+ const char *signatures;
+
+ if (!supported_response ("OpenPGP-signatures"))
+ return;
+
+ if (!(signatures = RCS_get_openpgp_signatures (rcs, rev)))
+ return;
+
+ buf_output0 (protocol, "OpenPGP-signatures ");
+ buf_output0 (protocol, signatures);
+ buf_output (protocol, "\n", 1);
+ buf_send_counted (protocol);
+}
+
+
+
/* Try to tell the client about checking out a base REV of FILE, sending the
* diff against PREV when possible. If the client doesn't understand this
* response, just ignore it and later code will also avoid the Base-*
@@ -8189,6 +8208,8 @@
*/
return;
+ server_send_signatures (rcs, rev);
+
/* FIXME: It would be more efficient if diffs could be sent when the
* revision numbers haven't changed but the keywords have.
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] ccvs/src ChangeLog base.c client.c rcs.c rcs.h ... [signed-commits2],
Derek Robert Price <=