net-libs/libssh2: Version 1.9.0
authorJeroen Roovers <jer@gentoo.org>
Mon, 24 Jun 2019 09:06:13 +0000 (11:06 +0200)
committerJeroen Roovers <jer@gentoo.org>
Mon, 24 Jun 2019 09:08:06 +0000 (11:08 +0200)
Package-Manager: Portage-2.3.67, Repoman-2.3.16
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
net-libs/libssh2/Manifest
net-libs/libssh2/files/libssh2-1.9.0-missing.patch [new file with mode: 0644]
net-libs/libssh2/libssh2-1.9.0.ebuild [new file with mode: 0644]
net-libs/libssh2/libssh2-9999.ebuild

index f5809249d6dcb95efdff6f99d21dbeaff9938b6e..3750c1955eb78454cc9622d94e08c5e4c42791cc 100644 (file)
@@ -1,2 +1,3 @@
 DIST libssh2-1.8.0.tar.gz 854916 BLAKE2B 618c4a19789f2e5eda85852760dffff5672d420d2fa50393b05b7398a1913f74e5f6695f078628050ac9851965d6e45cf410b7c4590a8f18d67c718c829ab352 SHA512 289aa45c4f99653bebf5f99565fe9c519abc204feb2084b47b7cc3badc8bf4ecdedd49ea6acdce8eb902b3c00995d5f92a3ca77b2508b92f04ae0e7de7287558
 DIST libssh2-1.8.2.tar.gz 859587 BLAKE2B 58e0854e83001c424a767ceb4ddfb535373320d8319aa632244dc14434276db7c8b7a77d4a5f22fe8e397f1050b33516d2fca1162658a9f414166f560bc1f358 SHA512 390ab4ad93bb738415ec11a6eb92806c9b9e9e5d8ee7c442d841a58b4292c1c447a9bc99e153ba464e2e11f9c0d1913469303598c3046722d1ae821991e8cb93
