summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/channels.c
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2000-06-03 07:06:14 +0000
committerkris <kris@FreeBSD.org>2000-06-03 07:06:14 +0000
commit10badcd8c786a973fe56a5b4fe4ea468245231e8 (patch)
tree0dae7ebcdaa0cc2475d9c1dbaf5bb589411d7caa /crypto/openssh/channels.c
parente1e1f536513ded16af2c57b02bb321a8459808e3 (diff)
downloadFreeBSD-src-10badcd8c786a973fe56a5b4fe4ea468245231e8.zip
FreeBSD-src-10badcd8c786a973fe56a5b4fe4ea468245231e8.tar.gz
Import vendor patch originally submitted by the below author: don't
treat failure to create the authentication agent directory in /tmp as a fatal error, but disable agent forwarding. Submitted by: Jan Koum <jkb@yahoo-inc.com>
Diffstat (limited to 'crypto/openssh/channels.c')
-rw-r--r--crypto/openssh/channels.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/crypto/openssh/channels.c b/crypto/openssh/channels.c
index 5bf1e5b..871dcb8 100644
--- a/crypto/openssh/channels.c
+++ b/crypto/openssh/channels.c
@@ -17,7 +17,7 @@
*/
#include "includes.h"
-RCSID("$Id: channels.c,v 1.57 2000/05/08 17:42:24 markus Exp $");
+RCSID("$Id: channels.c,v 1.59 2000/05/30 17:23:36 markus Exp $");
#include "ssh.h"
#include "packet.h"
@@ -147,23 +147,6 @@ channel_lookup(int id)
return c;
}
-void
-set_nonblock(int fd)
-{
- int val;
- val = fcntl(fd, F_GETFL, 0);
- if (val < 0) {
- error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
- return;
- }
- if (val & O_NONBLOCK)
- return;
- debug("fd %d setting O_NONBLOCK", fd);
- val |= O_NONBLOCK;
- if (fcntl(fd, F_SETFL, val) == -1)
- error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
-}
-
/*
* Register filedescriptors for a channel, used when allocating a channel or
* when the channel consumer/producer is ready, e.g. shell exec'd
@@ -2074,11 +2057,11 @@ cleanup_socket(void)
}
/*
- * This if called to process SSH_CMSG_AGENT_REQUEST_FORWARDING on the server.
+ * This is called to process SSH_CMSG_AGENT_REQUEST_FORWARDING on the server.
* This starts forwarding authentication requests.
*/
-void
+int
auth_input_request_forwarding(struct passwd * pw)
{
int sock, newch;
@@ -2096,8 +2079,16 @@ auth_input_request_forwarding(struct passwd * pw)
strlcpy(channel_forwarded_auth_socket_dir, "/tmp/ssh-XXXXXXXX", MAX_SOCKET_NAME);
/* Create private directory for socket */
- if (mkdtemp(channel_forwarded_auth_socket_dir) == NULL)
- packet_disconnect("mkdtemp: %.100s", strerror(errno));
+ if (mkdtemp(channel_forwarded_auth_socket_dir) == NULL) {
+ packet_send_debug("Agent forwarding disabled: mkdtemp() failed: %.100s",
+ strerror(errno));
+ restore_uid();
+ xfree(channel_forwarded_auth_socket_name);
+ xfree(channel_forwarded_auth_socket_dir);
+ channel_forwarded_auth_socket_name = NULL;
+ channel_forwarded_auth_socket_dir = NULL;
+ return 0;
+ }
snprintf(channel_forwarded_auth_socket_name, MAX_SOCKET_NAME, "%s/agent.%d",
channel_forwarded_auth_socket_dir, (int) getpid());
@@ -2132,6 +2123,7 @@ auth_input_request_forwarding(struct passwd * pw)
xstrdup("auth socket"));
strlcpy(channels[newch].path, channel_forwarded_auth_socket_name,
sizeof(channels[newch].path));
+ return 1;
}
/* This is called to process an SSH_SMSG_AGENT_OPEN message. */
OpenPOWER on IntegriCloud