Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/dist/ssh sync with 3.0 as of 2001/11/7.
details: https://anonhg.NetBSD.org/src/rev/0f9bf59ed8ae
branches: trunk
changeset: 517119:0f9bf59ed8ae
user: itojun <itojun%NetBSD.org@localhost>
date: Wed Nov 07 06:26:47 2001 +0000
description:
sync with 3.0 as of 2001/11/7.
diffstat:
crypto/dist/ssh/auth.c | 13 +++-
crypto/dist/ssh/auth2-chall.c | 6 +-
crypto/dist/ssh/auth2.c | 6 +-
crypto/dist/ssh/authfile.c | 12 ++--
crypto/dist/ssh/channels.c | 119 +++++++++++++++++++++++------------------
crypto/dist/ssh/channels.h | 15 ++--
crypto/dist/ssh/clientloop.c | 66 ++++++++++++----------
crypto/dist/ssh/compress.c | 6 +-
crypto/dist/ssh/key.c | 6 +-
crypto/dist/ssh/nchan2.ms | 26 ++++++++-
crypto/dist/ssh/packet.c | 5 +-
crypto/dist/ssh/readconf.c | 14 +++-
crypto/dist/ssh/readconf.h | 5 +-
crypto/dist/ssh/scp.c | 9 ++-
crypto/dist/ssh/serverloop.c | 120 ++++++++++++++++++++---------------------
crypto/dist/ssh/session.c | 115 +++++++++++++++++++++-------------------
crypto/dist/ssh/ssh-add.c | 93 ++++++++++++++++++++------------
crypto/dist/ssh/ssh-keygen.1 | 11 ++-
crypto/dist/ssh/ssh-keygen.c | 14 +++-
crypto/dist/ssh/ssh-keyscan.c | 8 +--
crypto/dist/ssh/ssh.1 | 16 ++++-
crypto/dist/ssh/ssh.c | 17 ++---
crypto/dist/ssh/sshconnect.c | 44 ++++----------
crypto/dist/ssh/sshconnect1.c | 12 ++--
crypto/dist/ssh/sshconnect2.c | 33 +++++-----
crypto/dist/ssh/sshd.8 | 9 +-
crypto/dist/ssh/sshd.c | 8 +-
crypto/dist/ssh/version.h | 8 +-
28 files changed, 452 insertions(+), 364 deletions(-)
diffs (truncated from 1992 to 300 lines):
diff -r 2951f7a5cf31 -r 0f9bf59ed8ae crypto/dist/ssh/auth.c
--- a/crypto/dist/ssh/auth.c Wed Nov 07 06:20:12 2001 +0000
+++ b/crypto/dist/ssh/auth.c Wed Nov 07 06:26:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auth.c,v 1.8 2001/09/27 03:24:02 itojun Exp $ */
+/* $NetBSD: auth.c,v 1.9 2001/11/07 06:26:47 itojun Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -24,7 +24,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.27 2001/07/11 18:26:15 markus Exp $");
+RCSID("$OpenBSD: auth.c,v 1.28 2001/10/03 10:01:20 markus Exp $");
#include <libgen.h>
@@ -419,7 +419,7 @@
char *err, size_t errlen)
{
uid_t uid = pw->pw_uid;
- char buf[MAXPATHLEN];
+ char buf[MAXPATHLEN], homedir[MAXPATHLEN];
char *cp;
struct stat st;
@@ -428,6 +428,11 @@
strerror(errno));
return -1;
}
+ if (realpath(pw->pw_dir, homedir) == NULL) {
+ snprintf(err, errlen, "realpath %s failed: %s", pw->pw_dir,
+ strerror(errno));
+ return -1;
+ }
/* check the open file to avoid races */
if (fstat(fileno(f), &st) < 0 ||
@@ -456,7 +461,7 @@
}
/* If are passed the homedir then we can stop */
- if (strcmp(pw->pw_dir, buf) == 0) {
+ if (strcmp(homedir, buf) == 0) {
debug3("secure_filename: terminating check at '%s'",
buf);
break;
diff -r 2951f7a5cf31 -r 0f9bf59ed8ae crypto/dist/ssh/auth2-chall.c
--- a/crypto/dist/ssh/auth2-chall.c Wed Nov 07 06:20:12 2001 +0000
+++ b/crypto/dist/ssh/auth2-chall.c Wed Nov 07 06:26:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auth2-chall.c,v 1.4 2001/06/23 19:37:38 itojun Exp $ */
+/* $NetBSD: auth2-chall.c,v 1.5 2001/11/07 06:26:47 itojun Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2001 Per Allansson. All rights reserved.
@@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2-chall.c,v 1.7 2001/06/23 15:12:17 itojun Exp $");
+RCSID("$OpenBSD: auth2-chall.c,v 1.8 2001/09/27 15:31:17 markus Exp $");
#include "ssh2.h"
#include "auth.h"
@@ -140,7 +140,7 @@
}
/*
- * try challenge-reponse, set authctxt->postponed if we have to
+ * try challenge-response, set authctxt->postponed if we have to
* wait for the response.
*/
int
diff -r 2951f7a5cf31 -r 0f9bf59ed8ae crypto/dist/ssh/auth2.c
--- a/crypto/dist/ssh/auth2.c Wed Nov 07 06:20:12 2001 +0000
+++ b/crypto/dist/ssh/auth2.c Wed Nov 07 06:26:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auth2.c,v 1.10 2001/09/27 03:24:02 itojun Exp $ */
+/* $NetBSD: auth2.c,v 1.11 2001/11/07 06:26:47 itojun Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -24,7 +24,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.70 2001/09/20 13:46:48 markus Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.71 2001/09/27 15:31:17 markus Exp $");
#include <openssl/evp.h>
@@ -119,7 +119,7 @@
x_authctxt = authctxt; /*XXX*/
- /* challenge-reponse is implemented via keyboard interactive */
+ /* challenge-response is implemented via keyboard interactive */
if (options.challenge_response_authentication)
options.kbd_interactive_authentication = 1;
diff -r 2951f7a5cf31 -r 0f9bf59ed8ae crypto/dist/ssh/authfile.c
--- a/crypto/dist/ssh/authfile.c Wed Nov 07 06:20:12 2001 +0000
+++ b/crypto/dist/ssh/authfile.c Wed Nov 07 06:26:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: authfile.c,v 1.9 2001/09/27 03:24:02 itojun Exp $ */
+/* $NetBSD: authfile.c,v 1.10 2001/11/07 06:26:47 itojun Exp $ */
/*
* Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
* Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -37,7 +37,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: authfile.c,v 1.38 2001/09/23 11:09:13 markus Exp $");
+RCSID("$OpenBSD: authfile.c,v 1.39 2001/10/07 10:29:52 markus Exp $");
#include <openssl/err.h>
#include <openssl/evp.h>
@@ -251,7 +251,7 @@
/* Check that it is at least big enough to contain the ID string. */
if (len < sizeof(authfile_id_string)) {
- debug3("No RSA1 key file %.200s.", filename);
+ debug3("Not a RSA1 key file %.200s.", filename);
buffer_free(&buffer);
return NULL;
}
@@ -261,7 +261,7 @@
*/
for (i = 0; i < sizeof(authfile_id_string); i++)
if (buffer_get_char(&buffer) != authfile_id_string[i]) {
- debug3("No RSA1 key file %.200s.", filename);
+ debug3("Not a RSA1 key file %.200s.", filename);
buffer_free(&buffer);
return NULL;
}
@@ -337,7 +337,7 @@
/* Check that it is at least big enough to contain the ID string. */
if (len < sizeof(authfile_id_string)) {
- debug3("No RSA1 key file %.200s.", filename);
+ debug3("Not a RSA1 key file %.200s.", filename);
buffer_free(&buffer);
close(fd);
return NULL;
@@ -348,7 +348,7 @@
*/
for (i = 0; i < sizeof(authfile_id_string); i++)
if (buffer_get_char(&buffer) != authfile_id_string[i]) {
- debug3("No RSA1 key file %.200s.", filename);
+ debug3("Not a RSA1 key file %.200s.", filename);
buffer_free(&buffer);
close(fd);
return NULL;
diff -r 2951f7a5cf31 -r 0f9bf59ed8ae crypto/dist/ssh/channels.c
--- a/crypto/dist/ssh/channels.c Wed Nov 07 06:20:12 2001 +0000
+++ b/crypto/dist/ssh/channels.c Wed Nov 07 06:26:47 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: channels.c,v 1.15 2001/10/18 19:46:12 sommerfeld Exp $ */
+/* $NetBSD: channels.c,v 1.16 2001/11/07 06:26:47 itojun Exp $ */
/*
* Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
* Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.134 2001/09/17 21:04:01 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.140 2001/10/10 22:18:47 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -135,7 +135,7 @@
static char *auth_sock_dir = NULL;
/* AF_UNSPEC or AF_INET or AF_INET6 */
-extern int IPv4or6;
+static int IPv4or6 = AF_UNSPEC;
/* helper */
static void port_open_helper(Channel *c, char *rtype);
@@ -243,6 +243,7 @@
}
/* Initialize and return new channel. */
c = channels[found] = xmalloc(sizeof(Channel));
+ memset(c, 0, sizeof(Channel));
buffer_init(&c->input);
buffer_init(&c->output);
buffer_init(&c->extended);
@@ -332,10 +333,6 @@
debug3("channel_free: status: %s", s);
xfree(s);
- if (c->detach_user != NULL) {
- debug("channel_free: channel %d: detaching channel user", c->self);
- c->detach_user(c->self, NULL);
- }
if (c->sock != -1)
shutdown(c->sock, SHUT_RDWR);
channel_close_fds(c);
@@ -360,22 +357,6 @@
channel_free(channels[i]);
}
-void
-channel_detach_all(void)
-{
- int i;
- Channel *c;
-
- for (i = 0; i < channels_alloc; i++) {
- c = channels[i];
- if (c != NULL && c->detach_user != NULL) {
- debug("channel_detach_all: channel %d", c->self);
- c->detach_user(c->self, NULL);
- c->detach_user = NULL;
- }
- }
-}
-
/*
* Closes the sockets/fds of all channels. This is used to close extra file
* descriptors after a fork.
@@ -431,14 +412,18 @@
for (i = 0; i < channels_alloc; i++) {
c = channels[i];
if (c != NULL && c->type == SSH_CHANNEL_OPEN) {
- if (!compat20 && buffer_len(&c->input) > packet_get_maxsize()) {
+#if 0
+ if (!compat20 &&
+ buffer_len(&c->input) > packet_get_maxsize()) {
debug("channel %d: big input buffer %d",
c->self, buffer_len(&c->input));
return 0;
}
+#endif
if (buffer_len(&c->output) > packet_get_maxsize()) {
- debug("channel %d: big output buffer %d",
- c->self, buffer_len(&c->output));
+ debug("channel %d: big output buffer %d > %d",
+ c->self, buffer_len(&c->output),
+ packet_get_maxsize());
return 0;
}
}
@@ -972,7 +957,7 @@
int have, ret;
have = buffer_len(&c->input);
-
+ c->delayed = 0;
debug2("channel %d: pre_dynamic: have %d", c->self, have);
/* buffer_dump(&c->input); */
/* check if the fixed size part of the packet is in buffer. */
@@ -1134,11 +1119,18 @@
"to %.100s port %d requested.",
c->listening_port, c->path, c->host_port);
- rtype = (c->type == SSH_CHANNEL_RPORT_LISTENER) ?
- "forwarded-tcpip" : "direct-tcpip";
- nextstate = (c->host_port == 0 &&
- c->type != SSH_CHANNEL_RPORT_LISTENER) ?
- SSH_CHANNEL_DYNAMIC : SSH_CHANNEL_OPENING;
+ if (c->type == SSH_CHANNEL_RPORT_LISTENER) {
+ nextstate = SSH_CHANNEL_OPENING;
+ rtype = "forwarded-tcpip";
+ } else {
+ if (c->host_port == 0) {
+ nextstate = SSH_CHANNEL_DYNAMIC;
+ rtype = "dynamic-tcpip";
+ } else {
+ nextstate = SSH_CHANNEL_OPENING;
+ rtype = "direct-tcpip";
+ }
+ }
addrlen = sizeof(addr);
newsock = accept(c->sock, &addr, &addrlen);
@@ -1159,8 +1151,16 @@
nc->host_port = c->host_port;
strlcpy(nc->path, c->path, sizeof(nc->path));
- if (nextstate != SSH_CHANNEL_DYNAMIC)
+ if (nextstate == SSH_CHANNEL_DYNAMIC) {
+ /*
+ * do not call the channel_post handler until
+ * this flag has been reset by a pre-handler.
+ * otherwise the FD_ISSET calls might overflow
+ */
+ nc->delayed = 1;
+ } else {
port_open_helper(nc, rtype);
+ }
}
}
@@ -1410,6 +1410,8 @@
static void
Home |
Main Index |
Thread Index |
Old Index