| | @@ -2872,11 +2872,11 @@ |
| 2872 | 2872 | g.allowSymlinks = db_get_boolean("allow-symlinks", |
| 2873 | 2873 | db_allow_symlinks_by_default()); |
| 2874 | 2874 | } |
| 2875 | 2875 | db_lset("repository", g.argv[2]); |
| 2876 | 2876 | db_record_repository_filename(g.argv[2]); |
| 2877 | | - db_lset_int("checkout", 0); |
| 2877 | + db_set_checkout(0); |
| 2878 | 2878 | azNewArgv[0] = g.argv[0]; |
| 2879 | 2879 | g.argv = azNewArgv; |
| 2880 | 2880 | if( !emptyFlag ){ |
| 2881 | 2881 | g.argc = 3; |
| 2882 | 2882 | if( g.zOpenRevision ){ |
| | @@ -3723,11 +3723,14 @@ |
| 3723 | 3723 | ** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to |
| 3724 | 3724 | ** accomplish this.) When verifying an old fingerprint, use the same |
| 3725 | 3725 | ** RCVFROM entry that generated the fingerprint in the first place. |
| 3726 | 3726 | ** |
| 3727 | 3727 | ** The fingerprint consists of the rcvid, a "/", and the MD5 checksum of |
| 3728 | | -** the remaining fields of the RCVFROM table entry. |
| 3728 | +** the remaining fields of the RCVFROM table entry. MD5 is used for this |
| 3729 | +** because it is 4x faster than SHA3 and 5x faster than SHA1, and there |
| 3730 | +** are no security concerns - this is just a checksum, not a security |
| 3731 | +** token. |
| 3729 | 3732 | */ |
| 3730 | 3733 | char *db_fingerprint(int rcvid){ |
| 3731 | 3734 | char *z = 0; |
| 3732 | 3735 | Blob sql = BLOB_INITIALIZER; |
| 3733 | 3736 | Stmt q; |
| | @@ -3769,5 +3772,21 @@ |
| 3769 | 3772 | }else if( g.argc!=2 ){ |
| 3770 | 3773 | fossil_fatal("wrong number of arguments"); |
| 3771 | 3774 | } |
| 3772 | 3775 | fossil_print("%z\n", db_fingerprint(rcvid)); |
| 3773 | 3776 | } |
| 3777 | + |
| 3778 | +/* |
| 3779 | +** Set the value of the "checkout" entry in the VVAR table. |
| 3780 | +** |
| 3781 | +** Also set "fingerprint" and "checkout-hash". |
| 3782 | +*/ |
| 3783 | +void db_set_checkout(int rid){ |
| 3784 | + char *z; |
| 3785 | + db_lset_int("checkout", rid); |
| 3786 | + z = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",rid); |
| 3787 | + db_lset("checkout-hash", z); |
| 3788 | + fossil_free(z); |
| 3789 | + z = db_fingerprint(0); |
| 3790 | + db_lset("fingerprint", z); |
| 3791 | + fossil_free(z); |
| 3792 | +} |
| 3774 | 3793 | |