core: New public enum gpgme_keyorg_t.
* src/gpgme.h.in (gpgme_keyorg_t): New. * src/keylist.c (parse_keyorg): New. (keylist_colon_handler): Set key->ORIGIN. -- This finally set the key origin value form data supplied by recent gpg versions. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
91e47d7165
commit
9bde9144f0
@ -330,6 +330,21 @@ typedef enum
|
|||||||
gpgme_tofu_policy_t;
|
gpgme_tofu_policy_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* The key origin values. */
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GPGME_KEYORG_UNKNOWN = 0,
|
||||||
|
GPGME_KEYORG_KS = 1,
|
||||||
|
GPGME_KEYORG_DANE = 3,
|
||||||
|
GPGME_KEYORG_WKD = 4,
|
||||||
|
GPGME_KEYORG_URL = 5,
|
||||||
|
GPGME_KEYORG_FILE = 6,
|
||||||
|
GPGME_KEYORG_SELF = 7,
|
||||||
|
GPGME_KEYORG_OTHER = 31
|
||||||
|
}
|
||||||
|
gpgme_keyorg_t;
|
||||||
|
|
||||||
|
|
||||||
/* The available protocols. */
|
/* The available protocols. */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -697,7 +712,7 @@ struct _gpgme_user_id
|
|||||||
/* The malloced TOFU information or NULL. */
|
/* The malloced TOFU information or NULL. */
|
||||||
gpgme_tofu_info_t tofu;
|
gpgme_tofu_info_t tofu;
|
||||||
|
|
||||||
/* Time of the last refresh of thsi user id. 0 if unknown. */
|
/* Time of the last refresh of this user id. 0 if unknown. */
|
||||||
unsigned long last_update;
|
unsigned long last_update;
|
||||||
};
|
};
|
||||||
typedef struct _gpgme_user_id *gpgme_user_id_t;
|
typedef struct _gpgme_user_id *gpgme_user_id_t;
|
||||||
|
@ -376,6 +376,25 @@ set_ownertrust (gpgme_key_t key, const char *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gpgme_keyorg_t
|
||||||
|
parse_keyorg (const char *string)
|
||||||
|
{
|
||||||
|
switch (atoi (string))
|
||||||
|
{
|
||||||
|
case 0: return GPGME_KEYORG_UNKNOWN;
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
return GPGME_KEYORG_KS;
|
||||||
|
case 3: return GPGME_KEYORG_DANE;
|
||||||
|
case 4: return GPGME_KEYORG_WKD;
|
||||||
|
case 5: return GPGME_KEYORG_URL;
|
||||||
|
case 6: return GPGME_KEYORG_FILE;
|
||||||
|
case 7: return GPGME_KEYORG_SELF;
|
||||||
|
default: return GPGME_KEYORG_OTHER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Parse field 15 of a secret key or subkey. This fields holds a
|
/* Parse field 15 of a secret key or subkey. This fields holds a
|
||||||
reference to smartcards. FIELD is the content of the field and we
|
reference to smartcards. FIELD is the content of the field and we
|
||||||
are allowed to modify it. */
|
are allowed to modify it. */
|
||||||
@ -719,7 +738,7 @@ keylist_colon_handler (void *priv, char *line)
|
|||||||
if (fields >= 20)
|
if (fields >= 20)
|
||||||
{
|
{
|
||||||
key->last_update = _gpgme_parse_timestamp_ul (field[18]);
|
key->last_update = _gpgme_parse_timestamp_ul (field[18]);
|
||||||
key->origin = 0; /* Fixme: Not yet defined in gpg. */
|
key->origin = parse_keyorg (field[19]);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -814,7 +833,7 @@ keylist_colon_handler (void *priv, char *line)
|
|||||||
if (fields >= 20)
|
if (fields >= 20)
|
||||||
{
|
{
|
||||||
opd->tmp_uid->last_update = _gpgme_parse_timestamp_ul (field[18]);
|
opd->tmp_uid->last_update = _gpgme_parse_timestamp_ul (field[18]);
|
||||||
opd->tmp_uid->origin = 0; /* Fixme: Not yet defined in gpg. */
|
opd->tmp_uid->origin = parse_keyorg (field[19]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user