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

Diff for /src/usr.bin/ssh/authfd.c between version 1.116 and 1.117

version 1.116, 2019/09/03 08:28:30 version 1.117, 2019/09/03 08:29:15
Line 316 
Line 316 
 }  }
   
 /*  /*
    * Check if the ssh agent has a given key.
    * Returns 0 if found, or a negative SSH_ERR_* error code on failure.
    */
   int
   ssh_agent_has_key(int sock, struct sshkey *key)
   {
           int r, ret = SSH_ERR_KEY_NOT_FOUND;
           size_t i;
           struct ssh_identitylist *idlist = NULL;
   
           if ((r = ssh_fetch_identitylist(sock, &idlist)) < 0) {
                   return r;
           }
   
           for (i = 0; i < idlist->nkeys; i++) {
                   if (sshkey_equal_public(idlist->keys[i], key)) {
                           ret = 0;
                           break;
                   }
           }
   
           ssh_free_identitylist(idlist);
           return ret;
   }
   
   /*
  * Sends a challenge (typically from a server via ssh(1)) to the agent,   * Sends a challenge (typically from a server via ssh(1)) to the agent,
  * and waits for a response from the agent.   * and waits for a response from the agent.
  * Returns true (non-zero) if the agent gave the correct answer, zero   * Returns true (non-zero) if the agent gave the correct answer, zero

Legend:
Removed from v.1.116  
changed lines
  Added in v.1.117