Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
kdump
kdump-drop-KSFTPErrorCode-libssh2-dep.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kdump-drop-KSFTPErrorCode-libssh2-dep.patch of Package kdump
From: Petr Tesarik <ptesarik@suse.cz> Date: Wed, 15 Apr 2015 10:27:25 +0200 Subject: Drop KSFTPErrorCode dependency on libssh2 References: FATE#318874, bsc#917747 Patch-mainline: v0.8.16 Git-commit: 170074b42a166ac3c0cc214c11b152e2c60fd82b This means kdump must maintain the list of error codes. However, this was the case already, because the error code would have to be added to the switch statement. Also, move KSFTPErrorCode to sshtransfer.h If someone wants to handle sftp-related exceptions, they can include sshtransfer.h explicitly. Signed-off-by: Petr Tesarik <ptesarik@suse.cz> --- kdumptool/global.cc | 113 ----------------------------------------------- kdumptool/global.h | 17 ------- kdumptool/sshtransfer.cc | 103 ++++++++++++++++++++++++++++++++++++++++++ kdumptool/sshtransfer.h | 47 +++++++++++++++++++ 4 files changed, 150 insertions(+), 130 deletions(-) --- a/kdumptool/global.cc +++ b/kdumptool/global.cc @@ -24,10 +24,6 @@ #include "global.h" -#if HAVE_LIBSSH2 -# include <libssh2.h> -# include <libssh2_sftp.h> -#endif #if HAVE_LIBESMTP # include <libesmtp.h> #endif @@ -69,115 +65,6 @@ string KGaiErrorCode::message(void) cons } //}}} -//{{{ KSFTPErrorCode ----------------------------------------------------------- - -/* -------------------------------------------------------------------------- */ -string KSFTPErrorCode::message(void) const - throw () -{ -#if HAVE_LIBSSH2 - const char *msg; - - switch (getCode()) { - case LIBSSH2_FX_OK: - msg = "OK"; - break; - - case LIBSSH2_FX_EOF: - msg = "End of file"; - break; - - case LIBSSH2_FX_NO_SUCH_FILE: - msg = "No such file"; - break; - - case LIBSSH2_FX_PERMISSION_DENIED: - msg = "Permission denied"; - break; - - case LIBSSH2_FX_FAILURE: - msg = "Failure"; - break; - - case LIBSSH2_FX_BAD_MESSAGE: - msg = "Bad message"; - break; - - case LIBSSH2_FX_NO_CONNECTION: - msg = "No connection"; - break; - - case LIBSSH2_FX_CONNECTION_LOST: - msg = "Connection lost"; - break; - - case LIBSSH2_FX_OP_UNSUPPORTED: - msg = "Operation unsupported"; - break; - - case LIBSSH2_FX_INVALID_HANDLE: - msg = "Invalid handle"; - break; - - case LIBSSH2_FX_NO_SUCH_PATH: - msg = "No such path"; - break; - - case LIBSSH2_FX_FILE_ALREADY_EXISTS: - msg = "File already exists"; - break; - - case LIBSSH2_FX_WRITE_PROTECT: - msg = "Write protect"; - break; - - case LIBSSH2_FX_NO_MEDIA: - msg = "No media"; - break; - - case LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM: - msg = "No space on file system"; - break; - - case LIBSSH2_FX_QUOTA_EXCEEDED: - msg = "Quote exceeded"; - break; - - case LIBSSH2_FX_UNKNOWN_PRINCIPLE: - msg = "Unknown principle"; - break; - - case LIBSSH2_FX_LOCK_CONFLICT: - msg = "Lock conflict"; - break; - - case LIBSSH2_FX_DIR_NOT_EMPTY: - msg = "Directory not empty"; - break; - - case LIBSSH2_FX_NOT_A_DIRECTORY: - msg = "Not a directory"; - break; - - case LIBSSH2_FX_INVALID_FILENAME: - msg = "Invalid file name"; - break; - - case LIBSSH2_FX_LINK_LOOP: - msg = "Link loop"; - break; - - default: - msg = "Unknown error"; - } - return string(msg); - -#else // HAVE_LIBSSH2 - return string("Compiled without libssh2 support"); - -#endif // HAVE_LIBSSH2 -} -//}}} //{{{ KELFErrorCode ------------------------------------------------------------ // ----------------------------------------------------------------------------- --- a/kdumptool/global.h +++ b/kdumptool/global.h @@ -166,22 +166,6 @@ class KGaiErrorCode : public KErrorCode }; //}}} -//{{{ KSFTPErrorCode ----------------------------------------------------------- - -/** - * Class for libssh2 errors. - */ -class KSFTPErrorCode : public KErrorCode { - public: - KSFTPErrorCode(int code) - : KErrorCode(code) - {} - - virtual std::string message(void) const - throw (); -}; - -//}}} //{{{ KELFErrorCode ------------------------------------------------------------ /** @@ -219,7 +203,6 @@ class KSmtpErrorCode : public KErrorCode typedef KCodeError<KSystemErrorCode> KSystemError; typedef KCodeError<KNetErrorCode> KNetError; typedef KCodeError<KGaiErrorCode> KGaiError; -typedef KCodeError<KSFTPErrorCode> KSFTPError; typedef KCodeError<KELFErrorCode> KELFError; typedef KCodeError<KSmtpErrorCode> KSmtpError; --- a/kdumptool/sshtransfer.cc +++ b/kdumptool/sshtransfer.cc @@ -162,6 +162,109 @@ StringVector SSHTransfer::makeArgs(std:: } //}}} +//{{{ KSFTPErrorCode ----------------------------------------------------------- + +/* -------------------------------------------------------------------------- */ +string KSFTPErrorCode::message(void) const + throw () +{ + const char *msg; + + switch (getCode()) { + case SSH_FX_OK: + msg = "OK"; + break; + + case SSH_FX_EOF: + msg = "End of file"; + break; + + case SSH_FX_NO_SUCH_FILE: + msg = "No such file"; + break; + + case SSH_FX_PERMISSION_DENIED: + msg = "Permission denied"; + break; + + case SSH_FX_FAILURE: + msg = "Failure"; + break; + + case SSH_FX_BAD_MESSAGE: + msg = "Bad message"; + break; + + case SSH_FX_NO_CONNECTION: + msg = "No connection"; + break; + + case SSH_FX_CONNECTION_LOST: + msg = "Connection lost"; + break; + + case SSH_FX_OP_UNSUPPORTED: + msg = "Operation unsupported"; + break; + + case SSH_FX_INVALID_HANDLE: + msg = "Invalid handle"; + break; + + case SSH_FX_NO_SUCH_PATH: + msg = "No such path"; + break; + + case SSH_FX_FILE_ALREADY_EXISTS: + msg = "File already exists"; + break; + + case SSH_FX_WRITE_PROTECT: + msg = "Write protect"; + break; + + case SSH_FX_NO_MEDIA: + msg = "No media"; + break; + + case SSH_FX_NO_SPACE_ON_FILESYSTEM: + msg = "No space on file system"; + break; + + case SSH_FX_QUOTA_EXCEEDED: + msg = "Quote exceeded"; + break; + + case SSH_FX_UNKNOWN_PRINCIPAL: + msg = "Unknown principal"; + break; + + case SSH_FX_LOCK_CONFLICT: + msg = "Lock conflict"; + break; + + case SSH_FX_DIR_NOT_EMPTY: + msg = "Directory not empty"; + break; + + case SSH_FX_NOT_A_DIRECTORY: + msg = "Not a directory"; + break; + + case SSH_FX_INVALID_FILENAME: + msg = "Invalid file name"; + break; + + case SSH_FX_LINK_LOOP: + msg = "Link loop"; + break; + + default: + msg = "Unknown error"; + } + return string(msg); +} +//}}} //{{{ SFTPPacket --------------------------------------------------------------- /* -------------------------------------------------------------------------- */ --- a/kdumptool/sshtransfer.h +++ b/kdumptool/sshtransfer.h @@ -67,6 +67,53 @@ class SSHTransfer : public URLTransfer { }; //}}} +//{{{ KSFTPErrorCode ----------------------------------------------------------- + +/** + * Error codes defined by the protocol + */ +enum { + SSH_FX_OK = 0, + SSH_FX_EOF = 1, + SSH_FX_NO_SUCH_FILE = 2, + SSH_FX_PERMISSION_DENIED = 3, + SSH_FX_FAILURE = 4, + SSH_FX_BAD_MESSAGE = 5, + SSH_FX_NO_CONNECTION = 6, + SSH_FX_CONNECTION_LOST = 7, + SSH_FX_OP_UNSUPPORTED = 8, + SSH_FX_INVALID_HANDLE = 9, + SSH_FX_NO_SUCH_PATH = 10, + SSH_FX_FILE_ALREADY_EXISTS = 11, + SSH_FX_WRITE_PROTECT = 12, + SSH_FX_NO_MEDIA = 13, + SSH_FX_NO_SPACE_ON_FILESYSTEM = 14, + SSH_FX_QUOTA_EXCEEDED = 15, + SSH_FX_UNKNOWN_PRINCIPAL = 16, + SSH_FX_LOCK_CONFLICT = 17, + SSH_FX_DIR_NOT_EMPTY = 18, + SSH_FX_NOT_A_DIRECTORY = 19, + SSH_FX_INVALID_FILENAME = 20, + SSH_FX_LINK_LOOP = 21, +}; + +/** + * Class for sftp errors. + */ +class KSFTPErrorCode : public KErrorCode { + + public: + KSFTPErrorCode(int code) + : KErrorCode(code) + {} + + virtual std::string message(void) const + throw (); +}; + +typedef KCodeError<KSFTPErrorCode> KSFTPError; + +//}}} //{{{ SFTPPacket --------------------------------------------------------------- /**
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor