38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
-
+
|
static void verify_rid(int rid){
Blob uuid, hash, content;
if( content_size(rid, 0)<0 ){
return; /* No way to verify phantoms */
}
blob_zero(&uuid);
db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
if( blob_size(&uuid)!=UUID_SIZE ){
if( hname_validate(blob_buffer(&uuid), blob_size(&uuid))!=HNAME_NONE ){
fossil_fatal("not a valid rid: %d", rid);
}
if( content_get(rid, &content) ){
sha1sum_blob(&content, &hash);
blob_reset(&content);
if( blob_compare(&uuid, &hash) ){
fossil_fatal("hash of rid %d (%b) does not match its uuid (%b)",
|