From 5431072f0ea1cbc8ca37914b6349e66079f1acff Mon Sep 17 00:00:00 2001 From: clem Date: Tue, 15 Jun 2004 13:49:36 +0000 Subject: First revision of securityplugins, called by libopiesecurity2 authentication framework (see http://dudu.dyn.2-h.org/nist/OMAF.php). --- (limited to 'noncore/securityplugins/dummy') diff --git a/noncore/securityplugins/dummy/.cvsignore b/noncore/securityplugins/dummy/.cvsignore new file mode 100644 index 0000000..a4e0e29 --- a/dev/null +++ b/noncore/securityplugins/dummy/.cvsignore @@ -0,0 +1,3 @@ +.moc +.obj +Makefile diff --git a/noncore/securityplugins/dummy/Makefile b/noncore/securityplugins/dummy/Makefile new file mode 100644 index 0000000..f6a1f9f --- a/dev/null +++ b/noncore/securityplugins/dummy/Makefile @@ -0,0 +1,204 @@ +############################################################################# +# Makefile for building: libmultiauthdummyplugin.so.1.0.0 +# Generated by qmake (1.05a) (Qt 3.1.2) on: Mon Jun 14 11:00:19 2004 +# Project: dummyplugin.pro +# Template: lib +# Command: $(QMAKE) -o Makefile dummyplugin.pro +############################################################################# + +####### Compiler, tools and options + +CC = $(CCACHE) $(DISTCC) gcc +CXX = $(CCACHE) $(DISTCC) g++ +LEX = flex +YACC = yacc +CFLAGS = -pipe $(CFLAGS_EXTRA) -Wall -W -g -fPIC -DQT_COMPONENT_DEBUG=2 -DQT_DEBUG -DOPIE_NO_BUILTIN_SHUTDOWN -DUSE_FILE_NOTIFICATION -DOPIE_SOUND_FRAGMENT_SHIFT=16 +CXXFLAGS = -pipe $(CFLAGS_EXTRA) -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) -Wall -W -g -fPIC -DQT_COMPONENT_DEBUG=2 -DQT_DEBUG -DOPIE_NO_BUILTIN_SHUTDOWN -DUSE_FILE_NOTIFICATION -DOPIE_SOUND_FRAGMENT_SHIFT=16 +LEXFLAGS = +YACCFLAGS= -d +INCPATH = -I/opt/opie/mkspecs/qws/linux-generic-g++ -I. -I$(OPIEDIR)/include -I$(QTDIR)/include -I.moc/$(PLATFORM)/ +LINK = g++ +LFLAGS = $(LFLAGS_EXTRA) -Wl,-rpath-link,$(OPIEDIR)/lib -shared -Wl,-soname,libmultiauthdummyplugin.so.1 -Wl,-rpath,/opt/opie/plugins/security +LIBS = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib $(LIBS_EXTRA) -lqpe -lopieui2 -L$(OPIEDIR)/lib -lqte +AR = ar cqs +RANLIB = +MOC = $(QTDIR)/bin/moc +UIC = $(QTDIR)/bin/uic +QMAKE = qmake +TAR = tar -cf +GZIP = gzip -9f +COPY = cp -f +COPY_FILE= $(COPY) -p +COPY_DIR = $(COPY) -pR +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +PRO = dummyplugin.pro +CHK_DIR_EXISTS= +MKDIR = + +####### Output directory + +OBJECTS_DIR = .obj/$(PLATFORM)/ + +####### Files + +HEADERS = dummyplugin.h \ + dummypluginimpl.h +SOURCES = dummyplugin.cpp \ + dummypluginimpl.cpp +OBJECTS = .obj/$(PLATFORM)/dummyplugin.o \ + .obj/$(PLATFORM)/dummypluginimpl.o +FORMS = +UICDECLS = +UICIMPLS = +SRCMOC = .moc/$(PLATFORM)/moc_dummyplugin.cpp +OBJMOC = .obj/$(PLATFORM)/moc_dummyplugin.o +DIST = ../../../gen.pro \ + ../../../include.pro \ + dummyplugin.pro +QMAKE_TARGET = multiauthdummyplugin +DESTDIR = $(OPIEDIR)/plugins/security/ +TARGET = libmultiauthdummyplugin.so.1.0.0 +TARGETA = $(OPIEDIR)/plugins/security/libmultiauthdummyplugin.a +TARGETD = libmultiauthdummyplugin.so.1.0.0 +TARGET0 = libmultiauthdummyplugin.so +TARGET1 = libmultiauthdummyplugin.so.1 +TARGET2 = libmultiauthdummyplugin.so.1.0 + +first: all +####### Implicit rules + +.SUFFIXES: .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + +all: Makefile $(OPIEDIR)/plugins/security/$(TARGET) + +$(OPIEDIR)/plugins/security/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) + test -d $(OPIEDIR)/plugins/security/ || mkdir -p $(OPIEDIR)/plugins/security/ + -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + -ln -s $(TARGET) $(TARGET0) + -ln -s $(TARGET) $(TARGET1) + -ln -s $(TARGET) $(TARGET2) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET1) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET2) + -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(OPIEDIR)/plugins/security/ + + + +staticlib: $(TARGETA) + +$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) + -$(DEL_FILE) $(TARGETA) + $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) + +mocables: $(SRCMOC) + +$(MOC): + ( cd $(QTDIR)/src/moc ; $(MAKE) ) + +Makefile: dummyplugin.pro /opt/opie/mkspecs/qws/linux-generic-g++/qmake.conf ../../../gen.pro \ + ../../../include.pro + $(QMAKE) -o Makefile dummyplugin.pro +qmake: + @$(QMAKE) -o Makefile dummyplugin.pro + +dist: + @mkdir -p .obj/$(PLATFORM)/multiauthdummyplugin && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .obj/$(PLATFORM)/multiauthdummyplugin/ && ( cd `dirname .obj/$(PLATFORM)/multiauthdummyplugin` && $(TAR) multiauthdummyplugin.tar multiauthdummyplugin && $(GZIP) multiauthdummyplugin.tar ) && $(MOVE) `dirname .obj/$(PLATFORM)/multiauthdummyplugin`/multiauthdummyplugin.tar.gz . && $(DEL_FILE) -r .obj/$(PLATFORM)/multiauthdummyplugin + +mocclean: + -$(DEL_FILE) $(OBJMOC) + -$(DEL_FILE) $(SRCMOC) + +uiclean: + +yaccclean: +lexclean: +clean: mocclean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET) $(TARGET) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0) $(OPIEDIR)/plugins/security/$(TARGET1) $(OPIEDIR)/plugins/security/$(TARGET2) $(TARGETA) + + +lupdate: + lupdate -noobsolete $(PRO) + +lrelease: + lrelease $(PRO) + +ipk: + tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="" install && ipkg-build ; rm -rf ; ) + +opie-lupdate: + opie-lupdate $(PRO) + +opie-lrelease: + opie-lrelease $(PRO) + +messages: + xgettext -C -n -ktr -kQT_TRANSLATE_NOOP dummyplugin.h dummypluginimpl.h dummyplugin.cpp dummypluginimpl.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-tr.po' && xgettext -C -n -a dummyplugin.h dummypluginimpl.h dummyplugin.cpp dummypluginimpl.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-allstrings.po' + +FORCE: + +####### Compile + +.obj/$(PLATFORM)/dummyplugin.o: dummyplugin.cpp dummyplugin.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/dummyplugin.o dummyplugin.cpp + +.obj/$(PLATFORM)/dummypluginimpl.o: dummypluginimpl.cpp dummypluginimpl.h \ + dummyplugin.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/dummypluginimpl.o dummypluginimpl.cpp + +.obj/$(PLATFORM)/moc_dummyplugin.o: .moc/$(PLATFORM)/moc_dummyplugin.cpp dummyplugin.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/moc_dummyplugin.o .moc/$(PLATFORM)/moc_dummyplugin.cpp + +.moc/x86-linux/moc_dummyplugin.cpp: $(MOC) dummyplugin.h + $(MOC) dummyplugin.h -o .moc/x86-linux/moc_dummyplugin.cpp + +####### Install + +install_target: + @$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" || $(MKDIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" + -$(COPY) "$(OPIEDIR)/plugins/security/$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)" + -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)" + -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)" + -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)" + +uninstall_target: + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)" + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)" + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)" + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)" + -$(DEL_DIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" + + +install: all install_target + +uninstall: uninstall_target + diff --git a/noncore/securityplugins/dummy/config.in b/noncore/securityplugins/dummy/config.in new file mode 100644 index 0000000..2053eef --- a/dev/null +++ b/noncore/securityplugins/dummy/config.in @@ -0,0 +1,4 @@ + config MULTIAUTH_DUMMY + boolean "opie-multiauth-dummy (dummy authentication plugin for opie-multiauth testing)" + default "y" + depends SECURITY diff --git a/noncore/securityplugins/dummy/dummyplugin.control b/noncore/securityplugins/dummy/dummyplugin.control new file mode 100644 index 0000000..1bd9700 --- a/dev/null +++ b/noncore/securityplugins/dummy/dummyplugin.control @@ -0,0 +1,11 @@ +Package: opie-multiauth-dummyplugin +Files: plugins/security/libmultiauthdummyplugin.so* pics/security/dummyplugin.png +Priority: optional +Section: opie/settings +Maintainer: Clement Seveillac +Architecture: arm +Version: 0.0.2.3 +Depends: opie-security +Description: Dummy plugin for opie-security authentication. + This is a very simple authentication plugin (you just have + to press a button basically), for demonstration purpose. diff --git a/noncore/securityplugins/dummy/dummyplugin.cpp b/noncore/securityplugins/dummy/dummyplugin.cpp new file mode 100644 index 0000000..0d19e43 --- a/dev/null +++ b/noncore/securityplugins/dummy/dummyplugin.cpp @@ -0,0 +1,92 @@ +#include "dummyplugin.h" + +#include + +#include +#include +#include +#include + +/// Simply return its name (Dummy plugin) +QString DummyPlugin::pluginName() const { + return "Dummy plugin"; +} + +/// no configuration widget for the moment +MultiauthConfigWidget * DummyPlugin::configWidget(QWidget * parent) { + return 0l; +} +QString DummyPlugin::pixmapNameWidget() const { + return "security/dummyplugin"; +} +QString DummyPlugin::pixmapNameConfig() const { + return 0l; +} + +/// Emit the MultiauthPluginObject::Success emitCode +void DummyPlugin::success() { + emit emitCode(MultiauthPluginObject::Success); +} + +/// Emit the MultiauthPluginObject::Failure emitCode +void DummyPlugin::failure() { + emit emitCode(MultiauthPluginObject::Failure); +} + +/// Emit the MultiauthPluginObject::Skip emitCode +void DummyPlugin::skip() { + emit emitCode(MultiauthPluginObject::Skip); +} + +/// Make one authentication attempt with this plugin +/** + * (very simple "success" / "failure" buttons in a dialog) + * \return The outcome code of this authentication + */ +int DummyPlugin::authenticate() { + + /* Standard, inescapable authentication dialog + */ + QDialog dummyDialog(0, + "Dummy dialog", + TRUE, + Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); + + QRect desk = oApp->desktop()->geometry(); + dummyDialog.setGeometry( 0, 0, desk.width(), desk.height() ); + + /* Creation of the particular widgets of our Dummy user interface + * Note: we have to resize the VBox to the QDialog size, since it's not + * done automatically. + */ + QVBoxLayout layout(&dummyDialog); + layout.setSpacing(11); + layout.setMargin(11); + layout.setAlignment( Qt::AlignTop ); + + QLabel title("

" + tr("\"Dummy\"
demonstration plugin") + "

", &dummyDialog); + QLabel subTitle("

" +tr("You can simulate the following outcomes:") + "

", &dummyDialog); + layout.addWidget(&title); + layout.addWidget(&subTitle); + + QHBoxLayout hl(&layout); + QPushButton pbSuccess("Success", &dummyDialog); + QPushButton pbSkip("Skip", &dummyDialog); + QPushButton pbFailure("Failure", &dummyDialog); + hl.addWidget(&pbSuccess, 0, Qt::AlignHCenter); + hl.addWidget(&pbSkip, 0, Qt::AlignHCenter); + hl.addWidget(&pbFailure, 0, Qt::AlignHCenter); + + /* Linking our pushbuttons to exit functions + * (each result button here has a corresponding slot) + */ + QObject::connect(&pbSuccess, SIGNAL(clicked()), this, SLOT(success())); + QObject::connect(&pbFailure, SIGNAL(clicked()), this, SLOT(failure())); + QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); + + /* The value of the signal these three slots will emit corresponds to + * the different values we want to return + */ + QObject::connect(this, SIGNAL(emitCode(int)), &dummyDialog, SLOT(done(int))); + return dummyDialog.exec(); +} diff --git a/noncore/securityplugins/dummy/dummyplugin.h b/noncore/securityplugins/dummy/dummyplugin.h new file mode 100644 index 0000000..9680dff --- a/dev/null +++ b/noncore/securityplugins/dummy/dummyplugin.h @@ -0,0 +1,66 @@ +/** + * \file dummyplugin.h + * \brief Standard Opie multiauth plugin definition + * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) + */ +/* + =. This file is part of the Opie Project + .=l. Copyright (C) 2004 Opie Developer Team + .>+-= + _;:, .> :=|. This library is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef DUMMY_PLUGIN_H +#define DUMMY_PLUGIN_H + +#include +#include +#include + +/// Multi-authentication example plugin, implementing a trivial 'yes/no' verification. +/** + * The plugin itself, implementing the main authenticate() function. + */ +class DummyPlugin : public QObject, public MultiauthPluginObject { + + Q_OBJECT + + public: + int authenticate(); + MultiauthConfigWidget * configWidget(QWidget * parent); + QString pixmapNameConfig() const; + QString pixmapNameWidget() const; + QString pluginName() const; + + signals: + /// Signal carrying the result code of this plugin + void emitCode(int resultCode); + + private slots: + void success(); + void failure(); + void skip(); +}; + +#endif diff --git a/noncore/securityplugins/dummy/dummyplugin.pro b/noncore/securityplugins/dummy/dummyplugin.pro new file mode 100644 index 0000000..bb9971c --- a/dev/null +++ b/noncore/securityplugins/dummy/dummyplugin.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib +CONFIG += qt warn_on +CONFIG -= moc + +HEADERS = dummyplugin.h dummypluginimpl.h + +SOURCES = dummyplugin.cpp dummypluginimpl.cpp + + +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += + +LIBS += -lqpe -lopieui2 + +DESTDIR = $(OPIEDIR)/plugins/security +TARGET = multiauthdummyplugin + +include ( $(OPIEDIR)/include.pro ) + diff --git a/noncore/securityplugins/dummy/dummypluginimpl.cpp b/noncore/securityplugins/dummy/dummypluginimpl.cpp new file mode 100644 index 0000000..518996c --- a/dev/null +++ b/noncore/securityplugins/dummy/dummypluginimpl.cpp @@ -0,0 +1,28 @@ +#include "dummypluginimpl.h" + +DummyPluginImpl::DummyPluginImpl() { + dummyPlugin = new DummyPlugin(); +} + +DummyPluginImpl::~DummyPluginImpl() { + delete dummyPlugin; +} + +MultiauthPluginObject* DummyPluginImpl::plugin() { + return dummyPlugin; +} + +Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( DummyPluginImpl ) +} + +QRESULT DummyPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { + *iface = 0; + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + } else { + return QE_NOINTERFACE; + } + return QS_OK; + +} diff --git a/noncore/securityplugins/dummy/dummypluginimpl.h b/noncore/securityplugins/dummy/dummypluginimpl.h new file mode 100644 index 0000000..49a18cd --- a/dev/null +++ b/noncore/securityplugins/dummy/dummypluginimpl.h @@ -0,0 +1,58 @@ +/** + * \file dummypluginimpl.h + * \brief Standard Opie multiauth plugin interface definition + * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) + */ +/* + =. This file is part of the Opie Project + .=l. Copyright (C) 2004 Opie Developer Team + .>+-= + _;:, .> :=|. This library is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef DUMMY_PLUGIN_IMPL_H +#define DUMMY_PLUGIN_IMPL_H + +#include "dummyplugin.h" + +/// Standard multiauth plugin class +class DummyPluginImpl : public MultiauthPluginInterface{ + + public: + DummyPluginImpl(); + virtual ~DummyPluginImpl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + /// defines standard addRef() and release() functions + Q_REFCOUNT; + + virtual MultiauthPluginObject *plugin(); + + private: + /// the plugin itself + DummyPlugin *dummyPlugin; + ulong ref; +}; + +#endif -- cgit v0.9.0.2