* Massive import of OpenSUSE patches, primarily for bugfixes

* Added some infrastructure created by OpenSUSE to allow for future addition of the Kickoff menu as an option
* Minor Slackware compilation fixes


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1171255 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent c5228d52f5
commit 27856879bf

@ -140,13 +140,16 @@ AuthReturn Authenticate(const char *caller, const char *method,
openlog("kcheckpass", LOG_PID, LOG_AUTH);
PAM_data.conv = conv;
if (strcmp(method, "classic")) {
sprintf(pservb, "%.31s-%.31s", caller, method);
pam_service = pservb;
} else {
if (!strcmp(method, "classic")) {
PAM_data.classic = 1;
pam_service = caller;
}
else if (!strcmp(method, "pam")) {
pam_service = caller;
} else {
sprintf(pservb, "%.31s-%.31s", caller, method);
pam_service = pservb;
}
pam_error = pam_start(pam_service, user, &PAM_conversation, &pamh);
if (pam_error != PAM_SUCCESS)
return AuthError;

@ -504,14 +504,23 @@ void BGDialog::loadWallpaperFilesList() {
//search for .desktop files before searching for images without .desktop files
TQStringList lst = m_pDirs->findAllResources("wallpaper", "*desktop", false, true);
TQStringList files;
TQStringList hiddenfiles;
for (TQStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
{
KSimpleConfig fileConfig(*it);
fileConfig.setGroup("Wallpaper");
int slash = (*it).findRev('/') + 1;
TQString directory = (*it).left(slash);
TQString imageCaption = fileConfig.readEntry("Name");
TQString fileName = fileConfig.readEntry("File");
if (fileConfig.readBoolEntry("Hidden",false)) {
hiddenfiles.append(directory + fileName);
continue;
}
if (imageCaption.isEmpty())
{
imageCaption = fileName;
@ -527,9 +536,8 @@ void BGDialog::loadWallpaperFilesList() {
rs = imageCaption + " (" + TQString::number(n) + ')';
lrs = rs.lower();
}
int slash = (*it).findRev('/') + 1;
TQString directory = (*it).left(slash);
bool canLoadScaleable = false;
#ifdef HAVE_LIBART
canLoadScaleable = true;
#endif
@ -543,7 +551,7 @@ void BGDialog::loadWallpaperFilesList() {
lst = m_pDirs->findAllResources("wallpaper", "*", false, true);
for (TQStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
{
if ( !(*it).endsWith(".desktop") && files.grep(*it).empty() ) {
if ( !(*it).endsWith(".desktop") && files.grep(*it).empty() && hiddenfiles.grep(*it).empty() ) {
// First try to see if we have a comment describing the image. If we do
// just use the first line of said comment.
KFileMetaInfo metaInfo(*it);

@ -73,6 +73,13 @@ struct ThemeInfo {
};
static TQString defaultThemeDescription( const TQString& theme )
{
if( theme == "redglass" || theme == "whiteglass" || theme == "pseudocore" || theme == "handhelds" )
return i18n( "XFree theme %1 - incomplete for KDE" ).arg( theme );
return i18n( "No description available" );;
}
ThemePage::ThemePage( TQWidget* parent, const char* name )
: TQWidget( parent, name ), selectedTheme( NULL ), currentTheme( NULL )
{
@ -333,7 +340,7 @@ void ThemePage::insertTheme( const TQString &path )
// Defaults in case there's no name or comment field.
TQString name = dirName;
TQString desc = i18n( "No description available" );
TQString desc = defaultThemeDescription( name );
TQString sample = "left_ptr";
KSimpleConfig c( path + "/index.theme", true ); // Open read-only
@ -480,7 +487,7 @@ void ThemePage::insertThemes()
// Defaults in case there's no index.theme file or it lacks
// a name and a comment field.
TQString name = *it;
TQString desc = i18n( "No description available" );
TQString desc = defaultThemeDescription( name );
TQString sample = "left_ptr";
// Parse the index.theme file if the theme has one.

@ -19,6 +19,9 @@
#define __menutab_impl_h__
#include <tqlistview.h>
#include <stdlib.h>
#include <kpushbutton.h>
#include "menutab.h"

@ -67,7 +67,7 @@ void KSpellCheckingConfig::defaults()
spellConfig->setRunTogether(0);
spellConfig->setDictionary("");
spellConfig->setDictFromList(FALSE);
spellConfig->setEncoding (KS_E_ASCII);
spellConfig->setEncoding (KS_E_UTF8);
spellConfig->setClient (KS_CLIENT_ISPELL);
}

@ -4,12 +4,38 @@
#
# Copyright GPL v2 by David Faure <david@mandrakesoft.com>
#
if test $# -ge 1 -a "$1" != "--help"; then
quiet=0
if test "$1" = "-q"; then
quiet=1
shift
fi
quiet=0
if test "$1" = "-q"; then
quiet=1
shift
fi
if test "$1" = "--help"; then
echo "Usage: $0 <name> where name is a device or a mountpoint."
exit 0
fi
if test -z "$1"; then
for dev in /dev/cdrom /dev/dvd /dev/dvdram /dev/cdrecorder; do
if test -e $dev; then
lp=`readlink $dev`
if test -n "$lp"; then
device=/dev/$lp
else
device=$dev
fi
break
fi
done
else
device=$1
fi
udi=`dcop kded mediamanager properties $device 2>/dev/null | head -n 1 `
if test -n "$udi"; then
dcop kded mediamanager unmount "$udi" >/dev/null 2>&1
fi
# Checking for stuff in the PATH is ugly with sh.
# I guess this is the reason for making this a kde app...
OS=`uname -s`
@ -34,7 +60,5 @@ if test $# -ge 1 -a "$1" != "--help"; then
elif test $quiet -eq 0; then
kdialog --title "KDE Eject" --error "Eject $1 failed!"
fi
else
kdialog --title "KDE Eject" --msgbox "Usage: $0 <name> where name is a device or a mountpoint."
fi
exit 1

@ -107,6 +107,35 @@ k_dcop:
* space for desktop icons
*/
virtual void desktopIconsAreaChanged(const TQRect &area, int screen) = 0;
/**
* Find the next free place for a not yet existing icon, so it fits
* in the user arrangement. Basicly prepare for icons to be moved in.
* It will try to find a place in the virtual grid near col,row
* where no other icon is.
*
* If you specify -1 for row or column, it will try to find the next
* free room where no other icon follows. E.g. if you specify column
* = -1 and row = 0, kdesktop will find the next vertical placement
* so that the icon appears at the end of the existing icons preferable
* in the first column. If the first column is full, it will find the
* next free room in the second column.
*
* If you specify both column and row, kdesktop won't care for aligning,
* or surrounding icons, but try to find the free place near the given
* grid place (e.g. specify 0,0 to find the nearest place in the left
* upper corner).
*/
virtual TQPoint findPlaceForIcon( int column, int row) = 0;
/// copy the desktop file in the Desktop and place it at x, y
virtual void addIcon(const TQString &url, int x, int y) = 0;
/// same with specific destination
virtual void addIcon(const TQString &url, const TQString &dest, int x, int y) = 0;
/// remove the desktop file (either full path or relative)
virtual void removeIcon(const TQString &dest) = 0;
};
#endif

@ -6,6 +6,8 @@ kdesktop_la_LIBADD = libkdesktopsettings.la $(top_builddir)/libkonq/libkonq.la
SUBDIRS = . lock pics patterns programs init kwebdesktop
KDE_OPTIONS = nofinal
####### Files
bin_PROGRAMS = kcheckrunning

@ -32,6 +32,9 @@
#include <unistd.h>
#include <kcolordrag.h>
#include <kurldrag.h>
#include <stdlib.h>
#include <kio/job.h>
#include <tqfile.h>
#include <tqdir.h>
#include <tqevent.h>
@ -58,6 +61,7 @@
#include <kglobalsettings.h>
#include <kpopupmenu.h>
#include <kapplication.h>
#include <kdirlister.h>
// Create the equivalent of KAccelBase::connectItem
// and then remove this include and fix reconnects in initRoot() -- ellis
//#include <kaccelbase.h>
@ -986,4 +990,47 @@ bool KDesktop::event(TQEvent * e)
return TQWidget::event(e);
}
TQPoint KDesktop::findPlaceForIcon( int column, int row )
{
if (m_pIconView)
return m_pIconView->findPlaceForIcon(column, row);
else
return TQPoint(-1, -1);
}
void KDesktop::addIcon(const TQString & _url, int x, int y)
{
addIcon( _url, KGlobalSettings::desktopPath(), x, y );
}
void KDesktop::addIcon(const TQString & _url, const TQString & _dest, int x, int y)
{
TQString filename = _url.mid(_url.findRev('/') + 1);
TQValueList<KIO::CopyInfo> files;
KIO::CopyInfo i;
i.uSource = KURL::fromPathOrURL( _url );
i.uDest = KURL::fromPathOrURL( _dest );
i.uDest.addPath( filename );
files.append(i);
if (!TQFile::exists(i.uDest.prettyURL().replace("file://",TQString::null))) { m_pIconView->slotAboutToCreate( TQPoint( x, y ), files );
KIO::copy( i.uSource, i.uDest, false ); }
// m_pIconView->addFuturePosition(filename, x, y);
// qDebug("addIcon %s %s %d %d", _url.latin1(), _dest.latin1(), x, y);
// system(TQString("cp \"%1\" \"%2/%3\"").arg(KURL(_url).path()).arg(KURL(_dest).path()).arg(filename).latin1());
// m_pIconView->update( _dest );
}
void KDesktop::removeIcon(const TQString &_url)
{
if (_url.at(0) != '/') {
qDebug("removeIcon with relative path not supported for now");
return;
}
unlink(KURL(_url).path().latin1());
TQString dest = _url.left(_url.findRev('/') + 1);
m_pIconView->update( dest );
}
#include "desktop.moc"

@ -164,6 +164,11 @@ protected:
virtual void setIconsEnabled( bool enable );
virtual bool event ( TQEvent * e );
virtual TQPoint findPlaceForIcon( int column, int row);
virtual void addIcon(const TQString &url, int x, int y);
virtual void addIcon(const TQString &url, const TQString &dest, int x, int y);
virtual void removeIcon(const TQString &url);
private slots:
void desktopResized();

@ -962,6 +962,18 @@ void KDIconView::slotNewItems( const KFileItemList & entries )
kdDebug(1214) << "KDIconView::slotNewItems count=" << entries.count() << endl;
KFileItemListIterator it(entries);
KFileIVI* fileIVI = 0L;
if (m_nextItemPos.isNull() && !m_dotDirectory) {
// Not found, we'll need to save the new pos
kdDebug(1214)<<"Neither a drop position stored nor m_dotDirectory set"<<endl;
m_dotDirectory = new KSimpleConfig( dotDirectoryPath(), true );
// recursion
slotNewItems( entries );
delete m_dotDirectory;
m_dotDirectory = 0;
return;
}
for (; it.current(); ++it)
{
KURL url = it.current()->url();
@ -1026,15 +1038,6 @@ void KDIconView::slotNewItems( const KFileItemList & entries )
kdDebug(1214)<<"Using saved position"<<endl;
}
}
else
{
// Not found, we'll need to save the new pos
kdDebug(1214)<<"slotNewItems(): New item without position information, try to find a sane location"<<endl;
moveToFreePosition(fileIVI);
m_bNeedSave = true;
}
}
}
@ -1638,6 +1641,98 @@ void KDIconView::moveToFreePosition(TQIconViewItem *item )
}
TQPoint KDIconView::findPlaceForIconCol( int column, int dx, int dy)
{
if (column < 0)
return TQPoint();
TQRect rect;
rect.moveTopLeft( TQPoint(column * dx, 0) );
rect.setWidth(dx);
rect.setHeight(dy);
if (rect.right() > viewport()->width())
return TQPoint();
while ( rect.bottom() < viewport()->height() - spacing() )
{
if ( !isFreePosition(0,rect) )
rect.moveBy(0, rect.height());
else
return rect.topLeft();
}
return TQPoint();
}
TQPoint KDIconView::findPlaceForIconRow( int row, int dx, int dy )
{
if (row < 0)
return TQPoint();
TQRect rect;
rect.moveTopLeft(TQPoint(0, row * dy));
rect.setWidth(dx);
rect.setHeight(dy);
if (rect.bottom() > viewport()->height())
return TQPoint();
while (rect.right() < viewport()->width() - spacing())
{
if (!isFreePosition(0,rect))
rect.moveBy(rect.width()+spacing(), 0);
else
return rect.topLeft();
}
return TQPoint();
}
TQPoint KDIconView::findPlaceForIcon( int column, int row)
{
int dx = gridXValue(), dy = 0;
TQIconViewItem *item = firstItem();
for ( ; item; item = item->nextItem() ) {
dx = QMAX( dx, item->width() );
dy = QMAX( dy, item->height() );
}
dx += spacing();
dy += spacing();
if (row == -1) {
int max_cols = viewport()->width() / dx;
int delta = 0;
TQPoint res;
do {
delta++;
res = findPlaceForIconCol(column + (delta / 2) * (-2 * (delta % 2) + 1),
dx, dy);
if (delta / 2 > QMAX(max_cols - column, column))
return res;
} while (res.isNull());
return res;
}
if (column == -1) {
int max_rows = viewport()->height() / dy;
int delta = 0;
TQPoint res;
do {
delta++;
res = findPlaceForIconRow(row + (delta / 2) * (-2 * (delta % 2) + 1),
dx, dy);
if (delta / 2 > QMAX(max_rows - row, row))
return res;
} while (res.isNull());
return res;
}
// very unlikely - if I may add that
return TQPoint(0, 0);
}
void KDIconView::saveIconPositions()
{
kdDebug(1214) << "KDIconView::saveIconPositions" << endl;
@ -1665,4 +1760,11 @@ void KDIconView::saveIconPositions()
m_dotDirectory->sync();
}
void KDIconView::update( const TQString &_url )
{
if (m_dirLister)
m_dirLister->updateDirectory( _url );
}
#include "kdiconview.moc"

@ -73,6 +73,8 @@ public:
TQStringList selectedURLs();
void update( const TQString &url );
/**
* Save the icon positions
*/
@ -103,6 +105,10 @@ public:
void startDirLister();
TQPoint findPlaceForIconCol( int column, int dx, int dy );
TQPoint findPlaceForIconRow( int row, int dx, int dy );
TQPoint findPlaceForIcon( int column, int row );
protected slots:
// slots connected to the icon view
@ -112,8 +118,9 @@ protected slots:
void slotMouseButtonClickedKDesktop(int _button, TQIconViewItem* _item, const TQPoint& _global);
void slotContextMenuRequested(TQIconViewItem* _item, const TQPoint& _global);
void slotEnableAction( const char * name, bool enabled );
public slots:
void slotAboutToCreate(const TQPoint &pos, const TQValueList<KIO::CopyInfo> &files);
protected slots:
void slotItemRenamed(TQIconViewItem*, const TQString &name);
// slots connected to the directory lister

@ -39,6 +39,8 @@
#include <kstdguiitem.h>
#include <kpixmapeffect.h>
#include <kpixmap.h>
#include <kwin.h>
#include <kwinmodule.h>
#include <tqframe.h>
#include <tqlabel.h>
@ -119,6 +121,8 @@ static void segv_handler(int)
sleep(1);
}
extern Atom qt_wm_state;
//===========================================================================
//
// Screen saver handling process. Handles screensaver window,
@ -135,6 +139,8 @@ LockProcess::LockProcess(bool child, bool useBlankOnly)
mRestoreXF86Lock(false),
mForbidden(false),
mAutoLogout(false),
mVkbdProcess(NULL),
mKWinModule(NULL),
mPipeOpen(false),
mPipeOpen_out(false),
mInfoMessageDisplayed(false),
@ -1120,9 +1126,11 @@ bool LockProcess::checkPass()
if (mAutoLogout)
killTimer(mAutoLogoutTimerId);
showVkbd();
PasswordDlg passDlg( this, &greetPlugin);
int ret = execDialog( &passDlg );
hideVkbd();
if (mForceReject == true) {
ret = TQDialog::Rejected;
}
@ -1251,9 +1259,13 @@ bool LockProcess::x11Event(XEvent *event)
switch (event->type)
{
case KeyPress:
case ButtonPress:
case MotionNotify:
case ButtonRelease:
if( forwardVkbdEvent( event ))
return true; // filter out
// fall through
case KeyPress:
if (mBusy || !mDialogs.isEmpty())
break;
mBusy = true;
@ -1290,11 +1302,30 @@ bool LockProcess::x11Event(XEvent *event)
case ConfigureNotify: // from SubstructureNotifyMask on the root window
if(event->xconfigure.event == qt_xrootwin())
stayOnTop();
for( TQValueList< VkbdWindow >::Iterator it = mVkbdWindows.begin();
it != mVkbdWindows.end();
++it ) {
if( (*it).id == event->xconfigure.window ) {
(*it).rect = TQRect( event->xconfigure.x, event->xconfigure.y,
event->xconfigure.width, event->xconfigure.height );
break;
}
}
break;
case MapNotify: // from SubstructureNotifyMask on the root window
windowAdded( event->xmap.window, false );
if( event->xmap.event == qt_xrootwin())
stayOnTop();
break;
case DestroyNotify:
for( TQValueList< VkbdWindow >::Iterator it = mVkbdWindows.begin();
it != mVkbdWindows.end();
++it )
if( (*it).id == event->xdestroywindow.window ) {
mVkbdWindows.remove( it );
break;
}
break;
}
// We have grab with the grab window being the root window.
@ -1319,17 +1350,24 @@ bool LockProcess::x11Event(XEvent *event)
void LockProcess::stayOnTop()
{
if(!mDialogs.isEmpty())
if(!mDialogs.isEmpty() || !mVkbdWindows.isEmpty())
{
// this restacking is written in a way so that
// if the stacking positions actually don't change,
// all restacking operations will be no-op,
// and no ConfigureNotify will be generated,
// thus avoiding possible infinite loops
XRaiseWindow( qt_xdisplay(), mDialogs.first()->winId()); // raise topmost
if( !mVkbdWindows.isEmpty())
XRaiseWindow( qt_xdisplay(), mVkbdWindows.first().id );
else
XRaiseWindow( qt_xdisplay(), mDialogs.first()->winId()); // raise topmost
// and stack others below it
Window* stack = new Window[ mDialogs.count() + 1 ];
Window* stack = new Window[ mDialogs.count() + mVkbdWindows.count() + 1 ];
int count = 0;
for( TQValueList< VkbdWindow >::ConstIterator it = mVkbdWindows.begin();
it != mVkbdWindows.end();
++it )
stack[ count++ ] = (*it).id;
for( TQValueList< TQWidget* >::ConstIterator it = mDialogs.begin();
it != mDialogs.end();
++it )
@ -1428,4 +1466,200 @@ void LockProcess::msgBox( TQMessageBox::Icon type, const TQString &txt )
execDialog( &box );
}
static int run_vkbd = -1;
void LockProcess::showVkbd()
{
if( run_vkbd == - 1 ) {
int status = system( "hal-find-by-property --key system.formfactor.subtype --string tabletpc" );
// status = 0; // enable for testing
run_vkbd = ( WIFEXITED( status ) && WEXITSTATUS( status ) == 0
&& !KStandardDirs::findExe( "xvkbd" ).isEmpty()) ? 1 : 0;
}
if( run_vkbd ) {
mVkbdWindows.clear();
mVkbdLastEventWindow = None;
mKWinModule = new KWinModule( NULL, KWinModule::INFO_WINDOWS );
connect( mKWinModule, TQT_SIGNAL( windowAdded( WId )), TQT_SLOT( windowAdded( WId )));
mVkbdProcess = new KProcess;
*mVkbdProcess << "xvkbd" << "-compact" << "-geometry" << "-0-0" << "-xdm";
mVkbdProcess->start();
}
}
void LockProcess::hideVkbd()
{
if( mVkbdProcess != NULL ) {
mVkbdProcess->kill();
delete mVkbdProcess;
mVkbdProcess = NULL;
delete mKWinModule;
mKWinModule = NULL;
mVkbdWindows.clear();
}
}
void LockProcess::windowAdded( WId w )
{
windowAdded( w, true );
}
void LockProcess::windowAdded( WId w, bool managed )
{
KWin::WindowInfo info = KWin::windowInfo( w, 0, NET::WM2WindowClass );
if( info.windowClassClass().lower() != "xvkbd" )
return;
// Unmanaged windows (i.e. popups) don't currently work anyway, since they
// don't have WM_CLASS set anyway. I could perhaps try tricks with X id
// ranges if really needed.
if( managed ) {
// withdraw the window, wait for it to be withdrawn, reparent it directly
// to root at the right position
XWithdrawWindow( qt_xdisplay(), w, qt_xscreen());
for(;;) {
Atom type;
int format;
unsigned long length, after;
unsigned char *data;
int r = XGetWindowProperty( qt_xdisplay(), w, qt_wm_state, 0, 2,
false, AnyPropertyType, &type, &format,
&length, &after, &data );
bool withdrawn = true;
if ( r == Success && data && format == 32 ) {
Q_UINT32 *wstate = (Q_UINT32*)data;
withdrawn = (*wstate == WithdrawnState );
XFree( (char *)data );
}
if( withdrawn )
break;
}
}
XSelectInput( qt_xdisplay(), w, StructureNotifyMask );
XWindowAttributes attr_geom;
if( !XGetWindowAttributes( qt_xdisplay(), w, &attr_geom ))
return;
int x = XDisplayWidth( qt_xdisplay(), qt_xscreen()) - attr_geom.width;
int y = XDisplayHeight( qt_xdisplay(), qt_xscreen()) - attr_geom.height;
if( managed ) {
XSetWindowAttributes attr;
attr.override_redirect = True;
XChangeWindowAttributes( qt_xdisplay(), w, CWOverrideRedirect, &attr );
XReparentWindow( qt_xdisplay(), w, qt_xrootwin(), x, y );
XMapWindow( qt_xdisplay(), w );
}
VkbdWindow data;
data.id = w;
data.rect = TQRect( x, y, attr_geom.width, attr_geom.height );
mVkbdWindows.prepend( data );
}
bool LockProcess::forwardVkbdEvent( XEvent* event )
{
if( mVkbdProcess == NULL )
return false;
TQPoint pos;
Time time;
switch( event->type )
{
case ButtonPress:
case ButtonRelease:
pos = TQPoint( event->xbutton.x, event->xbutton.y );
time = event->xbutton.time;
break;
case MotionNotify:
pos = TQPoint( event->xmotion.x, event->xmotion.y );
time = event->xmotion.time;
break;
default:
return false;
}
// vkbd windows are kept topmost, so just find the first one in the position
for( TQValueList< VkbdWindow >::ConstIterator it = mVkbdWindows.begin();
it != mVkbdWindows.end();
++it ) {
if( (*it).rect.contains( pos )) {
// Find the subwindow where the event should actually go.
// Not exactly cheap in the number of X roundtrips but oh well.
Window window = (*it).id;
Window root, child;
int root_x, root_y, x, y;
unsigned int mask;
for(;;) {
if( !XQueryPointer( qt_xdisplay(), window, &root, &child, &root_x, &root_y, &x, &y, &mask ))
return false;
if( child == None )
break;
window = child;
}
switch( event->type )
{
case ButtonPress:
case ButtonRelease:
event->xbutton.x = x;
event->xbutton.y = y;
event->xbutton.subwindow = None;
break;
case MotionNotify:
event->xmotion.x = x;
event->xmotion.y = y;
event->xmotion.subwindow = None;
break;
}
event->xany.window = window;
sendVkbdFocusInOut( window, time );
XSendEvent( qt_xdisplay(), window, False, 0, event );
return true;
}
}
sendVkbdFocusInOut( None, time );
return false;
}
// Fake EnterNotify/LeaveNotify events as the mouse moves. They're not sent by X
// because of the grab and having them makes xvkbd highlight the buttons (but
// not needed otherwise it seems).
void LockProcess::sendVkbdFocusInOut( WId window, Time t )
{
if( mVkbdLastEventWindow == window )
return;
if( mVkbdLastEventWindow != None ) {
XEvent e;
e.xcrossing.type = LeaveNotify;
e.xcrossing.display = qt_xdisplay();
e.xcrossing.window = mVkbdLastEventWindow;
e.xcrossing.root = qt_xrootwin();
e.xcrossing.subwindow = None;
e.xcrossing.time = t;
e.xcrossing.x = 0;
e.xcrossing.y = 0;
e.xcrossing.x_root = -1;
e.xcrossing.y_root = -1;
e.xcrossing.mode = NotifyNormal;
e.xcrossing.detail = NotifyAncestor;
e.xcrossing.same_screen = True;
e.xcrossing.focus = False;
e.xcrossing.state = 0;
XSendEvent( qt_xdisplay(), mVkbdLastEventWindow, False, 0, &e );
}
mVkbdLastEventWindow = window;
if( mVkbdLastEventWindow != None ) {
XEvent e;
e.xcrossing.type = EnterNotify;
e.xcrossing.display = qt_xdisplay();
e.xcrossing.window = mVkbdLastEventWindow;
e.xcrossing.root = qt_xrootwin();
e.xcrossing.subwindow = None;
e.xcrossing.time = t;
e.xcrossing.x = 0;
e.xcrossing.y = 0;
e.xcrossing.x_root = 0;
e.xcrossing.y_root = 0;
e.xcrossing.mode = NotifyNormal;
e.xcrossing.detail = NotifyAncestor;
e.xcrossing.same_screen = True;
e.xcrossing.focus = False;
e.xcrossing.state = 0;
XSendEvent( qt_xdisplay(), mVkbdLastEventWindow, False, 0, &e );
}
}
#include "lockprocess.moc"

@ -23,6 +23,7 @@
#include <X11/Xlib.h>
class KLibrary;
class KWinModule;
struct GreeterPluginHandle {
KLibrary *library;
@ -79,6 +80,7 @@ private slots:
void suspend();
void checkDPMSActive();
void slotDeadTimePassed();
void windowAdded( WId );
private:
void configure();
@ -103,6 +105,11 @@ private:
void stayOnTop();
void lockXF86();
void unlockXF86();
void showVkbd();
void hideVkbd();
bool forwardVkbdEvent( XEvent* event );
void sendVkbdFocusInOut( WId window, Time t );
void windowAdded( WId window, bool managed );
void resume( bool force );
static TQVariant getConf(void *ctx, const char *key, const TQVariant &dflt);
@ -135,18 +142,29 @@ private:
int mAutoLogoutTimerId;
int mAutoLogoutTimeout;
bool mAutoLogout;
bool mInfoMessageDisplayed;
TQDialog *currentDialog;
bool mDialogControlLock;
bool mForceReject;
TQTimer *resizeTimer;
unsigned int mkeyCode;
KProcess* mVkbdProcess;
KWinModule* mKWinModule;
struct VkbdWindow
{
WId id;
QRect rect;
};
QValueList< VkbdWindow > mVkbdWindows;
WId mVkbdLastEventWindow;
bool mPipeOpen;
int mPipe_fd;
bool mPipeOpen_out;
int mPipe_fd_out;
TQTimer *resizeTimer;
unsigned int mkeyCode;
bool mInfoMessageDisplayed;
TQDialog *currentDialog;
bool mDialogControlLock;
bool mForceReject;
};
#endif

@ -145,6 +145,9 @@ Minicli::Minicli( TQWidget *parent, const char *name)
connect( m_dlg->cbCommand, TQT_SIGNAL( returnPressed() ),
m_dlg->pbRun, TQT_SLOT( animateClick() ) );
m_dlg->cbCommand->setHistoryEditorEnabled( true );
connect( m_dlg->cbCommand, TQT_SIGNAL(removed( const TQString&) ), TQT_SLOT(saveConfig()) );
// Advanced group box...
connect(m_dlg->cbPriority, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotChangeScheduler(bool)));
connect(m_dlg->slPriority, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotPriority(int)));
@ -295,7 +298,9 @@ void Minicli::accept()
}
bool logout = (cmd == "logout");
if( !logout && runCommand() == 1 )
bool lock = (cmd == "lock");
if( !logout && !lock && runCommand() == 1 )
return;
m_dlg->cbCommand->addToHistory( m_dlg->cbCommand->currentText().stripWhiteSpace() );
@ -308,6 +313,14 @@ void Minicli::accept()
kapp->propagateSessionManager();
kapp->requestShutDown();
}
if ( lock )
{
TQCString appname( "kdesktop" );
int kicker_screen_number = qt_xscreen();
if ( kicker_screen_number )
appname.sprintf("kdesktop-screen-%d", kicker_screen_number);
kapp->dcopClient()->send(appname, "KScreensaverIface", "lock()", "");
}
}
void Minicli::reject()

