Diffstat (limited to 'noncore/securityplugins/blueping') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/securityplugins/blueping/.cvsignore | 3 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/Makefile | 204 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingplugin.control | 12 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingplugin.cpp | 198 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingplugin.h | 81 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingplugin.pro | 18 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingpluginimpl.cpp | 28 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/bluepingpluginimpl.h | 58 | ||||
-rw-r--r-- | noncore/securityplugins/blueping/config.in | 4 |
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 @@ | |||
1 | .moc | ||
2 | .obj | ||
3 | 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 @@ | |||
1 | ############################################################################# | ||
2 | # Makefile for building: libmultiauthbluepingplugin.so.1.0.0 | ||
3 | # Generated by qmake (1.05a) (Qt 3.1.2) on: Mon Jun 14 11:00:20 2004 | ||
4 | # Project: bluepingplugin.pro | ||
5 | # Template: lib | ||
6 | # Command: $(QMAKE) -o Makefile bluepingplugin.pro | ||
7 | ############################################################################# | ||
8 | |||
9 | ####### Compiler, tools and options | ||
10 | |||
11 | CC = $(CCACHE) $(DISTCC) gcc | ||
12 | CXX = $(CCACHE) $(DISTCC) g++ | ||
13 | LEX = flex | ||
14 | YACC = yacc | ||
15 | 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 | ||
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 | ||
17 | LEXFLAGS = | ||
18 | YACCFLAGS= -d | ||
19 | INCPATH = -I/opt/opie/mkspecs/qws/linux-generic-g++ -I. -I$(OPIEDIR)/include -I$(QTDIR)/include -I.moc/$(PLATFORM)/ | ||
20 | LINK = g++ | ||
21 | LFLAGS = $(LFLAGS_EXTRA) -Wl,-rpath-link,$(OPIEDIR)/lib -shared -Wl,-soname,libmultiauthbluepingplugin.so.1 -Wl,-rpath,/opt/opie/plugins/security | ||
22 | LIBS = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib $(LIBS_EXTRA) -lqpe -lopieui2 -lopiecore2 -L$(OPIEDIR)/lib -lqte | ||
23 | AR = ar cqs | ||
24 | RANLIB = | ||
25 | MOC = $(QTDIR)/bin/moc | ||
26 | UIC = $(QTDIR)/bin/uic | ||
27 | QMAKE = qmake | ||
28 | TAR = tar -cf | ||
29 | GZIP = gzip -9f | ||
30 | COPY = cp -f | ||
31 | COPY_FILE= $(COPY) -p | ||
32 | COPY_DIR = $(COPY) -pR | ||
33 | DEL_FILE = rm -f | ||
34 | SYMLINK = ln -sf | ||
35 | DEL_DIR = rmdir | ||
36 | MOVE = mv -f | ||
37 | PRO = bluepingplugin.pro | ||
38 | CHK_DIR_EXISTS= | ||
39 | MKDIR = | ||
40 | |||
41 | ####### Output directory | ||
42 | |||
43 | OBJECTS_DIR = .obj/$(PLATFORM)/ | ||
44 | |||
45 | ####### Files | ||
46 | |||
47 | HEADERS = bluepingplugin.h \ | ||
48 | bluepingpluginimpl.h | ||
49 | SOURCES = bluepingplugin.cpp \ | ||
50 | bluepingpluginimpl.cpp | ||
51 | OBJECTS = .obj/$(PLATFORM)/bluepingplugin.o \ | ||
52 | .obj/$(PLATFORM)/bluepingpluginimpl.o | ||
53 | FORMS = | ||
54 | UICDECLS = | ||
55 | UICIMPLS = | ||
56 | SRCMOC = .moc/$(PLATFORM)/moc_bluepingplugin.cpp | ||
57 | OBJMOC = .obj/$(PLATFORM)/moc_bluepingplugin.o | ||
58 | DIST = ../../../gen.pro \ | ||
59 | ../../../include.pro \ | ||
60 | bluepingplugin.pro | ||
61 | QMAKE_TARGET = multiauthbluepingplugin | ||
62 | DESTDIR = $(OPIEDIR)/plugins/security/ | ||
63 | TARGET = libmultiauthbluepingplugin.so.1.0.0 | ||
64 | TARGETA= $(OPIEDIR)/plugins/security/libmultiauthbluepingplugin.a | ||
65 | TARGETD= libmultiauthbluepingplugin.so.1.0.0 | ||
66 | TARGET0= libmultiauthbluepingplugin.so | ||
67 | TARGET1= libmultiauthbluepingplugin.so.1 | ||
68 | TARGET2= libmultiauthbluepingplugin.so.1.0 | ||
69 | |||
70 | first: all | ||
71 | ####### Implicit rules | ||
72 | |||
73 | .SUFFIXES: .c .cpp .cc .cxx .C | ||
74 | |||
75 | .cpp.o: | ||
76 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
77 | |||
78 | .cc.o: | ||
79 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
80 | |||
81 | .cxx.o: | ||
82 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
83 | |||
84 | .C.o: | ||
85 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
86 | |||
87 | .c.o: | ||
88 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
89 | |||
90 | ####### Build rules | ||
91 | |||
92 | all: Makefile $(OPIEDIR)/plugins/security/$(TARGET) | ||
93 | |||
94 | $(OPIEDIR)/plugins/security/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
95 | test -d $(OPIEDIR)/plugins/security/ || mkdir -p $(OPIEDIR)/plugins/security/ | ||
96 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) | ||
97 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
98 | -ln -s $(TARGET) $(TARGET0) | ||
99 | -ln -s $(TARGET) $(TARGET1) | ||
100 | -ln -s $(TARGET) $(TARGET2) | ||
101 | -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET) | ||
102 | -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0) | ||
103 | -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET1) | ||
104 | -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET2) | ||
105 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(OPIEDIR)/plugins/security/ | ||
106 | |||
107 | |||
108 | |||
109 | staticlib: $(TARGETA) | ||
110 | |||
111 | $(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) | ||
112 | -$(DEL_FILE) $(TARGETA) | ||
113 | $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) | ||
114 | |||
115 | mocables: $(SRCMOC) | ||
116 | |||
117 | $(MOC): | ||
118 | ( cd $(QTDIR)/src/moc ; $(MAKE) ) | ||
119 | |||
120 | Makefile: bluepingplugin.pro /opt/opie/mkspecs/qws/linux-generic-g++/qmake.conf ../../../gen.pro \ | ||
121 | ../../../include.pro | ||
122 | $(QMAKE) -o Makefile bluepingplugin.pro | ||
123 | qmake: | ||
124 | @$(QMAKE) -o Makefile bluepingplugin.pro | ||
125 | |||
126 | dist: | ||
127 | @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 | ||
128 | |||
129 | mocclean: | ||
130 | -$(DEL_FILE) $(OBJMOC) | ||
131 | -$(DEL_FILE) $(SRCMOC) | ||
132 | |||
133 | uiclean: | ||
134 | |||
135 | yaccclean: | ||
136 | lexclean: | ||
137 | clean: mocclean | ||
138 | -$(DEL_FILE) $(OBJECTS) | ||
139 | -$(DEL_FILE) *~ core *.core | ||
140 | |||
141 | |||
142 | ####### Sub-libraries | ||
143 | |||
144 | distclean: clean | ||
145 | -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET) $(TARGET) | ||
146 | -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0) $(OPIEDIR)/plugins/security/$(TARGET1) $(OPIEDIR)/plugins/security/$(TARGET2) $(TARGETA) | ||
147 | |||
148 | |||
149 | lupdate: | ||
150 | lupdate -noobsolete $(PRO) | ||
151 | |||
152 | lrelease: | ||
153 | lrelease $(PRO) | ||
154 | |||
155 | ipk: | ||
156 | tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="" install && ipkg-build ; rm -rf ; ) | ||
157 | |||
158 | opie-lupdate: | ||
159 | opie-lupdate $(PRO) | ||
160 | |||
161 | opie-lrelease: | ||
162 | opie-lrelease $(PRO) | ||
163 | |||
164 | messages: | ||
165 | 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' | ||
166 | |||
167 | FORCE: | ||
168 | |||
169 | ####### Compile | ||
170 | |||
171 | .obj/$(PLATFORM)/bluepingplugin.o: bluepingplugin.cpp bluepingplugin.h | ||
172 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/bluepingplugin.o bluepingplugin.cpp | ||
173 | |||
174 | .obj/$(PLATFORM)/bluepingpluginimpl.o: bluepingpluginimpl.cpp bluepingpluginimpl.h \ | ||
175 | bluepingplugin.h | ||
176 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/bluepingpluginimpl.o bluepingpluginimpl.cpp | ||
177 | |||
178 | .obj/$(PLATFORM)/moc_bluepingplugin.o: .moc/$(PLATFORM)/moc_bluepingplugin.cpp bluepingplugin.h | ||
179 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/moc_bluepingplugin.o .moc/$(PLATFORM)/moc_bluepingplugin.cpp | ||
180 | |||
181 | .moc/x86-linux/moc_bluepingplugin.cpp: $(MOC) bluepingplugin.h | ||
182 | $(MOC) bluepingplugin.h -o .moc/x86-linux/moc_bluepingplugin.cpp | ||
183 | |||
184 | ####### Install | ||
185 | |||
186 | install_target: | ||
187 | @$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" || $(MKDIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" | ||
188 | -$(COPY) "$(OPIEDIR)/plugins/security/$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)" | ||
189 | -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)" | ||
190 | -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)" | ||
191 | -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)" | ||
192 | |||
193 | uninstall_target: | ||
194 | -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)" | ||
195 | -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)" | ||
196 | -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)" | ||
197 | -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)" | ||
198 | -$(DEL_DIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" | ||
199 | |||
200 | |||
201 | install: all install_target | ||
202 | |||
203 | uninstall: uninstall_target | ||
204 | |||
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 @@ | |||
1 | Package: opie-multiauth-bluepingplugin | ||
2 | Files: plugins/security/libmultiauthbluepingplugin.so* pics/security/bluepingplugin.png | ||
3 | Priority: optional | ||
4 | Section: opie/settings | ||
5 | Maintainer: Clement Seveillac <clement@nist.gov> | ||
6 | Architecture: arm | ||
7 | Version: 0.0.2.5 | ||
8 | Depends: libopiecore2, opie-security | ||
9 | Description: Blueping plugin for opie-security authentication. | ||
10 | This is a bluetooth-based authentication plugin (you need | ||
11 | to have another Bluetooth device around, the more secure the | ||
12 | 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 @@ | |||
1 | #include "bluepingplugin.h" | ||
2 | |||
3 | #include <opie2/oapplication.h> | ||
4 | #include <opie2/odebug.h> | ||
5 | #include <opie2/odevice.h> | ||
6 | |||
7 | #include <qdialog.h> | ||
8 | #include <qlayout.h> | ||
9 | #include <qhbox.h> | ||
10 | #include <qlabel.h> | ||
11 | #include <qpushbutton.h> | ||
12 | #include <qtimer.h> | ||
13 | |||
14 | using namespace Opie::Core; | ||
15 | |||
16 | /// creates and initializes the m_config Config object | ||
17 | BluepingPlugin::BluepingPlugin() : MultiauthPluginObject(), m_ping(0) { | ||
18 | m_config = new Config("Security"); | ||
19 | m_config->setGroup("BluepingPlugin"); | ||
20 | bluetoothAlreadyRestarted = false; | ||
21 | } | ||
22 | |||
23 | /// deletes the m_config Config object and noticeW if necessary | ||
24 | BluepingPlugin::~BluepingPlugin() { | ||
25 | delete m_config; | ||
26 | if (m_ping != 0) | ||
27 | delete m_ping; | ||
28 | } | ||
29 | |||
30 | /// Simply return its name (Blueping plugin) | ||
31 | QString BluepingPlugin::pluginName() const { | ||
32 | return "Blueping plugin"; | ||
33 | } | ||
34 | |||
35 | /// no configuration widget for the moment | ||
36 | MultiauthConfigWidget * BluepingPlugin::configWidget(QWidget * parent) { | ||
37 | return 0l; | ||
38 | } | ||
39 | QString BluepingPlugin::pixmapNameWidget() const { | ||
40 | return "security/bluepingplugin"; | ||
41 | } | ||
42 | QString BluepingPlugin::pixmapNameConfig() const { | ||
43 | return 0l; | ||
44 | } | ||
45 | |||
46 | /// Emit the MultiauthPluginObject::Success emitCode | ||
47 | void BluepingPlugin::success() { | ||
48 | emit emitCode(MultiauthPluginObject::Success); | ||
49 | } | ||
50 | |||
51 | /// Emit the MultiauthPluginObject::Failure emitCode | ||
52 | void BluepingPlugin::failure() { | ||
53 | emit emitCode(MultiauthPluginObject::Failure); | ||
54 | } | ||
55 | |||
56 | /// Emit the MultiauthPluginObject::Skip emitCode | ||
57 | void BluepingPlugin::skip() { | ||
58 | emit emitCode(MultiauthPluginObject::Skip); | ||
59 | } | ||
60 | |||
61 | /// do the actual ping | ||
62 | void BluepingPlugin::ping() { | ||
63 | m_ping = new OProcess(); | ||
64 | odebug << "pinging device: " << macToPing << oendl; | ||
65 | *m_ping << "l2ping" << "-c 1" << macToPing; | ||
66 | |||
67 | // starting to ping in the background | ||
68 | /// \todo as soon as ping is launched, check RSSI (signal strength) and check | ||
69 | /// it's high enough, meaning the device is close enough? | ||
70 | /// \todo make it optionally pollable, so don't finish the ping and call | ||
71 | /// Opie suspend if l2ping timeouts? | ||
72 | if ( !m_ping->start() ) { | ||
73 | oerr << "could not start l2ping" << oendl; | ||
74 | this->skip(); | ||
75 | } | ||
76 | QObject::connect(m_ping, SIGNAL(processExited(Opie::Core::OProcess*)), | ||
77 | this, SLOT(pingFinished(Opie::Core::OProcess*)) ); | ||
78 | } | ||
79 | |||
80 | /// Deals with m_ping result | ||
81 | void BluepingPlugin::pingFinished(OProcess * ping) { | ||
82 | if ( ping->normalExit() && (ping->exitStatus() == 0) ) | ||
83 | { | ||
84 | odebug << "Successful Bluetooth ping!" << oendl; | ||
85 | success(); | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | odebug << "Failed Bluetooth ping..." << oendl; | ||
90 | failure(); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | /// Make one authentication attempt with this plugin | ||
95 | /** | ||
96 | * (very simple "success" / "failure" buttons in a dialog) | ||
97 | * \return The outcome code of this authentication | ||
98 | */ | ||
99 | int BluepingPlugin::authenticate() { | ||
100 | |||
101 | Config cfg("Security"); | ||
102 | cfg.setGroup("BluepingPlugin"); | ||
103 | macToPing = cfg.readEntry("mac"); | ||
104 | if (!macToPing.isEmpty()) | ||
105 | { | ||
106 | /* Standard, inescapable authentication dialog | ||
107 | */ | ||
108 | QDialog bluepingDialog(0, | ||
109 | "Blueping dialog", | ||
110 | TRUE, | ||
111 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); | ||
112 | |||
113 | QRect desk = oApp->desktop()->geometry(); | ||
114 | bluepingDialog.setGeometry( 0, 0, desk.width(), desk.height() ); | ||
115 | |||
116 | // Creation of the particular widgets of our Blueping user interface | ||
117 | QVBoxLayout *layout = new QVBoxLayout(&bluepingDialog); | ||
118 | layout->setSpacing(11); | ||
119 | layout->setMargin(11); | ||
120 | layout->setAlignment( Qt::AlignTop ); | ||
121 | |||
122 | QLabel title("<center><h1>\"Blueping\" <br />plugin</h1></center>", &bluepingDialog); | ||
123 | QLabel subTitle("<center><h2>Trying to reach your configured bluetooth device...</h2></center>", &bluepingDialog); | ||
124 | QLabel subTitle2("<center>You can skip this step and use another authentication way with the following button</center>", &bluepingDialog); | ||
125 | QPushButton pbSkip("Skip", &bluepingDialog); | ||
126 | layout->addWidget(&title); | ||
127 | layout->addWidget(&subTitle); | ||
128 | layout->addWidget(&subTitle2); | ||
129 | layout->addWidget(&pbSkip, 0, Qt::AlignHCenter); | ||
130 | |||
131 | // connect the skip button to the skip signal emitting function | ||
132 | QObject::connect(&pbSkip, SIGNAL(clicked()), this, SLOT(skip())); | ||
133 | // connect the signal emitting functions to the bluepingDialog done(int) finishing function | ||
134 | QObject::connect(this, SIGNAL(emitCode(int)), &bluepingDialog, SLOT(done(int))); | ||
135 | |||
136 | if (!bluetoothAlreadyRestarted) | ||
137 | { | ||
138 | // we have just started or resumed the device, so Bluetooth has to be (re)started | ||
139 | OProcess killB; | ||
140 | killB << "killall" << "hciattach"; | ||
141 | odebug << "killing Bluetooth..." << oendl; | ||
142 | if ( !killB.start(OProcess::Block) ) { | ||
143 | oerr << "could not kill bluetooth" << oendl; | ||
144 | } | ||
145 | |||
146 | OProcess startB; | ||
147 | switch ( ODevice::inst()->model() ) { | ||
148 | case Model_iPAQ_H39xx: | ||
149 | startB << "/sbin/hciattach" << "/dev/tts/1" << "bcsp" << "921600"; | ||
150 | break; | ||
151 | |||
152 | case Model_iPAQ_H5xxx: | ||
153 | startB << "/sbin/hciattach" << "/dev/tts/1" << "any" << "921600"; | ||
154 | break; | ||
155 | |||
156 | default: | ||
157 | startB << "/sbin/hciattach" << "/dev/ttySB0" << "bcsp" << "230400"; | ||
158 | break; | ||
159 | } // end switch on device models | ||
160 | |||
161 | if ( !startB.start(OProcess::Block) ) { | ||
162 | oerr << "could not (re)start bluetooth" << oendl; | ||
163 | return MultiauthPluginObject::Skip; | ||
164 | } | ||
165 | else | ||
166 | { | ||
167 | if ( startB.normalExit() && (startB.exitStatus() == 0) ) | ||
168 | { | ||
169 | odebug << "hciattach exited normally."<< oendl; | ||
170 | bluetoothAlreadyRestarted = true; | ||
171 | // 500 ms timer, so l2ping won't try to find a route before bluetooth has \em really started | ||
172 | QTimer::singleShot( 500, this, SLOT(ping()) ); | ||
173 | } | ||
174 | else | ||
175 | { | ||
176 | owarn << "hciattach exited anormally (error code: " << startB.exitStatus() << ")" << oendl; | ||
177 | } // end if startBluetooth exit status == 0 | ||
178 | } // end if startBluetooth started | ||
179 | } | ||
180 | else | ||
181 | { | ||
182 | // we don't need to wait, since bluetooth has been started long enough ago | ||
183 | ping(); | ||
184 | } // end if bluetooth not restarted | ||
185 | |||
186 | |||
187 | // start the dialog event loop, while the ping is starting (or will start soon) in the background | ||
188 | return bluepingDialog.exec(); | ||
189 | |||
190 | |||
191 | } | ||
192 | else | ||
193 | { | ||
194 | owarn << "No Bluetooth device has been set!" << oendl; | ||
195 | owarn << "We will consider it as a successful authentication though." << oendl; | ||
196 | return MultiauthPluginObject::Success; | ||
197 | } // end if mac defined | ||
198 | } | ||
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 @@ | |||
1 | /** | ||
2 | * \file bluepingplugin.h | ||
3 | * \brief Standard Opie multiauth plugin definition | ||
4 | * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) | ||
5 | */ | ||
6 | /* | ||
7 | =. This file is part of the Opie Project | ||
8 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This library is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This library is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | |||
34 | #ifndef BLUEPING_PLUGIN_H | ||
35 | #define BLUEPING_PLUGIN_H | ||
36 | |||
37 | #include <opie2/multiauthplugininterface.h> | ||
38 | |||
39 | #include <opie2/oprocess.h> | ||
40 | |||
41 | #include <qobject.h> | ||
42 | #include <qstring.h> | ||
43 | #include <qpe/config.h> | ||
44 | |||
45 | /// Multi-authentication bluetooth plugin, which tries to ping a specific MAC address. | ||
46 | /** | ||
47 | * The plugin itself, implementing the main authenticate() function. | ||
48 | */ | ||
49 | class BluepingPlugin : public QObject, public MultiauthPluginObject { | ||
50 | |||
51 | Q_OBJECT | ||
52 | |||
53 | public: | ||
54 | BluepingPlugin(); | ||
55 | virtual ~BluepingPlugin(); | ||
56 | int authenticate(); | ||
57 | MultiauthConfigWidget * configWidget(QWidget * parent); | ||
58 | QString pixmapNameConfig() const; | ||
59 | QString pixmapNameWidget() const; | ||
60 | QString pluginName() const; | ||
61 | |||
62 | signals: | ||
63 | /// Signal carrying the result code of this plugin | ||
64 | void emitCode(int resultCode); | ||
65 | |||
66 | private slots: | ||
67 | void success(); | ||
68 | void failure(); | ||
69 | void skip(); | ||
70 | void ping(); | ||
71 | void pingFinished(Opie::Core::OProcess * ping); | ||
72 | |||
73 | private: | ||
74 | Opie::Core::OProcess *m_ping; | ||
75 | Config * m_config; | ||
76 | bool bluetoothAlreadyRestarted; | ||
77 | QString macToPing; | ||
78 | |||
79 | }; | ||
80 | |||
81 | #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 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on | ||
3 | |||
4 | HEADERS = bluepingplugin.h bluepingpluginimpl.h | ||
5 | |||
6 | SOURCES = bluepingplugin.cpp bluepingpluginimpl.cpp | ||
7 | |||
8 | |||
9 | INCLUDEPATH+= $(OPIEDIR)/include | ||
10 | DEPENDPATH+= | ||
11 | |||
12 | LIBS += -lqpe -lopieui2 -lopiecore2 | ||
13 | |||
14 | DESTDIR = $(OPIEDIR)/plugins/security | ||
15 | TARGET = multiauthbluepingplugin | ||
16 | |||
17 | include ( $(OPIEDIR)/include.pro ) | ||
18 | |||
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 @@ | |||
1 | #include "bluepingpluginimpl.h" | ||
2 | |||
3 | BluepingPluginImpl::BluepingPluginImpl() { | ||
4 | bluepingPlugin = new BluepingPlugin(); | ||
5 | } | ||
6 | |||
7 | BluepingPluginImpl::~BluepingPluginImpl() { | ||
8 | delete bluepingPlugin; | ||
9 | } | ||
10 | |||
11 | MultiauthPluginObject* BluepingPluginImpl::plugin() { | ||
12 | return bluepingPlugin; | ||
13 | } | ||
14 | |||
15 | Q_EXPORT_INTERFACE() { | ||
16 | Q_CREATE_INSTANCE( BluepingPluginImpl ) | ||
17 | } | ||
18 | |||
19 | QRESULT BluepingPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { | ||
20 | *iface = 0; | ||
21 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) { | ||
22 | *iface = this, (*iface)->addRef(); | ||
23 | } else { | ||
24 | return QE_NOINTERFACE; | ||
25 | } | ||
26 | return QS_OK; | ||
27 | |||
28 | } | ||
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 @@ | |||
1 | /** | ||
2 | * \file bluepingpluginimpl.h | ||
3 | * \brief Standard Opie multiauth plugin interface definition | ||
4 | * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) | ||
5 | */ | ||
6 | /* | ||
7 | =. This file is part of the Opie Project | ||
8 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This library is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This library is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | |||
34 | #ifndef BLUEPING_PLUGIN_IMPL_H | ||
35 | #define BLUEPING_PLUGIN_IMPL_H | ||
36 | |||
37 | #include "bluepingplugin.h" | ||
38 | |||
39 | /// Standard multiauth plugin class | ||
40 | class BluepingPluginImpl : public MultiauthPluginInterface{ | ||
41 | |||
42 | public: | ||
43 | BluepingPluginImpl(); | ||
44 | virtual ~BluepingPluginImpl(); | ||
45 | |||
46 | QRESULT queryInterface( const QUuid &, QUnknownInterface** ); | ||
47 | /// defines standard addRef() and release() functions | ||
48 | Q_REFCOUNT; | ||
49 | |||
50 | virtual MultiauthPluginObject *plugin(); | ||
51 | |||
52 | private: | ||
53 | /// the plugin itself | ||
54 | BluepingPlugin *bluepingPlugin; | ||
55 | ulong ref; | ||
56 | }; | ||
57 | |||
58 | #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 @@ | |||
1 | config MULTIAUTH_BLUEPING | ||
2 | boolean "opie-multiauth-blueping (blueping authentication plugin for opie-multiauth testing)" | ||
3 | default "y" | ||
4 | depends SECURITY | ||