25 |
#include <windows.h> |
#include <windows.h> |
26 |
#include <stdio.h> |
#include <stdio.h> |
27 |
#include <string.h> |
#include <string.h> |
|
#include <malloc.h> |
|
28 |
#include <ctype.h> |
#include <ctype.h> |
29 |
#include <assert.h> |
#include <assert.h> |
30 |
#include <gpgme.h> |
#include <gpgme.h> |
60 |
free_attr_list (attr_list_t ctx) |
free_attr_list (attr_list_t ctx) |
61 |
{ |
{ |
62 |
attr_list_t n; |
attr_list_t n; |
63 |
|
|
64 |
while (ctx) { |
while (ctx) { |
65 |
n = ctx->next; |
n = ctx->next; |
66 |
safe_free (ctx->fpr); |
free_if_alloc (ctx->fpr); |
67 |
safe_free (ctx->d); |
free_if_alloc (ctx->d); |
68 |
|
free_if_alloc (ctx); |
69 |
ctx = n; |
ctx = n; |
70 |
} |
} |
71 |
} |
} |
89 |
continue; |
continue; |
90 |
buffer = buf+9+10; |
buffer = buf+9+10; |
91 |
pos = 0; |
pos = 0; |
92 |
c = (attr_list_t)calloc (1, sizeof *c); |
c = new attr_list_s; |
93 |
if (!c) |
if (!c) |
94 |
BUG (0); |
BUG (0); |
95 |
|
memset (c, 0, sizeof *c); |
96 |
|
|
97 |
p = strtok (buffer, " "); |
p = strtok (buffer, " "); |
98 |
while (p != NULL) { |
while (p != NULL) { |
99 |
switch (pos) { |
switch (pos) { |
100 |
case 0: |
case 0: |
101 |
c->fpr = strdup (p); |
c->fpr = m_strdup (p); |
102 |
break; |
break; |
103 |
|
|
104 |
case 1: |
case 1: |
122 |
; |
; |
123 |
t->next = c; |
t->next = c; |
124 |
} |
} |
125 |
c->d = (unsigned char*)malloc (c->octets); |
c->d = new unsigned char[c->octets]; |
126 |
if (!c->d) |
if (!c->d) |
127 |
BUG (0); |
BUG (0); |
128 |
memcpy (c->d, data, c->octets); |
memcpy (c->d, data, c->octets); |
203 |
goto next; |
goto next; |
204 |
c->gloflags.is_protected = sk->is_protected; |
c->gloflags.is_protected = sk->is_protected; |
205 |
c->gloflags.divert_to_card = sk->protect.s2k.mode==1002? 1 : 0; |
c->gloflags.divert_to_card = sk->protect.s2k.mode==1002? 1 : 0; |
206 |
if (c->pubpart != NULL) { |
if (c->pubpart != NULL) { |
207 |
c->pubpart->gloflags.is_protected = sk->is_protected; |
c->pubpart->gloflags.is_protected = sk->is_protected; |
208 |
c->pubpart->gloflags.divert_to_card = sk->protect.s2k.mode==1002? 1 : 0; |
c->pubpart->gloflags.divert_to_card = sk->protect.s2k.mode==1002? 1 : 0; |
209 |
} |
} |
210 |
} |
} |
228 |
gpg_keycache_find_key2 (ctx, fpr, 0, &key, &fnd); |
gpg_keycache_find_key2 (ctx, fpr, 0, &key, &fnd); |
229 |
if (!fnd) |
if (!fnd) |
230 |
return gpg_error (GPG_ERR_NOT_FOUND); |
return gpg_error (GPG_ERR_NOT_FOUND); |
231 |
safe_free (fnd->attrib.d); |
free_if_alloc (fnd->attrib.d); |
232 |
fnd->attrib.flags = dat->flags; |
fnd->attrib.flags = dat->flags; |
233 |
fnd->attrib.len = dat->octets; |
fnd->attrib.len = dat->octets; |
234 |
fnd->attrib.d = (unsigned char*)malloc (dat->octets); |
fnd->attrib.d = new unsigned char[dat->octets]; |
235 |
if (!fnd->attrib.d) |
if (!fnd->attrib.d) |
236 |
BUG (0); |
BUG (0); |
237 |
memcpy (fnd->attrib.d, dat->d, dat->octets); |
memcpy (fnd->attrib.d, dat->d, dat->octets); |
259 |
} |
} |
260 |
|
|
261 |
|
|
262 |
static void |
void |
263 |
keycache_decode_uid (struct keycache_s *ctx) |
keycache_decode_uid (struct keycache_s *ctx) |
264 |
{ |
{ |
265 |
gpgme_user_id_t u; |
gpgme_user_id_t u; |
266 |
struct native_uid_s *n, *t; |
struct native_uid_s *n, *t; |
267 |
|
|
268 |
for (u = ctx->key->uids; u; u = u->next) { |
for (u = ctx->key->uids; u; u = u->next) { |
269 |
n = (struct native_uid_s*)calloc (1, sizeof *n); |
n = new native_uid_s; |
270 |
if (!n) |
if (!n) |
271 |
BUG (0); |
BUG (0); |
272 |
|
memset (n, 0, sizeof *n); |
273 |
if (is_8bit_string (u->uid)) { |
if (is_8bit_string (u->uid)) { |
274 |
n->malloced = 1; |
n->malloced = 1; |
275 |
n->uid = utf8_to_native (u->uid); |
n->uid = utf8_to_native (u->uid); |
276 |
if (u->name != NULL) |
if (u->name != NULL) |
277 |
n->name = utf8_to_native (u->name); |
n->name = utf8_to_native (u->name); |
278 |
if (u->email != NULL) |
if (u->email != NULL) |
279 |
n->email = strdup (u->email); |
n->email = m_strdup (u->email); |
280 |
if (u->comment != NULL) |
if (u->comment != NULL) |
281 |
n->comment = utf8_to_native (u->comment); |
n->comment = utf8_to_native (u->comment); |
282 |
} |
} |
321 |
while (n != NULL) { |
while (n != NULL) { |
322 |
t = n->next; |
t = n->next; |
323 |
if (n->malloced) { |
if (n->malloced) { |
324 |
safe_free (n->uid); |
free_if_alloc (n->uid); |
325 |
safe_free (n->name); |
free_if_alloc (n->name); |
326 |
safe_free (n->comment); |
free_if_alloc (n->comment); |
327 |
safe_free (n->email); |
free_if_alloc (n->email); |
|
safe_free (n->uid); |
|
328 |
} |
} |
329 |
safe_free (n); |
free_if_alloc (n); |
330 |
n = t; |
n = t; |
331 |
} |
} |
332 |
*r_n = NULL; |
*r_n = NULL; |
381 |
goto next; |
goto next; |
382 |
c->gloflags.has_desig_rev = 1; |
c->gloflags.has_desig_rev = 1; |
383 |
} |
} |
384 |
if (pkt->pkttype == PKT_SIGNATURE && key_seen == 1) { |
if (pkt->pkttype == PKT_SIGNATURE && key_seen == 1 && c != NULL) { |
385 |
sym_prefs = gpg_parse_sig_subpkt (pkt->pkt.signature->hashed, |
sym_prefs = gpg_parse_sig_subpkt (pkt->pkt.signature->hashed, |
386 |
SIGSUBPKT_PREF_SYM, &nsym); |
SIGSUBPKT_PREF_SYM, &nsym); |
387 |
if (!sym_prefs) |
if (!sym_prefs) |
396 |
if (c->sym_prefs) /* only use the prefs from the primary uid. */ |
if (c->sym_prefs) /* only use the prefs from the primary uid. */ |
397 |
goto next; |
goto next; |
398 |
else if (nsym > 0) { |
else if (nsym > 0) { |
399 |
c->sym_prefs = (unsigned char*)calloc (1, nsym+1); |
c->sym_prefs = new unsigned char[nsym+1]; |
400 |
if (!c->sym_prefs) |
if (!c->sym_prefs) |
401 |
BUG (0); |
BUG (0); |
402 |
|
memset (c->sym_prefs, 0, nsym+1); |
403 |
memcpy (c->sym_prefs, sym_prefs, nsym); |
memcpy (c->sym_prefs, sym_prefs, nsym); |
404 |
} |
} |
405 |
} |
} |
439 |
|
|
440 |
if (!r_ctx) |
if (!r_ctx) |
441 |
return gpg_error (GPG_ERR_INV_ARG); |
return gpg_error (GPG_ERR_INV_ARG); |
442 |
ctx = (gpg_keycache_t)calloc (1, sizeof *ctx); |
ctx = new gpg_keycache_s; |
443 |
if (!ctx) |
if (!ctx) |
444 |
BUG (0); |
BUG (0); |
445 |
|
memset (ctx, 0, sizeof *ctx); |
446 |
ctx->secret = 0; |
ctx->secret = 0; |
447 |
ctx->pos = 0; |
ctx->pos = 0; |
448 |
*r_ctx = ctx; |
*r_ctx = ctx; |
450 |
} |
} |
451 |
|
|
452 |
|
|
453 |
|
void |
454 |
|
gpg_keycache_item_release (struct keycache_s *c) |
455 |
|
{ |
456 |
|
if (c->key) |
457 |
|
gpgme_key_release (c->key); |
458 |
|
c->key = NULL; |
459 |
|
if (c->rev != NULL) |
460 |
|
gpg_desig_rev_release (c->rev); |
461 |
|
c->rev = NULL; |
462 |
|
free_if_alloc (c->pref_keyserver); |
463 |
|
free_if_alloc (c->sym_prefs); |
464 |
|
free_if_alloc (c->attrib.d); |
465 |
|
free_if_alloc (c->card_type); |
466 |
|
free_native_uids (&c->uids); |
467 |
|
free_if_alloc (c); |
468 |
|
} |
469 |
|
|
470 |
|
|
471 |
/* Release keycache object @ctx. */ |
/* Release keycache object @ctx. */ |
472 |
void |
void |
473 |
gpg_keycache_release (gpg_keycache_t ctx) |
gpg_keycache_release (gpg_keycache_t ctx) |
479 |
|
|
480 |
for (c = ctx->item; c; c = c2) { |
for (c = ctx->item; c; c = c2) { |
481 |
c2 = c->next; |
c2 = c->next; |
482 |
gpgme_key_release (c->key); |
gpg_keycache_item_release (c); |
|
c->key = NULL; |
|
|
if (c->rev != NULL) |
|
|
gpg_desig_rev_release (c->rev); |
|
|
c->rev = NULL; |
|
|
safe_free (c->pref_keyserver); |
|
|
safe_free (c->sym_prefs); |
|
|
safe_free (c->attrib.d); |
|
|
safe_free (c->card_type); |
|
|
free_native_uids (&c->uids); |
|
|
safe_free (c); |
|
483 |
} |
} |
484 |
safe_free (ctx); |
free_if_alloc (ctx); |
485 |
} |
} |
486 |
|
|
487 |
|
|
513 |
if (!ctx) |
if (!ctx) |
514 |
return gpg_error (GPG_ERR_INV_ARG); |
return gpg_error (GPG_ERR_INV_ARG); |
515 |
|
|
516 |
c = (struct keycache_s*)calloc (1, sizeof *c); |
c = new keycache_s; |
517 |
if (!c) |
if (!c) |
518 |
BUG (0); |
BUG (0); |
519 |
|
memset (c, 0, sizeof *c); |
520 |
c->gloflags.is_protected = 1; /*default: assume protection. */ |
c->gloflags.is_protected = 1; /*default: assume protection. */ |
521 |
c->key = key; |
c->key = key; |
522 |
if (!ctx->item) |
if (!ctx->item) |
630 |
if (c->flags != 0) { |
if (c->flags != 0) { |
631 |
*r_status = c->flags; |
*r_status = c->flags; |
632 |
*r_obj = c; |
*r_obj = c; |
633 |
c->flags = 0; |
c->flags = 0; /* reset update flag. */ |
634 |
return 0; |
return 0; |
635 |
} |
} |
636 |
} |
} |
638 |
} |
} |
639 |
|
|
640 |
|
|
641 |
|
static gpgme_error_t |
642 |
|
get_gpg_key (const char *keyid, int is_sec, gpgme_key_t *r_key) |
643 |
|
{ |
644 |
|
gpgme_ctx_t ctx; |
645 |
|
gpgme_error_t err; |
646 |
|
|
647 |
|
err = gpgme_new (&ctx); |
648 |
|
if (err) |
649 |
|
return err; |
650 |
|
gpgme_set_keylist_mode (ctx, GPGME_KEYLIST_MODE_SIGS); |
651 |
|
err = gpgme_get_key (ctx, keyid, r_key, is_sec); |
652 |
|
gpgme_release (ctx); |
653 |
|
return err; |
654 |
|
} |
655 |
|
|
656 |
|
|
657 |
|
/* Fetch a key directly from gpg but without adding |
658 |
|
it to the key cache. Caller must free @r_ctx. */ |
659 |
|
gpgme_error_t |
660 |
|
gpg_keycache_fetch_key (const char *keyid, int is_sec, |
661 |
|
gpgme_key_t *r_key, struct keycache_s **r_c) |
662 |
|
{ |
663 |
|
gpgme_error_t err; |
664 |
|
gpgme_key_t key; |
665 |
|
struct keycache_s *c; |
666 |
|
|
667 |
|
*r_key = NULL; |
668 |
|
*r_c = NULL; |
669 |
|
err = get_gpg_key (keyid, is_sec, &key); |
670 |
|
if (err) |
671 |
|
return err; |
672 |
|
|
673 |
|
c = new keycache_s; |
674 |
|
if (!c) |
675 |
|
BUG (0); |
676 |
|
memset (c, 0, sizeof *c); |
677 |
|
c->gloflags.is_protected = 1; /*default: assume protection. */ |
678 |
|
c->key = key; |
679 |
|
keycache_decode_uid (c); |
680 |
|
*r_key = key; |
681 |
|
*r_c = c; |
682 |
|
return 0; |
683 |
|
} |
684 |
|
|
685 |
|
|
686 |
|
/* Update the key with the keyid @key in the key cache. |
687 |
|
If the key does not exist, it is added otherwise all |
688 |
|
parts are first freed and then replaced with the updated data. */ |
689 |
gpgme_error_t |
gpgme_error_t |
690 |
gpg_keycache_update_key (gpg_keycache_t ctx, int is_sec, |
gpg_keycache_update_key (gpg_keycache_t ctx, int is_sec, |
691 |
void *opaque, const char *keyid) |
void *opaque, const char *keyid) |
692 |
{ |
{ |
|
struct keycache_s *c = NULL, *c_new=NULL; |
|
693 |
gpgme_key_t key=NULL, fndkey=NULL; |
gpgme_key_t key=NULL, fndkey=NULL; |
694 |
gpgme_error_t err; |
gpgme_error_t err; |
695 |
gpgme_ctx_t gctx; |
struct keycache_s *c = NULL, *c_new=NULL; |
696 |
gpg_keycache_t pub = (gpg_keycache_t)opaque; |
gpg_keycache_t pub = (gpg_keycache_t)opaque; |
697 |
|
|
698 |
err = gpgme_new (&gctx); |
err = get_gpg_key (keyid, is_sec, &key); |
|
if (err) |
|
|
return err; |
|
|
gpgme_set_keylist_mode (gctx, GPGME_KEYLIST_MODE_SIGS/*|GPGME_KEYLIST_MODE_SIG_NOTATIONS*/); |
|
|
err = gpgme_get_key (gctx, keyid, &key, is_sec); |
|
|
gpgme_release (gctx); |
|
699 |
if (err) |
if (err) |
700 |
return err; |
return err; |
701 |
err = gpg_keycache_find_key2 (ctx, keyid, 0, &fndkey, &c); |
err = gpg_keycache_find_key2 (ctx, keyid, 0, &fndkey, &c); |
726 |
c->gloflags.divert_to_card = c_new->gloflags.divert_to_card; |
c->gloflags.divert_to_card = c_new->gloflags.divert_to_card; |
727 |
} |
} |
728 |
} |
} |
729 |
if (c) |
if (c != NULL) |
730 |
c->flags = KC_FLAG_ADD; |
c->flags = KC_FLAG_ADD; |
|
|
|
731 |
} |
} |
732 |
|
|
733 |
/* refresh utf8 user ID list. */ |
/* refresh utf8 user ID list. */ |
734 |
if (c != NULL) { |
if (c != NULL && c->key) { |
735 |
free_native_uids (&c->uids); |
free_native_uids (&c->uids); |
736 |
keycache_decode_uid (c); |
keycache_decode_uid (c); |
737 |
} |
} |
757 |
|
|
758 |
c = ctx->item; |
c = ctx->item; |
759 |
if (c->next == NULL) { |
if (c->next == NULL) { |
760 |
gpgme_key_release (itm->key); |
if (itm->key) |
761 |
safe_free (itm); |
gpgme_key_release (itm->key); |
762 |
ctx->item = NULL; |
itm->key = NULL; |
763 |
|
free_if_alloc (itm); |
764 |
} |
} |
765 |
else { |
else { |
766 |
for (; c != NULL; c = c->next) { |
for (; c != NULL; c = c->next) { |
769 |
} |
} |
770 |
assert (c != NULL); /* XXX: sometimes access violation. */ |
assert (c != NULL); /* XXX: sometimes access violation. */ |
771 |
c->next = c->next->next; |
c->next = c->next->next; |
772 |
gpgme_key_release (itm->key); |
if (itm->key) |
773 |
safe_free (itm); |
gpgme_key_release (itm->key); |
774 |
|
itm->key = NULL; |
775 |
|
free_if_alloc (itm); |
776 |
} |
} |
777 |
return 0; |
return 0; |
778 |
} |
} |
797 |
return err; |
return err; |
798 |
|
|
799 |
/* XXX: GPGME_KEYLIST_MODE_SIG_NOTATIONS causes an internal error! */ |
/* XXX: GPGME_KEYLIST_MODE_SIG_NOTATIONS causes an internal error! */ |
800 |
gpgme_set_keylist_mode (c, GPGME_KEYLIST_MODE_SIGS/*|GPGME_KEYLIST_MODE_SIG_NOTATIONS*/); |
gpgme_set_keylist_mode (c, GPGME_KEYLIST_MODE_SIGS); |
801 |
err = gpgme_op_keylist_start (c, pattern, secret); |
err = gpgme_op_keylist_start (c, pattern, secret); |
802 |
while(!err) { |
while(!err) { |
803 |
err = gpgme_op_keylist_next (c, &key); |
err = gpgme_op_keylist_next (c, &key); |
811 |
err = gpg_error (GPG_ERR_NO_ERROR); |
err = gpg_error (GPG_ERR_NO_ERROR); |
812 |
keycache_update_photos (ctx); |
keycache_update_photos (ctx); |
813 |
keycache_decode_uids (ctx); |
keycache_decode_uids (ctx); |
|
/* XXX: make sure the progress dialog is closed. */ |
|
814 |
gpgme_op_keylist_end (c); |
gpgme_op_keylist_end (c); |
815 |
gpgme_release (c); |
gpgme_release (c); |
816 |
return err; |
return err; |
845 |
|
|
846 |
while (prefs[pos] != 0) |
while (prefs[pos] != 0) |
847 |
pos++; |
pos++; |
848 |
p = (unsigned char*)calloc (1, pos+1); |
p = new unsigned char[pos+1]; |
849 |
if (!p) |
if (!p) |
850 |
BUG (0); |
BUG (0); |
851 |
|
memset (p, 0, pos+1); |
852 |
memcpy (p, prefs, pos); |
memcpy (p, prefs, pos); |
853 |
return p; |
return p; |
854 |
} |
} |
855 |
|
|
856 |
|
|
857 |
|
/* Sync the secret and the public key cache information. */ |
858 |
gpgme_error_t |
gpgme_error_t |
859 |
gpg_keycache_sync (gpg_keycache_t pub, gpg_keycache_t sec) |
gpg_keycache_sync (gpg_keycache_t pub, gpg_keycache_t sec) |
860 |
{ |
{ |
864 |
if (!pub || !sec) |
if (!pub || !sec) |
865 |
return gpg_error (GPG_ERR_INV_ARG); |
return gpg_error (GPG_ERR_INV_ARG); |
866 |
|
|
867 |
for (c=sec->item; c; c=c->next) { |
for (c=sec->item; c; c=c->next) { |
868 |
if (!gpg_keycache_find_key2 (pub, c->key->subkeys->keyid, 0, &key, &c_sec)) { |
if (!gpg_keycache_find_key2 (pub, c->key->subkeys->keyid, 0, &key, &c_sec)) { |
869 |
c_sec->gloflags.is_protected = c->gloflags.is_protected; |
c_sec->gloflags.is_protected = c->gloflags.is_protected; |
870 |
c_sec->gloflags.divert_to_card = c->gloflags.divert_to_card; |
c_sec->gloflags.divert_to_card = c->gloflags.divert_to_card; |
922 |
} |
} |
923 |
if (ctx->tmp->flags != 0) |
if (ctx->tmp->flags != 0) |
924 |
ctx->tmp->flags = 0; /* reset the 'updated' status. */ |
ctx->tmp->flags = 0; /* reset the 'updated' status. */ |
925 |
|
|
926 |
/* it might be possible there is no public key. */ |
/* it might be possible there is no public key. */ |
927 |
if (flags && ctx->tmp->pubpart == NULL) |
if (flags && ctx->tmp->pubpart == NULL) |
928 |
flags = 0; |
flags = 0; |
929 |
*r_key = flags? ctx->tmp->pubpart->key : ctx->tmp->key; |
*r_key = flags? ctx->tmp->pubpart->key : ctx->tmp->key; |
930 |
*c = ctx->tmp; |
*c = ctx->tmp; |
931 |
ctx->tmp = ctx->tmp->next; |
ctx->tmp = ctx->tmp->next; |
932 |
ctx->pos++; |
ctx->pos++; |
933 |
|
|
934 |
return 0; |
return 0; |
948 |
return err; |
return err; |
949 |
} |
} |
950 |
|
|
951 |
|
|
952 |
gpgme_error_t |
gpgme_error_t |
953 |
gpg_keycache_next_key2 (gpg_keycache_t ctx, int flags, |
gpg_keycache_next_key2 (gpg_keycache_t ctx, int flags, |
954 |
struct keycache_s **c, gpgme_key_t *r_key) |
struct keycache_s **c, gpgme_key_t *r_key) |
1004 |
char **out, WORD *outlen) |
char **out, WORD *outlen) |
1005 |
{ |
{ |
1006 |
char tmp[128], *val; |
char tmp[128], *val; |
1007 |
char *enc = NULL; |
char *enc = NULL; |
1008 |
size_t pos = 0, i=0; |
size_t pos = 0; |
1009 |
|
|
1010 |
/* example: spk:24:1:21:http%3A//subkeys.pgp.de */ |
/* example: spk:24:1:21:http%3A//subkeys.pgp.de */ |
1011 |
*outlen = 0; |
*outlen = 0; |
1014 |
if (strncmp (subpkt_data, "spk:", 4)) |
if (strncmp (subpkt_data, "spk:", 4)) |
1015 |
return gpg_error (GPG_ERR_NO_DATA); |
return gpg_error (GPG_ERR_NO_DATA); |
1016 |
|
|
1017 |
strncpy (tmp, subpkt_data, 62); |
/* XXX: do not use static buffer sizes. */ |
1018 |
|
strncpy (tmp, subpkt_data, DIM (tmp)-4); |
1019 |
val = strtok (tmp, ":"); |
val = strtok (tmp, ":"); |
1020 |
while (val != NULL) { |
while (val != NULL) { |
1021 |
switch (pos++) { |
switch (pos++) { |
1035 |
break; |
break; |
1036 |
|
|
1037 |
case 4: |
case 4: |
1038 |
enc = strdup (val); |
enc = m_strdup (val); |
1039 |
break; |
break; |
1040 |
} |
} |
1041 |
val = strtok (NULL, ":"); |
val = strtok (NULL, ":"); |
1042 |
} |
} |
1043 |
if (!enc) |
if (!enc) |
1044 |
return gpg_error (GPG_ERR_NO_DATA);; |
return gpg_error (GPG_ERR_NO_DATA); |
1045 |
*out = (char*)calloc (1, strlen (enc)+1); |
unhexify_buffer (enc, out); |
1046 |
if (!*out) |
free_if_alloc (enc); |
|
BUG (0); |
|
|
for (pos = 0; pos < strlen (enc); pos++) { |
|
|
if (enc[pos] == '%' && enc[pos+1] == '%') |
|
|
(*out)[i++] = '%'; |
|
|
else if (enc[pos] == '%') { |
|
|
char temp[3]; |
|
|
temp[0] = enc[++pos]; |
|
|
temp[1] = enc[++pos]; |
|
|
temp[2] = 0; |
|
|
(*out)[i++] = (char)strtoul (temp, NULL, 16); |
|
|
} |
|
|
else |
|
|
(*out)[i++] = enc[pos]; |
|
|
} |
|
|
(*out)[i] = 0; |
|
|
safe_free (enc); |
|
1047 |
return 0; |
return 0; |
1048 |
} |
} |
1049 |
|
|
1062 |
case KC_ATTR_PREFSYM: |
case KC_ATTR_PREFSYM: |
1063 |
if (!force && item->sym_prefs) |
if (!force && item->sym_prefs) |
1064 |
break; |
break; |
1065 |
safe_free (item->sym_prefs); |
free_if_alloc (item->sym_prefs); |
1066 |
err = gpg_find_key_subpacket (item->key->subkeys->keyid+8, attr, &val); |
err = gpg_find_key_subpacket (item->key->subkeys->keyid+8, attr, &val); |
1067 |
if (!err && val != NULL) |
if (!err && val != NULL) |
1068 |
err = decode_subpacket (val, NULL, (char**)&item->sym_prefs, &n); |
err = decode_subpacket (val, NULL, (char**)&item->sym_prefs, &n); |
1071 |
case KC_ATTR_PREFKSERV: |
case KC_ATTR_PREFKSERV: |
1072 |
if (!force && item->pref_keyserver) |
if (!force && item->pref_keyserver) |
1073 |
break; |
break; |
1074 |
safe_free (item->pref_keyserver); |
free_if_alloc (item->pref_keyserver); |
1075 |
err = gpg_find_key_subpacket (item->key->subkeys->keyid+8, attr, &val); |
err = gpg_find_key_subpacket (item->key->subkeys->keyid+8, attr, &val); |
1076 |
if (!err && val != NULL) |
if (!err && val != NULL) |
1077 |
err = decode_subpacket (val, NULL, &item->pref_keyserver, &n); |
err = decode_subpacket (val, NULL, &item->pref_keyserver, &n); |