summaryrefslogtreecommitdiff
path: root/noncore/securityplugins/blueping
authorclem <clem>2004-06-15 13:49:36 (UTC)
committer clem <clem>2004-06-15 13:49:36 (UTC)
commit5431072f0ea1cbc8ca37914b6349e66079f1acff (patch) (side-by-side diff)
treeda335f89e506cde6ffe59a252b4ccab4e177809b /noncore/securityplugins/blueping
parentba4722d0fed5527a5b799281caf6324f2e7ad5d8 (diff)
downloadopie-5431072f0ea1cbc8ca37914b6349e66079f1acff.zip
opie-5431072f0ea1cbc8ca37914b6349e66079f1acff.tar.gz
opie-5431072f0ea1cbc8ca37914b6349e66079f1acff.tar.bz2
First revision of securityplugins, called by libopiesecurity2 authentication framework (see http://dudu.dyn.2-h.org/nist/OMAF.php).
Diffstat (limited to 'noncore/securityplugins/blueping') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/securityplugins/blueping/.cvsignore3
-rw-r--r--noncore/securityplugins/blueping/Makefile204
-rw-r--r--noncore/securityplugins/blueping/bluepingplugin.control12
-rw-r--r--noncore/securityplugins/blueping/bluepingplugin.cpp198
-rw-r--r--noncore/securityplugins/blueping/bluepingplugin.h81
-rw-r--r--noncore/securityplugins/blueping/bluepingplugin.pro18
-rw-r--r--noncore/securityplugins/blueping/bluepingpluginimpl.cpp28
-rw-r--r--noncore/securityplugins/blueping/bluepingpluginimpl.h58
-rw-r--r--noncore/securityplugins/blueping/config.in4
9 files changed, 606 insertions, 0 deletions
diff --git a/noncore/securityplugins/blueping/.cvsignore b/noncore/securityplugins/blueping/.cvsignore
new file mode 100644
index 0000000..a4e0e29
--- a/dev/null
+++ b/noncore/securityplugins/blueping/.cvsignore
@@ -0,0 +1,3 @@
+.moc
+.obj
+Makefile
diff --git a/noncore/securityplugins/blueping/Makefile b/noncore/securityplugins/blueping/Makefile
new file mode 100644
index 0000000..990a4e0
--- a/dev/null
+++ b/noncore/securityplugins/blueping/Makefile
@@ -0,0 +1,204 @@
+#############################################################################
+# Makefile for building: libmultiauthbluepingplugin.so.1.0.0
+# Generated by qmake (1.05a) (Qt 3.1.2) on: Mon Jun 14 11:00:20 2004
+# Project: bluepingplugin.pro
+# Template: lib
+# Command: $(QMAKE) -o Makefile bluepingplugin.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,libmultiauthbluepingplugin.so.1 -Wl,-rpath,/opt/opie/plugins/security
+LIBS = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib $(LIBS_EXTRA) -lqpe -lopieui2 -lopiecore2 -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 = bluepingplugin.pro
+CHK_DIR_EXISTS=
+MKDIR =
+
+####### Output directory
+
+OBJECTS_DIR = .obj/$(PLATFORM)/
+
+####### Files
+
+HEADERS = bluepingplugin.h \
+ bluepingpluginimpl.h
+SOURCES = bluepingplugin.cpp \
+ bluepingpluginimpl.cpp
+OBJECTS = .obj/$(PLATFORM)/bluepingplugin.o \
+ .obj/$(PLATFORM)/bluepingpluginimpl.o
+FORMS =
+UICDECLS =
+UICIMPLS =
+SRCMOC = .moc/$(PLATFORM)/moc_bluepingplugin.cpp
+OBJMOC = .obj/$(PLATFORM)/moc_bluepingplugin.o
+DIST = ../../../gen.pro \
+ ../../../include.pro \
+ bluepingplugin.pro
+QMAKE_TARGET = multiauthbluepingplugin
+DESTDIR = $(OPIEDIR)/plugins/security/
+TARGET = libmultiauthbluepingplugin.so.1.0.0
+TARGETA = $(OPIEDIR)/plugins/security/libmultiauthbluepingplugin.a
+TARGETD = libmultiauthbluepingplugin.so.1.0.0
+TARGET0 = libmultiauthbluepingplugin.so
+TARGET1 = libmultiauthbluepingplugin.so.1
+TARGET2 = libmultiauthbluepingplugin.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: bluepingplugin.pro /opt/opie/mkspecs/qws/linux-generic-g++/qmake.conf ../../../gen.pro \
+ ../../../include.pro
+ $(QMAKE) -o Makefile bluepingplugin.pro
+qmake:
+ @$(QMAKE) -o Makefile bluepingplugin.pro
+
+dist:
+ @mkdir -p .obj/$(PLATFORM)/multiauthbluepingplugin && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .obj/$(PLATFORM)/multiauthbluepingplugin/ && ( cd `dirname .obj/$(PLATFORM)/multiauthbluepingplugin` && $(TAR) multiauthbluepingplugin.tar multiauthbluepingplugin && $(GZIP) multiauthbluepingplugin.tar ) && $(MOVE) `dirname .obj/$(PLATFORM)/multiauthbluepingplugin`/multiauthbluepingplugin.tar.gz . && $(DEL_FILE) -r .obj/$(PLATFORM)/multiauthbluepingplugin
+
+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 bluepingplugin.h bluepingpluginimpl.h bluepingplugin.cpp bluepingpluginimpl.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-tr.po' && xgettext -C -n -a bluepingplugin.h bluepingpluginimpl.h bluepingplugin.cpp bluepingpluginimpl.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-allstrings.po'
+
+FORCE:
+
+####### Compile
+
+.obj/$(PLATFORM)/bluepingplugin.o: bluepingplugin.cpp bluepingplugin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/bluepingplugin.o bluepingplugin.cpp
+
+.obj/$(PLATFORM)/bluepingpluginimpl.o: bluepingpluginimpl.cpp bluepingpluginimpl.h \
+ bluepingplugin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/bluepingpluginimpl.o bluepingpluginimpl.cpp
+
+.obj/$(PLATFORM)/moc_bluepingplugin.o: .moc/$(PLATFORM)/moc_bluepingplugin.cpp bluepingplugin.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/moc_bluepingplugin.o .moc/$(PLATFORM)/moc_bluepingplugin.cpp
+
+.moc/x86-linux/moc_bluepingplugin.cpp: $(MOC) bluepingplugin.h
+ $(MOC) bluepingplugin.h -o .moc/x86-linux/moc_bluepingplugin.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/blueping/bluepingplugin.control b/noncore/securityplugins/blueping/bluepingplugin.control
new file mode 100644
index 0000000..9c5ec66
--- a/dev/null
+++ b/noncore/securityplugins/blueping/bluepingplugin.control
@@ -0,0 +1,12 @@
+Package: opie-multiauth-bluepingplugin
+Files: plugins/security/libmultiauthbluepingplugin.so* pics/security/bluepingplugin.png
+Priority: optional
+Section: opie/settings
+Maintainer: Clement Seveillac <clement@nist.gov>
+Architecture: arm
+Version: 0.0.2.5
+Depends: libopiecore2, opie-security
+Description: Blueping plugin for opie-security authentication.
+ This is a bluetooth-based authentication plugin (you need
+ to have another Bluetooth device around, the more secure the
+ bonding they made, the more secure the authentication)
diff --git a/noncore/securityplugins/blueping/bluepingplugin.cpp b/noncore/securityplugins/blueping/bluepingplugin.cpp
new file mode 100644
index 0000000..af0448b
--- a/dev/null
+++ b/noncore/securityplugins/blueping/bluepingplugin.cpp
@@ -0,0 +1,198 @@
+#include "bluepingplugin.h"
+
+#include <opie2/oapplication.h>
+#include <opie2/odebug.h>
+#include <opie2/odevice.h>
+
+#include <qdialog.h>
+#include <qlayout.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qtimer.h>
+
+using namespace Opie::Core;
+
+/// creates and initializes the m_config Config object
+BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) {
+ m_config = new Config("Security");
+ m_config->setGroup("BluepingPlugin");
+ bluetoothAlreadyRestarted = false;
+}
+
+/// deletes the m_config Config object and noticeW if necessary
+BluepingPlugin::~BluepingPlugin() {
+ delete m_config;
+ if (m_ping != 0)
+ delete m_ping;
+}
+
+/// Simply return its name (Blueping plugin)
+QString BluepingPlugin::pluginName() const {
+ return "Blueping plugin";
+}
+
+/// no configuration widget for the moment
+MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) {
+ return 0l;
+}
+QString BluepingPlugin::pixmapNameWidget() const {
+ return "security/bluepingplugin";
+}
+QString BluepingPlugin::pixmapNameConfig() const {
+ return 0l;
+}
+
+/// Emit the MultiauthPluginObject::Success emitCode
+void BluepingPlugin::success() {
+ emit emitCode(MultiauthPluginObject::Success);
+}
+
+/// Emit the MultiauthPluginObject::Failure emitCode
+void BluepingPlugin::failure() {
+ emit emitCode(MultiauthPluginObject::Failure);
+}
+
+/// Emit the MultiauthPluginObject::Skip emitCode
+void BluepingPlugin::skip() {
+ emit emitCode(MultiauthPluginObject::Skip);
+}
+
+/// do the actual ping
+void BluepingPlugin::ping() {
+ m_ping = new OProcess();
+ odebug << "pinging device: " << macToPing << oendl;
+ *m_ping << "l2ping" << "-c 1" << macToPing;
+
+ // starting to ping in the background
+ /// \todo as soon as ping is launched, check RSSI (signal strength) and check
+ /// it's high enough, meaning the device is close enough?
+ /// \todo make it optionally pollable, so don't finish the ping and call
+ /// Opie suspend if l2ping timeouts?
+ if ( !m_ping->start() ) {
+ oerr << "could not start l2ping" << oendl;
+ this->skip();
+ }
+ QObject::connect(m_ping, SIGNAL(processExited(Opie::Core::OProcess*)),
+ this, SLOT(pingFinished(Opie::Core::OProcess*)) );
+}
+
+/// Deals with m_ping result
+ void BluepingPlugin::pingFinished(OProcess * ping) {
+ if ( ping->normalExit() && (ping->exitStatus() == 0) )
+ {
+ odebug << "Successful Bluetooth ping!" << oendl;
+ success();
+ }
+ else
+ {
+ odebug << "Failed Bluetooth ping..." << oendl;
+ failure();
+ }
+ }
+
+/// Make one authentication attempt with this plugin
+/**
+ * (very simple "success" / "failure" buttons in a dialog)
+ * \return The outcome code of this authentication
+ */
+int BluepingPlugin::authenticate() {
+
+ Config cfg("Security");
+ cfg.setGroup("BluepingPlugin");
+ macToPing = cfg.readEntry("mac");
+ if (!macToPing.isEmpty())
+ {
+ /* Standard, inescapable authentication dialog
+ */
+ QDialog bluepingDialog(0,
+ "Blueping dialog",
+ TRUE,
+ Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
+
+ QRect desk = oApp->desktop()->geometry();
+ bluepingDialog.setGeometry( 0, 0, desk.width(), desk.height() );
+
+ // Creation of the particular widgets of our Blueping user interface
+ QVBoxLayout *layout = new QVBoxLayout(&bluepingDialog);
+ layout->setSpacing(11);
+ layout->setMargin(11);
+ layout->setAlignment( Qt::AlignTop );
+
+ QLabel title("<center><h1>\"Blueping\" <br />plugin</h1></center>", &bluepingDialog);
+ QLabel subTitle("<center><h2>Trying to reach your configured bluetooth device...</h2></center>", &bluepingDialog);
+ QLabel subTitle2("<center>You can skip this step and use another authentication way with the following button</center>", &bluepingDialog);
+ QPushButton pbSkip("Skip", &bluepingDialog);
+ layout->addWidget(&title);
+ layout->addWidget(&subTitle);
+ layout->addWidget(&subTitle2);
+ layout->addWidget(&pbSkip, 0, Qt::AlignHCenter);
+
+ // connect the skip button to the skip signal emitting function
+ QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip()));
+ // connect the signal emitting functions to the bluepingDialog done(int) finishing function
+ QObject::connect(this, SIGNAL(emitCode(int)), &bluepingDialog, SLOT(done(int)));
+
+ if (!bluetoothAlreadyRestarted)
+ {
+ // we have just started or resumed the device, so Bluetooth has to be (re)started
+ OProcess killB;
+ killB << "killall" << "hciattach";
+ odebug << "killing Bluetooth..." << oendl;
+ if ( !killB.start(OProcess::Block) ) {
+ oerr << "could not kill bluetooth" << oendl;
+ }
+
+ OProcess startB;
+ switch ( ODevice::inst()->model() ) {
+ case Model_iPAQ_H39xx:
+ startB << "/sbin/hciattach" << "/dev/tts/1" << "bcsp" << "921600";
+ break;
+
+ case Model_iPAQ_H5xxx:
+ startB << "/sbin/hciattach" << "/dev/tts/1" << "any" << "921600";
+ break;
+
+ default:
+ startB << "/sbin/hciattach" << "/dev/ttySB0" << "bcsp" << "230400";
+ break;
+ } // end switch on device models
+
+ if ( !startB.start(OProcess::Block) ) {
+ oerr << "could not (re)start bluetooth" << oendl;
+ return MultiauthPluginObject::Skip;
+ }
+ else
+ {
+ if ( startB.normalExit() && (startB.exitStatus() == 0) )
+ {
+ odebug << "hciattach exited normally."<< oendl;
+ bluetoothAlreadyRestarted = true;
+ // 500 ms timer, so l2ping won't try to find a route before bluetooth has \em really started
+ QTimer::singleShot( 500, this, SLOT(ping()) );
+ }
+ else
+ {
+ owarn << "hciattach exited anormally (error code: " << startB.exitStatus() << ")" << oendl;
+ } // end if startBluetooth exit status == 0
+ } // end if startBluetooth started
+ }
+ else
+ {
+ // we don't need to wait, since bluetooth has been started long enough ago
+ ping();
+ } // end if bluetooth not restarted
+
+
+ // start the dialog event loop, while the ping is starting (or will start soon) in the background
+ return bluepingDialog.exec();
+
+
+ }
+ else
+ {
+ owarn << "No Bluetooth device has been set!" << oendl;
+ owarn << "We will consider it as a successful authentication though." << oendl;
+ return MultiauthPluginObject::Success;
+ } // end if mac defined
+}
diff --git a/noncore/securityplugins/blueping/bluepingplugin.h b/noncore/securityplugins/blueping/bluepingplugin.h
new file mode 100644
index 0000000..c122471
--- a/dev/null
+++ b/noncore/securityplugins/blueping/bluepingplugin.h
@@ -0,0 +1,81 @@
+/**
+ * \file bluepingplugin.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 <opie-devel@handhelds.org>
+ .>+-=
+ _;:, .> :=|. 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_,=:_. -<s. This library is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: 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 BLUEPING_PLUGIN_H
+#define BLUEPING_PLUGIN_H
+
+#include <opie2/multiauthplugininterface.h>
+
+#include <opie2/oprocess.h>
+
+#include <qobject.h>
+#include <qstring.h>
+#include <qpe/config.h>
+
+/// Multi-authentication bluetooth plugin, which tries to ping a specific MAC address.
+/**
+ * The plugin itself, implementing the main authenticate() function.
+ */
+class BluepingPlugin : public QObject, public MultiauthPluginObject {
+
+ Q_OBJECT
+
+ public:
+ BluepingPlugin();
+ virtual ~BluepingPlugin();
+ 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();
+ void ping();
+ void pingFinished(Opie::Core::OProcess * ping);
+
+ private:
+ Opie::Core::OProcess *m_ping;
+ Config * m_config;
+ bool bluetoothAlreadyRestarted;
+ QString macToPing;
+
+};
+
+#endif
diff --git a/noncore/securityplugins/blueping/bluepingplugin.pro b/noncore/securityplugins/blueping/bluepingplugin.pro
new file mode 100644
index 0000000..1b92c16
--- a/dev/null
+++ b/noncore/securityplugins/blueping/bluepingplugin.pro
@@ -0,0 +1,18 @@
+TEMPLATE = lib
+CONFIG += qt warn_on
+
+HEADERS = bluepingplugin.h bluepingpluginimpl.h
+
+SOURCES = bluepingplugin.cpp bluepingpluginimpl.cpp
+
+
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH +=
+
+LIBS += -lqpe -lopieui2 -lopiecore2
+
+DESTDIR = $(OPIEDIR)/plugins/security
+TARGET = multiauthbluepingplugin
+
+include ( $(OPIEDIR)/include.pro )
+
diff --git a/noncore/securityplugins/blueping/bluepingpluginimpl.cpp b/noncore/securityplugins/blueping/bluepingpluginimpl.cpp
new file mode 100644
index 0000000..f7b1bfc
--- a/dev/null
+++ b/noncore/securityplugins/blueping/bluepingpluginimpl.cpp
@@ -0,0 +1,28 @@
+#include "bluepingpluginimpl.h"
+
+BluepingPluginImpl::BluepingPluginImpl() {
+ bluepingPlugin = new BluepingPlugin();
+}
+
+BluepingPluginImpl::~BluepingPluginImpl() {
+ delete bluepingPlugin;
+}
+
+MultiauthPluginObject* BluepingPluginImpl::plugin() {
+ return bluepingPlugin;
+}
+
+Q_EXPORT_INTERFACE() {
+ Q_CREATE_INSTANCE( BluepingPluginImpl )
+}
+
+QRESULT BluepingPluginImpl::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/blueping/bluepingpluginimpl.h b/noncore/securityplugins/blueping/bluepingpluginimpl.h
new file mode 100644
index 0000000..2fd023a
--- a/dev/null
+++ b/noncore/securityplugins/blueping/bluepingpluginimpl.h
@@ -0,0 +1,58 @@
+/**
+ * \file bluepingpluginimpl.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 <opie-devel@handhelds.org>
+ .>+-=
+ _;:, .> :=|. 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_,=:_. -<s. This library is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: 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 BLUEPING_PLUGIN_IMPL_H
+#define BLUEPING_PLUGIN_IMPL_H
+
+#include "bluepingplugin.h"
+
+/// Standard multiauth plugin class
+class BluepingPluginImpl : public MultiauthPluginInterface{
+
+ public:
+ BluepingPluginImpl();
+ virtual ~BluepingPluginImpl();
+
+ QRESULT queryInterface( const QUuid &, QUnknownInterface** );
+ /// defines standard addRef() and release() functions
+ Q_REFCOUNT;
+
+ virtual MultiauthPluginObject *plugin();
+
+ private:
+ /// the plugin itself
+ BluepingPlugin *bluepingPlugin;
+ ulong ref;
+};
+
+#endif
diff --git a/noncore/securityplugins/blueping/config.in b/noncore/securityplugins/blueping/config.in
new file mode 100644
index 0000000..ec17c33
--- a/dev/null
+++ b/noncore/securityplugins/blueping/config.in
@@ -0,0 +1,4 @@
+ config MULTIAUTH_BLUEPING
+ boolean "opie-multiauth-blueping (blueping authentication plugin for opie-multiauth testing)"
+ default "y"
+ depends SECURITY