summaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-11-20 18:42:18 +0100
committerWerner Koch <wk@gnupg.org>1998-11-20 18:42:18 +0100
commit47c61bafe3545f17e8244902dca0ff00077d0feb (patch)
tree0867aa7d405a1df94ac360b5cc2814e97dcbe115 /g10/getkey.c
parentsome bug fixes (diff)
downloadgnupg2-47c61bafe3545f17e8244902dca0ff00077d0feb.tar.xz
gnupg2-47c61bafe3545f17e8244902dca0ff00077d0feb.zip
Expiration time works (I hope so)
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index dcc90a5be..a6d0ed1a9 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -721,7 +721,7 @@ merge_one_pk_and_selfsig( KBNODE keyblock, KBNODE knode )
*/
const byte *p;
p = parse_sig_subpkt( sig->hashed_data, SIGSUBPKT_KEY_EXPIRE, NULL );
- pk->expiredate = p? buffer_to_u32(p):0;
+ pk->expiredate = p? pk->timestamp + buffer_to_u32(p):0;
/* fixme: add usage etc. to pk */
break;
}
@@ -739,7 +739,7 @@ merge_keys_and_selfsig( KBNODE keyblock )
PKT_secret_key *sk = NULL;
PKT_signature *sig;
KBNODE k;
- u32 kid[2];
+ u32 kid[2] = { 0, 0 };
for(k=keyblock; k; k = k->next ) {
if( k->pkt->pkttype == PKT_PUBLIC_KEY
@@ -747,7 +747,7 @@ merge_keys_and_selfsig( KBNODE keyblock )
pk = k->pkt->pkt.public_key; sk = NULL;
if( pk->version < 4 )
pk = NULL; /* not needed for old keys */
- else
+ else if( k->pkt->pkttype == PKT_PUBLIC_KEY )
keyid_from_pk( pk, kid );
}
else if( k->pkt->pkttype == PKT_SECRET_KEY
@@ -755,7 +755,7 @@ merge_keys_and_selfsig( KBNODE keyblock )
pk = NULL; sk = k->pkt->pkt.secret_key;
if( sk->version < 4 )
sk = NULL;
- else
+ else if( k->pkt->pkttype == PKT_SECRET_KEY )
keyid_from_sk( sk, kid );
}
else if( (pk || sk ) && k->pkt->pkttype == PKT_SIGNATURE
@@ -770,12 +770,12 @@ merge_keys_and_selfsig( KBNODE keyblock )
const byte *p;
p = parse_sig_subpkt( sig->hashed_data, SIGSUBPKT_KEY_EXPIRE, NULL );
if( pk ) {
- pk->expiredate = p? buffer_to_u32(p):0;
+ pk->expiredate = p? pk->timestamp + buffer_to_u32(p):0;
/* fixme: add usage etc. */
pk = NULL; /* use only the first self signature */
}
else {
- sk->expiredate = p? buffer_to_u32(p):0;
+ sk->expiredate = p? sk->timestamp + buffer_to_u32(p):0;
sk = NULL; /* use only the first self signature */
}
}