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 2.3.2.



details:   https://anonhg.NetBSD.org/src/rev/7d9a4a88bc13
branches:  trunk
changeset: 503565:7d9a4a88bc13
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Feb 08 19:02:14 2001 +0000

description:
sync with 2.3.2.

diffstat:

 crypto/dist/ssh/auth1.c       |   10 +---
 crypto/dist/ssh/auth2.c       |   11 +---
 crypto/dist/ssh/pathnames.h   |    5 +-
 crypto/dist/ssh/readconf.c    |   18 ++++--
 crypto/dist/ssh/scp.c         |   39 ++++++++------
 crypto/dist/ssh/session.c     |    6 +-
 crypto/dist/ssh/sftp-client.c |    6 +-
 crypto/dist/ssh/sftp-int.c    |  110 +++++++++++++++++++----------------------
 crypto/dist/ssh/sftp-server.c |    2 +-
 crypto/dist/ssh/sftp.c        |   46 +++++++++++++---
 crypto/dist/ssh/ssh-keyscan.c |    6 +-
 crypto/dist/ssh/sshconnect.c  |    2 +-
 crypto/dist/ssh/sshconnect1.c |    2 +-
 crypto/dist/ssh/sshconnect2.c |    2 +-
 crypto/dist/ssh/sshd.c        |    9 +++-
 crypto/dist/ssh/version.h     |    6 +-
 crypto/dist/ssh/xmalloc.c     |    6 +-
 17 files changed, 157 insertions(+), 129 deletions(-)

diffs (truncated from 787 to 300 lines):

diff -r 6ec6ea5ffd25 -r 7d9a4a88bc13 crypto/dist/ssh/auth1.c
--- a/crypto/dist/ssh/auth1.c   Thu Feb 08 18:55:32 2001 +0000
+++ b/crypto/dist/ssh/auth1.c   Thu Feb 08 19:02:14 2001 +0000
@@ -10,7 +10,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth1.c,v 1.14 2001/01/22 23:06:39 markus Exp $");
+RCSID("$OpenBSD: auth1.c,v 1.15 2001/02/07 22:35:45 markus Exp $");
 
 #include "xmalloc.h"
 #include "rsa.h"
@@ -336,14 +336,6 @@
 
        setproctitle("%s", user);
 
-#ifdef AFS
-       /* If machine has AFS, set process authentication group. */
-       if (k_hasafs()) {
-               k_setpag();
-               k_unlog();
-       }
-#endif /* AFS */
-
        /* Verify that the user is a valid user. */
        pw = getpwnam(user);
        if (pw && allowed_user(pw)) {
diff -r 6ec6ea5ffd25 -r 7d9a4a88bc13 crypto/dist/ssh/auth2.c
--- a/crypto/dist/ssh/auth2.c   Thu Feb 08 18:55:32 2001 +0000
+++ b/crypto/dist/ssh/auth2.c   Thu Feb 08 19:02:14 2001 +0000
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.36 2001/02/04 15:32:22 stevesk Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.39 2001/02/08 18:20:01 markus Exp $");
 
 #include <openssl/evp.h>
 
@@ -113,13 +113,6 @@
        if (options.challenge_reponse_authentication)
                options.kbd_interactive_authentication = 1;
 
-#ifdef AFS
-       /* If machine has AFS, set process authentication group. */
-       if (k_hasafs()) {
-               k_setpag();
-               k_unlog();
-       }
-#endif
        dispatch_init(&protocol_error);
        dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request);
        dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt);
@@ -281,7 +274,7 @@
        char *methods;
 
        /* XXX todo: check if multiple auth methods are needed */
