summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsg@openbsd.org <jsg@openbsd.org>2015-09-02 07:51:12 +0000
committerDamien Miller <djm@mindrot.org>2015-09-03 10:44:41 +1000
commitf3a3ea180afff080bab82087ee0b60db9fd84f6c (patch)
tree4740dcc7adb2acf0a0c994e65ce748d6a9b37714
parentf498a98cf83feeb7ea01c15cd1c98b3111361f3a (diff)
upstream commit
Fix occurrences of "r = func() != 0" which result in the wrong error codes being returned due to != having higher precedence than =. ok deraadt@ markus@ Upstream-ID: 5fc35c9fc0319cc6fca243632662d2f06b5fd840
-rw-r--r--authfd.c4
-rw-r--r--krl.c4
-rw-r--r--monitor.c4
-rw-r--r--sshkey.c22
4 files changed, 17 insertions, 17 deletions
diff --git a/authfd.c b/authfd.c
index eaa142648..12bf1251f 100644
--- a/authfd.c
+++ b/authfd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfd.c,v 1.98 2015/07/03 03:43:18 djm Exp $ */ 1/* $OpenBSD: authfd.c,v 1.99 2015/09/02 07:51:12 jsg Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -454,7 +454,7 @@ ssh_agent_sign(int sock, struct sshkey *key,
454 (r = sshbuf_put_string(msg, data, datalen)) != 0 || 454 (r = sshbuf_put_string(msg, data, datalen)) != 0 ||
455 (r = sshbuf_put_u32(msg, flags)) != 0) 455 (r = sshbuf_put_u32(msg, flags)) != 0)
456 goto out; 456 goto out;
457 if ((r = ssh_request_reply(sock, msg, msg) != 0)) 457 if ((r = ssh_request_reply(sock, msg, msg)) != 0)
458 goto out; 458 goto out;
459 if ((r = sshbuf_get_u8(msg, &type)) != 0) 459 if ((r = sshbuf_get_u8(msg, &type)) != 0)
460 goto out; 460 goto out;
diff --git a/krl.c b/krl.c
index 4075df853..570a4f747 100644
--- a/krl.c
+++ b/krl.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: krl.c,v 1.33 2015/07/03 03:43:18 djm Exp $ */ 17/* $OpenBSD: krl.c,v 1.34 2015/09/02 07:51:12 jsg Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
@@ -723,7 +723,7 @@ ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf,
723 if ((r = sshbuf_put(buf, KRL_MAGIC, sizeof(KRL_MAGIC) - 1)) != 0 || 723 if ((r = sshbuf_put(buf, KRL_MAGIC, sizeof(KRL_MAGIC) - 1)) != 0 ||
724 (r = sshbuf_put_u32(buf, KRL_FORMAT_VERSION)) != 0 || 724 (r = sshbuf_put_u32(buf, KRL_FORMAT_VERSION)) != 0 ||
725 (r = sshbuf_put_u64(buf, krl->krl_version)) != 0 || 725 (r = sshbuf_put_u64(buf, krl->krl_version)) != 0 ||
726 (r = sshbuf_put_u64(buf, krl->generated_date) != 0) || 726 (r = sshbuf_put_u64(buf, krl->generated_date)) != 0 ||
727 (r = sshbuf_put_u64(buf, krl->flags)) != 0 || 727 (r = sshbuf_put_u64(buf, krl->flags)) != 0 ||
728 (r = sshbuf_put_string(buf, NULL, 0)) != 0 || 728 (r = sshbuf_put_string(buf, NULL, 0)) != 0 ||
729 (r = sshbuf_put_cstring(buf, krl->comment)) != 0) 729 (r = sshbuf_put_cstring(buf, krl->comment)) != 0)
diff --git a/monitor.c b/monitor.c
index 934898392..e912a89cf 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.c,v 1.151 2015/08/21 23:29:31 deraadt Exp $ */ 1/* $OpenBSD: monitor.c,v 1.152 2015/09/02 07:51:12 jsg Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -722,7 +722,7 @@ mm_answer_sign(int sock, Buffer *m)
722 fatal("%s: sshbuf_new", __func__); 722 fatal("%s: sshbuf_new", __func__);
723 if ((r = sshbuf_put_cstring(sigbuf, proof_req)) != 0 || 723 if ((r = sshbuf_put_cstring(sigbuf, proof_req)) != 0 ||
724 (r = sshbuf_put_string(sigbuf, session_id2, 724 (r = sshbuf_put_string(sigbuf, session_id2,
725 session_id2_len) != 0) || 725 session_id2_len)) != 0 ||
726 (r = sshkey_puts(key, sigbuf)) != 0) 726 (r = sshkey_puts(key, sigbuf)) != 0)
727 fatal("%s: couldn't prepare private key " 727 fatal("%s: couldn't prepare private key "
728 "proof buffer: %s", __func__, ssh_err(r)); 728 "proof buffer: %s", __func__, ssh_err(r));
diff --git a/sshkey.c b/sshkey.c
index 32dd8f225..1f714c37f 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.21 2015/08/19 23:19:01 djm Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.22 2015/09/02 07:51:12 jsg Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -1717,7 +1717,7 @@ sshkey_cert_copy(const struct sshkey *from_key, struct sshkey *to_key)
1717 1717
1718 if ((ret = sshbuf_putb(to->certblob, from->certblob)) != 0 || 1718 if ((ret = sshbuf_putb(to->certblob, from->certblob)) != 0 ||
1719 (ret = sshbuf_putb(to->critical, from->critical)) != 0 || 1719 (ret = sshbuf_putb(to->critical, from->critical)) != 0 ||
1720 (ret = sshbuf_putb(to->extensions, from->extensions) != 0)) 1720 (ret = sshbuf_putb(to->extensions, from->extensions)) != 0)
1721 return ret; 1721 return ret;
1722 1722
1723 to->serial = from->serial; 1723 to->serial = from->serial;
@@ -2701,7 +2701,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2701 goto out; 2701 goto out;
2702 } 2702 }
2703 if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa), 2703 if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa),
2704 EC_KEY_get0_public_key(k->ecdsa)) != 0) || 2704 EC_KEY_get0_public_key(k->ecdsa))) != 0 ||
2705 (r = sshkey_ec_validate_private(k->ecdsa)) != 0) 2705 (r = sshkey_ec_validate_private(k->ecdsa)) != 0)
2706 goto out; 2706 goto out;
2707 break; 2707 break;
@@ -2719,7 +2719,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2719 goto out; 2719 goto out;
2720 } 2720 }
2721 if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa), 2721 if ((r = sshkey_ec_validate_public(EC_KEY_get0_group(k->ecdsa),
2722 EC_KEY_get0_public_key(k->ecdsa)) != 0) || 2722 EC_KEY_get0_public_key(k->ecdsa))) != 0 ||
2723 (r = sshkey_ec_validate_private(k->ecdsa)) != 0) 2723 (r = sshkey_ec_validate_private(k->ecdsa)) != 0)
2724 goto out; 2724 goto out;
2725 break; 2725 break;
@@ -2741,10 +2741,10 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2741 case KEY_RSA_CERT: 2741 case KEY_RSA_CERT:
2742 if ((r = sshkey_froms(buf, &k)) != 0 || 2742 if ((r = sshkey_froms(buf, &k)) != 0 ||
2743 (r = sshkey_add_private(k)) != 0 || 2743 (r = sshkey_add_private(k)) != 0 ||
2744 (r = sshbuf_get_bignum2(buf, k->rsa->d) != 0) || 2744 (r = sshbuf_get_bignum2(buf, k->rsa->d)) != 0 ||
2745 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp) != 0) || 2745 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp)) != 0 ||
2746 (r = sshbuf_get_bignum2(buf, k->rsa->p) != 0) || 2746 (r = sshbuf_get_bignum2(buf, k->rsa->p)) != 0 ||
2747 (r = sshbuf_get_bignum2(buf, k->rsa->q) != 0) || 2747 (r = sshbuf_get_bignum2(buf, k->rsa->q)) != 0 ||
2748 (r = rsa_generate_additional_parameters(k->rsa)) != 0) 2748 (r = rsa_generate_additional_parameters(k->rsa)) != 0)
2749 goto out; 2749 goto out;
2750 break; 2750 break;
@@ -3431,9 +3431,9 @@ sshkey_private_rsa1_to_blob(struct sshkey *key, struct sshbuf *blob,
3431 3431
3432 /* Store public key. This will be in plain text. */ 3432 /* Store public key. This will be in plain text. */
3433 if ((r = sshbuf_put_u32(encrypted, BN_num_bits(key->rsa->n))) != 0 || 3433 if ((r = sshbuf_put_u32(encrypted, BN_num_bits(key->rsa->n))) != 0 ||
3434 (r = sshbuf_put_bignum1(encrypted, key->rsa->n) != 0) || 3434 (r = sshbuf_put_bignum1(encrypted, key->rsa->n)) != 0 ||
3435 (r = sshbuf_put_bignum1(encrypted, key->rsa->e) != 0) || 3435 (r = sshbuf_put_bignum1(encrypted, key->rsa->e)) != 0 ||
3436 (r = sshbuf_put_cstring(encrypted, comment) != 0)) 3436 (r = sshbuf_put_cstring(encrypted, comment)) != 0)
3437 goto out; 3437 goto out;
3438 3438
3439 /* Allocate space for the private part of the key in the buffer. */ 3439 /* Allocate space for the private part of the key in the buffer. */