diff options
author | Stef Walter <stefw@gnome.org> | 2013-03-19 19:03:12 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-03-19 19:16:30 +0100 |
commit | 80303340701c2cba78937193084f3d716b883b55 (patch) | |
tree | de4b51e53827a1ec300913a00a6c1121eb06db7a /trust/token.c | |
parent | 832015f1fd91a9e94478514d7fe9b21e050f121a (diff) |
trust: Use descriptive labels for tokens
Try to determine which one is the system trust input token,
and which one is the default token by using datadir and sysconfdir
respectively.
https://bugs.freedesktop.org/show_bug.cgi?id=62534
Diffstat (limited to 'trust/token.c')
-rw-r--r-- | trust/token.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/trust/token.c b/trust/token.c index b0c0704..e0c2089 100644 --- a/trust/token.c +++ b/trust/token.c @@ -62,7 +62,8 @@ struct _p11_token { p11_parser *parser; p11_index *index; p11_builder *builder; - const char *path; + char *path; + char *label; CK_SLOT_ID slot; int loaded; }; @@ -253,15 +254,21 @@ p11_token_free (p11_token *token) p11_index_free (token->index); p11_parser_free (token->parser); p11_builder_free (token->builder); + free (token->path); + free (token->label); free (token); } p11_token * p11_token_new (CK_SLOT_ID slot, - const char *path) + const char *path, + const char *label) { p11_token *token; + return_val_if_fail (path != NULL, NULL); + return_val_if_fail (label != NULL, NULL); + token = calloc (1, sizeof (p11_token)); return_val_if_fail (token != NULL, NULL); @@ -280,13 +287,24 @@ p11_token_new (CK_SLOT_ID slot, token->path = strdup (path); return_val_if_fail (token->path != NULL, NULL); + token->label = strdup (label); + return_val_if_fail (token->label != NULL, NULL); + token->slot = slot; token->loaded = 0; + p11_debug ("token: %s: %s", token->label, token->path); return token; } const char * +p11_token_get_label (p11_token *token) +{ + return_val_if_fail (token != NULL, NULL); + return token->label; +} + +const char * p11_token_get_path (p11_token *token) { return_val_if_fail (token != NULL, NULL); |