summaryrefslogtreecommitdiffstats
path: root/tdesu/ssh.h
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
commite16866e072f94410321d70daedbcb855ea878cac (patch)
treeee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /tdesu/ssh.h
parenta58c20c1a7593631a1b50213c805507ebc16adaf (diff)
downloadtdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz
tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'tdesu/ssh.h')
-rw-r--r--tdesu/ssh.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/tdesu/ssh.h b/tdesu/ssh.h
new file mode 100644
index 000000000..c84c56d02
--- /dev/null
+++ b/tdesu/ssh.h
@@ -0,0 +1,90 @@
+/* vi: ts=8 sts=4 sw=4
+ *
+ * $Id$
+ *
+ * This file is part of the KDE project, module tdesu.
+ * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
+ *
+ * This is free software; you can use this library under the GNU Library
+ * General Public License, version 2. See the file "COPYING.LIB" for the
+ * exact licensing terms.
+ */
+
+#ifndef __SSH_h_Included__
+#define __SSH_h_Included__
+
+#include <tqcstring.h>
+
+#include "stub.h"
+
+#include <kdelibs_export.h>
+
+/**
+ * Executes a remote command, using ssh.
+ */
+
+class KDESU_EXPORT SshProcess: public StubProcess
+{
+public:
+ SshProcess(const TQCString &host=0, const TQCString &user=0, const TQCString &command=0);
+ ~SshProcess();
+
+ enum Errors { SshNotFound=1, SshNeedsPassword, SshIncorrectPassword };
+
+ /**
+ * Sets the target host.
+ */
+ void setHost(const TQCString &host) { m_Host = host; }
+
+ /**
+ * Sets the localtion of the remote stub.
+ */
+ void setStub(const TQCString &stub);
+
+ /**
+ * Checks if the current user\@host needs a password.
+ * @return The prompt for the password if a password is required. A null
+ * string otherwise.
+ *
+ * @todo The return doc is so obviously wrong that the C code needs to be checked.
+ */
+ int checkNeedPassword();
+
+ /**
+ * Checks if the stub is installed and if the password is correct.
+ * @return Zero if everything is correct, nonzero otherwise.
+ */
+ int checkInstall(const char *password);
+
+ /**
+ * Executes the command.
+ */
+ int exec(const char *password, int check=0);
+
+ TQCString prompt() { return m_Prompt; }
+ TQCString error() { return m_Error; }
+
+protected:
+ virtual TQCString display();
+ virtual TQCString displayAuth();
+ virtual TQCString dcopServer();
+
+private:
+ TQCString dcopForward();
+ int ConverseSsh(const char *password, int check);
+
+ int m_dcopPort;
+ int m_dcopSrv;
+ TQCString m_Prompt;
+ TQCString m_Host;
+ TQCString m_Error;
+ TQCString m_Stub;
+
+protected:
+ virtual void virtual_hook( int id, void* data );
+private:
+ class SshProcessPrivate;
+ SshProcessPrivate *d;
+};
+
+#endif