From 9e728b734630d08ec5ee3ff695d1b66995a6d7c7 Mon Sep 17 00:00:00 2001 From: sandman Date: Sat, 27 Jul 2002 22:35:53 +0000 Subject: Removed the old opie-login (it was only an ugly hack) --- 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 @@ - -QDMDialog - - QDialog - - name - QDMDialog - - - geometry - - 0 - 7 - 240 - 320 - - - - sizePolicy - - 0 - 1 - - - - minimumSize - - 240 - 240 - - - - maximumSize - - 240 - 320 - - - - palette - - - - 0 - 0 - 0 - - - 228 - 228 - 228 - - - 255 - 255 - 255 - - - 242 - 242 - 242 - - - 78 - 78 - 78 - - - 183 - 183 - 183 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 220 - 220 - 220 - - - 0 - 0 - 0 - - - 10 - 95 - 137 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 228 - 228 - 228 - - - 255 - 255 - 255 - - - 242 - 242 - 242 - - - 78 - 78 - 78 - - - 183 - 183 - 183 - - - 183 - 183 - 183 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 220 - 220 - 220 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 228 - 228 - 228 - - - 255 - 255 - 255 - - - 242 - 242 - 242 - - - 78 - 78 - 78 - - - 183 - 183 - 183 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 220 - 220 - 220 - - - 0 - 0 - 0 - - - 10 - 95 - 137 - - - 255 - 255 - 255 - - - - - - caption - QDM - - - QLabel - - name - label_logo - - - geometry - - 10 - 10 - 100 - 33 - - - - palette - - - - 0 - 0 - 0 - - - 220 - 220 - 220 - - - 255 - 255 - 255 - - - 237 - 237 - 237 - - - 110 - 110 - 110 - - - 146 - 146 - 146 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 84 - 112 - 152 - - - 255 - 255 - 255 - - - - - 128 - 128 - 128 - - - 220 - 220 - 220 - - - 255 - 255 - 255 - - - 253 - 253 - 253 - - - 110 - 110 - 110 - - - 146 - 146 - 146 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 84 - 112 - 152 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 220 - 220 - 220 - - - 255 - 255 - 255 - - - 253 - 253 - 253 - - - 110 - 110 - 110 - - - 146 - 146 - 146 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 84 - 112 - 152 - - - 255 - 255 - 255 - - - - - - frameShape - Panel - - - frameShadow - Sunken - - - margin - 2 - - - pixmap - image0 - - - scaledContents - true - - - - QLabel - - name - label_welcome - - - geometry - - 120 - 10 - 110 - 40 - - - - font - - 14 - 1 - - - - text - Welcome to -mLinux [iPAQ] - - - alignment - AlignCenter - - - hAlign - - - - QLabel - - name - label_time - - - geometry - - 180 - 50 - 50 - 16 - - - - text - 12:30:88 - - - - QLabel - - name - label_date - - - geometry - - 70 - 50 - 100 - 16 - - - - text - Wed Feb 12 2001 - - - - QLabel - - name - TextLabel5 - - - geometry - - 20 - 50 - 50 - 16 - - - - text - Today: - - - - QGroupBox - - name - GroupBox3 - - - geometry - - 10 - 80 - 220 - 120 - - - - backgroundOrigin - WidgetOrigin - - - title - Login - - - QPushButton - - name - PushButton3 - - - geometry - - 160 - 60 - 50 - 21 - - - - text - Clear - - - - QLineEdit - - name - input_password - - - geometry - - 80 - 60 - 70 - 22 - - - - echoMode - Password - - - - QComboBox - - name - input_user - - - geometry - - 80 - 30 - 120 - 21 - - - - editable - true - - - - QLabel - - name - label_user - - - geometry - - 10 - 30 - 60 - 21 - - - - text - User - - - - QLabel - - name - label_password - - - geometry - - 10 - 60 - 60 - 21 - - - - text - Password - - - - QPushButton - - name - button_shutdown - - - geometry - - 150 - 90 - 61 - 20 - - - - text - Shutdown - - - - QPushButton - - name - button_login - - - geometry - - 10 - 90 - 60 - 20 - - - - text - Login - - - - QPushButton - - name - button_sleep - - - geometry - - 90 - 90 - 60 - 20 - - - - text - Sleep - - - - - - - image0 - 789ced97db72e2461086effd149475e74a69413258d4d65ef880c7c022cbd8eb35a472a123c8465a09640ebb9577cffc3d033a986c2a38a9ca45bacb653ecd34bf7aba67843e9cd49eac41ede4c3d122b3b3d0adb9537b5e3bf15ea368f3eb6f9f7e1c1db78d9adea8358d5ae3f897a3e3b8e6d6943a19302234e04005d8a8c3811ea10107da40ad01073e123a70e01d502703ce086d38f00bf0b401075e13da70e03760b30e070e086d38d001b6c8804be059130e4c091d3850071aa770a04fe8c2817d609b0ca801e92e68b24be8c18109d0d1e1c021a10f07f6806e130e3409c98016d03b8303c784011c3802fa677020230ce0c00c180486236a3495e8d7697228b0ad891a2d24b6448d3a126d8d4637123d8d6227026d4dd7806b894d51a3ae44e39462eb12bd535ad82b8981a8d1ad40476b52facf129b4d4abf21d168d1d27d97e8b668f446627046a35f05ba4d83bef95262dba01a9d4b740c2aca834457543010e8e96d2aca85c49628e8ab44dba6d1cf123d87eef945a0df10057d92d87269ade612db2e15e55ea2e7d13aaf24061e65a40a84112ab6eda87bcdb56dcf7f7335984c4361cf2f7bc3669ee7450526152f8ebfed5749f8505ab9369f2cb29d2d16af7bee4d89e3385abe4765b5ceb2e9e6fbf9457079d509b3cefc6dd435d788638fbd43e5669a65dd95848bcd9e25eb7971348b62a5ff0e950d5fa6cffb674b1bc4b16df2c0d92e99bfafd2c9b2f0fc6722a68d1887af9a7bb8ca33af79e7767f6fed52b154247377b8ca4af4d6e6ea72bf125219f0ff335effe1c12aeafd3adc7671f781bd097178dd4d84f276fe72b88aaabedc4c3a62cf848b6a428c7ff98c3e3cc6b1d27b870ab7d5ebd76e678a849eca0383288eae53d82c4fe6501552bac1d2754bd746d8f6b945e377abf0038dcb2c56c52bbe1247b9c5b1f30fa8acaa2aa3bb387eb4c6c212de6ddef8309555a110975c655d4d253fc3f9ce11c96c55664369bdbf529984f5877bfa346ff0460b8ba70df555dedc431efd382ea8283bb37eae82c332ec7436ddee063db6b9280e6acab612c2f8ce8cd2ad4ab12f9471316ca8545556b761b87db84c17f5f2b9cf0b1115ef52930f0052d1d3dcfaa530b65c2e476ac59ece9fd793ce66520f569591beae27a5707e41dfe6f2afdbff2aff61959ee627f96e1ca2977b79439baeef0e775b2d11b64546c472a4e042a3b1c4d7127ab970993ada3da35553676a2f3f26923e53597e245896e5f0bf1d02ac9d8a95a64c1debf9ce64a9a53293de6892f2132fe98fd3fc8ad6af3e0f8bbbbbaae2f3347d96cf182db7270c73fda55f3cbfb4e24ee4292ffdd25e2bab9456ccf2d5d44d8a33cc7e2a5e4048332d9c2c56f5a731f387052aab9426f2486bc9d4caaf6eaa8b6f614159696e6eaec9573a35ff54a5b262951963de378c5e01ccc42f97861597cfc268f9a02e4eadf458af32830d355feb1dfffef1e80f6ca1ac19 - - - - - button_shutdown - clicked() - QDMDialog - slot_shutdown() - - - button_login - clicked() - QDMDialog - slot_login() - - - input_password - returnPressed() - button_login - setFocus() - - - input_user - highlighted(const QString&) - input_password - setFocus() - - - PushButton3 - clicked() - input_password - clear() - - - button_sleep - clicked() - QDMDialog - slot_sleepmode() - - slot_sleepmode() - slot_login() - slot_shutdown() - - - input_user - input_password - button_login - PushButton3 - button_sleep - button_shutdown - - 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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#if defined(QT_QWS_LOGIN_USEPAM) -extern "C" { -#include -} -#else -#define _XOPEN_SOURCE -#include -#include -#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 -#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 - 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 */ - 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 - -- cgit v0.9.0.2