author | dwmw2 <dwmw2> | 2002-09-20 13:06:34 (UTC) |
---|---|---|
committer | dwmw2 <dwmw2> | 2002-09-20 13:06:34 (UTC) |
commit | 37f294533b8288d341f8485649c7cc7d226dfc0d (patch) (side-by-side diff) | |
tree | 70506c2a8da236ead92d985a75373264648c5cec | |
parent | cc311b771843c289fadbe9a301e432963b906208 (diff) | |
download | opie-37f294533b8288d341f8485649c7cc7d226dfc0d.zip opie-37f294533b8288d341f8485649c7cc7d226dfc0d.tar.gz opie-37f294533b8288d341f8485649c7cc7d226dfc0d.tar.bz2 |
Report ssh-agent failure and disable
-rw-r--r-- | noncore/settings/sshkeys/sshkeys.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/settings/sshkeys/sshkeys.cpp b/noncore/settings/sshkeys/sshkeys.cpp index 701356a..3b4dce6 100644 --- a/noncore/settings/sshkeys/sshkeys.cpp +++ b/noncore/settings/sshkeys/sshkeys.cpp @@ -35,97 +35,100 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) 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(); } SSHKeysApp::~SSHKeysApp() { } 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))); 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; } - + if (sshadd_process.exitStatus() == 2) { + log_text(tr("Connection to ssh-agent failed")); + setEnabled(FALSE); + } } 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: |