From 04f49d973b14790b4c46689c767f6e0630b9b979 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 25 Feb 2002 18:18:40 +0000 Subject: * 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. --- sm/certpath.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sm/certpath.c') diff --git a/sm/certpath.c b/sm/certpath.c index 0dac59acf..c3c09dcdd 100644 --- a/sm/certpath.c +++ b/sm/certpath.c @@ -253,6 +253,24 @@ gpgsm_walk_cert_chain (KsbaCert start, KsbaCert *r_next) return rc; } + +/* Check whether the CERT is a root certificate. Returns True if this + is the case. */ +int +gpgsm_is_root_cert (KsbaCert cert) +{ + char *issuer; + char *subject; + int yes; + + issuer = ksba_cert_get_issuer (cert, 0); + subject = ksba_cert_get_subject (cert, 0); + yes = (issuer && subject && !strcmp (issuer, subject)); + xfree (issuer); + xfree (subject); + return yes; +} + int gpgsm_validate_path (KsbaCert cert) -- cgit v1.2.3