-rw-r--r-- | core/opie-login/README | 78 | ||||
-rw-r--r-- | core/opie-login/qdm_config.h | 30 | ||||
-rw-r--r-- | core/opie-login/qdmdialog.ui | 856 | ||||
-rw-r--r-- | core/opie-login/qdmdialogimpl.cpp | 535 | ||||
-rw-r--r-- | core/opie-login/qdmdialogimpl.h | 90 |
5 files changed, 0 insertions, 1589 deletions
diff --git a/core/opie-login/README b/core/opie-login/README deleted file mode 100644 index 4a4234d..0000000 --- a/core/opie-login/README +++ b/dev/null @@ -1,78 +0,0 @@ - -Welcome to LISA System's - - QDM - the Login-Dialog for QPE - - -WHAT'S THIS: - -This small add-on for the Qtopia Environment (QPE - see -http://qpe.sourceforge.net for further details) allows You to use your -handheld computer running QPE and Linux with the typical Un*x user -handling, i.e. just log in on a graphical environment, as e.g. KDM or -XDM. This way your personal data can be easily protected against -unwanted access from others in case you loose your machine. - - -STATUS: - -Still in development, but should be useable. - - -REQUIREMENTS: - -- QDM needs Linux-PAM (Pluggable Authentication Modules for Linux) for - proper user validation. - -- the /dev/fb0 device has to writeable to everyone ;-( - - -INSTALLATION: - -Per default this little add-on is not enabled. You have to do so -yourself for now, by setting a compile option variable called -QT_QWS_LOGIN . Furthermore there have to be made some changes in -launcher/taskbar.pro : - -At the section HEADERS insert a line: - ../login/qdmdialogimpl.h \ - -At the section SOURCES insert a line: - ../login/qdmdialogimpl.cpp \ - -furthermore serte these lines: - -INCLUDEPATH += ../login -DEPENDPATH += ../login - -INTERFACES = ../login/qdmdialog.ui - -For unix-login make folloing changes to a line: -LIBS = -lqpe -lcrypt - -For PAM use the following: -LIBS = -lqpe -ldl -lpam - - - -CONFIGURATION: - -Configuration of the 'Look' of QDM is done via Qt Designer. Just open -the .ui file and edit the look of the dialog as you like. You can, for -instance, change the logo pixmap. QDM should also be ready for i18n so -far. - -Other configuration stuff, eg welcome string in the upper right, and -user list can be changed in the qdm_config.h file. - - -USAGE: - -The QDM comes up, when the QPE is started, and if the QPE is started -as 'root'. Being started as any other user, the uid couldn't be -changed and the login dialog wouldn't be ofg much use. - - -CONTACT: - -http://www.lisa.de diff --git a/core/opie-login/qdm_config.h b/core/opie-login/qdm_config.h deleted file mode 100644 index bf5b5a4..0000000 --- a/core/opie-login/qdm_config.h +++ b/dev/null @@ -1,30 +0,0 @@ -//-- -*- c++ -*- - -#ifndef _QDM_CONFIG_H -#define _QDM_CONFIG_H - -/* - * Config file for QDM - */ - - -/** define this to enable the qdm login dialog for qpe */ -#define QT_QWS_LOGIN - -/** define this to let qdm use Linux-PAM */ -//define QT_QWS_LOGIN_USEPAM - -/** this is the list of users shown in the input-list */ -#define QDM_SHOWNUSERS static char *Shown_Users[] = { "guest", "root", "lisa", 0 }; - -/** which command to execute when going to sleep mode */ -#define QDM_CMD_SLEEP "/sbin/shutdow","-z","now" - -/** which command to execute when shutting down */ -#define QDM_CMD_SHUTDOWN "/sbin/shutdow","-z","now" - -/** Welcome string on dialog */ -#define QDM_WELCOME_STRING "Welcome to\nmLinux [iPAQ]" - - -#endif //-- _QDM_CONFIG_H diff --git a/core/opie-login/qdmdialog.ui b/core/opie-login/qdmdialog.ui deleted file mode 100644 index c9faf6f..0000000 --- a/core/opie-login/qdmdialog.ui +++ b/dev/null @@ -1,856 +0,0 @@ -<!DOCTYPE UI><UI> -<class>QDMDialog</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>QDMDialog</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>7</y> - <width>240</width> - <height>320</height> - </rect> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>1</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>minimumSize</name> - <size> - <width>240</width> - <height>240</height> - </size> - </property> - <property stdset="1"> - <name>maximumSize</name> - <size> - <width>240</width> - <height>320</height> - </size> - </property> - <property stdset="1"> - <name>palette</name> - <palette> - <active> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>228</red> - <green>228</green> - <blue>228</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>242</red> - <green>242</green> - <blue>242</blue> - </color> - <color> - <red>78</red> - <green>78</green> - <blue>78</blue> - </color> - <color> - <red>183</red> - <green>183</green> - <blue>183</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>220</red> - <green>220</green> - <blue>220</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>10</red> - <green>95</green> - <blue>137</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </active> - <disabled> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>228</red> - <green>228</green> - <blue>228</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>242</red> - <green>242</green> - <blue>242</blue> - </color> - <color> - <red>78</red> - <green>78</green> - <blue>78</blue> - </color> - <color> - <red>183</red> - <green>183</green> - <blue>183</blue> - </color> - <color> - <red>183</red> - <green>183</green> - <blue>183</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>220</red> - <green>220</green> - <blue>220</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>128</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </disabled> - <inactive> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>228</red> - <green>228</green> - <blue>228</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>242</red> - <green>242</green> - <blue>242</blue> - </color> - <color> - <red>78</red> - <green>78</green> - <blue>78</blue> - </color> - <color> - <red>183</red> - <green>183</green> - <blue>183</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>220</red> - <green>220</green> - <blue>220</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>10</red> - <green>95</green> - <blue>137</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </inactive> - </palette> - </property> - <property stdset="1"> - <name>caption</name> - <string>QDM</string> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>label_logo</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>10</y> - <width>100</width> - <height>33</height> - </rect> - </property> - <property stdset="1"> - <name>palette</name> - <palette> - <active> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>220</red> - <green>220</green> - <blue>220</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>237</red> - <green>237</green> - <blue>237</blue> - </color> - <color> - <red>110</red> - <green>110</green> - <blue>110</blue> - </color> - <color> - <red>146</red> - <green>146</green> - <blue>146</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>84</red> - <green>112</green> - <blue>152</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </active> - <disabled> - <color> - <red>128</red> - <green>128</green> - <blue>128</blue> - </color> - <color> - <red>220</red> - <green>220</green> - <blue>220</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>253</red> - <green>253</green> - <blue>253</blue> - </color> - <color> - <red>110</red> - <green>110</green> - <blue>110</blue> - </color> - <color> - <red>146</red> - <green>146</green> - <blue>146</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>128</red> - <green>128</green> - <blue>128</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>84</red> - <green>112</green> - <blue>152</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </disabled> - <inactive> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>220</red> - <green>220</green> - <blue>220</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>253</red> - <green>253</green> - <blue>253</blue> - </color> - <color> - <red>110</red> - <green>110</green> - <blue>110</blue> - </color> - <color> - <red>146</red> - <green>146</green> - <blue>146</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>84</red> - <green>112</green> - <blue>152</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </inactive> - </palette> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>Panel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Sunken</enum> - </property> - <property stdset="1"> - <name>margin</name> - <number>2</number> - </property> - <property stdset="1"> - <name>pixmap</name> - <pixmap>image0</pixmap> - </property> - <property stdset="1"> - <name>scaledContents</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>label_welcome</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>120</x> - <y>10</y> - <width>110</width> - <height>40</height> - </rect> - </property> - <property stdset="1"> - <name>font</name> - <font> - <pointsize>14</pointsize> - <bold>1</bold> - </font> - </property> - <property stdset="1"> - <name>text</name> - <string>Welcome to -mLinux [iPAQ]</string> - </property> - <property stdset="1"> - <name>alignment</name> - <set>AlignCenter</set> - </property> - <property> - <name>hAlign</name> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>label_time</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>180</x> - <y>50</y> - <width>50</width> - <height>16</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>12:30:88</string> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>label_date</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>70</x> - <y>50</y> - <width>100</width> - <height>16</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Wed Feb 12 2001</string> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel5</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>20</x> - <y>50</y> - <width>50</width> - <height>16</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Today:</string> - </property> - </widget> - <widget> - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>GroupBox3</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>80</y> - <width>220</width> - <height>120</height> - </rect> - </property> - <property stdset="1"> - <name>backgroundOrigin</name> - <enum>WidgetOrigin</enum> - </property> - <property stdset="1"> - <name>title</name> - <string>Login</string> - </property> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>PushButton3</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>160</x> - <y>60</y> - <width>50</width> - <height>21</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Clear</string> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>input_password</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>80</x> - <y>60</y> - <width>70</width> - <height>22</height> - </rect> - </property> - <property stdset="1"> - <name>echoMode</name> - <enum>Password</enum> - </property> - </widget> - <widget> - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>input_user</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>80</x> - <y>30</y> - <width>120</width> - <height>21</height> - </rect> - </property> - <property stdset="1"> - <name>editable</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>label_user</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>30</y> - <width>60</width> - <height>21</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>User</string> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>label_password</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>60</y> - <width>60</width> - <height>21</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Password</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>button_shutdown</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>150</x> - <y>90</y> - <width>61</width> - <height>20</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Shutdown</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>button_login</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>90</y> - <width>60</width> - <height>20</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Login</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>button_sleep</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>90</x> - <y>90</y> - <width>60</width> - <height>20</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Sleep</string> - </property> - </widget> - </widget> -</widget> -<images> - <image> - <name>image0</name> - <data format="XPM.GZ" length="4080">789ced97db72e2461086effd149475e74a69413258d4d65ef880c7c022cbd8eb35a472a123c8465a09640ebb9577cffc3d033a986c2a38a9ca45bacb653ecd34bf7aba67843e9cd49eac41ede4c3d122b3b3d0adb9537b5e3bf15ea368f3eb6f9f7e1c1db78d9adea8358d5ae3f897a3e3b8e6d6943a19302234e04005d8a8c3811ea10107da40ad01073e123a70e01d502703ce086d38f00bf0b401075e13da70e03760b30e070e086d38d001b6c8804be059130e4c091d3850071aa770a04fe8c2817d609b0ca801e92e68b24be8c18109d0d1e1c021a10f07f6806e130e3409c98016d03b8303c784011c3802fa677020230ce0c00c180486236a3495e8d7697228b0ad891a2d24b6448d3a126d8d4637123d8d6227026d4dd7806b894d51a3ae44e39462eb12bd535ad82b8981a8d1ad40476b52facf129b4d4abf21d168d1d27d97e8b668f446627046a35f05ba4d83bef95262dba01a9d4b740c2aca834457543010e8e96d2aca85c49628e8ab44dba6d1cf123d87eef945a0df10057d92d87269ade612db2e15e55ea2e7d13aaf24061e65a40a84112ab6eda87bcdb56dcf7f7335984c4361cf2f7bc3669ee7450526152f8ebfed5749f8505ab9369f2cb29d2d16af7bee4d89e3385abe4765b5ceb2e9e6fbf9457079d509b3cefc6dd435d788638fbd43e5669a65dd95848bcd9e25eb7971348b62a5ff0e950d5fa6cffb674b1bc4b16df2c0d92e99bfafd2c9b2f0fc6722a68d1887af9a7bb8ca33af79e7767f6fed52b154247377b8ca4af4d6e6ea72bf125219f0ff335effe1c12aeafd3adc7671f781bd097178dd4d84f276fe72b88aaabedc4c3a62cf848b6a428c7ff98c3e3cc6b1d27b870ab7d5ebd76e678a849eca0383288eae53d82c4fe6501552bac1d2754bd746d8f6b945e377abf0038dcb2c56c52bbe1247b9c5b1f30fa8acaa2aa3bb387eb4c6c212de6ddef8309555a110975c655d4d253fc3f9ce11c96c55664369bdbf529984f5877bfa346ff0460b8ba70df555dedc431efd382ea8283bb37eae82c332ec7436ddee063db6b9280e6acab612c2f8ce8cd2ad4ab12f9471316ca8545556b761b87db84c17f5f2b9cf0b1115ef52930f0052d1d3dcfaa530b65c2e476ac59ece9fd793ce66520f569591beae27a5707e41dfe6f2afdbff2aff61959ee627f96e1ca2977b79439baeef0e775b2d11b64546c472a4e042a3b1c4d7127ab970993ada3da35553676a2f3f26923e53597e245896e5f0bf1d02ac9d8a95a64c1debf9ce64a9a53293de6892f2132fe98fd3fc8ad6af3e0f8bbbbbaae2f3347d96cf182db7270c73fda55f3cbfb4e24ee4292ffdd25e2bab9456ccf2d5d44d8a33cc7e2a5e4048332d9c2c56f5a731f387052aab9426f2486bc9d4caaf6eaa8b6f614159696e6eaec9573a35ff54a5b262951963de378c5e01ccc42f97861597cfc268f9a02e4eadf458af32830d355feb1dfffef1e80f6ca1ac19</data> - </image> -</images> -<connections> - <connection> - <sender>button_shutdown</sender> - <signal>clicked()</signal> - <receiver>QDMDialog</receiver> - <slot>slot_shutdown()</slot> - </connection> - <connection> - <sender>button_login</sender> - <signal>clicked()</signal> - <receiver>QDMDialog</receiver> - <slot>slot_login()</slot> - </connection> - <connection> - <sender>input_password</sender> - <signal>returnPressed()</signal> - <receiver>button_login</receiver> - <slot>setFocus()</slot> - </connection> - <connection> - <sender>input_user</sender> - <signal>highlighted(const QString&)</signal> - <receiver>input_password</receiver> - <slot>setFocus()</slot> - </connection> - <connection> - <sender>PushButton3</sender> - <signal>clicked()</signal> - <receiver>input_password</receiver> - <slot>clear()</slot> - </connection> - <connection> - <sender>button_sleep</sender> - <signal>clicked()</signal> - <receiver>QDMDialog</receiver> - <slot>slot_sleepmode()</slot> - </connection> - <slot access="public">slot_sleepmode()</slot> - <slot access="public">slot_login()</slot> - <slot access="public">slot_shutdown()</slot> -</connections> -<tabstops> - <tabstop>input_user</tabstop> - <tabstop>input_password</tabstop> - <tabstop>button_login</tabstop> - <tabstop>PushButton3</tabstop> - <tabstop>button_sleep</tabstop> - <tabstop>button_shutdown</tabstop> -</tabstops> -</UI> diff --git a/core/opie-login/qdmdialogimpl.cpp b/core/opie-login/qdmdialogimpl.cpp deleted file mode 100644 index 5d4cd49..0000000 --- a/core/opie-login/qdmdialogimpl.cpp +++ b/dev/null @@ -1,535 +0,0 @@ -/********************************************************************** -** Copyright (C) 2001 LISA Systems -** -** This file is an additional part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** For further information contact info@lisa.de -** -**********************************************************************/ - -/* - * AUTHOR: Christian Rahn - * EMAIL: cdr@lisa.de - * - * $Id$ - */ - -#include "qdm_config.h" - -#ifdef QT_QWS_LOGIN - -#include <pwd.h> -#include <unistd.h> -#include <stdlib.h> -#include <iostream.h> -#include <assert.h> - -#include <qlabel.h> -#include <qregexp.h> -#include <qdatetime.h> -#include <qmessagebox.h> -#include <qcombobox.h> -#include <qlineedit.h> -#include <qtranslator.h> -#include <qpe/qpeapplication.h> - -#include <qwsdisplay_qws.h> - -#include <string.h> -#include <stdio.h> -#include <errno.h> -#include <unistd.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/sem.h> -#include <sys/shm.h> -#include <sys/ipc.h> - -#include <qpe/global.h> - -#if defined(QT_QWS_LOGIN_USEPAM) -extern "C" { -#include <security/pam_appl.h> -} -#else -#define _XOPEN_SOURCE -#include <unistd.h> -#include <crypt.h> -#endif - - -#include "qdmdialogimpl.h" -#include "../launcher/inputmethods.h" - - -//---------------------------------------------------------------------------- - -//-- taken from semctl man page -#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) -//-- union semun is defined by including <sys/sem.h> -#else -//-- according to X/OPEN we have to define it ourselves -union semun { - int val; // value for SETVAL - struct semid_ds *buf; // buffer for IPC_STAT, IPC_SET - unsigned short int *array; // array for GETALL, SETALL - struct seminfo *__buf; // buffer for IPC_INFO -}; -#endif - -//---------------------------------------------------------------------------- - -static const int ShowClockFreq = 1; - -QDM_SHOWNUSERS; - -#ifdef QT_QWS_LOGIN_USEPAM - -static const char *_PAM_SERVICE = "xdm"; -static const char *PAM_password; - -typedef const struct pam_message pam_message_type; - -static int PAM_conv( int, pam_message_type **, struct pam_response **, void * ); - -static struct pam_conv PAM_conversation = { - &PAM_conv, - NULL -}; - -//---------------------------------------------------------------------------- - -static char *COPY_STRING( const char * s ) { - return (s) ? strdup(s) : (char *)NULL; -} - -#define GET_MEM if (reply) realloc(reply, size);\ - else reply = (struct pam_response *)malloc(size); \ - if (!reply) return PAM_CONV_ERR; \ - size += sizeof(struct pam_response) - - -static int PAM_conv( int num_msg, pam_message_type **msg, - struct pam_response **resp, void *) -{ - int count = 0, replies = 0; - struct pam_response *reply = NULL; - int size = sizeof(struct pam_response); - - for( count = 0; count < num_msg; count++ ) { - switch (msg[count]->msg_style) { - case PAM_PROMPT_ECHO_ON: - /* user name given to PAM already */ - return PAM_CONV_ERR; - - case PAM_PROMPT_ECHO_OFF: - /* wants password */ - GET_MEM; - reply[replies].resp_retcode = PAM_SUCCESS; - reply[replies].resp = COPY_STRING(PAM_password); - replies++; - /* PAM frees resp */ - break; - case PAM_TEXT_INFO: - break; - default: - /* unknown or PAM_ERROR_MSG */ - if (reply) free (reply); - return PAM_CONV_ERR; - } - } - if (reply) *resp = reply; - return PAM_SUCCESS; -} - -#endif - - -//---------------------------------------------------------------------------- - -QDMDialogImpl::QDMDialogImpl( QWidget* parent, const char* name, bool modal, WFlags f ) - : QDMDialog( parent, name, modal, f ) -{ - showTime(); - clockTimer = startTimer( ShowClockFreq * 1000 ); //-- call timer evry min. - setActiveWindow(); - setFocus(); - - input = new InputMethods( this ); - input->resize( input->sizeHint() ); - input->move( 0, height() - input->height() ); - - for( int i=0; Shown_Users[i]; ++i ) { - input_user->insertItem( Shown_Users[i] ); - } - input_user->clearEdit(); - - label_welcome->setText( QDM_WELCOME_STRING ); - -}; - - - -QDMDialogImpl::~QDMDialogImpl() -{ - input->lower(); - input->close( false ); - input->hide(); - delete input; - input = 0; - if( parent() ) { - ((QWidget*)parent())->repaint(true); - } -}; - - -void QDMDialogImpl::accept () { }; -void QDMDialogImpl::reject () { }; - - -void QDMDialogImpl::showTime( void ) -{ - label_date->setText( QDate::currentDate().toString() ); - label_time->setText( QTime::currentTime().toString() ); -} - - -void QDMDialogImpl::timerEvent( QTimerEvent * e ) -{ - if( e->timerId() == clockTimer ) - showTime(); -} - - -//---------------------------------------------------------------------------- - -void QDMDialogImpl::slot_sleepmode() -{ - const int button = QMessageBox::warning( this, "Shutdown", tr( "Do you really want to go\nto sleep mode now?" ), - QString::null, tr( "Cancel" ), QString::null,0,1 ); - switch( button ) { - case 0: - done( Rejected ); - // Global::execute( cmd_shutdown ); - if( vfork() == 0 ) { - execl( QDM_CMD_SLEEP, 0 ); - cerr << "Sleepmode: " << strerror( errno ) << endl; - } - break; - - default: - break; - } -} - - -//---------------------------------------------------------------------------- - -void QDMDialogImpl::slot_shutdown() -{ - const int button = QMessageBox::warning( this, "Shutdown", tr("Do you really want to shut\nthe system down now?"), - QString::null, tr("Cancel"), QString::null,0,1 ); - switch( button ) { - case 0: - done( Rejected ); - // Global::execute( cmd_shutdown ); - if( vfork() == 0 ) { - execl( QDM_CMD_SHUTDOWN, 0 ); - cerr << "Shutdown: " << strerror( errno ) << endl; - } - break; - - default: - break; - } -} - - - - -//---------------------------------------------------------------------------- - -void QDMDialogImpl::informBadPassword() -{ - QMessageBox::warning( this, tr("Password wrong"), - tr("The given password is incorrect") ); -} - - -//---------------------------------------------------------------------------- - -#if defined(QT_QWS_LOGIN_USEPAM) - -static bool pwcheck_PAM( const char *user, const char *password ) -{ - bool pw_correct = false; - int pam_error; - int pam_return = 0; - pam_handle_t *pamh = 0; - PAM_password = password.latin1(); - - pam_error = pam_start( _PAM_SERVICE, user, &PAM_conversation, &pamh ); - if( pam_error == PAM_SUCCESS ) { - pam_error = pam_authenticate( pamh, 0 ); - if( pam_error == PAM_SUCCESS ) { - //-- password correct - pw_correct = true; - pam_return = PAM_SUCCESS; - } else { - pam_return = pam_error; - } - } else { - // cerr << "PAM error: " << pam_strerror( pamh, pam_error ) << endl; - } - pam_end( pamh, pam_return ); - return pw_correct; -} - -#else - -//---------------------------------------------------------------------------- - -static bool pwcheck_Unix( const char *user, const char *password ) -{ - struct passwd * pword = getpwnam( user ); - if( pword ) { - if( strcmp( crypt(password, password), pword->pw_passwd) == 0 ) { - return true; - } - } - return false; -} - -#endif - - - -//---------------------------------------------------------------------------- - -void QDMDialogImpl::slot_login() -{ - bool pw_correct = false; - const char *username = input_user->currentText().latin1(); - const char *password = input_password->text().latin1(); - - assert( username ); - -#if defined(QT_QWS_LOGIN_USEPAM) - pw_correct = pwcheck_PAM( username, password ); -#else - pw_correct = pwcheck_Unix( username, password ); -#endif - - if( pw_correct ) { - if( changePersona( username ) ) { - // cerr << "Password correct" << endl; - done( Accepted ); - return; - } - } else { - // cerr << "Password incorrect" << endl; - } - informBadPassword(); -} - - -//---------------------------------------------------------------------------- - -bool QDMDialogImpl::changePersona( const char *username ) -{ - int err; - - //-- get some info on user <username> - struct passwd * pword; - pword = getpwnam( username ); - - if( pword == 0 ) - return false; - - gid_t gid = pword->pw_gid; - uid_t uid = pword->pw_uid; - - //-- some very dirty hacks following - // extern int qws_display_id; - extern QString qws_qtePipeFilename(); - extern QString qws_dataDir(); - - - const QString QTEdataDir = qws_dataDir(); - QString QTEdataDirNew = QTEdataDir; - QTEdataDirNew.replace( QRegExp("root"), username ); - - const char *qws_display_str = getenv("QWS_DISPLAY"); - - //-- get name of semaphore and lock - QString pipe = qws_qtePipeFilename(); - - //-- change owner of semaphore - key_t semkey = ftok( pipe.latin1(), 'd' ); - int semid = semget( semkey, 0, 0 ); - if( semid < 0 ) - cerr << "error: semget, " << strerror( errno ) << endl; - - struct shmid_ds shminfo; - semun arg; - semid_ds semidds; - arg.buf = & semidds; - - if( semctl( semid, 0, IPC_STAT, arg ) < 0 ) - cerr << "error: semctl stat, " << strerror( errno ) << endl; - - arg.buf->sem_perm.uid = uid; - arg.buf->sem_perm.gid = gid; - - if( semctl( semid, 0, IPC_SET, arg ) < 0 ) - cerr << "error: semctl set, " << strerror( errno ) << endl; - - //-- change owner of shared memory - key_t memkey = ftok( pipe.latin1(), 'm' ); - int ramid = shmget( memkey, 0, 0 ); - if( ramid < 0 ) cerr << "error: shmget, " << strerror( errno ) << endl; - - if( shmctl( ramid, IPC_STAT, &shminfo ) < 0 ) - cerr << "error: shmctl stat, " << strerror( errno ) << endl; - - shminfo.shm_perm.uid = uid; - shminfo.shm_perm.gid = gid; - - if( shmctl( ramid, IPC_SET, &shminfo ) < 0 ) - cerr << "error: shmctl set, " << strerror( errno ) << endl; - - //-- change owner of region manager - memkey = ftok( pipe.latin1(), 'r' ); - int regionid = shmget( memkey, 0, 0 ); - if( regionid < 0 ) - cerr << "error: shmget, " << strerror( errno ) << endl; - - if( shmctl( regionid, IPC_STAT, &shminfo ) < 0 ) - cerr << "error: shmctl stat, " << strerror( errno ) << endl; - - shminfo.shm_perm.uid = uid; - shminfo.shm_perm.gid = gid; - - if( shmctl( regionid, IPC_SET, &shminfo ) < 0 ) - cerr << "error: shmctl set, " << strerror( errno ) << endl; - - // cerr << "ungrabbing qws display: " << qws_display_id << " on lock " << pipe << endl; - // QWSDisplay::ungrab(); - - //-- presenting socket-file to new user - chown( pipe.latin1(), uid, gid ); - chown( QTEdataDir.latin1(), uid, gid ); - - - //-- another dirty hack - force framebuffer to be writeable... - struct stat devstat; - if( ! stat( "/dev/fb0", &devstat ) ) { - if( chmod( "/dev/fb0", devstat.st_mode |S_IWOTH |S_IWUSR |S_IWGRP ) ) { - cerr << "chmod error: " << strerror( errno ) << endl; - } - } - - err = rename( QTEdataDir, QTEdataDirNew ) ; - if( err < 0 ) cerr << "error: rename " << strerror(errno) - << " , " << QTEdataDir << " -> " << QTEdataDirNew << endl; - - // - //-- actually change uid and gid - // - // cerr << "changing persona, uid: " << uid << " gid: " << gid << endl; - - err = setgid( gid ); - if( err != 0 ) cerr << "error: gid changePersona " << err << endl; - - err = setuid( uid ); - if( err != 0 ) cerr << "error: uid changePersona " << err << endl; - - - //-- set some environment - setenv( "QWS_DISPLAY", qws_display_str, true ); - setenv( "LOGNAME", username, true ); - setenv( "USER", username, true ); - setenv( "HOME", pword->pw_dir, true ); - - // cout << "QTE data dir: " << qws_dataDir() << endl; - - //-- I am reborn - - return true; -} - - - -//---------------------------------------------------------------------------- - -bool QDMDialogImpl::login( QWidget *parent ) -{ - //-- only when called as 'root' do login-box - if( getuid() != 0 ) - return true; - - - //-- are we coming from a 'restart' ? - if( getenv("QDM_STARTED") ) - return true; - else - unsetenv("QDM_STARTED"); - - -#ifndef QT_NO_TRANSLATION - QString lang = getenv( "LANG" ); - - QTranslator * trans = new QTranslator(qApp); - QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/login.qm"; - if ( trans->load( tfn )) - qApp->installTranslator( trans ); - else { - delete trans; - trans = 0; - } -#endif - - if( parent ) parent->erase(); - - QDMDialog *dialog = new QDMDialogImpl( parent, "Login", true //); - ,WStyle_NoBorder | WStyle_Customize ); - -#if QT_VERSION >= 300 - Q_CHECK_PTR( dialog ); -#else - CHECK_PTR( dialog ); -#endif - int result = dialog->exec(); - delete dialog; - - if( parent ) parent->erase(); - -#ifndef QT_NO_TRANSLATION - if( trans ) { - qApp->removeTranslator( trans ); - delete trans; - trans = 0; - } -#endif - - setenv( "QDM_STARTED", "", true ); - - // if( parent ) parent->erase(); - - //-- get all configs going - Global::restart(); - - return result; -} - - -#endif //-- QT_QWS_LOGIN diff --git a/core/opie-login/qdmdialogimpl.h b/core/opie-login/qdmdialogimpl.h deleted file mode 100644 index d62695b..0000000 --- a/core/opie-login/qdmdialogimpl.h +++ b/dev/null @@ -1,90 +0,0 @@ -//-- -*- c++ -*- -/********************************************************************** -** Copyright (C) 2001 LISA Systems -** -** This file is an additional part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** For further information contact info@lisa.de -** -**********************************************************************/ - -/* - * AUTHOR: Christian Rahn - * EMAIL: cdr@lisa.de - * - * $Id$ - */ - -#ifndef _QDM_IMPL_H -#define _QDM_IMPL_H - -#include "qdm_config.h" - -#if defined(QT_QWS_LOGIN) - -#include "qdmdialog.h" - -class InputMethods; - -class QDMDialogImpl : public QDMDialog -{ - Q_OBJECT - - public: - /** Pop up login dialog and do all stuff */ - static bool login( QWidget * parent = 0 ); - - protected: - /** a protected constructor */ - QDMDialogImpl( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0 ); - ~QDMDialogImpl(); - - /** Timer for clock display */ - void timerEvent( QTimerEvent * ); - - /** The Timer for the clock */ - int clockTimer; - - /** Conersation function for PAM */ - // int PAM_conv (int num_msg, pam_message_type **msg, struct pam_response **resp, void *); - - /** Just become (i.e. log in as) user <name> */ - bool changePersona( const char *name ); - - /** Inform about an incorrect given password */ - void informBadPassword(); - -private: - InputMethods *input; - - protected slots: - /** These got to be overridden so that the login dialog can't be circumvented */ - virtual void accept (); - virtual void reject (); - -public slots: - /** Display the atual time and date */ - void showTime( void ); - - /** login button pressed */ - virtual void slot_login(); - - /** Shutdown button pressed */ - virtual void slot_shutdown(); - - /** Sleep button pressed */ - virtual void slot_sleepmode(); -}; - -#endif //-- QT_QWS_LOGIN - -#endif //-- _QDM_IMPL_H - |