version 1.22, 1999/11/24 00:26:03 |
version 1.23, 1999/11/24 19:53:51 |
|
|
/* Check if we have the key. */ |
/* Check if we have the key. */ |
for (i = 0; i < num_identities; i++) |
for (i = 0; i < num_identities; i++) |
if (BN_cmp(identities[i].key->n, n) == 0) { |
if (BN_cmp(identities[i].key->n, n) == 0) { |
/* We have this key. Free the old key. Since we |
/* |
don\'t want to leave empty slots in the middle |
* We have this key. Free the old key. Since we |
of the array, we actually free the key there |
* don\'t want to leave empty slots in the middle of |
and copy data from the last entry. */ |
* the array, we actually free the key there and copy |
|
* data from the last entry. |
|
*/ |
RSA_free(identities[i].key); |
RSA_free(identities[i].key); |
xfree(identities[i].comment); |
xfree(identities[i].comment); |
if (i < num_identities - 1) |
if (i < num_identities - 1) |
|
|
/* Check if we already have the key. */ |
/* Check if we already have the key. */ |
for (i = 0; i < num_identities; i++) |
for (i = 0; i < num_identities; i++) |
if (BN_cmp(identities[i].key->n, k->n) == 0) { |
if (BN_cmp(identities[i].key->n, k->n) == 0) { |
/* We already have this key. Clear and free the |
/* |
new data and return success. */ |
* We already have this key. Clear and free the new |
|
* data and return success. |
|
*/ |
RSA_free(k); |
RSA_free(k); |
xfree(identities[num_identities].comment); |
xfree(identities[num_identities].comment); |
|
|
|
|
snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir, |
snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir, |
parent_pid); |
parent_pid); |
|
|
/* Create socket early so it will exist before command gets run |
/* |
from the parent. */ |
* Create socket early so it will exist before command gets run from |
|
* the parent. |
|
*/ |
sock = socket(AF_UNIX, SOCK_STREAM, 0); |
sock = socket(AF_UNIX, SOCK_STREAM, 0); |
if (sock < 0) { |
if (sock < 0) { |
perror("socket"); |
perror("socket"); |
|
|
perror("listen"); |
perror("listen"); |
cleanup_exit(1); |
cleanup_exit(1); |
} |
} |
/* Fork, and have the parent execute the command, if any, or |
/* |
present the socket data. The child continues as the |
* Fork, and have the parent execute the command, if any, or present |
authentication agent. */ |
* the socket data. The child continues as the authentication agent. |
|
*/ |
pid = fork(); |
pid = fork(); |
if (pid == -1) { |
if (pid == -1) { |
perror("fork"); |
perror("fork"); |