/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2009-11-05 01:59:51 UTC
  • Revision ID: teddy@fukt.bsnet.se-20091105015951-r8rm31afqy2qbh8k
* mandos (Client.disable): Rename keyword argument "log" to "quiet",
                           with inverted sense.  All callers changed.
  (ClientDBus.disable): Rename keyword argument "signal" to "quiet",
                        with inverted sense.  All callers changed.
  (main): Disable D-Bus use if bus name is not available on system bus.
  (main.cleanup): Bug fix: Only do "remove_from_connection" on clients
                  when using D-Bus.
* plugin-runner.c (main): Return EX_OSERR if a bad error happened when
                          trying to open config file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
333
333
        # Also start a new checker *right now*.
334
334
        self.start_checker()
335
335
    
336
 
    def disable(self, log=True):
 
336
    def disable(self, quiet=True):
337
337
        """Disable this client."""
338
338
        if not getattr(self, "enabled", False):
339
339
            return False
340
 
        if log:
 
340
        if not quiet:
341
341
            logger.info(u"Disabling client %s", self.name)
342
342
        if getattr(self, u"disable_initiator_tag", False):
343
343
            gobject.source_remove(self.disable_initiator_tag)
706
706
                                       variant_level=1))
707
707
        return r
708
708
    
709
 
    def disable(self, signal = True):
 
709
    def disable(self, quiet = False):
710
710
        oldstate = getattr(self, u"enabled", False)
711
711
        r = Client.disable(self, log=signal)
712
 
        if signal and oldstate != self.enabled:
 
712
        if not quiet and oldstate != self.enabled:
713
713
            # Emit D-Bus signal
714
714
            self.PropertyChanged(dbus.String(u"enabled"),
715
715
                                 dbus.Boolean(False, variant_level=1))
1567
1567
    bus = dbus.SystemBus()
1568
1568
    # End of Avahi example code
1569
1569
    if use_dbus:
1570
 
        bus_name = dbus.service.BusName(u"se.bsnet.fukt.Mandos", bus)
 
1570
        try:
 
1571
            bus_name = dbus.service.BusName(u"se.bsnet.fukt.Mandos",
 
1572
                                            bus, do_not_queue=True)
 
1573
        except dbus.exceptions.NameExistsException, e:
 
1574
            logger.error(unicode(e) + u", disabling D-Bus")
 
1575
            use_dbus = False
 
1576
            server_settings[u"use_dbus"] = False
 
1577
            tcp_server.use_dbus = False
1571
1578
    protocol = avahi.PROTO_INET6 if use_ipv6 else avahi.PROTO_INET
1572
1579
    service = AvahiService(name = server_settings[u"servicename"],
1573
1580
                           servicetype = u"_mandos._tcp",
1661
1668
                        tcp_server.clients.remove(c)
1662
1669
                        c.remove_from_connection()
1663
1670
                        # Don't signal anything except ClientRemoved
1664
 
                        c.disable(signal=False)
 
1671
                        c.disable(quiet=True)
1665
1672
                        # Emit D-Bus signal
1666
1673
                        self.ClientRemoved(object_path, c.name)
1667
1674
                        return
1677
1684
        
1678
1685
        while tcp_server.clients:
1679
1686
            client = tcp_server.clients.pop()
1680
 
            client.remove_from_connection()
 
1687
            if use_dbus:
 
1688
                client.remove_from_connection()
1681
1689
            client.disable_hook = None
1682
1690
            # Don't signal anything except ClientRemoved
1683
 
            client.disable(signal=False)
 
1691
            client.disable(quiet=True)
1684
1692
            if use_dbus:
1685
1693
                # Emit D-Bus signal
1686
1694
                mandos_dbus_service.ClientRemoved(client.dbus_object_path,