+DIST libssh2-1.9.0.tar.gz 888551 BLAKE2B 7bce5cd38b88654f0ca0f8b562e4bddc56346e3359e5873000cad7619607b2ec01c3945112dd8815d5de6daf650a750a4727cebe7d8996cc62f07ded06f3235f SHA512 41a3ebcf84e32eab69b7411ffb0a3b6e6db71491c968602b17392cfe3490ef00239726ec28acb3d25bf0ed62700db7f4d0bb5a9175618f413865f40badca6e17
diff --git a/net-libs/libssh2/files/libssh2-1.9.0-missing.patch b/net-libs/libssh2/files/libssh2-1.9.0-missing.patch
new file mode 100644 (file)
index 0000000..7cc58d2
--- /dev/null
@@ -0,0 +1,181 @@
+--- /dev/null
++++ b/tests/test_public_key_auth_succeeds_with_correct_ed25519_key.c
+@@ -0,0 +1,37 @@
++#include "session_fixture.h"
++
++#include <libssh2.h>
++
++#include <stdio.h>
++
++static const char *USERNAME = "libssh2"; /* configured in Dockerfile */
++static const char *KEY_FILE_PRIVATE = "key_ed25519";
++static const char *KEY_FILE_PUBLIC = "key_ed25519.pub"; /* configured in Dockerfile */
++
++int test(LIBSSH2_SESSION *session)
++{
++    int rc;
++    const char *userauth_list = NULL;
++
++    userauth_list = libssh2_userauth_list(session, USERNAME, strlen(USERNAME));
++    if(userauth_list == NULL) {
++        print_last_session_error("libssh2_userauth_list");
++        return 1;
++    }
++
++    if(strstr(userauth_list, "publickey") == NULL) {
++        fprintf(stderr, "'publickey' was expected in userauth list: %s\n",
++                userauth_list);
++        return 1;
++    }
++
++    rc = libssh2_userauth_publickey_fromfile_ex(
++        session, USERNAME, strlen(USERNAME), KEY_FILE_PUBLIC, KEY_FILE_PRIVATE,
++        NULL);
++    if(rc != 0) {
++        print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
++        return 1;
++    }
++
++    return 0;
++}
+--- /dev/null
++++ b/tests/test_public_key_auth_succeeds_with_correct_encrypted_ed25519_key.c
+@@ -0,0 +1,38 @@
++#include "session_fixture.h"
++
++#include <libssh2.h>
++
++#include <stdio.h>
++
++static const char *USERNAME = "libssh2"; /* configured in Dockerfile */
++static const char *PASSWORD = "libssh2";
++static const char *KEY_FILE_PRIVATE = "key_ed25519_encrypted";
++static const char *KEY_FILE_PUBLIC = "key_ed25519_encrypted.pub"; /* configured in Dockerfile */
++
++int test(LIBSSH2_SESSION *session)
++{
++    int rc;
++    const char *userauth_list = NULL;
++
++    userauth_list = libssh2_userauth_list(session, USERNAME, strlen(USERNAME));
++    if(userauth_list == NULL) {
++        print_last_session_error("libssh2_userauth_list");
++        return 1;
++    }
++
++    if(strstr(userauth_list, "publickey") == NULL) {
++        fprintf(stderr, "'publickey' was expected in userauth list: %s\n",
++                userauth_list);
++        return 1;
++    }
++
++    rc = libssh2_userauth_publickey_fromfile_ex(
++        session, USERNAME, strlen(USERNAME), KEY_FILE_PUBLIC, KEY_FILE_PRIVATE,
++        PASSWORD);
++    if(rc != 0) {
++        print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
++        return 1;
++    }
++
++    return 0;
++}
+--- /dev/null
++++ b/tests/test_public_key_auth_succeeds_with_correct_ed25519_key_from_mem.c
+@@ -0,0 +1,97 @@
++#include "session_fixture.h"
++
++#include <libssh2.h>
++
++#include <stdio.h>
++#include <stdlib.h>
++
++static const char *USERNAME = "libssh2"; /* configured in Dockerfile */
++static const char *KEY_FILE_ED25519_PRIVATE = "key_ed25519";
++
++int read_file(const char *path, char **buf, size_t *len);
++
++int test(LIBSSH2_SESSION *session)
++{
++    int rc;
++    FILE *fp = NULL;
++    char *buffer = NULL;
++    size_t len = 0;
++    const char *userauth_list = NULL;
++
++    userauth_list = libssh2_userauth_list(session, USERNAME, strlen(USERNAME));
++    if(userauth_list == NULL) {
++        print_last_session_error("libssh2_userauth_list");
++        return 1;
++    }
++
++    if(strstr(userauth_list, "publickey") == NULL) {
++        fprintf(stderr, "'publickey' was expected in userauth list: %s\n",
++                userauth_list);
++        return 1;
++    }
++
++    if(read_file(KEY_FILE_ED25519_PRIVATE, &buffer, &len)) {
++        fprintf(stderr, "Reading key file failed.");
++        return 1;
++    }
++
++    rc = libssh2_userauth_publickey_frommemory(session, USERNAME, strlen(USERNAME),
++                                               NULL, 0, buffer, len, NULL);
++
++    free(buffer);
++
++    if(rc != 0) {
++        print_last_session_error("libssh2_userauth_publickey_fromfile_ex");
++        return 1;
++    }
++
++    return 0;
++}
++
++int read_file(const char *path, char **out_buffer, size_t *out_len)
++{
++    int rc;
++    FILE *fp = NULL;
++    char *buffer = NULL;
++    size_t len = 0;
++
++    if(out_buffer == NULL || out_len == NULL || path == NULL) {
++        fprintf(stderr, "invalid params.");
++        return 1;
++    }
++
++    *out_buffer = NULL;
++    *out_len = 0;
++
++    fp = fopen(path, "r");
++
++    if(!fp) {
++       fprintf(stderr, "File could not be read.");
++       return 1;
++    }
++
++    fseek(fp, 0L, SEEK_END);
++    len = ftell(fp);
++    rewind(fp);
++
++    buffer = calloc(1, len + 1);
++    if(!buffer) {
++       fclose(fp);
++       fprintf(stderr, "Could not alloc memory.");
++       return 1;
++    }
++
++    if(1 != fread(buffer, len, 1, fp)) {
++       fclose(fp);
++       free(buffer);
++       fprintf(stderr, "Could not read file into memory.");
++       return 1;
++    }
++
++    fclose(fp);
++
++    *out_buffer = buffer;
++    *out_len = len;
++
++    return 0;
++}
diff --git a/net-libs/libssh2/libssh2-1.9.0.ebuild b/net-libs/libssh2/libssh2-1.9.0.ebuild
new file mode 100644 (file)
index 0000000..12ad74f
--- /dev/null
@@ -0,0 +1,57 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit cmake-multilib
+
+DESCRIPTION="Library implementing the SSH2 protocol"
+HOMEPAGE="https://www.libssh2.org"
+SRC_URI="https://www.${PN}.org/download/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-solaris"
+IUSE="gcrypt libressl mbedtls zlib"
+REQUIRED_USE="?? ( gcrypt mbedtls )"
+RESTRICT="test"
+
+RDEPEND="
+       gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] )
+       !gcrypt? (
+               mbedtls? ( net-libs/mbedtls[${MULTILIB_USEDEP}] )
+               !mbedtls? (
+                       !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+                       libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
+               )
+       )
+       zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
+"
+DEPEND="
+       ${RDEPEND}
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.8.0-mansyntax_sh.patch
+       "${FILESDIR}"/${PN}-1.9.0-missing.patch
+)
+
+multilib_src_configure() {
+       local crypto_backend=OpenSSL
+       if use gcrypt; then
+               crypto_backend=Libgcrypt
+       elif use mbedtls; then
+               crypto_backend=mbedTLS
+       fi
+
+       local mycmakeargs=(
+               -DBUILD_SHARED_LIBS=ON
+               -DCRYPTO_BACKEND=${crypto_backend}
+               -DENABLE_ZLIB_COMPRESSION=$(usex zlib)
+       )
+       cmake-utils_src_configure
+}
+
+multilib_src_install_all() {
+       einstalldocs
+       find "${ED}" -name '*.la' -delete || die
+}
index d1797b7dcfa7850974aba79f406292e0adeb9fa2..5bf05457d9add71a0f086f6ffb1619b0e470b5fc 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
 inherit git-r3 cmake-multilib
 
 DESCRIPTION="Library implementing the SSH2 protocol"
@@ -53,6 +53,4 @@ multilib_src_configure() {
 multilib_src_install_all() {
        einstalldocs
        find "${ED}" -name '*.la' -delete || die
-       mv "${ED}"/usr/share/doc/${PN}/* "${ED}"/usr/share/doc/${PF}/ || die
-       rm -r "${ED}"/usr/share/doc/${PN}/ || die
 }