-       if (authenticated) {
+       if (authenticated == 1) {
                /* turn off userauth */
                dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &protocol_error);
                packet_start(SSH2_MSG_USERAUTH_SUCCESS);
diff -r 6ec6ea5ffd25 -r 7d9a4a88bc13 crypto/dist/ssh/pathnames.h
--- a/crypto/dist/ssh/pathnames.h       Thu Feb 08 18:55:32 2001 +0000
+++ b/crypto/dist/ssh/pathnames.h       Thu Feb 08 19:02:14 2001 +0000
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pathnames.h,v 1.2 2001/01/29 01:58:17 niklas Exp $    */
+/*     $OpenBSD: pathnames.h,v 1.3 2001/02/08 00:04:52 markus Exp $    */
 
 /*
  * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
@@ -105,5 +105,8 @@
 /* for scp */
 #define _PATH_CP                       "cp"
 
+/* for sftp */
+#define _PATH_SFTP_SERVER              "/usr/libexec/sftp-server"
+
 #define _PATH_RSH                      "/usr/bin/rsh"
 #define _PATH_URANDOM                  "/dev/urandom"
diff -r 6ec6ea5ffd25 -r 7d9a4a88bc13 crypto/dist/ssh/readconf.c
--- a/crypto/dist/ssh/readconf.c        Thu Feb 08 18:55:32 2001 +0000
+++ b/crypto/dist/ssh/readconf.c        Thu Feb 08 19:02:14 2001 +0000
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.60 2001/01/28 20:36:16 stevesk Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.61 2001/02/08 14:39:36 deraadt Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -715,6 +715,8 @@
 void
 fill_default_options(Options * options)
 {
+       int len;
+
        if (options->forward_agent == -1)
                options->forward_agent = 0;
        if (options->forward_x11 == -1)
@@ -781,16 +783,18 @@
                options->protocol = SSH_PROTO_1|SSH_PROTO_2|SSH_PROTO_1_PREFERRED;
        if (options->num_identity_files == 0) {
                if (options->protocol & SSH_PROTO_1) {
+                       len = 2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1;
                        options->identity_files[options->num_identity_files] =
-                           xmalloc(2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1);
-                       sprintf(options->identity_files[options->num_identity_files++],
-                           "~/%.100s", _PATH_SSH_CLIENT_IDENTITY);
+                           xmalloc(len);
+                       snprintf(options->identity_files[options->num_identity_files++],
+                           len, "~/%.100s", _PATH_SSH_CLIENT_IDENTITY);
                }
                if (options->protocol & SSH_PROTO_2) {
+                       len = 2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1;
                        options->identity_files[options->num_identity_files] =
-                           xmalloc(2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1);
-                       sprintf(options->identity_files[options->num_identity_files++],
-                           "~/%.100s", _PATH_SSH_CLIENT_ID_DSA);
+                           xmalloc(len);
+                       snprintf(options->identity_files[options->num_identity_files++],
+                           len, "~/%.100s", _PATH_SSH_CLIENT_ID_DSA);
                }
        }
        if (options->escape_char == -1)
diff -r 6ec6ea5ffd25 -r 7d9a4a88bc13 crypto/dist/ssh/scp.c
--- a/crypto/dist/ssh/scp.c     Thu Feb 08 18:55:32 2001 +0000
+++ b/crypto/dist/ssh/scp.c     Thu Feb 08 19:02:14 2001 +0000
@@ -75,7 +75,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.53 2001/02/04 23:56:22 deraadt Exp $");
+RCSID("$OpenBSD: scp.c,v 1.55 2001/02/08 14:38:54 deraadt Exp $");
 
 #include "xmalloc.h"
 #include "atomicio.h"
@@ -312,7 +312,8 @@
 
        remin = remout = -1;
        /* Command to be executed on remote system using "ssh". */
-       (void) sprintf(cmd, "scp%s%s%s%s", verbose_mode ? " -v" : "",
+       (void) snprintf(cmd, sizeof cmd, "scp%s%s%s%s",
+           verbose_mode ? " -v" : "",
            iamrecursive ? " -r" : "", pflag ? " -p" : "",
            targetshouldbedirectory ? " -d" : "");
 
@@ -383,16 +384,18 @@
                                        suser = pwd->pw_name;
                                else if (!okname(suser))
                                        continue;
-                               sprintf(bp,
-                                   "%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'",
+                               snprintf(bp, len,
+                                   "%s%s -x -o'FallBackToRsh no' -n "
+                                   "-l %s %s %s %s '%s%s%s:%s'",
                                    ssh_program, verbose_mode ? " -v" : "",
                                    suser, host, cmd, src,
                                    tuser ? tuser : "", tuser ? "@" : "",
                                    thost, targ);
                        } else {
                                host = cleanhostname(argv[i]);
-                               sprintf(bp,
-                                   "exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'",
+                               snprintf(bp, len,
+                                   "exec %s%s -x -o'FallBackToRsh no' -n %s "
+                                   "%s %s '%s%s%s:%s'",
                                    ssh_program, verbose_mode ? " -v" : "",
                                    host, cmd, src,
                                    tuser ? tuser : "", tuser ? "@" : "",
@@ -406,7 +409,7 @@
                        if (remin == -1) {
                                len = strlen(targ) + CMDNEEDS + 20;
                                bp = xmalloc(len);
-                               (void) sprintf(bp, "%s -t %s", cmd, targ);
+                               (void) snprintf(bp, len, "%s -t %s", cmd, targ);
                                host = cleanhostname(thost);
                                if (do_cmd(host, tuser, bp, &remin,
                                    &remout, argc) < 0)
@@ -433,7 +436,7 @@
                        len = strlen(_PATH_CP) + strlen(argv[i]) +
                            strlen(argv[argc - 1]) + 20;
                        bp = xmalloc(len);
-                       (void) sprintf(bp, "exec %s%s%s %s %s", _PATH_CP,
+                       (void) snprintf(bp, len, "exec %s%s%s %s %s", _PATH_CP,
                            iamrecursive ? " -r" : "", pflag ? " -p" : "",
                            argv[i], argv[argc - 1]);
                        if (verbose_mode)
@@ -460,7 +463,7 @@
                host = cleanhostname(host);
                len = strlen(src) + CMDNEEDS + 20;
                bp = xmalloc(len);
-               (void) sprintf(bp, "%s -f %s", cmd, src);
+               (void) snprintf(bp, len, "%s -f %s", cmd, src);
                if (do_cmd(host, suser, bp, &remin, &remout, argc) < 0) {
                        (void) xfree(bp);
                        ++errs;
@@ -517,7 +520,7 @@
                         * Make it compatible with possible future
                         * versions expecting microseconds.
                         */
-                       (void) sprintf(buf, "T%lu 0 %lu 0\n",
+                       (void) snprintf(buf, sizeof buf, "T%lu 0 %lu 0\n",
                            (u_long) stb.st_mtime,
                            (u_long) stb.st_atime);
                        (void) atomic_write(remout, buf, strlen(buf));
@@ -525,7 +528,7 @@
                                goto next;
                }
 #define        FILEMODEMASK    (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
-               sprintf(buf, "C%04o %lu %s\n",
+               snprintf(buf, sizeof buf, "C%04o %lu %s\n",
                    (u_int) (stb.st_mode & FILEMODEMASK),
                    (u_long) stb.st_size, last);
                if (verbose_mode) {
@@ -594,7 +597,7 @@
        else
                last++;
        if (pflag) {
-               (void) sprintf(path, "T%lu 0 %lu 0\n",
+               (void) snprintf(path, sizeof(path), "T%lu 0 %lu 0\n",
                    (u_long) statp->st_mtime,
                    (u_long) statp->st_atime);
                (void) atomic_write(remout, path, strlen(path));
@@ -603,7 +606,7 @@
                        return;
                }
        }
-       (void) sprintf(path, "D%04o %d %.1024s\n",
+       (void) snprintf(path, sizeof path, "D%04o %d %.1024s\n",
            (u_int) (statp->st_mode & FILEMODEMASK), 0, last);
        if (verbose_mode)
                fprintf(stderr, "Entering directory: %s", path);
@@ -621,7 +624,7 @@
                        run_err("%s/%s: name too long", name, dp->d_name);
                        continue;
                }
-               (void) sprintf(path, "%s/%s", name, dp->d_name);
+               (void) snprintf(path, sizeof path, "%s/%s", name, dp->d_name);
                vect[0] = path;
                source(1, vect);
        }
@@ -751,9 +754,13 @@
                        size_t need;
 
                        need = strlen(targ) + strlen(cp) + 250;
-                       if (need > cursize)
+                       if (need > cursize) {
+                               if (namebuf)
+                                       xfree(namebuf);
                                namebuf = xmalloc(need);
-                       (void) sprintf(namebuf, "%s%s%s", targ,
+                               cursize = need;
+                       }
+                       (void) snprintf(namebuf, need, "%s%s%s", targ,
                            *targ ? "/" : "", cp);
                        np = namebuf;
                } else
diff -r 6ec6ea5ffd25 -r 7d9a4a88bc13 crypto/dist/ssh/session.c
--- a/crypto/dist/ssh/session.c Thu Feb 08 18:55:32 2001 +0000
+++ b/crypto/dist/ssh/session.c Thu Feb 08 19:02:14 2001 +0000
@@ -33,7 +33,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.53 2001/02/04 15:32:25 stevesk Exp $");
+RCSID("$OpenBSD: session.c,v 1.54 2001/02/08 17:11:23 stevesk Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -1206,7 +1206,7 @@
        }
        s->pw = auth_get_user();
        if (s->pw == NULL)
-               fatal("no user for session %i", s->self);
+               fatal("no user for session %d", s->self);
        debug("session_open: session %d: link with channel %d", s->self, chanid);
        s->chanid = chanid;
        return 1;
@@ -1516,7 +1516,7 @@
        if (s == NULL || s->ttyfd == -1)
                return;
 
-       debug("session_pty_cleanup: session %i release %s", s->self, s->tty);
+       debug("session_pty_cleanup: session %d release %s", s->self, s->tty);
 
        /* Cancel the cleanup function. */
        fatal_remove_cleanup(pty_cleanup_proc, (void *)s);
diff -r 6ec6ea5ffd25 -r 7d9a4a88bc13 crypto/dist/ssh/sftp-client.c
--- a/crypto/dist/ssh/sftp-client.c     Thu Feb 08 18:55:32 2001 +0000
+++ b/crypto/dist/ssh/sftp-client.c     Thu Feb 08 19:02:14 2001 +0000
@@ -29,7 +29,7 @@
 /* XXX: copy between two remote sites */
 
 #include "includes.h"
-RCSID("$OpenBSD: sftp-client.c,v 1.5 2001/02/07 10:55:12 djm Exp $");
+RCSID("$OpenBSD: sftp-client.c,v 1.8 2001/02/08 17:11:23 stevesk Exp $");
 
 #include "ssh.h"



Home | Main Index | Thread Index | Old Index