Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/crypto/dist/ssh Pull up revision 1.1 (requested by itoj...



details:   https://anonhg.NetBSD.org/src/rev/fb91af8f4436
branches:  netbsd-1-5
changeset: 490710:fb91af8f4436
user:      he <he%NetBSD.org@localhost>
date:      Mon Feb 26 20:27:17 2001 +0000

description:
Pull up revision 1.1 (requested by itojun):
  Update SSH to version found on trunk as of 26 Feb 2001.

diffstat:

 crypto/dist/ssh/auth2-chall.c  |  113 +++++++++++++++++++++++++++++++
 crypto/dist/ssh/canohost.h     |   34 +++++++++
 crypto/dist/ssh/clientloop.h   |   39 ++++++++++
 crypto/dist/ssh/groupaccess.c  |   78 +++++++++++++++++++++
 crypto/dist/ssh/groupaccess.h  |   49 +++++++++++++
 crypto/dist/ssh/log.h          |   75 +++++++++++++++++++++
 crypto/dist/ssh/login.h        |   40 +++++++++++
 crypto/dist/ssh/mac.c          |  114 ++++++++++++++++++++++++++++++++
 crypto/dist/ssh/mac.h          |   28 +++++++
 crypto/dist/ssh/misc.c         |   97 +++++++++++++++++++++++++++
 crypto/dist/ssh/misc.h         |   21 +++++
 crypto/dist/ssh/openssh2netbsd |   44 ++++++++++++
 crypto/dist/ssh/radix.h        |   28 +++++++
 crypto/dist/ssh/readpass.h     |   20 +++++
 crypto/dist/ssh/serverloop.h   |   22 ++++++
 crypto/dist/ssh/sftp-client.h  |   84 +++++++++++++++++++++++
 crypto/dist/ssh/sftp-common.c  |  146 +++++++++++++++++++++++++++++++++++++++++
 crypto/dist/ssh/sftp-common.h  |   55 +++++++++++++++
 crypto/dist/ssh/sftp-int.h     |   27 +++++++
 crypto/dist/ssh/sftp.h         |   88 ++++++++++++++++++++++++
 crypto/dist/ssh/ssh1.h         |   86 ++++++++++++++++++++++++
 crypto/dist/ssh/tildexpand.h   |   19 +++++
 22 files changed, 1307 insertions(+), 0 deletions(-)

diffs (truncated from 1395 to 300 lines):

diff -r d31731dc314d -r fb91af8f4436 crypto/dist/ssh/auth2-chall.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/auth2-chall.c     Mon Feb 26 20:27:17 2001 +0000
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2001 Markus Friedl. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "includes.h"
+RCSID("$OpenBSD: auth2-chall.c,v 1.2 2001/01/21 19:05:43 markus Exp $");
+
+#include "ssh2.h"
+#include "auth.h"
+#include "packet.h"
+#include "xmalloc.h"
+#include "dispatch.h"
+#include "log.h"
+
+void send_userauth_into_request(Authctxt *authctxt, char *challenge, int echo);
+void input_userauth_info_response(int type, int plen, void *ctxt);
+
+/*
+ * try challenge-reponse, return -1 (= postponed) if we have to
+ * wait for the response.
+ */
+int
+auth2_challenge(Authctxt *authctxt, char *devs)
+{
+       char *challenge;
+
+       if (!authctxt->valid || authctxt->user == NULL)
+               return 0;
+       if ((challenge = get_challenge(authctxt, devs)) == NULL)
+               return 0;
+       send_userauth_into_request(authctxt, challenge, 0);
+       dispatch_set(SSH2_MSG_USERAUTH_INFO_RESPONSE,
+           &input_userauth_info_response);
+       authctxt->postponed = 1;
+       return 0;
+}
+
+void
+send_userauth_into_request(Authctxt *authctxt, char *challenge, int echo)
+{
+       int nprompts = 1;
+
+       packet_start(SSH2_MSG_USERAUTH_INFO_REQUEST);
+       /* name, instruction and language are unused */
+       packet_put_cstring("");
+       packet_put_cstring("");
+       packet_put_cstring("");
+       packet_put_int(nprompts);
+       packet_put_cstring(challenge);
+       packet_put_char(echo);
+       packet_send();
+       packet_write_wait();
+}
+
+void
+input_userauth_info_response(int type, int plen, void *ctxt)
+{
+       Authctxt *authctxt = ctxt;
+       int authenticated = 0;
+       u_int nresp, rlen;
+       char *response, *method = "challenge-reponse";
+
+       if (authctxt == NULL)
+               fatal("input_userauth_info_response: no authctxt");
+
+       authctxt->postponed = 0;        /* reset */
+       nresp = packet_get_int();
+       if (nresp == 1) {
+               response = packet_get_string(&rlen);
+               packet_done();
+               if (strlen(response) == 0) {
+                       /*
+                        * if we received an empty response, resend challenge
+                        * with echo enabled
+                        */
+                       char *challenge = get_challenge(authctxt, NULL);
+                       if (challenge != NULL) {
+                               send_userauth_into_request(authctxt,
+                                   challenge, 1);
+                               authctxt->postponed = 1;
+                       }
+               } else if (authctxt->valid) {
+                       authenticated = verify_response(authctxt, response);
+                       memset(response, 'r', rlen);
+               }
+               xfree(response);
+       }
+       auth_log(authctxt, authenticated, method, " ssh2");
+       if (!authctxt->postponed) {
+               /* unregister callback and send reply */
+               dispatch_set(SSH2_MSG_USERAUTH_INFO_RESPONSE, NULL);
+               userauth_reply(authctxt, authenticated);
+       }
+}
diff -r d31731dc314d -r fb91af8f4436 crypto/dist/ssh/canohost.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/canohost.h        Mon Feb 26 20:27:17 2001 +0000
@@ -0,0 +1,34 @@
+/*     $OpenBSD: canohost.h,v 1.4 2001/02/03 10:08:37 markus Exp $     */
+
+/*
+ * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
+ * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
+ *                    All rights reserved
+ *
+ * As far as I am concerned, the code I have written for this software
+ * can be used freely for any purpose.  Any derived versions of this
+ * software must be clearly marked as such, and if the derived work is
+ * incompatible with the protocol description in the RFC file, it must be
+ * called by a name other than "ssh" or "Secure Shell".
+ */
+
+/*
+ * Return the canonical name of the host in the other side of the current
+ * connection (as returned by packet_get_connection).  The host name is
+ * cached, so it is efficient to call this several times.
+ */
+const char *get_canonical_hostname(int reverse_mapping_check);
+
+/*
+ * Returns the IP-address of the remote host as a string.  The returned
+ * string is cached and must not be freed.
+ */
+const char *get_remote_ipaddr(void);
+
+/* Returns the ipaddr/port number of the peer of the socket. */
+char * get_peer_ipaddr(int socket);
+int     get_peer_port(int sock);
+
+/* Returns the port number of the remote/local host. */
+int     get_remote_port(void);
+int    get_local_port(void);
diff -r d31731dc314d -r fb91af8f4436 crypto/dist/ssh/clientloop.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/clientloop.h      Mon Feb 26 20:27:17 2001 +0000
@@ -0,0 +1,39 @@
+/*     $OpenBSD: clientloop.h,v 1.4 2001/02/06 22:43:02 markus Exp $   */
+
+/*
+ * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
+ * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
+ *                    All rights reserved
+ *
+ * As far as I am concerned, the code I have written for this software
+ * can be used freely for any purpose.  Any derived versions of this
+ * software must be clearly marked as such, and if the derived work is
+ * incompatible with the protocol description in the RFC file, it must be
+ * called by a name other than "ssh" or "Secure Shell".
+ */
+/*
+ * Copyright (c) 2001 Markus Friedl.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Client side main loop for the interactive session. */
+int     client_loop(int have_pty, int escape_char, int id);
diff -r d31731dc314d -r fb91af8f4436 crypto/dist/ssh/groupaccess.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/groupaccess.c     Mon Feb 26 20:27:17 2001 +0000
@@ -0,0 +1,78 @@
+/*     $OpenBSD: groupaccess.c,v 1.3 2001/01/29 01:58:15 niklas Exp $  */
+
+/*
+ * Copyright (c) 2001 Kevin Steves.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "includes.h"
+
+#include "groupaccess.h"
+#include "xmalloc.h"
+#include "match.h"
+#include "log.h"
+
+static int ngroups;
+static char *groups_byname[NGROUPS_MAX + 1];   /* +1 for base/primary group */
+
+int
+ga_init(const char *user, gid_t base)
+{
+       gid_t groups_bygid[NGROUPS_MAX + 1];
+       int i, j;
+       struct group *gr;
+
+       if (ngroups > 0)
+               ga_free();
+
+       ngroups = sizeof(groups_bygid) / sizeof(gid_t);
+       if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
+               log("getgrouplist: groups list too small");
+       for (i = 0, j = 0; i < ngroups; i++)
+               if ((gr = getgrgid(groups_bygid[i])) != NULL)
+                       groups_byname[j++] = xstrdup(gr->gr_name);
+       return (ngroups = j);
+}
+
+int
+ga_match(char * const *groups, int n)
+{
+       int i, j;
+
+       for (i = 0; i < ngroups; i++)
+               for (j = 0; j < n; j++)
+                       if (match_pattern(groups_byname[i], groups[j]))
+                               return 1;
+       return 0;
+}
+
+void
+ga_free(void)
+{
+       int i;
+
+       if (ngroups > 0) {
+               for (i = 0; i < ngroups; i++)
+                       xfree(groups_byname[i]);
+               ngroups = 0;
+       }
+}
diff -r d31731dc314d -r fb91af8f4436 crypto/dist/ssh/groupaccess.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/dist/ssh/groupaccess.h     Mon Feb 26 20:27:17 2001 +0000
@@ -0,0 +1,49 @@
+/*     $OpenBSD: groupaccess.h,v 1.2 2001/01/29 01:58:15 niklas Exp $  */
+
+/*
+ * Copyright (c) 2001 Kevin Steves.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES



Home | Main Index | Thread Index | Old Index