Source-Changes-HG archive

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

[src/trunk]: src/crypto/external/bsd/openssh/dist ssh_packet_write_wait() ret...



details:   https://anonhg.NetBSD.org/src/rev/6ba81c8bbf26
branches:  trunk
changeset: 807408:6ba81c8bbf26
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 08 15:49:46 2015 +0000

description:
ssh_packet_write_wait() returns number of bytes now; check for negative
for error instead of 0. Fixes ssh command restrictions, reported by
Tobias Nygren.

diffstat:

 crypto/external/bsd/openssh/dist/dispatch.c |   6 +++---
 crypto/external/bsd/openssh/dist/packet.c   |  20 ++++++++++----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diffs (117 lines):

diff -r 66d99b2234d1 -r 6ba81c8bbf26 crypto/external/bsd/openssh/dist/dispatch.c
--- a/crypto/external/bsd/openssh/dist/dispatch.c       Wed Apr 08 14:13:55 2015 +0000
+++ b/crypto/external/bsd/openssh/dist/dispatch.c       Wed Apr 08 15:49:46 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dispatch.c,v 1.4 2015/04/03 23:58:19 christos Exp $    */
+/*     $NetBSD: dispatch.c,v 1.5 2015/04/08 15:49:46 christos Exp $    */
 /* $OpenBSD: dispatch.c,v 1.26 2015/02/12 20:34:19 dtucker Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: dispatch.c,v 1.4 2015/04/03 23:58:19 christos Exp $");
+__RCSID("$NetBSD: dispatch.c,v 1.5 2015/04/08 15:49:46 christos Exp $");
 #include <sys/types.h>
 
 #include <signal.h>
@@ -51,7 +51,7 @@
        if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 ||
            (r = sshpkt_put_u32(ssh, seq)) != 0 ||
            (r = sshpkt_send(ssh)) != 0 ||
-           (r = ssh_packet_write_wait(ssh)) != 0)
+           (r = ssh_packet_write_wait(ssh)) < 0)
                sshpkt_fatal(ssh, __func__, r);
        return 0;
 }
diff -r 66d99b2234d1 -r 6ba81c8bbf26 crypto/external/bsd/openssh/dist/packet.c
--- a/crypto/external/bsd/openssh/dist/packet.c Wed Apr 08 14:13:55 2015 +0000
+++ b/crypto/external/bsd/openssh/dist/packet.c Wed Apr 08 15:49:46 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: packet.c,v 1.16 2015/04/03 23:58:19 christos Exp $     */
+/*     $NetBSD: packet.c,v 1.17 2015/04/08 15:49:46 christos Exp $     */
 /* $OpenBSD: packet.c,v 1.208 2015/02/13 18:57:00 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
@@ -39,7 +39,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: packet.c,v 1.16 2015/04/03 23:58:19 christos Exp $");
+__RCSID("$NetBSD: packet.c,v 1.17 2015/04/08 15:49:46 christos Exp $");
 #include <sys/param.h> /* MIN roundup */
 #include <sys/types.h>
 #include <sys/queue.h>
@@ -1452,7 +1452,7 @@
                if (emsg != NULL) {
                        error("%s", emsg);
                        if ((r = sshpkt_disconnect(ssh, "%s", emsg)) != 0 ||
-                           (r = ssh_packet_write_wait(ssh)) != 0)
+                           (r = ssh_packet_write_wait(ssh)) < 0)
                                        return r;
                        return SSH_ERR_CONN_CORRUPT;
                }
@@ -1487,7 +1487,7 @@
                error("%s: len %d != sshbuf_len %zd", __func__,
                    len, sshbuf_len(state->incoming_packet));
                if ((r = sshpkt_disconnect(ssh, "invalid packet length")) != 0 ||
-                   (r = ssh_packet_write_wait(ssh)) != 0)
+                   (r = ssh_packet_write_wait(ssh)) < 0)
                        return r;
                return SSH_ERR_CONN_CORRUPT;
        }
@@ -1497,7 +1497,7 @@
        if (checksum != stored_checksum) {
                error("Corrupted check bytes on input");
                if ((r = sshpkt_disconnect(ssh, "connection corrupted")) != 0 ||
-                   (r = ssh_packet_write_wait(ssh)) != 0)
+                   (r = ssh_packet_write_wait(ssh)) < 0)
                        return r;
                return SSH_ERR_CONN_CORRUPT;
        }
@@ -1521,7 +1521,7 @@
        if (*typep < SSH_MSG_MIN || *typep > SSH_MSG_MAX) {
                error("Invalid ssh1 packet type: %d", *typep);
                if ((r = sshpkt_disconnect(ssh, "invalid packet type")) != 0 ||
-                   (r = ssh_packet_write_wait(ssh)) != 0)
+                   (r = ssh_packet_write_wait(ssh)) < 0)
                        return r;
                return SSH_ERR_PROTOCOL_ERROR;
        }
@@ -1694,7 +1694,7 @@
        if (padlen < 4) {
                if ((r = sshpkt_disconnect(ssh,
                    "Corrupted padlen %d on input.", padlen)) != 0 ||
-                   (r = ssh_packet_write_wait(ssh)) != 0)
+                   (r = ssh_packet_write_wait(ssh)) < 0)
                        return r;
                return SSH_ERR_CONN_CORRUPT;
        }
@@ -1727,7 +1727,7 @@
        if (*typep < SSH2_MSG_MIN || *typep >= SSH2_MSG_LOCAL_MIN) {
                if ((r = sshpkt_disconnect(ssh,
                    "Invalid ssh2 packet type: %d", *typep)) != 0 ||
-                   (r = ssh_packet_write_wait(ssh)) != 0)
+                   (r = ssh_packet_write_wait(ssh)) < 0)
                        return r;
                return SSH_ERR_PROTOCOL_ERROR;
        }
@@ -1896,7 +1896,7 @@
                    (r = sshpkt_send(ssh)) != 0)
                        fatal("%s: %s", __func__, ssh_err(r));
        }
-       if ((r = ssh_packet_write_wait(ssh)) != 0)
+       if ((r = ssh_packet_write_wait(ssh)) < 0)
                fatal("%s: %s", __func__, ssh_err(r));
 }
 
@@ -1957,7 +1957,7 @@
        if ((r = sshpkt_disconnect(ssh, "%s", buf)) != 0)
                sshpkt_fatal(ssh, __func__, r);
 
-       if ((r = ssh_packet_write_wait(ssh)) != 0)
+       if ((r = ssh_packet_write_wait(ssh)) < 0)
                sshpkt_fatal(ssh, __func__, r);
 
        /* Close the connection. */



Home | Main Index | Thread Index | Old Index