[BACK]Return to ssh-agent.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/ssh-agent.c between version 1.93 and 1.94

version 1.93, 2002/06/15 00:07:38 version 1.94, 2002/06/15 01:27:48
Line 391 
Line 391 
         Key *k = NULL;          Key *k = NULL;
         char *type_name;          char *type_name;
         char *comment;          char *comment;
         int type, success = 0;          int type, success = 0, death = 0;
         Idtab *tab = idtab_lookup(version);          Idtab *tab = idtab_lookup(version);
   
         switch (version) {          switch (version) {
Line 447 
Line 447 
                 goto send;                  goto send;
         }          }
         success = 1;          success = 1;
           while (buffer_len(&e->request)) {
                   switch (buffer_get_char(&e->request)) {
                   case SSH_AGENT_CONSTRAIN_LIFETIME:
                           death = time(NULL) + buffer_get_int(&e->request);
                           break;
                   default:
                           break;
                   }
           }
         if (lookup_identity(k, version) == NULL) {          if (lookup_identity(k, version) == NULL) {
                 Identity *id = xmalloc(sizeof(Identity));                  Identity *id = xmalloc(sizeof(Identity));
                 id->key = k;                  id->key = k;
                 id->comment = comment;                  id->comment = comment;
                 id->death = 0;                  id->death = death;
                 TAILQ_INSERT_TAIL(&tab->idlist, id, next);                  TAILQ_INSERT_TAIL(&tab->idlist, id, next);
                 /* Increment the number of identities. */                  /* Increment the number of identities. */
                 tab->nentries++;                  tab->nentries++;
Line 465 
Line 474 
             success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);              success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);
 }  }
   
 static void  
 process_constrain_identity(SocketEntry *e, int version)  
 {  
         Key *key = NULL;  
         u_char *blob;  
         u_int blen, bits, death = 0;  
         int success = 0;  
   
         switch (version) {  
         case 1:  
                 key = key_new(KEY_RSA1);  
                 bits = buffer_get_int(&e->request);  
                 buffer_get_bignum(&e->request, key->rsa->e);  
                 buffer_get_bignum(&e->request, key->rsa->n);  
   
                 break;  
         case 2:  
                 blob = buffer_get_string(&e->request, &blen);  
                 key = key_from_blob(blob, blen);  
                 xfree(blob);  
                 break;  
         }  
         while (buffer_len(&e->request)) {  
                 switch (buffer_get_char(&e->request)) {  
                 case SSH_AGENT_CONSTRAIN_LIFETIME:  
                         death = time(NULL) + buffer_get_int(&e->request);  
                         break;  
                 default:  
                         break;  
                 }  
         }  
         if (key != NULL) {  
                 Identity *id = lookup_identity(key, version);  
                 if (id != NULL && id->death == 0 && death != 0) {  
                         id->death = death;  
                         success = 1;  
                 }  
                 key_free(key);  
         }  
         buffer_put_int(&e->output, 1);  
         buffer_put_char(&e->output,  
             success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE);  
 }  
   
 /* XXX todo: encrypt sensitive data with passphrase */  /* XXX todo: encrypt sensitive data with passphrase */
 static void  static void
 process_lock_agent(SocketEntry *e, int lock)  process_lock_agent(SocketEntry *e, int lock)
Line 702 
Line 667 
                 process_request_identities(e, 1);                  process_request_identities(e, 1);
                 break;                  break;
         case SSH_AGENTC_ADD_RSA_IDENTITY:          case SSH_AGENTC_ADD_RSA_IDENTITY:
           case SSH_AGENTC_ADD_RSA_ID_CONSTRAINED:
                 process_add_identity(e, 1);                  process_add_identity(e, 1);
                 break;                  break;
         case SSH_AGENTC_REMOVE_RSA_IDENTITY:          case SSH_AGENTC_REMOVE_RSA_IDENTITY:
Line 710 
Line 676 
         case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES:          case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES:
                 process_remove_all_identities(e, 1);                  process_remove_all_identities(e, 1);
                 break;                  break;
         case SSH_AGENTC_CONSTRAIN_IDENTITY1:  
                 process_constrain_identity(e, 1);  
                 break;  
         /* ssh2 */          /* ssh2 */
         case SSH2_AGENTC_SIGN_REQUEST:          case SSH2_AGENTC_SIGN_REQUEST:
                 process_sign_request2(e);                  process_sign_request2(e);
Line 721 
Line 684 
                 process_request_identities(e, 2);                  process_request_identities(e, 2);
                 break;                  break;
         case SSH2_AGENTC_ADD_IDENTITY:          case SSH2_AGENTC_ADD_IDENTITY:
           case SSH2_AGENTC_ADD_ID_CONSTRAINED:
                 process_add_identity(e, 2);                  process_add_identity(e, 2);
                 break;                  break;
         case SSH2_AGENTC_REMOVE_IDENTITY:          case SSH2_AGENTC_REMOVE_IDENTITY:
Line 728 
Line 692 
                 break;                  break;
         case SSH2_AGENTC_REMOVE_ALL_IDENTITIES:          case SSH2_AGENTC_REMOVE_ALL_IDENTITIES:
                 process_remove_all_identities(e, 2);                  process_remove_all_identities(e, 2);
                 break;  
         case SSH_AGENTC_CONSTRAIN_IDENTITY:  
                 process_constrain_identity(e, 2);  
                 break;                  break;
 #ifdef SMARTCARD  #ifdef SMARTCARD
         case SSH_AGENTC_ADD_SMARTCARD_KEY:          case SSH_AGENTC_ADD_SMARTCARD_KEY:

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.94