# # patch "ChangeLog" # from [4788040681360b54139bf140f9a602cae52fe0e3] # to [8508236ca23959954a0c0134b71043eedd74adf1] # # patch "database.cc" # from [2f0d694a3ff58c86f98ae425dba01c9f0e467578] # to [3cd127283c020d9afadec7daae6e0a7358d1b977] # --- ChangeLog +++ ChangeLog @@ -1,5 +1,11 @@ 2005-04-23 Nathaniel Smith + * database.cc (put_key): Check for existence of keys with + conflicting key ids, give more informative message than former SQL + constraint error. + +2005-04-23 Nathaniel Smith + * transforms.cc (filesystem_is_ascii_extension_impl): Add EUC to the list of ascii-extending encodings. --- database.cc +++ database.cc @@ -1495,7 +1495,7 @@ L(F("Killing revision %s locally\n") % rid); execute("DELETE from revision_certs WHERE id = '%s'",rid.inner()().c_str()); execute("DELETE from revision_ancestry WHERE child = '%s'", - rid.inner()().c_str()); + rid.inner()().c_str()); execute("DELETE from revisions WHERE id = '%s'",rid.inner()().c_str()); } @@ -1641,6 +1641,9 @@ { hexenc thash; key_hash_code(pub_id, pub_encoded, thash); + I(!public_key_exists(thash)); + E(!public_key_exists(pub_id), + F("another key with name '%s' already exists") % pub_id); execute("INSERT INTO public_keys VALUES('%q', '%q', '%q')", thash().c_str(), pub_id().c_str(), pub_encoded().c_str()); } @@ -1649,9 +1652,10 @@ database::put_key(rsa_keypair_id const & priv_id, base64< arc4 > const & priv_encoded) { - hexenc thash; key_hash_code(priv_id, priv_encoded, thash); + E(!private_key_exists(priv_id), + F("another key with name '%s' already exists") % priv_id); execute("INSERT INTO private_keys VALUES('%q', '%q', '%q')", thash().c_str(), priv_id().c_str(), priv_encoded().c_str()); }