aboutsummaryrefslogtreecommitdiffstats
path: root/sm/certpath.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-02-25 18:18:40 +0000
committerWerner Koch <[email protected]>2002-02-25 18:18:40 +0000
commit04f49d973b14790b4c46689c767f6e0630b9b979 (patch)
tree460bac0bb6c5e9b6f14336121231ae008f24bfd9 /sm/certpath.c
parent* keybox-search.c (blob_cmp_mail): Use case-insensitive compare (diff)
downloadgnupg-04f49d973b14790b4c46689c767f6e0630b9b979.tar.gz
gnupg-04f49d973b14790b4c46689c767f6e0630b9b979.zip
* 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.
Diffstat (limited to 'sm/certpath.c')
-rw-r--r--sm/certpath.c18
1 files changed, 18 insertions, 0 deletions
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)