@ -54,12 +54,14 @@ public:
void setCommand(const TQString& command);
void reset();
void saveConfig();
void clearHistory();
virtual void show();
virtual TQSize sizeHint() const;
public slots:
void saveConfig();
protected slots:
virtual void accept();
virtual void reject();

@ -382,6 +382,7 @@ static int startApp()
change_uid = false;
password = dlg.password();
keep = dlg.keep();
KConfigGroup(config,"Passwords").writeEntry("Keep", keep);
data.setSilent( KStartupInfoData::No );
KStartupInfo::sendChange( id, data );
}

@ -45,6 +45,7 @@
#include <pwd.h>
#include <errno.h>
#include <sys/prctl.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -248,6 +249,8 @@ int create_socket()
int main(int argc, char *argv[])
{
prctl(PR_SET_DUMPABLE, 0);
KAboutData aboutData("kdesud", I18N_NOOP("KDE su daemon"),
Version, I18N_NOOP("Daemon used by kdesu"),
KAboutData::License_Artistic,

@ -87,6 +87,18 @@ extern int loginsuccess( const char *User, const char *Host, const char *Tty, ch
#include "consolekit.h"
#endif
#define AU_FAILED 0
#define AU_SUCCESS 1
#ifdef HAVE_LIBAUDIT
#include <libaudit.h>
#else
#define log_to_audit_system(l,h,d,s) do { ; } while (0)
#endif
#ifdef WITH_CONSOLE_KIT
#include "consolekit.h"
#endif
/*
* Session data, mostly what struct verify_info was for
*/
@ -291,6 +303,56 @@ fail_delay( int retval ATTR_UNUSED, unsigned usec_delay ATTR_UNUSED,
{}
# endif
/**
* log_to_audit_system:
* @login: Name of user
* @hostname: Name of host machine
* @tty: Name of display
* @success: 1 for success, 0 for failure
*
* Logs the success or failure of the login attempt with the linux kernel
* audit system. The intent is to capture failed events where the user
* fails authentication or otherwise is not permitted to login. There are
* many other places where pam could potentially fail and cause login to
* fail, but these are system failures rather than the signs of an account
* being hacked.
*
* Returns nothing.
*/
#ifdef HAVE_LIBAUDIT
static void
log_to_audit_system (const char *loginname,
const char *hostname,
const char *tty,
int success)
{
struct passwd *pw;
char buf[64];
int audit_fd;
audit_fd = audit_open();
if (loginname)
pw = getpwnam(loginname);
else {
loginname = "unknown";
pw = NULL;
}
Debug("log_to_audit %p %s\n", pw, loginname);
if (pw) {
snprintf(buf, sizeof(buf), "uid=%d", pw->pw_uid);
audit_log_user_message(audit_fd, AUDIT_USER_LOGIN,
buf, hostname, NULL, tty, (int)success);
} else {
snprintf(buf, sizeof(buf), "acct=%s", loginname);
audit_log_user_message(audit_fd, AUDIT_USER_LOGIN,
buf, hostname, NULL, tty, (int)success);
}
close(audit_fd);
}
#endif
static int
doPAMAuth( const char *psrv, struct pam_data *pdata )
{
@ -349,6 +411,8 @@ doPAMAuth( const char *psrv, struct pam_data *pdata )
GSendStr( curuser );
}
if (pretc != PAM_SUCCESS) {
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
switch (pretc) {
case PAM_USER_UNKNOWN:
case PAM_AUTH_ERR:
@ -484,6 +548,9 @@ Verify( GConvFunc gconv, int rootok )
} else
psrv = PAMService;
pdata.usecur = TRUE;
} else if (!strcmp( curtype, "pam" )) {
psrv = PAMService;
pdata.usecur = FALSE;
} else {
sprintf( psrvb, "%.31s-%.31s", PAMService, curtype );
psrv = psrvb;
@ -553,7 +620,7 @@ Verify( GConvFunc gconv, int rootok )
free( msg );
V_RET_FAIL( 0 );
}
} else if (!strcmp( curtype, "generic" )) {
} else if (!strcmp( curtype, "generic" ) || !strcmp(curtype, "pam")) {
if (!gconv( GCONV_USER, 0 ))
return 0;
for (curret = 0;;) {
@ -699,6 +766,8 @@ Verify( GConvFunc gconv, int rootok )
if (!p->pw_uid) {
if (!rootok && !td->allowRootLogin)
V_RET_FAIL( "Root logins are not allowed" );
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
return 1; /* don't deny root to log in */
}
@ -735,6 +804,8 @@ Verify( GConvFunc gconv, int rootok )
}
if (pretc == PAM_SUCCESS)
break;
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
/* effectively there is only PAM_AUTHTOK_ERR */
GSendInt( V_FAIL );
}
@ -824,6 +895,8 @@ Verify( GConvFunc gconv, int rootok )
GSendInt( V_MSG_ERR );
GSendStr( "Your account has expired;"
" please contact your system administrator" );
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
GSendInt( V_FAIL );
LC_RET0;
} else if (tim > (expir - warntime) && !quietlog) {
@ -858,6 +931,8 @@ Verify( GConvFunc gconv, int rootok )
GSendInt( V_MSG_ERR );
GSendStr( "Your account has expired;"
" please contact your system administrator" );
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
GSendInt( V_FAIL );
LC_RET0;
}
@ -917,6 +992,8 @@ Verify( GConvFunc gconv, int rootok )
close( fd );
}
GSendStr( "Logins are not allowed at the moment.\nTry again later" );
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
GSendInt( V_FAIL );
LC_RET0;
}
@ -927,6 +1004,8 @@ Verify( GConvFunc gconv, int rootok )
PrepErrorGreet();
GSendInt( V_MSG_ERR );
GSendStr( "You are not allowed to login at the moment" );
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
GSendInt( V_FAIL );
LC_RET0;
}
@ -938,6 +1017,8 @@ Verify( GConvFunc gconv, int rootok )
Debug( "shell not in /etc/shells\n" );
endusershell();
V_RET_FAIL( "Your login shell is not listed in /etc/shells" );
/* Log the failed login attempt */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_FAILED);
}
if (!strcmp( s, p->pw_shell )) {
endusershell();
@ -1223,10 +1304,17 @@ StartClient()
env = setEnv( env, "PATH", curuid ? td->userPath : td->systemPath );
env = setEnv( env, "SHELL", p->pw_shell );
env = setEnv( env, "HOME", p->pw_dir );
if (cursource == PWSRC_AUTOLOGIN)
env = setEnv (env, "KDM_AUTOLOGIN", curuser);
#if !defined(USE_PAM) && !defined(_AIX) && defined(KERBEROS)
if (krbtkfile[0] != '\0')
env = setEnv( env, "KRBTKFILE", krbtkfile );
#endif
#ifdef WITH_CONSOLE_KIT
if (ck_session_cookie != NULL) {
env = setEnv ( env, "XDG_SESSION_COOKIE", ck_session_cookie );
}
#endif
#ifdef WITH_CONSOLE_KIT
if (ck_session_cookie != NULL) {
env = setEnv ( env, "XDG_SESSION_COOKIE", ck_session_cookie );
@ -1360,6 +1448,9 @@ StartClient()
# define D_LOGIN_SETGROUP 0
#endif /* USE_PAM */
/* Login succeeded */
log_to_audit_system (curuser, td->remoteHost, td->name, AU_SUCCESS);
removeAuth = 1;
chownCtrl( &td->ctrl, curuid );
endpwent();

@ -1985,6 +1985,17 @@ Description:
Specify the widget style for the greeter. Empty means to use the
built-in default which currently is <literal>Plastik</literal>.
Key: UseAdminSession
Type: bool
Default: false
User: greeter
Instance: #*/!
Comment:
Admin session
Description:
If given there will be a special button that requires root password
and starts the given session
Key: ColorScheme
Type: string
Default: ""

@ -240,6 +240,53 @@ if test "x$with_kdm_xconsole" = xyes; then
AC_DEFINE(WITH_KDM_XCONSOLE, 1, [Build kdm with built-in xconsole])
fi
########### Check for DBus
AC_MSG_CHECKING(for DBus)
dbus_inc=NOTFOUND
dbus_lib=NOTFOUND
dbus=NOTFOUND
search_incs="$kde_includes $kde_extra_includes /usr/include /usr/include/dbus-1.0 /usr/local/include /usr/local/include/dbus-1.0"
AC_FIND_FILE(dbus/dbus.h, $search_incs, dbus_incdir)
search_incs_arch_deps="$kde_includes $kde_extra_includes /usr/lib$kdelibsuff/dbus-1.0/include /usr/local/lib$kdelibsuff/dbus-1.0/include"
AC_FIND_FILE(dbus/dbus-arch-deps.h, $search_incs_arch_deps, dbus_incdir_arch_deps)
if test -r $dbus_incdir/dbus/dbus.h && test -r $dbus_incdir_arch_deps/dbus/dbus-arch-deps.h ; then
DBUS_INCS="-I$dbus_incdir -I$dbus_incdir_arch_deps"
dbus_inc=FOUND
fi
search_libs="$kde_libraries $kde_extra_libs /usr/lib$kdelibsuff /usr/local/lib$kdelibsuff"
AC_FIND_FILE(libdbus-1.so, $search_libs, dbus_libdir)
if test -r $dbus_libdir/libdbus-1.so ; then
DBUS_LIBS="-L$dbus_libdir -ldbus-1"
dbus_lib=FOUND
fi
if test $dbus_inc != FOUND || test $dbus_lib != FOUND ; then
KDE_PKG_CHECK_MODULES( DBUS, "dbus-1", [ DBUS_INCS=$DBUS_CFLAGS; dbus_inc=FOUND; dbus_lib=FOUND; ] , AC_MSG_RESULT( Nothing found on PKG_CONFIG_PATH ) )
fi
dbus_bus_var=`pkg-config --variable=system_bus_default_address dbus-1 2>/dev/null`
if test -z "$dbus_bus_var"; then
dbus_bus_var="unix:path=/var/run/dbus/system_bus_socket"
fi
AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS, "$dbus_bus_var", [Define the unix domain path for dbus system bus])
if test $dbus_inc = FOUND && test $dbus_lib = FOUND ; then
AC_MSG_RESULT(headers $DBUS_INCS libraries $DBUS_LIBS)
dbus=FOUND
else
AC_MSG_RESULT(searched but not found)
fi
AC_SUBST(DBUS_INCS)
AC_SUBST(DBUS_LIBS)
########### Check for DBus
AC_MSG_CHECKING(for DBus)
@ -288,3 +335,27 @@ fi
AC_SUBST(DBUS_LIBS)
dnl AC_OUTPUT(kdm/kfrontend/sessions/kde.desktop)
AC_ARG_WITH(libaudit,
[ --with-libaudit=[auto/yes/no] Add Linux audit support [default=auto]],,
with_libaudit=auto)
# Check for Linux auditing API
#
# libaudit detection
if test x$with_libaudit = xno ; then
have_libaudit=no;
else
# See if we have audit daemon library
AC_CHECK_LIB(audit, audit_log_user_message,
have_libaudit=yes, have_libaudit=no)
fi
AM_CONDITIONAL(HAVE_LIBAUDIT, test x$have_libaudit = xyes)
if test x$have_libaudit = xyes ; then
EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -laudit"
AC_DEFINE(HAVE_LIBAUDIT,1,[linux audit support])
fi

@ -21,6 +21,7 @@ kdm_greet_SOURCES = \
kchooser.cpp \
kgverify.cpp \
kdmshutdown.cpp \
kdmadmindialog.cpp \
kgreeter.cpp \
kgapp.cpp
kdm_greet_LDFLAGS = $(all_libraries) $(KDE_RPATH)

@ -44,8 +44,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# include <sched.h>
#endif
#if defined(HAVE_XTEST) || defined(HAVE_XKB)
# include <X11/Xlib.h>
#if defined(HAVE_XTEST) || defined(HAVE_XKB)
# include <X11/keysym.h>
#endif