summaryrefslogtreecommitdiff
authordrw <drw>2004-02-22 00:36:16 (UTC)
committer drw <drw>2004-02-22 00:36:16 (UTC)
commitf1441dcbda778df001066d2ed6157e73f7c5f876 (patch) (side-by-side diff)
tree4295af5dacfb3a18b0c5a692d1fe59b74b1d808a
parent69b33f76ffff03b3648db62a761f3de1b58eec3f (diff)
downloadopie-f1441dcbda778df001066d2ed6157e73f7c5f876.zip
opie-f1441dcbda778df001066d2ed6157e73f7c5f876.tar.gz
opie-f1441dcbda778df001066d2ed6157e73f7c5f876.tar.bz2
SSH Keys: libopie->libopie2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sshkeys/opie-sshkeys.control2
-rw-r--r--noncore/settings/sshkeys/sshkeys.cpp417
-rw-r--r--noncore/settings/sshkeys/sshkeys.h53
-rw-r--r--noncore/settings/sshkeys/sshkeys.pro2
4 files changed, 237 insertions, 237 deletions
diff --git a/noncore/settings/sshkeys/opie-sshkeys.control b/noncore/settings/sshkeys/opie-sshkeys.control
index 4deccf4..08e3508 100644
--- a/noncore/settings/sshkeys/opie-sshkeys.control
+++ b/noncore/settings/sshkeys/opie-sshkeys.control
@@ -6,3 +6,3 @@ Maintainer: David Woodhouse <dwmw2@infradead.org>
Architecture: arm
-Depends: task-opie-minimal, ssh, opie-sh-ssh-askpass
+Depends: task-opie-minimal, ssh, opie-sh-ssh-askpass, libopiecore2
Description: Utility for managing ssh-agent keys.
diff --git a/noncore/settings/sshkeys/sshkeys.cpp b/noncore/settings/sshkeys/sshkeys.cpp
index 43e02af..e76fd6b 100644
--- a/noncore/settings/sshkeys/sshkeys.cpp
+++ b/noncore/settings/sshkeys/sshkeys.cpp
@@ -1,2 +1,2 @@
-/*
+/*
* ssh-agent key manipulation utility
@@ -23,3 +23,2 @@
#include <qpe/qpeapplication.h>
-#include <opie/oprocess.h>
#include <qmultilineedit.h>
@@ -41,32 +40,32 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl )
{
- char *home = getenv("HOME");
- unsigned i;
-
- connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton()));
- connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton()));
- connect(RemoveAllButton, SIGNAL(clicked()), this, SLOT(doRemoveAllButton()));
-
- connect(&addprocess, SIGNAL(receivedStdout(OProcess*,char*,int)),
- this, SLOT(log_sshadd_output(OProcess*,char*,int)));
- connect(&addprocess, SIGNAL(receivedStderr(OProcess*,char*,int)),
- this, SLOT(log_sshadd_stderr(OProcess*,char*,int)));
- connect(&addprocess, SIGNAL(processExited(OProcess*)),
- this, SLOT(ssh_add_exited(OProcess*)));
-
- connect(KeyFileName, SIGNAL(textChanged(const QString&)),
- this, SLOT(add_text_changed(const QString&)));
-
- if (home) {
- for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) {
- char thiskeyname[32];
-
- thiskeyname[31] = 0;
- snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]);
- if (!access(thiskeyname, R_OK)) {
- KeyFileName->insertItem(thiskeyname);
- }
- }
- }
-
- doRefreshListButton();
+ char *home = getenv("HOME");
+ unsigned i;
+
+ connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton()));
+ connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton()));
+ connect(RemoveAllButton, SIGNAL(clicked()), this, SLOT(doRemoveAllButton()));
+
+ connect(&addprocess, SIGNAL(receivedStdout(OProcess*,char*,int)),
+ this, SLOT(log_sshadd_output(OProcess*,char*,int)));
+ connect(&addprocess, SIGNAL(receivedStderr(OProcess*,char*,int)),
+ this, SLOT(log_sshadd_stderr(OProcess*,char*,int)));
+ connect(&addprocess, SIGNAL(processExited(OProcess*)),
+ this, SLOT(ssh_add_exited(OProcess*)));
+
+ connect(KeyFileName, SIGNAL(textChanged(const QString&)),
+ this, SLOT(add_text_changed(const QString&)));
+
+ if (home) {
+ for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) {
+ char thiskeyname[32];
+
+ thiskeyname[31] = 0;
+ snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]);
+ if (!access(thiskeyname, R_OK)) {
+ KeyFileName->insertItem(thiskeyname);
+ }
+ }
+ }
+
+ doRefreshListButton();
}
@@ -79,33 +78,33 @@ void SSHKeysApp::doRefreshListButton()
{
- OProcess sshadd_process;
- QListViewItem *t = KeyList->firstChild();
-
- while(t) {
- QListViewItem *next = t->nextSibling();
- KeyList->takeItem(t);
- delete(t);
- t = next;
- }
-
- connect(&sshadd_process, SIGNAL(receivedStdout(OProcess*,char*,int)),
- this, SLOT(get_list_keys_output(OProcess*,char*,int)));
- connect(&sshadd_process, SIGNAL(receivedStderr(OProcess*,char*,int)),
- this, SLOT(log_sshadd_stderr(OProcess*,char*,int)));
-
- keystate = KeySize;
- incoming_keyname="";
- incoming_keysize="";
- incoming_keyfingerprint="";
-
-// log_text("Running ssh-add -l");
- sshadd_process << "ssh-add" << "-l";
- bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput);
- if (!ret) {
- log_text(tr("Error running ssh-add"));
- return;
- }
- flush_sshadd_output();
- if (sshadd_process.exitStatus() == 2) {
- setEnabled(FALSE);
- }
+ OProcess sshadd_process;
+ QListViewItem *t = KeyList->firstChild();
+
+ while(t) {
+ QListViewItem *next = t->nextSibling();
+ KeyList->takeItem(t);
+ delete(t);
+ t = next;
+ }
+
+ connect(&sshadd_process, SIGNAL(receivedStdout(OProcess*,char*,int)),
+ this, SLOT(get_list_keys_output(OProcess*,char*,int)));
+ connect(&sshadd_process, SIGNAL(receivedStderr(OProcess*,char*,int)),
+ this, SLOT(log_sshadd_stderr(OProcess*,char*,int)));
+
+ keystate = KeySize;
+ incoming_keyname="";
+ incoming_keysize="";
+ incoming_keyfingerprint="";
+
+// log_text("Running ssh-add -l");
+ sshadd_process << "ssh-add" << "-l";
+ bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput);
+ if (!ret) {
+ log_text(tr("Error running ssh-add"));
+ return;
+ }
+ flush_sshadd_output();
+ if (sshadd_process.exitStatus() == 2) {
+ setEnabled(FALSE);
+ }
}
@@ -114,66 +113,66 @@ void SSHKeysApp::get_list_keys_output(OProcess *proc, char *buffer, int buflen)
{
- int i;
- (void) proc;
-
- for (i=0; i<buflen; i++) {
- switch(keystate) {
- case Noise:
- noise:
- if (buffer[i] == '\n') {
- log_text(incoming_noise.local8Bit());
- incoming_noise = "";
- keystate = KeySize;
- } else {
- incoming_noise += buffer[i];
- }
- break;
-
- case KeySize:
- if (isdigit(buffer[i])) {
- incoming_keysize += buffer[i];
- } else if (buffer[i] == ' ') {
- keystate = KeyFingerprint;
- } else {
- incoming_keysize = "";
- incoming_noise = "";
- keystate = Noise;
- goto noise;
- }
- break;
-
- case KeyFingerprint:
- if (isxdigit(buffer[i]) || buffer[i] == ':') {
- incoming_keyfingerprint += buffer[i];
- } else if (buffer[i] == ' ') {
- keystate = KeyName;
- } else {
- incoming_keysize = "";
- incoming_keyfingerprint = "";
- incoming_noise = "";
- keystate = Noise;
- goto noise;
- }
- break;
-
- case KeyName:
- if (buffer[i] == '\n') {
- /* Wheee. Got one. */
- KeyList->insertItem(new
- QListViewItem(KeyList, incoming_keyname, incoming_keysize, incoming_keyfingerprint));
- incoming_keysize = "";
- incoming_keyfingerprint = "";
- incoming_keyname = "";
- keystate = KeySize;
- } else if (isprint(buffer[i])) {
- incoming_keyname += buffer[i];
- } else {
- incoming_keysize = "";
- incoming_keyfingerprint = "";
- incoming_noise = "";
- keystate = Noise;
- goto noise;
- }
- break;
- }
- }
+ int i;
+ (void) proc;
+
+ for (i=0; i<buflen; i++) {
+ switch(keystate) {
+ case Noise:
+ noise:
+ if (buffer[i] == '\n') {
+ log_text(incoming_noise.local8Bit());
+ incoming_noise = "";
+ keystate = KeySize;
+ } else {
+ incoming_noise += buffer[i];
+ }
+ break;
+
+ case KeySize:
+ if (isdigit(buffer[i])) {
+ incoming_keysize += buffer[i];
+ } else if (buffer[i] == ' ') {
+ keystate = KeyFingerprint;
+ } else {
+ incoming_keysize = "";
+ incoming_noise = "";
+ keystate = Noise;
+ goto noise;
+ }
+ break;
+
+ case KeyFingerprint:
+ if (isxdigit(buffer[i]) || buffer[i] == ':') {
+ incoming_keyfingerprint += buffer[i];
+ } else if (buffer[i] == ' ') {
+ keystate = KeyName;
+ } else {
+ incoming_keysize = "";
+ incoming_keyfingerprint = "";
+ incoming_noise = "";
+ keystate = Noise;
+ goto noise;
+ }
+ break;
+
+ case KeyName:
+ if (buffer[i] == '\n') {
+ /* Wheee. Got one. */
+ KeyList->insertItem(new
+ QListViewItem(KeyList, incoming_keyname, incoming_keysize, incoming_keyfingerprint));
+ incoming_keysize = "";
+ incoming_keyfingerprint = "";
+ incoming_keyname = "";
+ keystate = KeySize;
+ } else if (isprint(buffer[i])) {
+ incoming_keyname += buffer[i];
+ } else {
+ incoming_keysize = "";
+ incoming_keyfingerprint = "";
+ incoming_noise = "";
+ keystate = Noise;
+ goto noise;
+ }
+ break;
+ }
+ }
}
@@ -182,11 +181,11 @@ void SSHKeysApp::flush_sshadd_output(void)
{
- if (pending_stdout.length()) {
- log_text(pending_stdout.ascii());
- }
- pending_stdout = "";
-
- if (pending_stderr.length()) {
- log_text(pending_stderr.ascii());
- }
- pending_stderr = "";
+ if (pending_stdout.length()) {
+ log_text(pending_stdout.ascii());
+ }
+ pending_stdout = "";
+
+ if (pending_stderr.length()) {
+ log_text(pending_stderr.ascii());
+ }
+ pending_stderr = "";
}
@@ -195,14 +194,14 @@ void SSHKeysApp::log_sshadd_output(OProcess *proc, char *buffer, int buflen)
{
- (void) proc;
-
- while (buflen) {
- if (*buffer == '\n') {
- log_text(pending_stdout);
- pending_stdout = "";
- } else {
- pending_stdout += *buffer;
- }
- buffer++;
- buflen--;
- }
+ (void) proc;
+
+ while (buflen) {
+ if (*buffer == '\n') {
+ log_text(pending_stdout);
+ pending_stdout = "";
+ } else {
+ pending_stdout += *buffer;
+ }
+ buffer++;
+ buflen--;
+ }
}
@@ -211,14 +210,14 @@ void SSHKeysApp::log_sshadd_stderr(OProcess *proc, char *buffer, int buflen)
{
- (void) proc;
-
- while (buflen) {
- if (*buffer == '\n') {
- log_text(pending_stderr);
- pending_stderr = "";
- } else {
- pending_stderr += *buffer;
- }
- buffer++;
- buflen--;
- }
+ (void) proc;
+
+ while (buflen) {
+ if (*buffer == '\n') {
+ log_text(pending_stderr);
+ pending_stderr = "";
+ } else {
+ pending_stderr += *buffer;
+ }
+ buffer++;
+ buflen--;
+ }
}
@@ -227,9 +226,9 @@ void SSHKeysApp::ssh_add_exited(OProcess *proc)
{
- (void)proc;
+ (void)proc;
- doRefreshListButton();
- setEnabled(TRUE);
- if (proc->exitStatus() == 2) {
- setEnabled(FALSE);
- }
+ doRefreshListButton();
+ setEnabled(TRUE);
+ if (proc->exitStatus() == 2) {
+ setEnabled(FALSE);
+ }
}
@@ -238,10 +237,10 @@ void SSHKeysApp::add_text_changed(const QString &text)
{
- struct stat sbuf;
-
- if (!text.length() || (!access(text.ascii(), R_OK) &&
- !stat(text.ascii(), &sbuf) &&
- S_ISREG(sbuf.st_mode)))
- AddButton->setEnabled(TRUE);
- else
- AddButton->setEnabled(FALSE);
+ struct stat sbuf;
+
+ if (!text.length() || (!access(text.ascii(), R_OK) &&
+ !stat(text.ascii(), &sbuf) &&
+ S_ISREG(sbuf.st_mode)))
+ AddButton->setEnabled(TRUE);
+ else
+ AddButton->setEnabled(FALSE);
}
@@ -250,20 +249,20 @@ void SSHKeysApp::doAddButton()
{
- addprocess.clearArguments();
-
- setEnabled(FALSE);
-
- if (KeyFileName->currentText().length()) {
- addprocess << "ssh-add" << "--" << KeyFileName->currentText();
-// log_text(QString(tr("Running ssh-add -- ")) + KeyFileName->currentText());
- } else {
- addprocess << "ssh-add";
-// log_text(tr("Running ssh-add"));
- }
- bool ret = addprocess.start(OProcess::NotifyOnExit, OProcess::AllOutput);
- if (!ret) {
- log_text(tr("Error running ssh-add"));
- doRefreshListButton();
- setEnabled(TRUE);
- }
- flush_sshadd_output();
+ addprocess.clearArguments();
+
+ setEnabled(FALSE);
+
+ if (KeyFileName->currentText().length()) {
+ addprocess << "ssh-add" << "--" << KeyFileName->currentText();
+// log_text(QString(tr("Running ssh-add -- ")) + KeyFileName->currentText());
+ } else {
+ addprocess << "ssh-add";
+// log_text(tr("Running ssh-add"));
+ }
+ bool ret = addprocess.start(OProcess::NotifyOnExit, OProcess::AllOutput);
+ if (!ret) {
+ log_text(tr("Error running ssh-add"));
+ doRefreshListButton();
+ setEnabled(TRUE);
+ }
+ flush_sshadd_output();
}
@@ -272,4 +271,4 @@ void SSHKeysApp::log_text(const char *text)
{
- TextOutput->append(text);
- TextOutput->setCursorPosition(TextOutput->numLines()+1, 0, FALSE);
+ TextOutput->append(text);
+ TextOutput->setCursorPosition(TextOutput->numLines()+1, 0, FALSE);
}
@@ -278,17 +277,17 @@ void SSHKeysApp::doRemoveAllButton()
{
- OProcess sshadd_process;
-
- connect(&sshadd_process, SIGNAL(receivedStdout(OProcess*,char*,int)),
- this, SLOT(log_sshadd_output(OProcess*,char*,int)));
- connect(&sshadd_process, SIGNAL(receivedStderr(OProcess*,char*,int)),
- this, SLOT(log_sshadd_stderr(OProcess*,char*,int)));
-
-// log_text(tr("Running ssh-add -D"));
- sshadd_process << "ssh-add" << "-D";
- bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput);
- if (!ret) {
- log_text(tr("Error running ssh-add"));
- }
- flush_sshadd_output();
- doRefreshListButton();
+ OProcess sshadd_process;
+
+ connect(&sshadd_process, SIGNAL(receivedStdout(OProcess*,char*,int)),
+ this, SLOT(log_sshadd_output(OProcess*,char*,int)));
+ connect(&sshadd_process, SIGNAL(receivedStderr(OProcess*,char*,int)),
+ this, SLOT(log_sshadd_stderr(OProcess*,char*,int)));
+
+// log_text(tr("Running ssh-add -D"));
+ sshadd_process << "ssh-add" << "-D";
+ bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput);
+ if (!ret) {
+ log_text(tr("Error running ssh-add"));
+ }
+ flush_sshadd_output();
+ doRefreshListButton();
}
diff --git a/noncore/settings/sshkeys/sshkeys.h b/noncore/settings/sshkeys/sshkeys.h
index bbc6993..7483bbc 100644
--- a/noncore/settings/sshkeys/sshkeys.h
+++ b/noncore/settings/sshkeys/sshkeys.h
@@ -1,2 +1,2 @@
-/*
+/*
* ssh-agent key manipulation utility
@@ -25,3 +25,4 @@
#include "sshkeysbase.h"
-#include <opie/oprocess.h>
+
+#include <opie2/oprocess.h>
@@ -29,32 +30,32 @@ class SSHKeysApp : public SSHKeysBase
{
- Q_OBJECT
-
+ Q_OBJECT
+
public:
- SSHKeysApp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
- ~SSHKeysApp();
+ SSHKeysApp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~SSHKeysApp();
private:
- void log_text(const char *text);
- void flush_sshadd_output(void);
-
- enum { Noise, KeyName, KeySize, KeyFingerprint } keystate;
- QString incoming_keyname;
- QString incoming_keysize;
- QString incoming_keyfingerprint;
- QString incoming_noise;
- OProcess addprocess;
- QString pending_stdout;
- QString pending_stderr;
+ void log_text(const char *text);
+ void flush_sshadd_output(void);
+
+ enum { Noise, KeyName, KeySize, KeyFingerprint } keystate;
+ QString incoming_keyname;
+ QString incoming_keysize;
+ QString incoming_keyfingerprint;
+ QString incoming_noise;
+ OProcess addprocess;
+ QString pending_stdout;
+ QString pending_stderr;
private slots:
- void doAddButton();
- void doRefreshListButton();
- void doRemoveAllButton();
- void get_list_keys_output(OProcess *proc, char *buffer, int buflen);
- void log_sshadd_output(OProcess *proc, char *buffer, int buflen);
- void log_sshadd_stderr(OProcess *proc, char *buffer, int buflen);
- void ssh_add_exited(OProcess *proc);
- void add_text_changed(const QString &text);
+ void doAddButton();
+ void doRefreshListButton();
+ void doRemoveAllButton();
+ void get_list_keys_output(OProcess *proc, char *buffer, int buflen);
+ void log_sshadd_output(OProcess *proc, char *buffer, int buflen);
+ void log_sshadd_stderr(OProcess *proc, char *buffer, int buflen);
+ void ssh_add_exited(OProcess *proc);
+ void add_text_changed(const QString &text);
};
-#endif
+#endif
diff --git a/noncore/settings/sshkeys/sshkeys.pro b/noncore/settings/sshkeys/sshkeys.pro
index e98df2e..273db3c 100644
--- a/noncore/settings/sshkeys/sshkeys.pro
+++ b/noncore/settings/sshkeys/sshkeys.pro
@@ -8,3 +8,3 @@ INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie
+LIBS += -lqpe -lopiecore2
DESTDIR = $(OPIEDIR)/bin