mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-30 01:05:14 +02:00
- Sync with OpenBSD CVS:
[clientloop.c login.c serverloop.c ssh-agent.c ssh.h sshconnect.c sshd.c] - pid_t [session.c] - remove bogus chan_read_failed. this could cause data corruption (missing data) at end of a SSH2 session.
This commit is contained in:
parent
3ef692aa05
commit
166fca8894
@ -1,6 +1,12 @@
|
|||||||
20000420
|
20000420
|
||||||
- Make fixpaths work with perl4, patch from Andre Lucas
|
- Make fixpaths work with perl4, patch from Andre Lucas
|
||||||
<andre.lucas@dial.pipex.com>
|
<andre.lucas@dial.pipex.com>
|
||||||
|
- Sync with OpenBSD CVS:
|
||||||
|
[clientloop.c login.c serverloop.c ssh-agent.c ssh.h sshconnect.c sshd.c]
|
||||||
|
- pid_t
|
||||||
|
[session.c]
|
||||||
|
- remove bogus chan_read_failed. this could cause data
|
||||||
|
corruption (missing data) at end of a SSH2 session.
|
||||||
|
|
||||||
20000419
|
20000419
|
||||||
- OpenBSD CVS updates
|
- OpenBSD CVS updates
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$Id: clientloop.c,v 1.11 2000/04/16 01:18:41 damien Exp $");
|
RCSID("$Id: clientloop.c,v 1.12 2000/04/19 21:42:21 damien Exp $");
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
@ -471,7 +471,8 @@ client_process_net_input(fd_set * readset)
|
|||||||
void
|
void
|
||||||
client_process_input(fd_set * readset)
|
client_process_input(fd_set * readset)
|
||||||
{
|
{
|
||||||
int len, pid;
|
int len;
|
||||||
|
pid_t pid;
|
||||||
char buf[8192], *s;
|
char buf[8192], *s;
|
||||||
|
|
||||||
/* Read input from stdin. */
|
/* Read input from stdin. */
|
||||||
|
6
login.c
6
login.c
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$Id: login.c,v 1.23 2000/04/16 01:18:43 damien Exp $");
|
RCSID("$Id: login.c,v 1.24 2000/04/19 21:42:22 damien Exp $");
|
||||||
|
|
||||||
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
|
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
|
||||||
# include <utmpx.h>
|
# include <utmpx.h>
|
||||||
@ -136,7 +136,7 @@ get_last_login_time(uid_t uid, const char *logname,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
record_login(int pid, const char *ttyname, const char *user, uid_t uid,
|
record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
|
||||||
const char *host, struct sockaddr * addr)
|
const char *host, struct sockaddr * addr)
|
||||||
{
|
{
|
||||||
#if defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG)
|
#if defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG)
|
||||||
@ -274,7 +274,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
|
|||||||
/* Records that the user has logged out. */
|
/* Records that the user has logged out. */
|
||||||
|
|
||||||
void
|
void
|
||||||
record_logout(int pid, const char *ttyname)
|
record_logout(pid_t pid, const char *ttyname)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBUTIL_LOGIN
|
#ifdef HAVE_LIBUTIL_LOGIN
|
||||||
const char *line = ttyname + 5; /* /dev/ttyq8 -> ttyq8 */
|
const char *line = ttyname + 5; /* /dev/ttyq8 -> ttyq8 */
|
||||||
|
10
serverloop.c
10
serverloop.c
@ -52,7 +52,7 @@ static int max_fd; /* Max file descriptor number for select(). */
|
|||||||
* that the child's output gets a chance to drain before it is yanked.
|
* that the child's output gets a chance to drain before it is yanked.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int child_pid; /* Pid of the child. */
|
static pid_t child_pid; /* Pid of the child. */
|
||||||
static volatile int child_terminated; /* The child has terminated. */
|
static volatile int child_terminated; /* The child has terminated. */
|
||||||
static volatile int child_has_selected; /* Child has had chance to drain. */
|
static volatile int child_has_selected; /* Child has had chance to drain. */
|
||||||
static volatile int child_wait_status; /* Status from wait(). */
|
static volatile int child_wait_status; /* Status from wait(). */
|
||||||
@ -63,7 +63,8 @@ void
|
|||||||
sigchld_handler(int sig)
|
sigchld_handler(int sig)
|
||||||
{
|
{
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
int wait_pid;
|
pid_t wait_pid;
|
||||||
|
|
||||||
debug("Received SIGCHLD.");
|
debug("Received SIGCHLD.");
|
||||||
wait_pid = wait((int *) &child_wait_status);
|
wait_pid = wait((int *) &child_wait_status);
|
||||||
if (wait_pid != -1) {
|
if (wait_pid != -1) {
|
||||||
@ -373,9 +374,10 @@ process_buffered_input_packets()
|
|||||||
* child program).
|
* child program).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
server_loop(int pid, int fdin_arg, int fdout_arg, int fderr_arg)
|
server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
|
||||||
{
|
{
|
||||||
int wait_status, wait_pid; /* Status and pid returned by wait(). */
|
int wait_status; /* Status returned by wait(). */
|
||||||
|
pid_t wait_pid; /* pid returned by wait(). */
|
||||||
int waiting_termination = 0; /* Have displayed waiting close message. */
|
int waiting_termination = 0; /* Have displayed waiting close message. */
|
||||||
unsigned int max_time_milliseconds;
|
unsigned int max_time_milliseconds;
|
||||||
unsigned int previous_stdout_buffer_bytes;
|
unsigned int previous_stdout_buffer_bytes;
|
||||||
|
10
session.c
10
session.c
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: session.c,v 1.4 2000/04/14 10:30:33 markus Exp $");
|
RCSID("$OpenBSD: session.c,v 1.5 2000/04/19 09:24:39 markus Exp $");
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
@ -1388,8 +1388,12 @@ session_exit_message(Session *s, int status)
|
|||||||
/* disconnect channel */
|
/* disconnect channel */
|
||||||
debug("session_exit_message: release channel %d", s->chanid);
|
debug("session_exit_message: release channel %d", s->chanid);
|
||||||
channel_cancel_cleanup(s->chanid);
|
channel_cancel_cleanup(s->chanid);
|
||||||
if (c->istate == CHAN_INPUT_OPEN)
|
/*
|
||||||
chan_read_failed(c);
|
* emulate a write failure with 'chan_write_failed', nobody will be
|
||||||
|
* interested in data we write.
|
||||||
|
* Note that we must not call 'chan_read_failed', since there could
|
||||||
|
* be some more data waiting in the pipe.
|
||||||
|
*/
|
||||||
chan_write_failed(c);
|
chan_write_failed(c);
|
||||||
s->chanid = -1;
|
s->chanid = -1;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh-agent.c,v 1.28 2000/04/14 10:30:33 markus Exp $ */
|
/* $OpenBSD: ssh-agent.c,v 1.29 2000/04/19 07:05:49 deraadt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-agent.c,v 1.28 2000/04/14 10:30:33 markus Exp $");
|
RCSID("$OpenBSD: ssh-agent.c,v 1.29 2000/04/19 07:05:49 deraadt Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "rsa.h"
|
#include "rsa.h"
|
||||||
@ -46,7 +46,7 @@ Identity *identities = NULL;
|
|||||||
int max_fd = 0;
|
int max_fd = 0;
|
||||||
|
|
||||||
/* pid of shell == parent of agent */
|
/* pid of shell == parent of agent */
|
||||||
int parent_pid = -1;
|
pid_t parent_pid = -1;
|
||||||
|
|
||||||
/* pathname and directory for AUTH_SOCKET */
|
/* pathname and directory for AUTH_SOCKET */
|
||||||
char socket_name[1024];
|
char socket_name[1024];
|
||||||
@ -464,7 +464,7 @@ after_select(fd_set *readset, fd_set *writeset)
|
|||||||
void
|
void
|
||||||
check_parent_exists(int sig)
|
check_parent_exists(int sig)
|
||||||
{
|
{
|
||||||
if (kill(parent_pid, 0) < 0) {
|
if (parent_pid != -1 && kill(parent_pid, 0) < 0) {
|
||||||
/* printf("Parent has died - Authentication agent exiting.\n"); */
|
/* printf("Parent has died - Authentication agent exiting.\n"); */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -550,6 +550,7 @@ main(int ac, char **av)
|
|||||||
}
|
}
|
||||||
pid = atoi(pidstr);
|
pid = atoi(pidstr);
|
||||||
if (pid < 1) { /* XXX PID_MAX check too */
|
if (pid < 1) { /* XXX PID_MAX check too */
|
||||||
|
/* Yes, PID_MAX check please */
|
||||||
fprintf(stderr, "%s=\"%s\", which is not a good PID\n",
|
fprintf(stderr, "%s=\"%s\", which is not a good PID\n",
|
||||||
SSH_AGENTPID_ENV_NAME, pidstr);
|
SSH_AGENTPID_ENV_NAME, pidstr);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
8
ssh.h
8
ssh.h
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* RCSID("$Id: ssh.h,v 1.32 2000/04/16 01:18:47 damien Exp $"); */
|
/* RCSID("$Id: ssh.h,v 1.33 2000/04/19 21:42:22 damien Exp $"); */
|
||||||
|
|
||||||
#ifndef SSH_H
|
#ifndef SSH_H
|
||||||
#define SSH_H
|
#define SSH_H
|
||||||
@ -288,14 +288,14 @@ get_last_login_time(uid_t uid, const char *logname,
|
|||||||
* by login(1).
|
* by login(1).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
record_login(int pid, const char *ttyname, const char *user, uid_t uid,
|
record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
|
||||||
const char *host, struct sockaddr *addr);
|
const char *host, struct sockaddr *addr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Records that the user has logged out. This does many thigs normally done
|
* Records that the user has logged out. This does many thigs normally done
|
||||||
* by login(1) or init.
|
* by login(1) or init.
|
||||||
*/
|
*/
|
||||||
void record_logout(int pid, const char *ttyname);
|
void record_logout(pid_t pid, const char *ttyname);
|
||||||
|
|
||||||
/*------------ definitions for sshconnect.c ----------*/
|
/*------------ definitions for sshconnect.c ----------*/
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ char *tilde_expand_filename(const char *filename, uid_t my_uid);
|
|||||||
* (of the child program), and reads from stdout and stderr (of the child
|
* (of the child program), and reads from stdout and stderr (of the child
|
||||||
* program).
|
* program).
|
||||||
*/
|
*/
|
||||||
void server_loop(int pid, int fdin, int fdout, int fderr);
|
void server_loop(pid_t pid, int fdin, int fdout, int fderr);
|
||||||
void server_loop2(void);
|
void server_loop2(void);
|
||||||
|
|
||||||
/* Client side main loop for the interactive session. */
|
/* Client side main loop for the interactive session. */
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sshconnect.c,v 1.68 2000/04/14 10:30:33 markus Exp $");
|
RCSID("$OpenBSD: sshconnect.c,v 1.69 2000/04/19 07:05:50 deraadt Exp $");
|
||||||
|
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
@ -62,7 +62,7 @@ ssh_proxy_connect(const char *host, u_short port, uid_t original_real_uid,
|
|||||||
const char *cp;
|
const char *cp;
|
||||||
char *command_string;
|
char *command_string;
|
||||||
int pin[2], pout[2];
|
int pin[2], pout[2];
|
||||||
int pid;
|
pid_t pid;
|
||||||
char strport[NI_MAXSERV];
|
char strport[NI_MAXSERV];
|
||||||
|
|
||||||
/* Convert the port number into a string. */
|
/* Convert the port number into a string. */
|
||||||
|
5
sshd.c
5
sshd.c
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sshd.c,v 1.106 2000/04/17 12:31:47 markus Exp $");
|
RCSID("$OpenBSD: sshd.c,v 1.107 2000/04/19 07:05:50 deraadt Exp $");
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "rsa.h"
|
#include "rsa.h"
|
||||||
@ -396,7 +396,8 @@ main(int ac, char **av)
|
|||||||
{
|
{
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
int opt, sock_in = 0, sock_out = 0, newsock, i, fdsetsz, pid, on = 1;
|
int opt, sock_in = 0, sock_out = 0, newsock, i, fdsetsz, on = 1;
|
||||||
|
pid_t pid;
|
||||||
socklen_t fromlen;
|
socklen_t fromlen;
|
||||||
int silentrsa = 0;
|
int silentrsa = 0;
|
||||||
fd_set *fdset;
|
fd_set *fdset;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user