aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/regress/unittests/misc/test_hpdelim.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-04-13 20:00:56 +0000
committerEd Maste <emaste@FreeBSD.org>2022-04-13 20:00:56 +0000
commit1323ec571215a77ddd21294f0871979d5ad6b992 (patch)
tree19d67138a6330f9ec39a96fece07fb0f410d7ab6 /crypto/openssh/regress/unittests/misc/test_hpdelim.c
parent595ac4a11893971ba17a51e0477d580e29e1ef7a (diff)
parent85d1f2d493556f113b3f1f4b1800ace6656627ad (diff)
downloadsrc-1323ec571215a77ddd21294f0871979d5ad6b992.tar.gz
src-1323ec571215a77ddd21294f0871979d5ad6b992.zip
ssh: update to OpenSSH v8.9p1
Release notes are available at https://www.openssh.com/txt/release-8.9 Some highlights: * ssh(1), sshd(8), ssh-add(1), ssh-agent(1): add a system for restricting forwarding and use of keys added to ssh-agent(1) * ssh(1), sshd(8): add the sntrup761x25519-sha512@openssh.com hybrid ECDH/x25519 + Streamlined NTRU Prime post-quantum KEX to the default KEXAlgorithms list (after the ECDH methods but before the prime-group DH ones). The next release of OpenSSH is likely to make this key exchange the default method. * sshd(8), portable OpenSSH only: this release removes in-built support for MD5-hashed passwords. If you require these on your system then we recommend linking against libxcrypt or similar. Future deprecation notice ========================= A near-future release of OpenSSH will switch scp(1) from using the legacy scp/rcp protocol to using SFTP by default. Legacy scp/rcp performs wildcard expansion of remote filenames (e.g. "scp host:* .") through the remote shell. This has the side effect of requiring double quoting of shell meta-characters in file names included on scp(1) command-lines, otherwise they could be interpreted as shell commands on the remote side. MFC after: 1 month Relnotes: Yes Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'crypto/openssh/regress/unittests/misc/test_hpdelim.c')
-rw-r--r--crypto/openssh/regress/unittests/misc/test_hpdelim.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/crypto/openssh/regress/unittests/misc/test_hpdelim.c b/crypto/openssh/regress/unittests/misc/test_hpdelim.c
new file mode 100644
index 000000000000..d423023dc3d2
--- /dev/null
+++ b/crypto/openssh/regress/unittests/misc/test_hpdelim.c
@@ -0,0 +1,82 @@
+/* $OpenBSD: test_hpdelim.c,v 1.2 2022/02/06 22:58:33 dtucker Exp $ */
+/*
+ * Regress test for misc hpdelim() and co
+ *
+ * Placed in the public domain.
+ */
+
+#include "includes.h"
+
+#include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+
+#include "../test_helper/test_helper.h"
+
+#include "log.h"
+#include "misc.h"
+#include "xmalloc.h"
+
+void test_hpdelim(void);
+
+void
+test_hpdelim(void)
+{
+ char *orig, *str, *cp, *port;
+
+#define START_STRING(x) orig = str = xstrdup(x)
+#define DONE_STRING() free(orig)
+
+ TEST_START("hpdelim host only");
+ START_STRING("host");
+ cp = hpdelim(&str);
+ ASSERT_STRING_EQ(cp, "host");
+ ASSERT_PTR_EQ(str, NULL);
+ DONE_STRING();
+ TEST_DONE();
+
+ TEST_START("hpdelim :port");
+ START_STRING(":1234");
+ cp = hpdelim(&str);
+ ASSERT_STRING_EQ(cp, "");
+ ASSERT_PTR_NE(str, NULL);
+ port = hpdelim(&str);
+ ASSERT_STRING_EQ(port, "1234");
+ ASSERT_PTR_EQ(str, NULL);
+ DONE_STRING();
+ TEST_DONE();
+
+ TEST_START("hpdelim host:port");
+ START_STRING("host:1234");
+ cp = hpdelim(&str);
+ ASSERT_STRING_EQ(cp, "host");
+ ASSERT_PTR_NE(str, NULL);
+ port = hpdelim(&str);
+ ASSERT_STRING_EQ(port, "1234");
+ ASSERT_PTR_EQ(str, NULL);
+ DONE_STRING();
+ TEST_DONE();
+
+ TEST_START("hpdelim [host]:port");
+ START_STRING("[::1]:1234");
+ cp = hpdelim(&str);
+ ASSERT_STRING_EQ(cp, "[::1]");
+ ASSERT_PTR_NE(str, NULL);
+ port = hpdelim(&str);
+ ASSERT_STRING_EQ(port, "1234");
+ ASSERT_PTR_EQ(str, NULL);
+ DONE_STRING();
+ TEST_DONE();
+
+ TEST_START("hpdelim missing ] error");
+ START_STRING("[::1:1234");
+ cp = hpdelim(&str);
+ ASSERT_PTR_EQ(cp, NULL);
+ DONE_STRING();
+ TEST_DONE();
+
+}