[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#536441: [kdm] kdm-settings does not start as root: quick-and-dirty fix



Package: kdm
Version: 4:4.4.5-7
Tags: patch

A quick-and-dirty fix would be to simply launch something like "kdesu kcmshell4 kdm" from the kdm settings dialog if we are not root:

#include <QProcess>
	if (geteuid() != 0) {
		// launch kdesu, workaround until KDE 4.5 for debian bugs 523094 536441 546376 575746 580269 602976
		QProcess kdesu_process;
		kdesu_process.startDetached("/usr/lib/kde4/libexec/kdesu",QStringList("/usr/share/kde4/apps/kdm/kdmconfig_root.sh"));
	}

content of /usr/share/kde4/apps/kdm/kdmconfig_root.sh:
#!/bin/sh
[ $(id -u) -eq 0 ] && kcmshell4 kdm

The id check is necessary because if a user presses the ignore button another kdm-settings would be launched which asks him for the root password again.

Code status: This code is not yet tested inside kdm-config, only inside a demo qt application, because I have no experience with patching and building kdm. If you think it is good I can test it further. The shell script was tested as root and non-root with dash and bash.
I tagged this "patch" because it is probably only a few lines away from being a real patch. If you think the tagging is wrong, please remove it.

This solution would, in contrast to adding a button or message box, not require any locale changes.

Thanks for any feedback

Max Gaukler



Reply to: