1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* import.c (gpgsm_import): Just do a basic cert check before

storing it.
* certpath.c (gpgsm_basic_cert_check): New.

* keydb.c (keydb_store_cert): New.
* import.c (store_cert): Removed and change all caller to use
the new function.
* verify.c (store_cert): Ditto.

* certlist.c (gpgsm_add_to_certlist): Validate the path

* certpath.c (gpgsm_validate_path): Check the trust list.
* call-agent.c (gpgsm_agent_istrusted): New.
This commit is contained in:
Werner Koch 2002-01-15 13:02:47 +00:00
parent 9dd0040085
commit a9979e26a5
11 changed files with 352 additions and 80 deletions

View file

@ -1143,3 +1143,58 @@ keydb_classify_name (const char *name, KEYDB_SEARCH_DESC *desc)
return 0;
}
/* Store the certificate in the key Db but make sure that it does not
already exists. We do this simply by comparing the fingerprint */
int
keydb_store_cert (KsbaCert cert)
{
KEYDB_HANDLE kh;
int rc;
unsigned char fpr[20];
if (!gpgsm_get_fingerprint (cert, 0, fpr, NULL))
{
log_error (_("failed to get the fingerprint\n"));
return GNUPG_General_Error;
}
kh = keydb_new (0);
if (!kh)
{
log_error (_("failed to allocate keyDB handle\n"));
return GNUPG_Out_Of_Core;
}
rc = keydb_search_fpr (kh, fpr);
if (rc != -1)
{
keydb_release (kh);
if (!rc)
return 0; /* okay */
log_error (_("problem looking for existing certificate: %s\n"),
gnupg_strerror (rc));
return rc;
}
rc = keydb_locate_writable (kh, 0);
if (rc)
{
log_error (_("error finding writable keyDB: %s\n"), gnupg_strerror (rc));
keydb_release (kh);
return rc;
}
rc = keydb_insert_cert (kh, cert);
if (rc)
{
log_error (_("error storing certificate: %s\n"), gnupg_strerror (rc));
keydb_release (kh);
return rc;
}
keydb_release (kh);
return 0;
}