> I decided to toy around with Sugar a bit to see what it's all about, and
> apt-get installed sugar. When clicking on "shutdown" in the context
> menu, I was surprised to see that my computer actually shut down,
> despite /usr/bin/sugar* not carrying any s(u|g)id bit. Given that
> /sbin/halt refuses to be run by an ordinary user, where does Sugar
> get the privileges from?

The shutdown is done by HAL "power management" interface called by dbus.
('org.freedesktop.Hal.Device.SystemPowerManagement')

>  In any case, it shouldn't have that privilege
> since malicious softare could exploit it to power down the computer.
> Security policies shouldn't appear as inconsistent as they do in this
> case.

We could replace shutdown by logout. I've created a quick little patch
that add "logout" to the menu and allow us to return to gdm/kdm/xdm.
diff --git a/src/view/home/activitiesring.py b/src/view/home/activitiesring.py
index 438874f..f7209df 100644
--- a/src/view/home/activitiesring.py
+++ b/src/view/home/activitiesring.py
@@ -317,6 +317,12 @@ class _MyIcon(MyIcon):
  
         self.set_palette(palette)
 
+        item = gtk.MenuItem(_('Logout'))
+        item.connect('activate', self._logout_activate_cb)
+        palette.menu.append(item)
+        item.show()
+
+
     def _reboot_activate_cb(self, menuitem):
         model = shellmodel.get_instance()
         model.props.state = ShellModel.STATE_SHUTDOWN
@@ -331,6 +337,19 @@ class _MyIcon(MyIcon):
         else:
             pm.Reboot()
 
+    def _logout_activate_cb(self, menuitem):
+        model = self._shell.get_model()
+        model.props.state = ShellModel.STATE_SHUTDOWN
+
+        pm = self._get_power_manager()
+
+        hw_manager = hardwaremanager.get_manager()
+        hw_manager.shutdown()
+
+        pid = int(os.getpid())
+        os.kill(pid, signal.SIGTERM)
+
+
     def _shutdown_activate_cb(self, menuitem):
         model = shellmodel.get_instance()
         model.props.state = ShellModel.STATE_SHUTDOWN

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée

Reply via email to