Diffstat (limited to 'noncore/settings/sshkeys/sshkeys.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sshkeys/sshkeys.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/noncore/settings/sshkeys/sshkeys.cpp b/noncore/settings/sshkeys/sshkeys.cpp index cebc845..d8b1014 100644 --- a/noncore/settings/sshkeys/sshkeys.cpp +++ b/noncore/settings/sshkeys/sshkeys.cpp | |||
@@ -20,15 +20,19 @@ | |||
20 | */ | 20 | */ |
21 | #include "sshkeys.h" | 21 | #include "sshkeys.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qdir.h> | ||
25 | #include <qfile.h> | ||
24 | #include <qmultilineedit.h> | 26 | #include <qmultilineedit.h> |
25 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
26 | #include <qlistview.h> | 28 | #include <qlistview.h> |
27 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
28 | 30 | ||
29 | #include <sys/types.h> | 31 | #include <sys/types.h> |
30 | #include <sys/stat.h> | 32 | #include <sys/stat.h> |
33 | #include <fcntl.h> | ||
34 | #include <sys/ioctl.h> | ||
31 | #include <stdlib.h> | 35 | #include <stdlib.h> |
32 | #include <unistd.h> | 36 | #include <unistd.h> |
33 | #include <stdio.h> | 37 | #include <stdio.h> |
34 | #include <ctype.h> | 38 | #include <ctype.h> |
@@ -38,9 +42,17 @@ static char *keynames[] = { "identity", "id_rsa", "id_dsa" }; | |||
38 | 42 | ||
39 | SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) | 43 | SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) |
40 | : SSHKeysBase( parent, name, fl ) | 44 | : SSHKeysBase( parent, name, fl ) |
41 | { | 45 | { |
42 | char *home = getenv("HOME"); | 46 | /* If we had a controlling TTY, detach from it. |
47 | This is to ensure that SSH uses ssh-askpass */ | ||
48 | int fd = open("/dev/tty", O_RDONLY); | ||
49 | if (fd != -1) { | ||
50 | ioctl(fd, TIOCNOTTY, NULL); | ||
51 | close(fd); | ||
52 | } | ||
53 | |||
54 | QCString home = QFile::encodeName( QDir::homeDirPath() ); | ||
43 | unsigned i; | 55 | unsigned i; |
44 | 56 | ||
45 | connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton())); | 57 | connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton())); |
46 | connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton())); | 58 | connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton())); |
@@ -60,9 +72,9 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) | |||
60 | for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) { | 72 | for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) { |
61 | char thiskeyname[32]; | 73 | char thiskeyname[32]; |
62 | 74 | ||
63 | thiskeyname[31] = 0; | 75 | thiskeyname[31] = 0; |
64 | snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]); | 76 | snprintf(thiskeyname, 31, "%s/.ssh/%s", home.data(), keynames[i]); |
65 | if (!access(thiskeyname, R_OK)) { | 77 | if (!access(thiskeyname, R_OK)) { |
66 | KeyFileName->insertItem(thiskeyname); | 78 | KeyFileName->insertItem(thiskeyname); |
67 | } | 79 | } |
68 | } | 80 | } |