summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index b89ead6e5..4a288199f 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -35,7 +35,7 @@
35 35
36#include "includes.h" 36#include "includes.h"
37#include "openbsd-compat/fake-queue.h" 37#include "openbsd-compat/fake-queue.h"
38RCSID("$OpenBSD: ssh-agent.c,v 1.91 2002/06/11 05:46:20 mpech Exp $"); 38RCSID("$OpenBSD: ssh-agent.c,v 1.92 2002/06/15 00:01:36 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41#include <openssl/md5.h> 41#include <openssl/md5.h>
@@ -470,15 +470,13 @@ send:
470} 470}
471 471
472static void 472static void
473process_lifetime_identity(SocketEntry *e, int version) 473process_contrain_identity(SocketEntry *e, int version)
474{ 474{
475 Key *key = NULL; 475 Key *key = NULL;
476 u_char *blob; 476 u_char *blob;
477 u_int blen, bits, death; 477 u_int blen, bits, death = 0;
478 int success = 0; 478 int success = 0;
479 479
480 death = time(NULL) + buffer_get_int(&e->request);
481
482 switch (version) { 480 switch (version) {
483 case 1: 481 case 1:
484 key = key_new(KEY_RSA1); 482 key = key_new(KEY_RSA1);
@@ -493,9 +491,18 @@ process_lifetime_identity(SocketEntry *e, int version)
493 xfree(blob); 491 xfree(blob);
494 break; 492 break;
495 } 493 }
494 while (buffer_len(&e->request)) {
495 switch (buffer_get_char(&e->request)) {
496 case SSH_AGENT_CONTRAIN_LIFETIME:
497 death = time(NULL) + buffer_get_int(&e->request);
498 break;
499 default:
500 break;
501 }
502 }
496 if (key != NULL) { 503 if (key != NULL) {
497 Identity *id = lookup_identity(key, version); 504 Identity *id = lookup_identity(key, version);
498 if (id != NULL && id->death == 0) { 505 if (id != NULL && id->death == 0 && death != 0) {
499 id->death = death; 506 id->death = death;
500 success = 1; 507 success = 1;
501 } 508 }
@@ -707,8 +714,8 @@ process_message(SocketEntry *e)
707 case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES: 714 case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES:
708 process_remove_all_identities(e, 1); 715 process_remove_all_identities(e, 1);
709 break; 716 break;
710 case SSH_AGENTC_LIFETIME_IDENTITY1: 717 case SSH_AGENTC_CONTRAIN_IDENTITY1:
711 process_lifetime_identity(e, 1); 718 process_contrain_identity(e, 1);
712 break; 719 break;
713 /* ssh2 */ 720 /* ssh2 */
714 case SSH2_AGENTC_SIGN_REQUEST: 721 case SSH2_AGENTC_SIGN_REQUEST:
@@ -726,8 +733,8 @@ process_message(SocketEntry *e)
726 case SSH2_AGENTC_REMOVE_ALL_IDENTITIES: 733 case SSH2_AGENTC_REMOVE_ALL_IDENTITIES:
727 process_remove_all_identities(e, 2); 734 process_remove_all_identities(e, 2);
728 break; 735 break;
729 case SSH_AGENTC_LIFETIME_IDENTITY: 736 case SSH_AGENTC_CONTRAIN_IDENTITY:
730 process_lifetime_identity(e, 2); 737 process_contrain_identity(e, 2);
731 break; 738 break;
732#ifdef SMARTCARD 739#ifdef SMARTCARD
733 case SSH_AGENTC_ADD_SMARTCARD_KEY: 740 case SSH_AGENTC_ADD_SMARTCARD_KEY: