1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

* server.c (option_handler): Allow to use -2 for "send all certs

except the root cert".
* sign.c (add_certificate_list): Implement it here.
* certpath.c (gpgsm_is_root_cert): New.
This commit is contained in:
Werner Koch 2002-02-25 18:18:40 +00:00
parent 2a2d713359
commit 04f49d973b
9 changed files with 69 additions and 6 deletions

View file

@ -103,7 +103,7 @@ get_default_signer (void)
}
/* Depending on the options in CTRL add the certifcate CERT as well as
/* Depending on the options in CTRL add the certificate CERT as well as
other certificate up in the chain to the Root-CA to the CMS
object. */
static int
@ -113,22 +113,34 @@ add_certificate_list (CTRL ctrl, KsbaCMS cms, KsbaCert cert)
int rc = 0;
KsbaCert next = NULL;
int n;
int not_root = 0;
ksba_cert_ref (cert);
n = ctrl->include_certs;
if (n == -2)
{
not_root = 1;
n = -1;
}
if (n < 0 || n > 50)
n = 50; /* We better apply an upper bound */
if (n)
{
err = ksba_cms_add_cert (cms, cert);
if (not_root && gpgsm_is_root_cert (cert))
err = 0;
else
err = ksba_cms_add_cert (cms, cert);
if (err)
goto ksba_failure;
}
while ( n-- && !(rc = gpgsm_walk_cert_chain (cert, &next)) )
{
err = ksba_cms_add_cert (cms, next);
if (not_root && gpgsm_is_root_cert (next))
err = 0;
else
err = ksba_cms_add_cert (cms, next);
ksba_cert_release (cert);
cert = next; next = NULL;
if (err)