summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-05-07 12:03:14 +1000
committerDamien Miller <djm@mindrot.org>2000-05-07 12:03:14 +1000
commite247cc402bc391650f014316363dbce78ad85dc7 (patch)
tree65d72c3d3514c6119f47017f14b71ed153485a5d /channels.c
parent0437b33e54fd72060d17908d6abf96bfabaacad2 (diff)
- Remove references to SSLeay.
- Big OpenBSD CVS update - markus@cvs.openbsd.org [clientloop.c] - typo [session.c] - update proctitle on pty alloc/dealloc, e.g. w/ windows client [session.c] - update proctitle for proto 1, too [channels.h nchan.c serverloop.c session.c sshd.c] - use c-style comments - deraadt@cvs.openbsd.org [scp.c] - more atomicio - markus@cvs.openbsd.org [channels.c] - set O_NONBLOCK [ssh.1] - update AUTHOR [readconf.c ssh-keygen.c ssh.h] - default DSA key file ~/.ssh/id_dsa [clientloop.c] - typo, rm verbose debug - deraadt@cvs.openbsd.org [ssh-keygen.1] - document DSA use of ssh-keygen [sshd.8] - a start at describing what i understand of the DSA side [ssh-keygen.1] - document -X and -x [ssh-keygen.c] - simplify usage - markus@cvs.openbsd.org [sshd.8] - there is no rhosts_dsa [ssh-keygen.1] - document -y, update -X,-x [nchan.c] - fix close for non-open ssh1 channels [servconf.c servconf.h ssh.h sshd.8 sshd.c ] - s/DsaKey/HostDSAKey/, document option [sshconnect2.c] - respect number_of_password_prompts [channels.c channels.h servconf.c servconf.h session.c sshd.8] - GatewayPorts for sshd, ok deraadt@ [ssh-add.1 ssh-agent.1 ssh.1] - more doc on: DSA, id_dsa, known_hosts2, authorized_keys2 [ssh.1] - more info on proto 2 [sshd.8] - sync AUTHOR w/ ssh.1 [key.c key.h sshconnect.c] - print key type when talking about host keys [packet.c] - clear padding in ssh2 [dsa.c key.c radix.c ssh.h sshconnect1.c uuencode.c uuencode.h] - replace broken uuencode w/ libc b64_ntop [auth2.c] - log failure before sending the reply [key.c radix.c uuencode.c] - remote trailing comments before calling __b64_pton [auth2.c readconf.c readconf.h servconf.c servconf.h ssh.1] [sshconnect2.c sshd.8] - add DSAAuthetication option to ssh/sshd, document SSH2 in sshd.8 - Bring in b64_ntop and b64_pton from OpenBSD libc (bsd-base64.[ch])
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/channels.c b/channels.c
index bd8c337ee..f833e1bb9 100644
--- a/channels.c
+++ b/channels.c
@@ -17,7 +17,7 @@
17 */ 17 */
18 18
19#include "includes.h" 19#include "includes.h"
20RCSID("$Id: channels.c,v 1.28 2000/05/01 23:23:45 damien Exp $"); 20RCSID("$Id: channels.c,v 1.29 2000/05/07 02:03:15 damien Exp $");
21 21
22#include "ssh.h" 22#include "ssh.h"
23#include "packet.h" 23#include "packet.h"
@@ -147,8 +147,25 @@ channel_lookup(int id)
147 return c; 147 return c;
148} 148}
149 149
150void
151set_nonblock(int fd)
152{
153 int val;
154 val = fcntl(fd, F_GETFL, 0);
155 if (val < 0) {
156 error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
157 return;
158 }
159 if (val & O_NONBLOCK)
160 return;
161 debug("fd %d setting O_NONBLOCK", fd);
162 val |= O_NONBLOCK;
163 if (fcntl(fd, F_SETFL, val) == -1)
164 error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
165}
166
150/* 167/*
151 * register filedescriptors for a channel, used when allocating a channel or 168 * Register filedescriptors for a channel, used when allocating a channel or
152 * when the channel consumer/producer is ready, e.g. shell exec'd 169 * when the channel consumer/producer is ready, e.g. shell exec'd
153 */ 170 */
154 171
@@ -163,11 +180,18 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd, int extusage)
163 if (efd > channel_max_fd_value) 180 if (efd > channel_max_fd_value)
164 channel_max_fd_value = efd; 181 channel_max_fd_value = efd;
165 /* XXX set close-on-exec -markus */ 182 /* XXX set close-on-exec -markus */
183
166 c->rfd = rfd; 184 c->rfd = rfd;
167 c->wfd = wfd; 185 c->wfd = wfd;
168 c->sock = (rfd == wfd) ? rfd : -1; 186 c->sock = (rfd == wfd) ? rfd : -1;
169 c->efd = efd; 187 c->efd = efd;
170 c->extended_usage = extusage; 188 c->extended_usage = extusage;
189 if (rfd != -1)
190 set_nonblock(rfd);
191 if (wfd != -1)
192 set_nonblock(wfd);
193 if (efd != -1)
194 set_nonblock(efd);
171} 195}
172 196
173/* 197/*
@@ -1532,7 +1556,7 @@ channel_request_remote_forwarding(u_short listen_port, const char *host_to_conne
1532 */ 1556 */
1533 1557
1534void 1558void
1535channel_input_port_forward_request(int is_root) 1559channel_input_port_forward_request(int is_root, int gateway_ports)
1536{ 1560{
1537 u_short port, host_port; 1561 u_short port, host_port;
1538 char *hostname; 1562 char *hostname;
@@ -1551,9 +1575,8 @@ channel_input_port_forward_request(int is_root)
1551 port); 1575 port);
1552 /* 1576 /*
1553 * Initiate forwarding, 1577 * Initiate forwarding,
1554 * bind port to localhost only (gateway ports == 0).
1555 */ 1578 */
1556 channel_request_local_forwarding(port, hostname, host_port, 0); 1579 channel_request_local_forwarding(port, hostname, host_port, gateway_ports);
1557 1580
1558 /* Free the argument string. */ 1581 /* Free the argument string. */
1559 xfree(hostname); 1582 xfree(hostname);