[kde-runtime] backport support for libssh 0.6 and ECDSA keys (kde#327024) from master/4.13

Kevin Kofler kkofler at fedoraproject.org
Fri Jan 10 16:13:33 UTC 2014


commit d9ce74d1a80c18a4d978b4b9af447c9d56e5283d
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Fri Jan 10 17:13:30 2014 +0100

    backport support for libssh 0.6 and ECDSA keys (kde#327024) from master/4.13
    
    * Fri Jan 10 2014 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.12.0-3
    - backport support for libssh 0.6 and ECDSA keys (kde#327024) from master/4.13

 ...libssh-0.6-0001-kio_sftp-Fix-error-values.patch |   90 ++++++++++
 ...002-kio_sftp-Fix-printing-dest-in-the-log.patch |   34 ++++
 ...bssh-0.6-0003-kio_sftp-Support-ECDSA-keys.patch |  154 ++++++++++++++++
 ...-cmake-Fix-version-checking-in-FindLibSSH.patch |  185 ++++++++++++++++++++
 kde-runtime.spec                                   |   19 ++-
 5 files changed, 479 insertions(+), 3 deletions(-)
---
diff --git a/kde-runtime-4.12.0-libssh-0.6-0001-kio_sftp-Fix-error-values.patch b/kde-runtime-4.12.0-libssh-0.6-0001-kio_sftp-Fix-error-values.patch
new file mode 100644
index 0000000..3306412
--- /dev/null
+++ b/kde-runtime-4.12.0-libssh-0.6-0001-kio_sftp-Fix-error-values.patch
@@ -0,0 +1,90 @@
+From 08f5bb92a5435b6c6c052fb11712a6dce2fcd61d Mon Sep 17 00:00:00 2001
+Message-Id: <08f5bb92a5435b6c6c052fb11712a6dce2fcd61d.1389369771.git.kevin.kofler at chello.at>
+From: Andreas Schneider <asn at cryptomilk.org>
+Date: Fri, 27 Sep 2013 12:13:43 +0200
+Subject: [PATCH 1/4] kio_sftp: Fix error values.
+
+---
+ kioslave/sftp/kio_sftp.cpp | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/kioslave/sftp/kio_sftp.cpp b/kioslave/sftp/kio_sftp.cpp
+index 37b1810..ff95588 100644
+--- a/kioslave/sftp/kio_sftp.cpp
++++ b/kioslave/sftp/kio_sftp.cpp
+@@ -503,7 +503,7 @@ bool sftpProtocol::sftpOpenConnection (const AuthInfo& info)
+ {
+   mSession = ssh_new();
+   if (mSession == NULL) {
+-    error(KIO::ERR_INTERNAL, i18n("Could not create a new SSH session."));
++    error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not create a new SSH session."));
+     return false;
+   }
+ 
+@@ -514,39 +514,39 @@ bool sftpProtocol::sftpOpenConnection (const AuthInfo& info)
+   // Set timeout
+   int rc = ssh_options_set(mSession, SSH_OPTIONS_TIMEOUT, &timeout_sec);
+   if (rc < 0) {
+-    error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set a timeout."));
++    error(KIO::ERR_INTERNAL, i18n("Could not set a timeout."));
+     return false;
+   }
+   rc = ssh_options_set(mSession, SSH_OPTIONS_TIMEOUT_USEC, &timeout_usec);
+   if (rc < 0) {
+-    error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set a timeout."));
++    error(KIO::ERR_INTERNAL, i18n("Could not set a timeout."));
+     return false;
+   }
+ 
+   // Don't use any compression
+   rc = ssh_options_set(mSession, SSH_OPTIONS_COMPRESSION_C_S, "none");
+   if (rc < 0) {
+-    error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set compression."));
++    error(KIO::ERR_INTERNAL, i18n("Could not set compression."));
+     return false;
+   }
+ 
+   rc = ssh_options_set(mSession, SSH_OPTIONS_COMPRESSION_S_C, "none");
+   if (rc < 0) {
+-    error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set compression."));
++    error(KIO::ERR_INTERNAL, i18n("Could not set compression."));
+     return false;
+   }
+ 
+   // Set host and port
+   rc = ssh_options_set(mSession, SSH_OPTIONS_HOST, mHost.toUtf8().constData());
+   if (rc < 0) {
+-    error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set host."));
++    error(KIO::ERR_INTERNAL, i18n("Could not set host."));
+     return false;
+   }
+ 
+   if (mPort > 0) {
+     rc = ssh_options_set(mSession, SSH_OPTIONS_PORT, &mPort);
+     if (rc < 0) {
+-        error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set port."));
++        error(KIO::ERR_INTERNAL, i18n("Could not set port."));
+       return false;
+     }
+   }
+@@ -555,7 +555,7 @@ bool sftpProtocol::sftpOpenConnection (const AuthInfo& info)
+   if (!info.username.isEmpty()) {
+     rc = ssh_options_set(mSession, SSH_OPTIONS_USER, info.username.toUtf8().constData());
+     if (rc < 0) {
+-      error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set username."));
++      error(KIO::ERR_INTERNAL, i18n("Could not set username."));
+       return false;
+     }
+   }
+@@ -564,7 +564,7 @@ bool sftpProtocol::sftpOpenConnection (const AuthInfo& info)
+   if (verbosity) {
+     rc = ssh_options_set(mSession, SSH_OPTIONS_LOG_VERBOSITY_STR, verbosity);
+     if (rc < 0) {
+-      error(KIO::ERR_OUT_OF_MEMORY, i18n("Could not set log verbosity."));
++      error(KIO::ERR_INTERNAL, i18n("Could not set log verbosity."));
+       return false;
+     }
+   }
+-- 
+1.8.1.4
+
diff --git a/kde-runtime-4.12.0-libssh-0.6-0002-kio_sftp-Fix-printing-dest-in-the-log.patch b/kde-runtime-4.12.0-libssh-0.6-0002-kio_sftp-Fix-printing-dest-in-the-log.patch
new file mode 100644
index 0000000..cfbe2e7
--- /dev/null
+++ b/kde-runtime-4.12.0-libssh-0.6-0002-kio_sftp-Fix-printing-dest-in-the-log.patch
@@ -0,0 +1,34 @@
+From 09f175638ce93ec4e4cac09d7d020ef3d34625f4 Mon Sep 17 00:00:00 2001
+Message-Id: <09f175638ce93ec4e4cac09d7d020ef3d34625f4.1389369771.git.kevin.kofler at chello.at>
+In-Reply-To: <08f5bb92a5435b6c6c052fb11712a6dce2fcd61d.1389369771.git.kevin.kofler at chello.at>
+References: <08f5bb92a5435b6c6c052fb11712a6dce2fcd61d.1389369771.git.kevin.kofler at chello.at>
+From: Andreas Schneider <asn at cryptomilk.org>
+Date: Thu, 9 Jan 2014 09:07:52 +0100
+Subject: [PATCH 2/4] kio_sftp: Fix printing dest in the log.
+
+---
+ kioslave/sftp/kio_sftp.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/kioslave/sftp/kio_sftp.cpp b/kioslave/sftp/kio_sftp.cpp
+index ff95588..8c34faa 100644
+--- a/kioslave/sftp/kio_sftp.cpp
++++ b/kioslave/sftp/kio_sftp.cpp
+@@ -1364,12 +1364,12 @@ sftpProtocol::StatusCode sftpProtocol::sftpPut(const KUrl& url, int permissions,
+             initialMode = 0644;
+           }
+ 
+-          kDebug(KIO_SFTP_DB) << "Trying to open:" << dest << ", mode=" << QString::number(initialMode);
++          kDebug(KIO_SFTP_DB) << "Trying to open:" << QString(dest) << ", mode=" << QString::number(initialMode);
+           file = sftp_open(mSftp, dest.constData(), O_CREAT | O_TRUNC | O_WRONLY, initialMode);
+         } // flags & KIO::Resume
+ 
+         if (file == NULL) {
+-          kDebug(KIO_SFTP_DB) << "COULD NOT WRITE " << dest
++          kDebug(KIO_SFTP_DB) << "COULD NOT WRITE " << QString(dest)
+                               << ", permissions=" << permissions
+                               << ", error=" << ssh_get_error(mSession);
+           if (sftp_get_error(mSftp) == SSH_FX_PERMISSION_DENIED) {
+-- 
+1.8.1.4
+
diff --git a/kde-runtime-4.12.0-libssh-0.6-0003-kio_sftp-Support-ECDSA-keys.patch b/kde-runtime-4.12.0-libssh-0.6-0003-kio_sftp-Support-ECDSA-keys.patch
new file mode 100644
index 0000000..ad97fa5
--- /dev/null
+++ b/kde-runtime-4.12.0-libssh-0.6-0003-kio_sftp-Support-ECDSA-keys.patch
@@ -0,0 +1,154 @@
+From 40076246be995cc006a12f8afc2c18cfacbf0604 Mon Sep 17 00:00:00 2001
+Message-Id: <40076246be995cc006a12f8afc2c18cfacbf0604.1389369771.git.kevin.kofler at chello.at>
+In-Reply-To: <08f5bb92a5435b6c6c052fb11712a6dce2fcd61d.1389369771.git.kevin.kofler at chello.at>
+References: <08f5bb92a5435b6c6c052fb11712a6dce2fcd61d.1389369771.git.kevin.kofler at chello.at>
+From: Andreas Schneider <asn at cryptomilk.org>
+Date: Thu, 9 Jan 2014 10:19:06 +0100
+Subject: [PATCH 3/4] kio_sftp: Support ECDSA keys.
+
+This migrates to the API of libssh 0.6.0.
+
+BUG: 327024
+---
+ kioslave/CMakeLists.txt    |  2 +-
+ kioslave/sftp/kio_sftp.cpp | 47 ++++++++++++++++++++++++++++++++++++----------
+ 2 files changed, 38 insertions(+), 11 deletions(-)
+
+diff --git a/kioslave/CMakeLists.txt b/kioslave/CMakeLists.txt
+index 026ae9b..b150290 100644
+--- a/kioslave/CMakeLists.txt
++++ b/kioslave/CMakeLists.txt
+@@ -11,7 +11,7 @@ set_package_properties(Samba PROPERTIES DESCRIPTION "the SMB client library, a v
+                       )
+ endif(NOT WIN32)
+ 
+-macro_optional_find_package(LibSSH 0.4.0)
++macro_optional_find_package(LibSSH 0.6.0)
+ set_package_properties(LibSSH PROPERTIES DESCRIPTION "the SSH library with SFTP support"
+                        URL "http://www.libssh.org/"
+                        TYPE OPTIONAL
+diff --git a/kioslave/sftp/kio_sftp.cpp b/kioslave/sftp/kio_sftp.cpp
+index 8c34faa..14bcaf6 100644
+--- a/kioslave/sftp/kio_sftp.cpp
++++ b/kioslave/sftp/kio_sftp.cpp
+@@ -632,8 +632,10 @@ void sftpProtocol::openConnection() {
+   QString msg;     // msg for dialog box
+   QString caption; // dialog box caption
+   unsigned char *hash = NULL; // the server hash
++  ssh_key srv_pubkey;
+   char *hexa;
+-  int rc, state, hlen;
++  size_t hlen;
++  int rc, state;
+ 
+   // Attempt to start a ssh session and establish a connection with the server.
+   if (!sftpOpenConnection(info)) {
+@@ -643,13 +645,25 @@ void sftpProtocol::openConnection() {
+   kDebug(KIO_SFTP_DB) << "Getting the SSH server hash";
+ 
+   /* get the hash */
+-  hlen = ssh_get_pubkey_hash(mSession, &hash);
+-  if (hlen < 0) {
++  rc = ssh_get_publickey(mSession, &srv_pubkey);
++  if (rc < 0) {
+     error(KIO::ERR_SLAVE_DEFINED, QString::fromUtf8(ssh_get_error(mSession)));
+     closeConnection();
+     return;
+   }
+ 
++  rc = ssh_get_publickey_hash(srv_pubkey,
++                              SSH_PUBLICKEY_HASH_SHA1,
++                              &hash,
++                              &hlen);
++  ssh_key_free(srv_pubkey);
++  if (rc < 0) {
++    error(KIO::ERR_SLAVE_DEFINED,
++          i18n("Could not create hash from server public key"));
++    closeConnection();
++    return;
++  }
++
+   kDebug(KIO_SFTP_DB) << "Checking if the SSH server is known";
+ 
+   /* check the server public key hash */
+@@ -658,7 +672,7 @@ void sftpProtocol::openConnection() {
+     case SSH_SERVER_KNOWN_OK:
+       break;
+     case SSH_SERVER_FOUND_OTHER:
+-      delete hash;
++      ssh_string_free_char((char *)hash);
+       error(KIO::ERR_SLAVE_DEFINED, i18n("The host key for this server was "
+             "not found, but another type of key exists.\n"
+             "An attacker might change the default server key to confuse your "
+@@ -668,7 +682,7 @@ void sftpProtocol::openConnection() {
+       return;
+     case SSH_SERVER_KNOWN_CHANGED:
+       hexa = ssh_get_hexa(hash, hlen);
+-      delete hash;
++      ssh_string_free_char((char *)hash);
+       /* TODO print known_hosts file, port? */
+       error(KIO::ERR_SLAVE_DEFINED, i18n("The host key for the server %1 has changed.\n"
+           "This could either mean that DNS SPOOFING is happening or the IP "
+@@ -676,18 +690,18 @@ void sftpProtocol::openConnection() {
+           "The fingerprint for the key sent by the remote host is:\n %2\n"
+           "Please contact your system administrator.\n%3",
+           mHost, QString::fromUtf8(hexa), QString::fromUtf8(ssh_get_error(mSession))));
+-      delete hexa;
++      ssh_string_free_char(hexa);
+       closeConnection();
+       return;
+     case SSH_SERVER_FILE_NOT_FOUND:
+     case SSH_SERVER_NOT_KNOWN:
+       hexa = ssh_get_hexa(hash, hlen);
+-      delete hash;
++      ssh_string_free_char((char *)hash);
+       caption = i18n("Warning: Cannot verify host's identity.");
+       msg = i18n("The authenticity of host %1 cannot be established.\n"
+         "The key fingerprint is: %2\n"
+         "Are you sure you want to continue connecting?", mHost, hexa);
+-      delete hexa;
++      ssh_string_free_char(hexa);
+ 
+       if (KMessageBox::Yes != messageBox(WarningYesNo, msg, caption)) {
+         closeConnection();
+@@ -704,7 +718,7 @@ void sftpProtocol::openConnection() {
+       }
+       break;
+     case SSH_SERVER_ERROR:
+-      delete hash;
++      ssh_string_free_char((char *)hash);
+       error(KIO::ERR_SLAVE_DEFINED, QString::fromUtf8(ssh_get_error(mSession)));
+       return;
+   }
+@@ -732,7 +746,7 @@ void sftpProtocol::openConnection() {
+   if (rc != SSH_AUTH_SUCCESS && (method & SSH_AUTH_METHOD_PUBLICKEY)) {
+     kDebug(KIO_SFTP_DB) << "Trying to authenticate with public key";
+     for(;;) {
+-      rc = ssh_userauth_autopubkey(mSession, NULL);
++      rc = ssh_userauth_publickey_auto(mSession, NULL, NULL);
+       if (rc == SSH_AUTH_ERROR) {
+         kDebug(KIO_SFTP_DB) << "Public key authentication failed:" <<
+                 QString::fromUtf8(ssh_get_error(mSession));
+@@ -747,6 +761,19 @@ void sftpProtocol::openConnection() {
+     }
+   }
+ 
++  // Try to authenticate with GSSAPI
++  if (rc != SSH_AUTH_SUCCESS && (method & SSH_AUTH_METHOD_GSSAPI_MIC)) {
++      kDebug(KIO_SFTP_DB) << "Trying to authenticate with GSSAPI";
++      rc = ssh_userauth_gssapi(mSession);
++      if (rc == SSH_AUTH_ERROR) {
++          kDebug(KIO_SFTP_DB) << "Public key authentication failed:" <<
++                 QString::fromUtf8(ssh_get_error(mSession));
++          closeConnection();
++          error(KIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed."));
++          return;
++      }
++  }
++
+   // Try to authenticate with keyboard interactive
+   if (rc != SSH_AUTH_SUCCESS && (method & SSH_AUTH_METHOD_INTERACTIVE)) {
+     kDebug(KIO_SFTP_DB) << "Trying to authenticate with keyboard interactive";
+-- 
+1.8.1.4
+
diff --git a/kde-runtime-4.12.0-libssh-0.6-0004-cmake-Fix-version-checking-in-FindLibSSH.patch b/kde-runtime-4.12.0-libssh-0.6-0004-cmake-Fix-version-checking-in-FindLibSSH.patch
new file mode 100644
index 0000000..40d1034
--- /dev/null
+++ b/kde-runtime-4.12.0-libssh-0.6-0004-cmake-Fix-version-checking-in-FindLibSSH.patch
@@ -0,0 +1,185 @@
+From 6e8fe646f0eb824f2fcd55699e24858255fe090a Mon Sep 17 00:00:00 2001
+Message-Id: <6e8fe646f0eb824f2fcd55699e24858255fe090a.1389369771.git.kevin.kofler at chello.at>
+In-Reply-To: <08f5bb92a5435b6c6c052fb11712a6dce2fcd61d.1389369771.git.kevin.kofler at chello.at>
+References: <08f5bb92a5435b6c6c052fb11712a6dce2fcd61d.1389369771.git.kevin.kofler at chello.at>
+From: Andreas Schneider <asn at cryptomilk.org>
+Date: Thu, 9 Jan 2014 17:03:41 +0100
+Subject: [PATCH 4/4] cmake: Fix version checking in FindLibSSH.
+
+---
+ cmake/modules/FindLibSSH.cmake | 133 +++++++++++++++++++----------------------
+ kioslave/sftp/CMakeLists.txt   |   2 +-
+ 2 files changed, 62 insertions(+), 73 deletions(-)
+
+diff --git a/cmake/modules/FindLibSSH.cmake b/cmake/modules/FindLibSSH.cmake
+index 45a1c0e..9ea394c 100644
+--- a/cmake/modules/FindLibSSH.cmake
++++ b/cmake/modules/FindLibSSH.cmake
+@@ -6,90 +6,79 @@
+ #  LIBSSH_LIBRARIES - Link these to use LibSSH
+ #  LIBSSH_DEFINITIONS - Compiler switches required for using LibSSH
+ #
+-#  Copyright (c) 2009 Andreas Schneider <mail at cynapses.org>
++#  Copyright (c) 2009-2014 Andreas Schneider <asn at cryptomilk.org>
+ #
+ #  Redistribution and use is allowed according to the terms of the New
+ #  BSD license.
+ #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+ #
+ 
+-if (LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)
+-  # in cache already
+-  set(LIBSSH_FOUND TRUE)
+-else (LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)
++find_path(LIBSSH_INCLUDE_DIR
++  NAMES
++    libssh/libssh.h
++  PATHS
++    /usr/include
++    /usr/local/include
++    /opt/local/include
++    /sw/include
++    ${CMAKE_INCLUDE_PATH}
++    ${CMAKE_INSTALL_PREFIX}/include
++)
+ 
+-  find_path(LIBSSH_INCLUDE_DIR
+-    NAMES
+-      libssh/libssh.h
+-    PATHS
+-      /usr/include
+-      /usr/local/include
+-      /opt/local/include
+-      /sw/include
+-      ${CMAKE_INCLUDE_PATH}
+-      ${CMAKE_INSTALL_PREFIX}/include
+-  )
++find_library(SSH_LIBRARY
++  NAMES
++    ssh
++    libssh
++  PATHS
++    /usr/lib
++    /usr/local/lib
++    /opt/local/lib
++    /sw/lib
++    ${CMAKE_LIBRARY_PATH}
++    ${CMAKE_INSTALL_PREFIX}/lib
++)
+ 
+-  find_library(SSH_LIBRARY
+-    NAMES
+-      ssh
+-      libssh
+-    PATHS
+-      /usr/lib
+-      /usr/local/lib
+-      /opt/local/lib
+-      /sw/lib
+-      ${CMAKE_LIBRARY_PATH}
+-      ${CMAKE_INSTALL_PREFIX}/lib
+-  )
++set(LIBSSH_LIBRARIES
++    ${LIBSSH_LIBRARIES}
++    ${SSH_LIBRARY}
++)
+ 
+-  if (LIBSSH_INCLUDE_DIR AND SSH_LIBRARY)
+-    set(LIBSSH_FOUND TRUE)
+-  endif (LIBSSH_INCLUDE_DIR AND SSH_LIBRARY)
++if (LibSSH_FIND_VERSION)
++  file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_MAJOR
++    REGEX "#define[ ]+LIBSSH_VERSION_MAJOR[ ]+[0-9]+")
+ 
+-  set(LIBSSH_INCLUDE_DIRS
+-    ${LIBSSH_INCLUDE_DIR}
+-  )
++  # Older versions of libssh like libssh-0.2 have LIBSSH_VERSION but not LIBSSH_VERSION_MAJOR
++  if (LIBSSH_VERSION_MAJOR)
++    string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MAJOR ${LIBSSH_VERSION_MAJOR})
++    file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_MINOR
++      REGEX "#define[ ]+LIBSSH_VERSION_MINOR[ ]+[0-9]+")
++    string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MINOR ${LIBSSH_VERSION_MINOR})
++    file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_PATCH
++      REGEX "#define[ ]+LIBSSH_VERSION_MICRO[ ]+[0-9]+")
++    string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_PATCH ${LIBSSH_VERSION_PATCH})
+ 
+-  if (LIBSSH_FOUND)
+-    set(LIBSSH_LIBRARIES
+-      ${LIBSSH_LIBRARIES}
+-      ${SSH_LIBRARY}
+-    )
++    set(LIBSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH})
+ 
+-    if (LibSSH_FIND_VERSION)
+-      file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_MAJOR
+-        REGEX "#define[ ]+LIBSSH_VERSION_MAJOR[ ]+[0-9]+")
++  else (LIBSSH_VERSION_MAJOR)
++    message(STATUS "LIBSSH_VERSION_MAJOR not found in ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h, assuming libssh is too old")
++    set(LIBSSH_FOUND FALSE)
++  endif (LIBSSH_VERSION_MAJOR)
++endif (LibSSH_FIND_VERSION)
+ 
+-      # Older versions of libssh like libssh-0.2 have LIBSSH_VERSION but not LIBSSH_VERSION_MAJOR
+-      if (LIBSSH_VERSION_MAJOR)
+-        string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MAJOR ${LIBSSH_VERSION_MAJOR})
+-        file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_MINOR
+-          REGEX "#define[ ]+LIBSSH_VERSION_MINOR[ ]+[0-9]+")
+-        string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MINOR ${LIBSSH_VERSION_MINOR})
+-        file(STRINGS ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h LIBSSH_VERSION_PATCH
+-          REGEX "#define[ ]+LIBSSH_VERSION_MICRO[ ]+[0-9]+")
+-        string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_PATCH ${LIBSSH_VERSION_PATCH})
++# If the version is too old, but libs and includes are set,
++# find_package_handle_standard_args will set LIBSSH_FOUND to TRUE again,
++# so we need this if() here.
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(LibSSH DEFAULT_MSG LIBSSH_LIBRARIES LIBSSH_INCLUDE_DIR)
+ 
+-        set(LIBSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH})
+-
+-      else (LIBSSH_VERSION_MAJOR)
+-        message(STATUS "LIBSSH_VERSION_MAJOR not found in ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h, assuming libssh is too old")
+-        set(LIBSSH_FOUND FALSE)
+-      endif (LIBSSH_VERSION_MAJOR)
+-    endif (LibSSH_FIND_VERSION)
+-  endif (LIBSSH_FOUND)
+-
+-  # If the version is too old, but libs and includes are set,
+-  # find_package_handle_standard_args will set LIBSSH_FOUND to TRUE again,
+-  # so we need this if() here.
+-  if (LIBSSH_FOUND)
+-    include(FindPackageHandleStandardArgs)
+-    find_package_handle_standard_args(LibSSH DEFAULT_MSG LIBSSH_LIBRARIES LIBSSH_INCLUDE_DIRS)
+-  endif (LIBSSH_FOUND)
+-
+-  # show the LIBSSH_INCLUDE_DIRS and LIBSSH_LIBRARIES variables only in the advanced view
+-  mark_as_advanced(LIBSSH_INCLUDE_DIRS LIBSSH_LIBRARIES)
+-
+-endif (LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)
++find_package_handle_standard_args(LibSSH
++                                  FOUND_VAR
++                                    LIBSSH_FOUND
++                                  REQUIRED_VARS
++                                    LIBSSH_LIBRARIES
++                                    LIBSSH_INCLUDE_DIR
++                                  VERSION_VAR
++                                    LIBSSH_VERSION)
+ 
++# show the LIBSSH_INCLUDE_DIRS and LIBSSH_LIBRARIES variables only in the advanced view
++mark_as_advanced(LIBSSH_INCLUDE_DIR LIBSSH_LIBRARIES)
+diff --git a/kioslave/sftp/CMakeLists.txt b/kioslave/sftp/CMakeLists.txt
+index fcffc0b..dcf5b4d 100644
+--- a/kioslave/sftp/CMakeLists.txt
++++ b/kioslave/sftp/CMakeLists.txt
+@@ -4,7 +4,7 @@ set(kio_sftp_PART_SRCS
+    kio_sftp.cpp
+ )
+ 
+-include_directories(${LIBSSH_INCLUDE_DIRS})
++include_directories(${LIBSSH_INCLUDE_DIR})
+ 
+ kde4_add_plugin(kio_sftp ${kio_sftp_PART_SRCS})
+ target_link_libraries(kio_sftp ${KDE4_KIO_LIBS} ${LIBSSH_LIBRARIES})
+-- 
+1.8.1.4
+
diff --git a/kde-runtime.spec b/kde-runtime.spec
index bbef301..60c2018 100644
--- a/kde-runtime.spec
+++ b/kde-runtime.spec
@@ -6,7 +6,7 @@
 Name:    kde-runtime
 Summary: KDE Runtime
 Version: 4.12.0
-Release: 2%{?dist}
+Release: 3%{?dist}
 
 # http://techbase.kde.org/Policies/Licensing_Policy
 License: LGPLv2+ and GPLv2+
@@ -72,6 +72,11 @@ Patch53: kde-runtime-4.11.95-initial_passwordless_kwallet_option.patch
 Patch60: kdebase-runtime-4.6.0-canberra.patch
 
 ## upstream patches
+# backport support for libssh 0.6 and ECDSA keys (kde#327024) from master/4.13
+Patch100: kde-runtime-4.12.0-libssh-0.6-0001-kio_sftp-Fix-error-values.patch
+Patch101: kde-runtime-4.12.0-libssh-0.6-0002-kio_sftp-Fix-printing-dest-in-the-log.patch
+Patch102: kde-runtime-4.12.0-libssh-0.6-0003-kio_sftp-Support-ECDSA-keys.patch
+Patch103: kde-runtime-4.12.0-libssh-0.6-0004-cmake-Fix-version-checking-in-FindLibSSH.patch
 
 # rhel patches
 Patch300: kde-runtime-4.9.2-webkit.patch
@@ -141,7 +146,7 @@ BuildRequires: pkgconfig(QtWebKit)
 %endif
 %if 0%{?fedora}
 BuildRequires: openslp-devel
-BuildRequires: libssh-devel
+BuildRequires: libssh-devel >= 0.6
 %endif
 BuildRequires: xorg-x11-font-utils
 BuildRequires: zlib-devel
@@ -218,6 +223,11 @@ Requires: %{name} = %{version}-%{release}
 %patch60 -p1 -b .canberra
 %endif
 
+%patch100 -p1 -b .libssh-0.6-1
+%patch101 -p1 -b .libssh-0.6-2
+%patch102 -p1 -b .libssh-0.6-3
+%patch103 -p1 -b .libssh-0.6-4
+
 %if ! 0%{?webkit}
 %patch300 -p1 -b .webkit
 %global no_webkit -DKDERUNTIME_NO_WEBKIT:BOOL=ON -DPLASMA_NO_KDEWEBKIT:BOOL=ON
@@ -435,6 +445,9 @@ fi
 
 
 %changelog
+* Fri Jan 10 2014 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.12.0-3
+- backport support for libssh 0.6 and ECDSA keys (kde#327024) from master/4.13
+
 * Wed Jan 01 2014 Rex Dieter <rdieter at fedoraproject.org> 4.12.0-2
 - rebuild (libwebp)
 
@@ -461,7 +474,7 @@ fi
 - 4.11.95
 
 * Tue Nov 19 2013 Rex Dieter <rdieter at fedoraproject.org> 4.11.90-2
-- Volume gets restored to 100% after each knotify event (#324975)
+- Volume gets restored to 100%% after each knotify event (#324975)
 
 * Sat Nov 16 2013 Rex Dieter <rdieter at fedoraproject.org> - 4.11.90-1
 - 4.11.90


More information about the scm-commits mailing list