[ssh-agent.1 ssh-agent.c]
     add debug flag
This commit is contained in:
Ben Lindstrom 2001-07-04 03:48:02 +00:00
parent cd392284ac
commit d94580c708
3 changed files with 37 additions and 11 deletions

View File

@ -19,6 +19,9 @@
- markus@cvs.openbsd.org 2001/06/26 02:47:07 - markus@cvs.openbsd.org 2001/06/26 02:47:07
[ssh-keygen.c] [ssh-keygen.c]
allow loading a private RSA key to a cyberflex card. allow loading a private RSA key to a cyberflex card.
- markus@cvs.openbsd.org 2001/06/26 04:07:06
[ssh-agent.1 ssh-agent.c]
add debug flag
20010629 20010629
- (bal) Removed net_aton() since we don't use it any more - (bal) Removed net_aton() since we don't use it any more
@ -5846,4 +5849,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - Released 1.0pre1
$Id: ChangeLog,v 1.1349 2001/07/04 03:44:03 mouring Exp $ $Id: ChangeLog,v 1.1350 2001/07/04 03:48:02 mouring Exp $

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ssh-agent.1,v 1.24 2001/04/10 09:13:21 itojun Exp $ .\" $OpenBSD: ssh-agent.1,v 1.25 2001/06/26 04:07:06 markus Exp $
.\" .\"
.\" Author: Tatu Ylonen <ylo@cs.hut.fi> .\" Author: Tatu Ylonen <ylo@cs.hut.fi>
.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -48,6 +48,8 @@
.Op Fl c Li | Fl s .Op Fl c Li | Fl s
.Nm ssh-agent .Nm ssh-agent
.Fl k .Fl k
.Nm ssh-agent
.Fl d
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
is a program to hold private keys used for public key authentication 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.
Kill the current agent (given by the Kill the current agent (given by the
.Ev SSH_AGENT_PID .Ev SSH_AGENT_PID
environment variable). environment variable).
.It Fl d
Debug mode. When this option is specified
.Nm
will fork.
.El .El
.Pp .Pp
If a commandline is given, this is executed as a subprocess of the agent. If a commandline is given, this is executed as a subprocess of the agent.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-agent.c,v 1.56 2001/06/25 08:25:40 markus Exp $ */ /* $OpenBSD: ssh-agent.c,v 1.57 2001/06/26 04:07:06 markus Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -36,7 +36,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: ssh-agent.c,v 1.56 2001/06/25 08:25:40 markus Exp $"); RCSID("$OpenBSD: ssh-agent.c,v 1.57 2001/06/26 04:07:06 markus Exp $");
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/md5.h> #include <openssl/md5.h>
@ -706,7 +706,7 @@ usage(void)
int int
main(int ac, char **av) main(int ac, char **av)
{ {
int sock, c_flag = 0, k_flag = 0, s_flag = 0, ch; int sock, c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0, ch;
struct sockaddr_un sunaddr; struct sockaddr_un sunaddr;
#ifdef HAVE_SETRLIMIT #ifdef HAVE_SETRLIMIT
struct rlimit rlim; struct rlimit rlim;
@ -726,9 +726,9 @@ main(int ac, char **av)
seed_rng(); seed_rng();
#ifdef __GNU_LIBRARY__ #ifdef __GNU_LIBRARY__
while ((ch = getopt(ac, av, "+cks")) != -1) { while ((ch = getopt(ac, av, "+cdks")) != -1) {
#else /* __GNU_LIBRARY__ */ #else /* __GNU_LIBRARY__ */
while ((ch = getopt(ac, av, "cks")) != -1) { while ((ch = getopt(ac, av, "cdks")) != -1) {
#endif /* __GNU_LIBRARY__ */ #endif /* __GNU_LIBRARY__ */
switch (ch) { switch (ch) {
case 'c': case 'c':
@ -744,6 +744,11 @@ main(int ac, char **av)
usage(); usage();
s_flag++; s_flag++;
break; break;
case 'd':
if (d_flag)
usage();
d_flag++;
break;
default: default:
usage(); usage();
} }
@ -751,10 +756,10 @@ main(int ac, char **av)
ac -= optind; ac -= optind;
av += optind; av += optind;
if (ac > 0 && (c_flag || k_flag || s_flag)) if (ac > 0 && (c_flag || k_flag || s_flag || d_flag))
usage(); usage();
if (ac == 0 && !c_flag && !k_flag && !s_flag) { if (ac == 0 && !c_flag && !k_flag && !s_flag && !d_flag) {
shell = getenv("SHELL"); shell = getenv("SHELL");
if (shell != NULL && strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) if (shell != NULL && strncmp(shell + strlen(shell) - 3, "csh", 3) == 0)
c_flag = 1; c_flag = 1;
@ -827,6 +832,14 @@ main(int ac, char **av)
* Fork, and have the parent execute the command, if any, or present * Fork, and have the parent execute the command, if any, or present
* the socket data. The child continues as the authentication agent. * the socket data. The child continues as the authentication agent.
*/ */
if (d_flag) {
log_init(__progname, SYSLOG_LEVEL_DEBUG1, SYSLOG_FACILITY_AUTH, 1);
format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
SSH_AUTHSOCKET_ENV_NAME);
printf("echo Agent pid %d;\n", parent_pid);
goto skip;
}
pid = fork(); pid = fork();
if (pid == -1) { if (pid == -1) {
perror("fork"); perror("fork");
@ -869,6 +882,8 @@ main(int ac, char **av)
perror("setsid"); perror("setsid");
cleanup_exit(1); cleanup_exit(1);
} }
skip:
if (atexit(cleanup_socket) < 0) { if (atexit(cleanup_socket) < 0) {
perror("atexit"); perror("atexit");
cleanup_exit(1); cleanup_exit(1);
@ -879,8 +894,10 @@ main(int ac, char **av)
alarm(10); alarm(10);
} }
idtab_init(); idtab_init();
signal(SIGINT, SIG_IGN); if (!d_flag) {
signal(SIGPIPE, SIG_IGN); signal(SIGINT, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
}
signal(SIGHUP, cleanup_handler); signal(SIGHUP, cleanup_handler);
signal(SIGTERM, cleanup_handler); signal(SIGTERM, cleanup_handler);
while (1) { while (1) {