mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
- djm@cvs.openbsd.org 2004/06/14 01:44:39
[channels.c clientloop.c misc.c misc.h packet.c ssh-agent.c ssh-keyscan.c] [sshd.c] set_nonblock() instead of fnctl(...,O_NONBLOCK); "looks sane" deraadt@
This commit is contained in:
parent
0e220dbfbc
commit
232711f6db
@ -29,6 +29,10 @@
|
|||||||
[readconf.h scp.1 sftp.1 ssh.1 ssh.c ssh_config.5]
|
[readconf.h scp.1 sftp.1 ssh.1 ssh.c ssh_config.5]
|
||||||
implement session multiplexing in the client (the server has supported
|
implement session multiplexing in the client (the server has supported
|
||||||
this since 2.0); ok markus@
|
this since 2.0); ok markus@
|
||||||
|
- djm@cvs.openbsd.org 2004/06/14 01:44:39
|
||||||
|
[channels.c clientloop.c misc.c misc.h packet.c ssh-agent.c ssh-keyscan.c]
|
||||||
|
[sshd.c]
|
||||||
|
set_nonblock() instead of fnctl(...,O_NONBLOCK); "looks sane" deraadt@
|
||||||
|
|
||||||
20040603
|
20040603
|
||||||
- (dtucker) [auth-pam.c] Don't use pam_* namespace for sshd's PAM functions.
|
- (dtucker) [auth-pam.c] Don't use pam_* namespace for sshd's PAM functions.
|
||||||
@ -1213,4 +1217,4 @@
|
|||||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.3382 2004/06/15 00:34:08 djm Exp $
|
$Id: ChangeLog,v 1.3383 2004/06/15 00:35:30 djm Exp $
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: channels.c,v 1.204 2004/06/13 15:03:02 djm Exp $");
|
RCSID("$OpenBSD: channels.c,v 1.205 2004/06/14 01:44:38 djm Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
@ -2509,8 +2509,8 @@ connect_to(const char *host, u_short port)
|
|||||||
verbose("socket: %.100s", strerror(errno));
|
verbose("socket: %.100s", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0)
|
if (set_nonblock(sock) == -1)
|
||||||
fatal("connect_to: F_SETFL: %s", strerror(errno));
|
fatal("%s: set_nonblock(%d)", __func__, sock);
|
||||||
if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0 &&
|
if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0 &&
|
||||||
errno != EINPROGRESS) {
|
errno != EINPROGRESS) {
|
||||||
error("connect_to %.100s port %s: %.100s", ntop, strport,
|
error("connect_to %.100s port %s: %.100s", ntop, strport,
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: clientloop.c,v 1.123 2004/06/13 15:03:02 djm Exp $");
|
RCSID("$OpenBSD: clientloop.c,v 1.124 2004/06/14 01:44:38 djm Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
@ -167,7 +167,7 @@ static void
|
|||||||
enter_non_blocking(void)
|
enter_non_blocking(void)
|
||||||
{
|
{
|
||||||
in_non_blocking_mode = 1;
|
in_non_blocking_mode = 1;
|
||||||
(void) fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
|
set_nonblock(fileno(stdin));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
34
misc.c
34
misc.c
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: misc.c,v 1.23 2003/10/28 09:08:06 markus Exp $");
|
RCSID("$OpenBSD: misc.c,v 1.24 2004/06/14 01:44:39 djm Exp $");
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@ -46,7 +46,7 @@ chop(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set/unset filedescriptor to non-blocking */
|
/* set/unset filedescriptor to non-blocking */
|
||||||
void
|
int
|
||||||
set_nonblock(int fd)
|
set_nonblock(int fd)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
@ -54,20 +54,23 @@ set_nonblock(int fd)
|
|||||||
val = fcntl(fd, F_GETFL, 0);
|
val = fcntl(fd, F_GETFL, 0);
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
|
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
|
||||||
return;
|
return (-1);
|
||||||
}
|
}
|
||||||
if (val & O_NONBLOCK) {
|
if (val & O_NONBLOCK) {
|
||||||
debug2("fd %d is O_NONBLOCK", fd);
|
debug3("fd %d is O_NONBLOCK", fd);
|
||||||
return;
|
return (0);
|
||||||
}
|
}
|
||||||
debug2("fd %d setting O_NONBLOCK", fd);
|
debug2("fd %d setting O_NONBLOCK", fd);
|
||||||
val |= O_NONBLOCK;
|
val |= O_NONBLOCK;
|
||||||
if (fcntl(fd, F_SETFL, val) == -1)
|
if (fcntl(fd, F_SETFL, val) == -1) {
|
||||||
debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s",
|
debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd,
|
||||||
fd, strerror(errno));
|
strerror(errno));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
unset_nonblock(int fd)
|
unset_nonblock(int fd)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
@ -75,17 +78,20 @@ unset_nonblock(int fd)
|
|||||||
val = fcntl(fd, F_GETFL, 0);
|
val = fcntl(fd, F_GETFL, 0);
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
|
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
|
||||||
return;
|
return (-1);
|
||||||
}
|
}
|
||||||
if (!(val & O_NONBLOCK)) {
|
if (!(val & O_NONBLOCK)) {
|
||||||
debug2("fd %d is not O_NONBLOCK", fd);
|
debug3("fd %d is not O_NONBLOCK", fd);
|
||||||
return;
|
return (0);
|
||||||
}
|
}
|
||||||
debug("fd %d clearing O_NONBLOCK", fd);
|
debug("fd %d clearing O_NONBLOCK", fd);
|
||||||
val &= ~O_NONBLOCK;
|
val &= ~O_NONBLOCK;
|
||||||
if (fcntl(fd, F_SETFL, val) == -1)
|
if (fcntl(fd, F_SETFL, val) == -1) {
|
||||||
debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s",
|
debug("fcntl(%d, F_SETFL, ~O_NONBLOCK): %s",
|
||||||
fd, strerror(errno));
|
fd, strerror(errno));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* disable nagle on socket */
|
/* disable nagle on socket */
|
||||||
|
6
misc.h
6
misc.h
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: misc.h,v 1.14 2004/05/08 00:21:31 djm Exp $ */
|
/* $OpenBSD: misc.h,v 1.15 2004/06/14 01:44:39 djm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
char *chop(char *);
|
char *chop(char *);
|
||||||
char *strdelim(char **);
|
char *strdelim(char **);
|
||||||
void set_nonblock(int);
|
int set_nonblock(int);
|
||||||
void unset_nonblock(int);
|
int unset_nonblock(int);
|
||||||
void set_nodelay(int);
|
void set_nodelay(int);
|
||||||
int a2port(const char *);
|
int a2port(const char *);
|
||||||
char *cleanhostname(char *);
|
char *cleanhostname(char *);
|
||||||
|
11
packet.c
11
packet.c
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: packet.c,v 1.113 2004/05/11 19:01:43 deraadt Exp $");
|
RCSID("$OpenBSD: packet.c,v 1.114 2004/06/14 01:44:39 djm Exp $");
|
||||||
|
|
||||||
#include "openbsd-compat/sys-queue.h"
|
#include "openbsd-compat/sys-queue.h"
|
||||||
|
|
||||||
@ -319,13 +319,10 @@ void
|
|||||||
packet_set_nonblocking(void)
|
packet_set_nonblocking(void)
|
||||||
{
|
{
|
||||||
/* Set the socket into non-blocking mode. */
|
/* Set the socket into non-blocking mode. */
|
||||||
if (fcntl(connection_in, F_SETFL, O_NONBLOCK) < 0)
|
set_nonblock(connection_in);
|
||||||
error("fcntl O_NONBLOCK: %.100s", strerror(errno));
|
|
||||||
|
|
||||||
if (connection_out != connection_in) {
|
if (connection_out != connection_in)
|
||||||
if (fcntl(connection_out, F_SETFL, O_NONBLOCK) < 0)
|
set_nonblock(connection_out);
|
||||||
error("fcntl O_NONBLOCK: %.100s", strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the socket used for reading. */
|
/* Returns the socket used for reading. */
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "openbsd-compat/sys-queue.h"
|
#include "openbsd-compat/sys-queue.h"
|
||||||
RCSID("$OpenBSD: ssh-agent.c,v 1.118 2004/05/08 00:21:31 djm Exp $");
|
RCSID("$OpenBSD: ssh-agent.c,v 1.119 2004/06/14 01:44:39 djm Exp $");
|
||||||
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
@ -789,8 +789,7 @@ new_socket(sock_type type, int fd)
|
|||||||
{
|
{
|
||||||
u_int i, old_alloc, new_alloc;
|
u_int i, old_alloc, new_alloc;
|
||||||
|
|
||||||
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
|
set_nonblock(fd);
|
||||||
error("fcntl O_NONBLOCK: %s", strerror(errno));
|
|
||||||
|
|
||||||
if (fd > max_fd)
|
if (fd > max_fd)
|
||||||
max_fd = fd;
|
max_fd = fd;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-keyscan.c,v 1.48 2004/06/13 12:53:24 djm Exp $");
|
RCSID("$OpenBSD: ssh-keyscan.c,v 1.49 2004/06/14 01:44:39 djm Exp $");
|
||||||
|
|
||||||
#include "openbsd-compat/sys-queue.h"
|
#include "openbsd-compat/sys-queue.h"
|
||||||
|
|
||||||
@ -397,8 +397,8 @@ tcpconnect(char *host)
|
|||||||
error("socket: %s", strerror(errno));
|
error("socket: %s", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fcntl(s, F_SETFL, O_NONBLOCK) < 0)
|
if (set_nonblock(s) == -1)
|
||||||
fatal("F_SETFL: %s", strerror(errno));
|
fatal("%s: set_nonblock(%d)", __func__, s);
|
||||||
if (connect(s, ai->ai_addr, ai->ai_addrlen) < 0 &&
|
if (connect(s, ai->ai_addr, ai->ai_addrlen) < 0 &&
|
||||||
errno != EINPROGRESS)
|
errno != EINPROGRESS)
|
||||||
error("connect (`%s'): %s", host, strerror(errno));
|
error("connect (`%s'): %s", host, strerror(errno));
|
||||||
|
8
sshd.c
8
sshd.c
@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sshd.c,v 1.292 2004/06/13 12:53:24 djm Exp $");
|
RCSID("$OpenBSD: sshd.c,v 1.293 2004/06/14 01:44:39 djm Exp $");
|
||||||
|
|
||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
@ -1140,8 +1140,7 @@ main(int ac, char **av)
|
|||||||
verbose("socket: %.100s", strerror(errno));
|
verbose("socket: %.100s", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fcntl(listen_sock, F_SETFL, O_NONBLOCK) < 0) {
|
if (set_nonblock(listen_sock) == -1) {
|
||||||
error("listen_sock O_NONBLOCK: %s", strerror(errno));
|
|
||||||
close(listen_sock);
|
close(listen_sock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1284,8 +1283,7 @@ main(int ac, char **av)
|
|||||||
error("accept: %.100s", strerror(errno));
|
error("accept: %.100s", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fcntl(newsock, F_SETFL, 0) < 0) {
|
if (unset_nonblock(newsock) == -1) {
|
||||||
error("newsock del O_NONBLOCK: %s", strerror(errno));
|
|
||||||
close(newsock);
|
close(newsock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user