summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index 70c2a7f65..90c64ea8a 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.22 1999/11/24 00:26:03 deraadt Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.23 1999/11/24 19:53:51 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include "includes.h" 11#include "includes.h"
12RCSID("$OpenBSD: ssh-agent.c,v 1.22 1999/11/24 00:26:03 deraadt Exp $"); 12RCSID("$OpenBSD: ssh-agent.c,v 1.23 1999/11/24 19:53:51 markus Exp $");
13 13
14#include "ssh.h" 14#include "ssh.h"
15#include "rsa.h" 15#include "rsa.h"
@@ -189,10 +189,12 @@ process_remove_identity(SocketEntry *e)
189 /* Check if we have the key. */ 189 /* Check if we have the key. */
190 for (i = 0; i < num_identities; i++) 190 for (i = 0; i < num_identities; i++)
191 if (BN_cmp(identities[i].key->n, n) == 0) { 191 if (BN_cmp(identities[i].key->n, n) == 0) {
192 /* We have this key. Free the old key. Since we 192 /*
193 don\'t want to leave empty slots in the middle 193 * We have this key. Free the old key. Since we
194 of the array, we actually free the key there 194 * don\'t want to leave empty slots in the middle of
195 and copy data from the last entry. */ 195 * the array, we actually free the key there and copy
196 * data from the last entry.
197 */
196 RSA_free(identities[i].key); 198 RSA_free(identities[i].key);
197 xfree(identities[i].comment); 199 xfree(identities[i].comment);
198 if (i < num_identities - 1) 200 if (i < num_identities - 1)
@@ -291,8 +293,10 @@ process_add_identity(SocketEntry *e)
291 /* Check if we already have the key. */ 293 /* Check if we already have the key. */
292 for (i = 0; i < num_identities; i++) 294 for (i = 0; i < num_identities; i++)
293 if (BN_cmp(identities[i].key->n, k->n) == 0) { 295 if (BN_cmp(identities[i].key->n, k->n) == 0) {
294 /* We already have this key. Clear and free the 296 /*
295 new data and return success. */ 297 * We already have this key. Clear and free the new
298 * data and return success.
299 */
296 RSA_free(k); 300 RSA_free(k);
297 xfree(identities[num_identities].comment); 301 xfree(identities[num_identities].comment);
298 302
@@ -511,11 +515,7 @@ main(int ac, char **av)
511 __progname); 515 __progname);
512 exit(1); 516 exit(1);
513 } 517 }
514#if defined(__GNU_LIBRARY__)
515 while ((ch = getopt(ac, av, "+cks")) != -1) {
516#else
517 while ((ch = getopt(ac, av, "cks")) != -1) { 518 while ((ch = getopt(ac, av, "cks")) != -1) {
518#endif /* defined(__GNU_LIBRARY__) */
519 switch (ch) { 519 switch (ch) {
520 case 'c': 520 case 'c':
521 if (s_flag) 521 if (s_flag)
@@ -579,8 +579,10 @@ main(int ac, char **av)
579 snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir, 579 snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir,
580 parent_pid); 580 parent_pid);
581 581
582 /* Create socket early so it will exist before command gets run 582 /*
583 from the parent. */ 583 * Create socket early so it will exist before command gets run from
584 * the parent.
585 */
584 sock = socket(AF_UNIX, SOCK_STREAM, 0); 586 sock = socket(AF_UNIX, SOCK_STREAM, 0);
585 if (sock < 0) { 587 if (sock < 0) {
586 perror("socket"); 588 perror("socket");
@@ -597,9 +599,10 @@ main(int ac, char **av)
597 perror("listen"); 599 perror("listen");
598 cleanup_exit(1); 600 cleanup_exit(1);
599 } 601 }
600 /* Fork, and have the parent execute the command, if any, or 602 /*
601 present the socket data. The child continues as the 603 * Fork, and have the parent execute the command, if any, or present
602 authentication agent. */ 604 * the socket data. The child continues as the authentication agent.
605 */
603 pid = fork(); 606 pid = fork();
604 if (pid == -1) { 607 if (pid == -1) {
605 perror("fork"); 608 perror("fork");