diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ssh-agent.1 | 8 | ||||
-rw-r--r-- | ssh-agent.c | 35 |
3 files changed, 37 insertions, 11 deletions
@@ -19,6 +19,9 @@ | |||
19 | - markus@cvs.openbsd.org 2001/06/26 02:47:07 | 19 | - markus@cvs.openbsd.org 2001/06/26 02:47:07 |
20 | [ssh-keygen.c] | 20 | [ssh-keygen.c] |
21 | allow loading a private RSA key to a cyberflex card. | 21 | allow loading a private RSA key to a cyberflex card. |
22 | - markus@cvs.openbsd.org 2001/06/26 04:07:06 | ||
23 | [ssh-agent.1 ssh-agent.c] | ||
24 | add debug flag | ||
22 | 25 | ||
23 | 20010629 | 26 | 20010629 |
24 | - (bal) Removed net_aton() since we don't use it any more | 27 | - (bal) Removed net_aton() since we don't use it any more |
@@ -5846,4 +5849,4 @@ | |||
5846 | - Wrote replacements for strlcpy and mkdtemp | 5849 | - Wrote replacements for strlcpy and mkdtemp |
5847 | - Released 1.0pre1 | 5850 | - Released 1.0pre1 |
5848 | 5851 | ||
5849 | $Id: ChangeLog,v 1.1349 2001/07/04 03:44:03 mouring Exp $ | 5852 | $Id: ChangeLog,v 1.1350 2001/07/04 03:48:02 mouring Exp $ |
diff --git a/ssh-agent.1 b/ssh-agent.1 index 1d214698d..0aecfc0f0 100644 --- a/ssh-agent.1 +++ b/ssh-agent.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ssh-agent.1,v 1.24 2001/04/10 09:13:21 itojun Exp $ | 1 | .\" $OpenBSD: ssh-agent.1,v 1.25 2001/06/26 04:07:06 markus Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -48,6 +48,8 @@ | |||
48 | .Op Fl c Li | Fl s | 48 | .Op Fl c Li | Fl s |
49 | .Nm ssh-agent | 49 | .Nm ssh-agent |
50 | .Fl k | 50 | .Fl k |
51 | .Nm ssh-agent | ||
52 | .Fl d | ||
51 | .Sh DESCRIPTION | 53 | .Sh DESCRIPTION |
52 | .Nm | 54 | .Nm |
53 | is a program to hold private keys used for public key authentication | 55 | is a program to hold private keys used for public key authentication |
@@ -80,6 +82,10 @@ does not look like it's a csh style of shell. | |||
80 | Kill the current agent (given by the | 82 | Kill the current agent (given by the |
81 | .Ev SSH_AGENT_PID | 83 | .Ev SSH_AGENT_PID |
82 | environment variable). | 84 | environment variable). |
85 | .It Fl d | ||
86 | Debug mode. When this option is specified | ||
87 | .Nm | ||
88 | will fork. | ||
83 | .El | 89 | .El |
84 | .Pp | 90 | .Pp |
85 | If a commandline is given, this is executed as a subprocess of the agent. | 91 | If a commandline is given, this is executed as a subprocess of the agent. |
diff --git a/ssh-agent.c b/ssh-agent.c index 54b375fce..573efaf89 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.56 2001/06/25 08:25:40 markus Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.57 2001/06/26 04:07:06 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "includes.h" | 38 | #include "includes.h" |
39 | RCSID("$OpenBSD: ssh-agent.c,v 1.56 2001/06/25 08:25:40 markus Exp $"); | 39 | RCSID("$OpenBSD: ssh-agent.c,v 1.57 2001/06/26 04:07:06 markus Exp $"); |
40 | 40 | ||
41 | #include <openssl/evp.h> | 41 | #include <openssl/evp.h> |
42 | #include <openssl/md5.h> | 42 | #include <openssl/md5.h> |
@@ -706,7 +706,7 @@ usage(void) | |||
706 | int | 706 | int |
707 | main(int ac, char **av) | 707 | main(int ac, char **av) |
708 | { | 708 | { |
709 | int sock, c_flag = 0, k_flag = 0, s_flag = 0, ch; | 709 | int sock, c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0, ch; |
710 | struct sockaddr_un sunaddr; | 710 | struct sockaddr_un sunaddr; |
711 | #ifdef HAVE_SETRLIMIT | 711 | #ifdef HAVE_SETRLIMIT |
712 | struct rlimit rlim; | 712 | struct rlimit rlim; |
@@ -726,9 +726,9 @@ main(int ac, char **av) | |||
726 | seed_rng(); | 726 | seed_rng(); |
727 | 727 | ||
728 | #ifdef __GNU_LIBRARY__ | 728 | #ifdef __GNU_LIBRARY__ |
729 | while ((ch = getopt(ac, av, "+cks")) != -1) { | 729 | while ((ch = getopt(ac, av, "+cdks")) != -1) { |
730 | #else /* __GNU_LIBRARY__ */ | 730 | #else /* __GNU_LIBRARY__ */ |
731 | while ((ch = getopt(ac, av, "cks")) != -1) { | 731 | while ((ch = getopt(ac, av, "cdks")) != -1) { |
732 | #endif /* __GNU_LIBRARY__ */ | 732 | #endif /* __GNU_LIBRARY__ */ |
733 | switch (ch) { | 733 | switch (ch) { |
734 | case 'c': | 734 | case 'c': |
@@ -744,6 +744,11 @@ main(int ac, char **av) | |||
744 | usage(); | 744 | usage(); |
745 | s_flag++; | 745 | s_flag++; |
746 | break; | 746 | break; |
747 | case 'd': | ||
748 | if (d_flag) | ||
749 | usage(); | ||
750 | d_flag++; | ||
751 | break; | ||
747 | default: | 752 | default: |
748 | usage(); | 753 | usage(); |
749 | } | 754 | } |
@@ -751,10 +756,10 @@ main(int ac, char **av) | |||
751 | ac -= optind; | 756 | ac -= optind; |
752 | av += optind; | 757 | av += optind; |
753 | 758 | ||
754 | if (ac > 0 && (c_flag || k_flag || s_flag)) | 759 | if (ac > 0 && (c_flag || k_flag || s_flag || d_flag)) |
755 | usage(); | 760 | usage(); |
756 | 761 | ||
757 | if (ac == 0 && !c_flag && !k_flag && !s_flag) { | 762 | if (ac == 0 && !c_flag && !k_flag && !s_flag && !d_flag) { |
758 | shell = getenv("SHELL"); | 763 | shell = getenv("SHELL"); |
759 | if (shell != NULL && strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) | 764 | if (shell != NULL && strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) |
760 | c_flag = 1; | 765 | c_flag = 1; |
@@ -827,6 +832,14 @@ main(int ac, char **av) | |||
827 | * Fork, and have the parent execute the command, if any, or present | 832 | * Fork, and have the parent execute the command, if any, or present |
828 | * the socket data. The child continues as the authentication agent. | 833 | * the socket data. The child continues as the authentication agent. |
829 | */ | 834 | */ |
835 | if (d_flag) { | ||
836 | log_init(__progname, SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 1); | ||
837 | format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n"; | ||
838 | printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name, | ||
839 | SSH_AUTHSOCKET_ENV_NAME); | ||
840 | printf("echo Agent pid %d;\n", parent_pid); | ||
841 | goto skip; | ||
842 | } | ||
830 | pid = fork(); | 843 | pid = fork(); |
831 | if (pid == -1) { | 844 | if (pid == -1) { |
832 | perror("fork"); | 845 | perror("fork"); |
@@ -869,6 +882,8 @@ main(int ac, char **av) | |||
869 | perror("setsid"); | 882 | perror("setsid"); |
870 | cleanup_exit(1); | 883 | cleanup_exit(1); |
871 | } | 884 | } |
885 | |||
886 | skip: | ||
872 | if (atexit(cleanup_socket) < 0) { | 887 | if (atexit(cleanup_socket) < 0) { |
873 | perror("atexit"); | 888 | perror("atexit"); |
874 | cleanup_exit(1); | 889 | cleanup_exit(1); |
@@ -879,8 +894,10 @@ main(int ac, char **av) | |||
879 | alarm(10); | 894 | alarm(10); |
880 | } | 895 | } |
881 | idtab_init(); | 896 | idtab_init(); |
882 | signal(SIGINT, SIG_IGN); | 897 | if (!d_flag) { |
883 | signal(SIGPIPE, SIG_IGN); | 898 | signal(SIGINT, SIG_IGN); |
899 | signal(SIGPIPE, SIG_IGN); | ||
900 | } | ||
884 | signal(SIGHUP, cleanup_handler); | 901 | signal(SIGHUP, cleanup_handler); |
885 | signal(SIGTERM, cleanup_handler); | 902 | signal(SIGTERM, cleanup_handler); |
886 | while (1) { | 903 | while (1) { |