summaryrefslogtreecommitdiffstats
path: root/sm/qualified.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2006-03-21 10:56:47 +0100
committerWerner Koch <wk@gnupg.org>2006-03-21 10:56:47 +0100
commit6b19366e4e4583bc70f43c2ac138b9a7decb7075 (patch)
tree74ccd4d237a7579e9251c05fc4df78372bd37bc7 /sm/qualified.c
parentFixed card removal problems (diff)
downloadgnupg2-6b19366e4e4583bc70f43c2ac138b9a7decb7075.tar.xz
gnupg2-6b19366e4e4583bc70f43c2ac138b9a7decb7075.zip
Add Kludge for RegTP sillyness.
Diffstat (limited to 'sm/qualified.c')
-rw-r--r--sm/qualified.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sm/qualified.c b/sm/qualified.c
index a52269734..07abaadc4 100644
--- a/sm/qualified.c
+++ b/sm/qualified.c
@@ -145,24 +145,29 @@ read_list (char *key, char *country, int *lnr)
per user because it is not a decision of the user.
Returns: 0 if the certificate is included. GPG_ERR_NOT_FOUND if it
- is not in the liost or any other error (e.g. if no list of
- qualified signatures is available. */
+ is not in the list or any other error (e.g. if no list of
+ qualified signatures is available. If COUNTRY has not been passed
+ as NULL a string witha maximum length of 2 will be copied into it;
+ thus the caller needs to provide a buffer of length 3. */
gpg_error_t
-gpgsm_is_in_qualified_list (ctrl_t ctrl, ksba_cert_t cert)
+gpgsm_is_in_qualified_list (ctrl_t ctrl, ksba_cert_t cert, char *country)
{
gpg_error_t err;
char *fpr;
char key[41];
- char country[2];
+ char mycountry[3];
int lnr = 0;
+ if (country)
+ *country = 0;
+
fpr = gpgsm_get_fingerprint_hexstring (cert, GCRY_MD_SHA1);
if (!fpr)
return gpg_error (GPG_ERR_GENERAL);
if (listfp)
rewind (listfp);
- while (!(err = read_list (key, country, &lnr)))
+ while (!(err = read_list (key, mycountry, &lnr)))
{
if (!strcmp (key, fpr))
break;
@@ -170,6 +175,9 @@ gpgsm_is_in_qualified_list (ctrl_t ctrl, ksba_cert_t cert)
if (gpg_err_code (err) == GPG_ERR_EOF)
err = gpg_error (GPG_ERR_NOT_FOUND);
+ if (!err && country)
+ strcpy (country, mycountry);
+
xfree (fpr);
return err;
}