author | clem <clem> | 2004-09-17 21:05:46 (UTC) |
---|---|---|
committer | clem <clem> | 2004-09-17 21:05:46 (UTC) |
commit | dcb3342e9f310425ed1abeaa6c00a3132ec609b8 (patch) (unidiff) | |
tree | 383be9477bc59940722094ca6854186afa80e7bd | |
parent | f35f5bef4c8bad180a02b1804fe0ce8fd7c451bd (diff) | |
download | opie-dcb3342e9f310425ed1abeaa6c00a3132ec609b8.zip opie-dcb3342e9f310425ed1abeaa6c00a3132ec609b8.tar.gz opie-dcb3342e9f310425ed1abeaa6c00a3132ec609b8.tar.bz2 |
if there are no configured plugins, we simply return 0 to let the user in
-rw-r--r-- | libopie2/opiesecurity/multiauthcommon.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libopie2/opiesecurity/multiauthcommon.cpp b/libopie2/opiesecurity/multiauthcommon.cpp index d8e26d5..9de62d2 100644 --- a/libopie2/opiesecurity/multiauthcommon.cpp +++ b/libopie2/opiesecurity/multiauthcommon.cpp | |||
@@ -44,64 +44,73 @@ void SecOwnerDlg::resizeEvent( QResizeEvent * ) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | bool SecOwnerDlg::eventFilter(QObject *o, QEvent *e) | 46 | bool SecOwnerDlg::eventFilter(QObject *o, QEvent *e) |
47 | { | 47 | { |
48 | if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) { | 48 | if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) { |
49 | accept(); | 49 | accept(); |
50 | return TRUE; | 50 | return TRUE; |
51 | } | 51 | } |
52 | return QWidget::eventFilter(o, e); | 52 | return QWidget::eventFilter(o, e); |
53 | } | 53 | } |
54 | 54 | ||
55 | void SecOwnerDlg::mousePressEvent( QMouseEvent * ) { accept(); } | 55 | void SecOwnerDlg::mousePressEvent( QMouseEvent * ) { accept(); } |
56 | 56 | ||
57 | 57 | ||
58 | namespace Internal { | 58 | namespace Internal { |
59 | /// run plugins until we reach nbSuccessMin successes | 59 | /// run plugins until we reach nbSuccessMin successes |
60 | int runPlugins() { | 60 | int runPlugins() { |
61 | 61 | ||
62 | SecOwnerDlg *oi = 0; | 62 | SecOwnerDlg *oi = 0; |
63 | // see if there is contact information. | 63 | // see if there is contact information. |
64 | QString vfilename = Global::applicationFileName("addressbook", | 64 | QString vfilename = Global::applicationFileName("addressbook", |
65 | "businesscard.vcf"); | 65 | "businesscard.vcf"); |
66 | if (QFile::exists(vfilename)) { | 66 | if (QFile::exists(vfilename)) { |
67 | Contact c; | 67 | Contact c; |
68 | c = Contact::readVCard( vfilename )[0]; | 68 | c = Contact::readVCard( vfilename )[0]; |
69 | 69 | ||
70 | oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); | 70 | oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); |
71 | } | 71 | } |
72 | 72 | ||
73 | Config config("Security"); | 73 | Config config("Security"); |
74 | config.setGroup("Plugins"); | 74 | config.setGroup("Plugins"); |
75 | QStringList plugins = config.readListEntry("IncludePlugins", ','); | 75 | QStringList plugins = config.readListEntry("IncludePlugins", ','); |
76 | /* if there are no configured plugins, we simply return 0 to | ||
77 | * let the user in: | ||
78 | */ | ||
79 | if (plugins.isEmpty() == true) { | ||
80 | owarn << "No authentication plugin has been configured yet!" << oendl; | ||
81 | odebug << "Letting the user in..." << oendl; | ||
82 | if(oi) delete oi; | ||
83 | return 0; | ||
84 | } | ||
76 | config.setGroup("Misc"); | 85 | config.setGroup("Misc"); |
77 | int nbSuccessMin = config.readNumEntry("nbSuccessMin", 1); | 86 | int nbSuccessMin = config.readNumEntry("nbSuccessMin", 1); |
78 | int nbSuccess = 0; | 87 | int nbSuccess = 0; |
79 | 88 | ||
80 | /* tries to launch successively each plugin in $OPIEDIR/plugins/security | 89 | /* tries to launch successively each plugin in $OPIEDIR/plugins/security |
81 | * directory which file name is in Security.conf / [Misc] / IncludePlugins | 90 | * directory which file name is in Security.conf / [Misc] / IncludePlugins |
82 | */ | 91 | */ |
83 | QString path = QPEApplication::qpeDir() + "/plugins/security"; | 92 | QString path = QPEApplication::qpeDir() + "/plugins/security"; |
84 | QStringList::Iterator libIt; | 93 | QStringList::Iterator libIt; |
85 | 94 | ||
86 | for ( libIt = plugins.begin(); libIt != plugins.end(); ++libIt ) { | 95 | for ( libIt = plugins.begin(); libIt != plugins.end(); ++libIt ) { |
87 | QInterfacePtr<MultiauthPluginInterface> iface; | 96 | QInterfacePtr<MultiauthPluginInterface> iface; |
88 | QLibrary *lib = new QLibrary( path + "/" + *libIt ); | 97 | QLibrary *lib = new QLibrary( path + "/" + *libIt ); |
89 | 98 | ||
90 | if ( lib->queryInterface( | 99 | if ( lib->queryInterface( |
91 | IID_MultiauthPluginInterface, | 100 | IID_MultiauthPluginInterface, |
92 | (QUnknownInterface**)&iface ) == QS_OK ) | 101 | (QUnknownInterface**)&iface ) == QS_OK ) |
93 | { | 102 | { |
94 | // the plugin is a true Multiauth plugin | 103 | // the plugin is a true Multiauth plugin |
95 | odebug << "Accepted plugin: " << QString( path + "/" + *libIt ) << oendl; | 104 | odebug << "Accepted plugin: " << QString( path + "/" + *libIt ) << oendl; |
96 | odebug << "Plugin name: " << iface->plugin()->pluginName() << oendl; | 105 | odebug << "Plugin name: " << iface->plugin()->pluginName() << oendl; |
97 | 106 | ||
98 | int resultCode; | 107 | int resultCode; |
99 | int tries = 0; | 108 | int tries = 0; |
100 | 109 | ||
101 | // perform authentication | 110 | // perform authentication |
102 | resultCode = iface->plugin()->authenticate(); | 111 | resultCode = iface->plugin()->authenticate(); |
103 | 112 | ||
104 | // display the result in command line | 113 | // display the result in command line |
105 | QString resultMessage; | 114 | QString resultMessage; |
106 | switch (resultCode) | 115 | switch (resultCode) |
107 | { | 116 | { |