/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: 2011-09-26 21:12:40 UTC
  • mfrom: (502.1.1 teddy)
  • Revision ID: teddy@fukt.bsnet.se-20110926211240-qahsqx7nvx5ktjyn
Merge inconsequential change

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
# along with this program.  If not, see
29
29
# <http://www.gnu.org/licenses/>.
30
30
31
 
# Contact the authors at <mandos@recompile.se>.
 
31
# Contact the authors at <mandos@fukt.bsnet.se>.
32
32
33
33
 
34
34
from __future__ import (division, absolute_import, print_function,
62
62
import functools
63
63
import cPickle as pickle
64
64
import multiprocessing
65
 
import types
66
65
 
67
66
import dbus
68
67
import dbus.service
83
82
        SO_BINDTODEVICE = None
84
83
 
85
84
 
86
 
version = "1.4.1"
 
85
version = "1.3.1"
87
86
 
88
87
#logger = logging.getLogger('mandos')
89
88
logger = logging.Logger('mandos')
160
159
                            " after %i retries, exiting.",
161
160
                            self.rename_count)
162
161
            raise AvahiServiceError("Too many renames")
163
 
        self.name = unicode(self.server
164
 
                            .GetAlternativeServiceName(self.name))
 
162
        self.name = unicode(self.server.GetAlternativeServiceName(self.name))
165
163
        logger.info("Changing Zeroconf service name to %r ...",
166
164
                    self.name)
167
165
        syslogger.setFormatter(logging.Formatter
322
320
    
323
321
    def extended_timeout_milliseconds(self):
324
322
        "Return the 'extended_timeout' attribute in milliseconds"
325
 
        return _timedelta_to_milliseconds(self.extended_timeout)
 
323
        return _timedelta_to_milliseconds(self.extended_timeout)    
326
324
    
327
325
    def interval_milliseconds(self):
328
326
        "Return the 'interval' attribute in milliseconds"
362
360
        self.last_enabled = None
363
361
        self.last_checked_ok = None
364
362
        self.timeout = string_to_delta(config["timeout"])
365
 
        self.extended_timeout = string_to_delta(config
366
 
                                                ["extended_timeout"])
 
363
        self.extended_timeout = string_to_delta(config["extended_timeout"])
367
364
        self.interval = string_to_delta(config["interval"])
368
365
        self.disable_hook = disable_hook
369
366
        self.checker = None
382
379
            config["approval_delay"])
383
380
        self.approval_duration = string_to_delta(
384
381
            config["approval_duration"])
385
 
        self.changedstate = (multiprocessing_manager
386
 
                             .Condition(multiprocessing_manager
387
 
                                        .Lock()))
 
382
        self.changedstate = multiprocessing_manager.Condition(multiprocessing_manager.Lock())
388
383
    
389
384
    def send_changedstate(self):
390
385
        self.changedstate.acquire()
391
386
        self.changedstate.notify_all()
392
387
        self.changedstate.release()
393
 
    
 
388
        
394
389
    def enable(self):
395
390
        """Start this client's checker and timeout hooks"""
396
391
        if getattr(self, "enabled", False):
464
459
        if timeout is None:
465
460
            timeout = self.timeout
466
461
        self.last_checked_ok = datetime.datetime.utcnow()
467
 
        if self.disable_initiator_tag is not None:
468
 
            gobject.source_remove(self.disable_initiator_tag)
469
 
        if getattr(self, "enabled", False):
470
 
            self.disable_initiator_tag = (gobject.timeout_add
471
 
                                          (_timedelta_to_milliseconds
472
 
                                           (timeout), self.disable))
473
 
            self.expires = datetime.datetime.utcnow() + timeout
 
462
        gobject.source_remove(self.disable_initiator_tag)
 
463
        self.expires = datetime.datetime.utcnow() + timeout
 
464
        self.disable_initiator_tag = (gobject.timeout_add
 
465
                                      (_timedelta_to_milliseconds(timeout),
 
466
                                       self.disable))
474
467
    
475
468
    def need_approval(self):
476
469
        self.last_approval_request = datetime.datetime.utcnow()
633
626
    def _get_all_dbus_properties(self):
634
627
        """Returns a generator of (name, attribute) pairs
635
628
        """
636
 
        return ((prop.__get__(self)._dbus_name, prop.__get__(self))
637
 
                for cls in self.__class__.__mro__
 
629
        return ((prop._dbus_name, prop)
638
630
                for name, prop in
639
 
                inspect.getmembers(cls, self._is_dbus_property))
 
631
                inspect.getmembers(self, self._is_dbus_property))
640
632
    
641
633
    def _get_dbus_property(self, interface_name, property_name):
642
634
        """Returns a bound method if one exists which is a D-Bus
643
635
        property with the specified name and interface.
644
636
        """
645
 
        for cls in  self.__class__.__mro__:
646
 
            for name, value in (inspect.getmembers
647
 
                                (cls, self._is_dbus_property)):
648
 
                if (value._dbus_name == property_name
649
 
                    and value._dbus_interface == interface_name):
650
 
                    return value.__get__(self)
651
 
        
 
637
        for name in (property_name,
 
638
                     property_name + "_dbus_property"):
 
639
            prop = getattr(self, name, None)
 
640
            if (prop is None
 
641
                or not self._is_dbus_property(prop)
 
642
                or prop._dbus_name != property_name
 
643
                or (interface_name and prop._dbus_interface
 
644
                    and interface_name != prop._dbus_interface)):
 
645
                continue
 
646
            return prop
652
647
        # No such property
653
648
        raise DBusPropertyNotFound(self.dbus_object_path + ":"
654
649
                                   + interface_name + "."
763
758
    return dbus.String(dt.isoformat(),
764
759
                       variant_level=variant_level)
765
760
 
766
 
class AlternateDBusNamesMetaclass(DBusObjectWithProperties
767
 
                                  .__metaclass__):
768
 
    """Applied to an empty subclass of a D-Bus object, this metaclass
769
 
    will add additional D-Bus attributes matching a certain pattern.
770
 
    """
771
 
    def __new__(mcs, name, bases, attr):
772
 
        # Go through all the base classes which could have D-Bus
773
 
        # methods, signals, or properties in them
774
 
        for base in (b for b in bases
775
 
                     if issubclass(b, dbus.service.Object)):
776
 
            # Go though all attributes of the base class
777
 
            for attrname, attribute in inspect.getmembers(base):
778
 
                # Ignore non-D-Bus attributes, and D-Bus attributes
779
 
                # with the wrong interface name
780
 
                if (not hasattr(attribute, "_dbus_interface")
781
 
                    or not attribute._dbus_interface
782
 
                    .startswith("se.recompile.Mandos")):
783
 
                    continue
784
 
                # Create an alternate D-Bus interface name based on
785
 
                # the current name
786
 
                alt_interface = (attribute._dbus_interface
787
 
                                 .replace("se.recompile.Mandos",
788
 
                                          "se.bsnet.fukt.Mandos"))
789
 
                # Is this a D-Bus signal?
790
 
                if getattr(attribute, "_dbus_is_signal", False):
791
 
                    # Extract the original non-method function by
792
 
                    # black magic
793
 
                    nonmethod_func = (dict(
794
 
                            zip(attribute.func_code.co_freevars,
795
 
                                attribute.__closure__))["func"]
796
 
                                      .cell_contents)
797
 
                    # Create a new, but exactly alike, function
798
 
                    # object, and decorate it to be a new D-Bus signal
799
 
                    # with the alternate D-Bus interface name
800
 
                    new_function = (dbus.service.signal
801
 
                                    (alt_interface,
802
 
                                     attribute._dbus_signature)
803
 
                                    (types.FunctionType(
804
 
                                nonmethod_func.func_code,
805
 
                                nonmethod_func.func_globals,
806
 
                                nonmethod_func.func_name,
807
 
                                nonmethod_func.func_defaults,
808
 
                                nonmethod_func.func_closure)))
809
 
                    # Define a creator of a function to call both the
810
 
                    # old and new functions, so both the old and new
811
 
                    # signals gets sent when the function is called
812
 
                    def fixscope(func1, func2):
813
 
                        """This function is a scope container to pass
814
 
                        func1 and func2 to the "call_both" function
815
 
                        outside of its arguments"""
816
 
                        def call_both(*args, **kwargs):
817
 
                            """This function will emit two D-Bus
818
 
                            signals by calling func1 and func2"""
819
 
                            func1(*args, **kwargs)
820
 
                            func2(*args, **kwargs)
821
 
                        return call_both
822
 
                    # Create the "call_both" function and add it to
823
 
                    # the class
824
 
                    attr[attrname] = fixscope(attribute,
825
 
                                              new_function)
826
 
                # Is this a D-Bus method?
827
 
                elif getattr(attribute, "_dbus_is_method", False):
828
 
                    # Create a new, but exactly alike, function
829
 
                    # object.  Decorate it to be a new D-Bus method
830
 
                    # with the alternate D-Bus interface name.  Add it
831
 
                    # to the class.
832
 
                    attr[attrname] = (dbus.service.method
833
 
                                      (alt_interface,
834
 
                                       attribute._dbus_in_signature,
835
 
                                       attribute._dbus_out_signature)
836
 
                                      (types.FunctionType
837
 
                                       (attribute.func_code,
838
 
                                        attribute.func_globals,
839
 
                                        attribute.func_name,
840
 
                                        attribute.func_defaults,
841
 
                                        attribute.func_closure)))
842
 
                # Is this a D-Bus property?
843
 
                elif getattr(attribute, "_dbus_is_property", False):
844
 
                    # Create a new, but exactly alike, function
845
 
                    # object, and decorate it to be a new D-Bus
846
 
                    # property with the alternate D-Bus interface
847
 
                    # name.  Add it to the class.
848
 
                    attr[attrname] = (dbus_service_property
849
 
                                      (alt_interface,
850
 
                                       attribute._dbus_signature,
851
 
                                       attribute._dbus_access,
852
 
                                       attribute
853
 
                                       ._dbus_get_args_options
854
 
                                       ["byte_arrays"])
855
 
                                      (types.FunctionType
856
 
                                       (attribute.func_code,
857
 
                                        attribute.func_globals,
858
 
                                        attribute.func_name,
859
 
                                        attribute.func_defaults,
860
 
                                        attribute.func_closure)))
861
 
        return type.__new__(mcs, name, bases, attr)
862
761
 
863
762
class ClientDBus(Client, DBusObjectWithProperties):
864
763
    """A Client class using D-Bus
890
789
    def notifychangeproperty(transform_func,
891
790
                             dbus_name, type_func=lambda x: x,
892
791
                             variant_level=1):
893
 
        """ Modify a variable so that it's a property which announces
894
 
        its changes to DBus.
895
 
 
896
 
        transform_fun: Function that takes a value and a variant_level
897
 
                       and transforms it to a D-Bus type.
898
 
        dbus_name: D-Bus name of the variable
 
792
        """ Modify a variable so that its a property that announce its
 
793
        changes to DBus.
 
794
        transform_fun: Function that takes a value and transform it to
 
795
                       DBus type.
 
796
        dbus_name: DBus name of the variable
899
797
        type_func: Function that transform the value before sending it
900
 
                   to the D-Bus.  Default: no transform
901
 
        variant_level: D-Bus variant level.  Default: 1
 
798
                   to DBus
 
799
        variant_level: DBus variant level. default: 1
902
800
        """
903
 
        attrname = "_{0}".format(dbus_name)
 
801
        real_value = [None,]
904
802
        def setter(self, value):
 
803
            old_value = real_value[0]
 
804
            real_value[0] = value
905
805
            if hasattr(self, "dbus_object_path"):
906
 
                if (not hasattr(self, attrname) or
907
 
                    type_func(getattr(self, attrname, None))
908
 
                    != type_func(value)):
909
 
                    dbus_value = transform_func(type_func(value),
910
 
                                                variant_level
911
 
                                                =variant_level)
 
806
                if type_func(old_value) != type_func(real_value[0]):
 
807
                    dbus_value = transform_func(type_func(real_value[0]),
 
808
                                                variant_level)
912
809
                    self.PropertyChanged(dbus.String(dbus_name),
913
810
                                         dbus_value)
914
 
            setattr(self, attrname, value)
915
811
        
916
 
        return property(lambda self: getattr(self, attrname), setter)
 
812
        return property(lambda self: real_value[0], setter)
917
813
    
918
814
    
919
815
    expires = notifychangeproperty(datetime_to_dbus, "Expires")
924
820
    last_enabled = notifychangeproperty(datetime_to_dbus,
925
821
                                        "LastEnabled")
926
822
    checker = notifychangeproperty(dbus.Boolean, "CheckerRunning",
927
 
                                   type_func = lambda checker:
928
 
                                       checker is not None)
 
823
                                   type_func = lambda checker: checker is not None)
929
824
    last_checked_ok = notifychangeproperty(datetime_to_dbus,
930
825
                                           "LastCheckedOK")
931
 
    last_approval_request = notifychangeproperty(
932
 
        datetime_to_dbus, "LastApprovalRequest")
 
826
    last_approval_request = notifychangeproperty(datetime_to_dbus,
 
827
                                                 "LastApprovalRequest")
933
828
    approved_by_default = notifychangeproperty(dbus.Boolean,
934
829
                                               "ApprovedByDefault")
935
 
    approval_delay = notifychangeproperty(dbus.UInt16,
936
 
                                          "ApprovalDelay",
937
 
                                          type_func =
938
 
                                          _timedelta_to_milliseconds)
939
 
    approval_duration = notifychangeproperty(
940
 
        dbus.UInt16, "ApprovalDuration",
941
 
        type_func = _timedelta_to_milliseconds)
 
830
    approval_delay = notifychangeproperty(dbus.UInt16, "ApprovalDelay",
 
831
                                          type_func = _timedelta_to_milliseconds)
 
832
    approval_duration = notifychangeproperty(dbus.UInt16, "ApprovalDuration",
 
833
                                             type_func = _timedelta_to_milliseconds)
942
834
    host = notifychangeproperty(dbus.String, "Host")
943
835
    timeout = notifychangeproperty(dbus.UInt16, "Timeout",
944
 
                                   type_func =
945
 
                                   _timedelta_to_milliseconds)
946
 
    extended_timeout = notifychangeproperty(
947
 
        dbus.UInt16, "ExtendedTimeout",
948
 
        type_func = _timedelta_to_milliseconds)
949
 
    interval = notifychangeproperty(dbus.UInt16,
950
 
                                    "Interval",
951
 
                                    type_func =
952
 
                                    _timedelta_to_milliseconds)
 
836
                                   type_func = _timedelta_to_milliseconds)
 
837
    extended_timeout = notifychangeproperty(dbus.UInt16, "ExtendedTimeout",
 
838
                                            type_func = _timedelta_to_milliseconds)
 
839
    interval = notifychangeproperty(dbus.UInt16, "Interval",
 
840
                                    type_func = _timedelta_to_milliseconds)
953
841
    checker_command = notifychangeproperty(dbus.String, "Checker")
954
842
    
955
843
    del notifychangeproperty
1009
897
    
1010
898
    
1011
899
    ## D-Bus methods, signals & properties
1012
 
    _interface = "se.recompile.Mandos.Client"
 
900
    _interface = "se.bsnet.fukt.Mandos.Client"
1013
901
    
1014
902
    ## Signals
1015
903
    
1190
1078
        gobject.source_remove(self.disable_initiator_tag)
1191
1079
        self.disable_initiator_tag = None
1192
1080
        self.expires = None
1193
 
        time_to_die = _timedelta_to_milliseconds((self
1194
 
                                                  .last_checked_ok
1195
 
                                                  + self.timeout)
1196
 
                                                 - datetime.datetime
1197
 
                                                 .utcnow())
 
1081
        time_to_die = (self.
 
1082
                       _timedelta_to_milliseconds((self
 
1083
                                                   .last_checked_ok
 
1084
                                                   + self.timeout)
 
1085
                                                  - datetime.datetime
 
1086
                                                  .utcnow()))
1198
1087
        if time_to_die <= 0:
1199
1088
            # The timeout has passed
1200
1089
            self.disable()
1201
1090
        else:
1202
1091
            self.expires = (datetime.datetime.utcnow()
1203
 
                            + datetime.timedelta(milliseconds =
1204
 
                                                 time_to_die))
 
1092
                            + datetime.timedelta(milliseconds = time_to_die))
1205
1093
            self.disable_initiator_tag = (gobject.timeout_add
1206
1094
                                          (time_to_die, self.disable))
1207
1095
    
1286
1174
            return super(ProxyClient, self).__setattr__(name, value)
1287
1175
        self._pipe.send(('setattr', name, value))
1288
1176
 
1289
 
class ClientDBusTransitional(ClientDBus):
1290
 
    __metaclass__ = AlternateDBusNamesMetaclass
1291
1177
 
1292
1178
class ClientHandler(socketserver.BaseRequestHandler, object):
1293
1179
    """A class to handle client connections.
1373
1259
                                       client.name)
1374
1260
                        if self.server.use_dbus:
1375
1261
                            # Emit D-Bus signal
1376
 
                            client.Rejected("Disabled")
 
1262
                            client.Rejected("Disabled")                    
1377
1263
                        return
1378
1264
                    
1379
1265
                    if client._approved or not client.approval_delay:
1396
1282
                        return
1397
1283
                    
1398
1284
                    #wait until timeout or approved
 
1285
                    #x = float(client._timedelta_to_milliseconds(delay))
1399
1286
                    time = datetime.datetime.now()
1400
1287
                    client.changedstate.acquire()
1401
 
                    (client.changedstate.wait
1402
 
                     (float(client._timedelta_to_milliseconds(delay)
1403
 
                            / 1000)))
 
1288
                    client.changedstate.wait(float(client._timedelta_to_milliseconds(delay) / 1000))
1404
1289
                    client.changedstate.release()
1405
1290
                    time2 = datetime.datetime.now()
1406
1291
                    if (time2 - time) >= delay:
1430
1315
                    sent_size += sent
1431
1316
                
1432
1317
                logger.info("Sending secret to %s", client.name)
1433
 
                # bump the timeout using extended_timeout
 
1318
                # bump the timeout as if seen
1434
1319
                client.checked_ok(client.extended_timeout)
1435
1320
                if self.server.use_dbus:
1436
1321
                    # Emit D-Bus signal
1516
1401
        except:
1517
1402
            self.handle_error(request, address)
1518
1403
        self.close_request(request)
1519
 
    
 
1404
            
1520
1405
    def process_request(self, request, address):
1521
1406
        """Start a new process to process the request."""
1522
 
        proc = multiprocessing.Process(target = self.sub_process_main,
1523
 
                                       args = (request,
1524
 
                                               address))
1525
 
        proc.start()
1526
 
        return proc
 
1407
        multiprocessing.Process(target = self.sub_process_main,
 
1408
                                args = (request, address)).start()
1527
1409
 
1528
1410
 
1529
1411
class MultiprocessingMixInWithPipe(MultiprocessingMixIn, object):
1535
1417
        """
1536
1418
        parent_pipe, self.child_pipe = multiprocessing.Pipe()
1537
1419
        
1538
 
        proc = MultiprocessingMixIn.process_request(self, request,
1539
 
                                                    client_address)
 
1420
        super(MultiprocessingMixInWithPipe,
 
1421
              self).process_request(request, client_address)
1540
1422
        self.child_pipe.close()
1541
 
        self.add_pipe(parent_pipe, proc)
 
1423
        self.add_pipe(parent_pipe)
1542
1424
    
1543
 
    def add_pipe(self, parent_pipe, proc):
 
1425
    def add_pipe(self, parent_pipe):
1544
1426
        """Dummy function; override as necessary"""
1545
1427
        raise NotImplementedError
1546
1428
 
1634
1516
    def server_activate(self):
1635
1517
        if self.enabled:
1636
1518
            return socketserver.TCPServer.server_activate(self)
1637
 
    
1638
1519
    def enable(self):
1639
1520
        self.enabled = True
1640
 
    
1641
 
    def add_pipe(self, parent_pipe, proc):
 
1521
    def add_pipe(self, parent_pipe):
1642
1522
        # Call "handle_ipc" for both data and EOF events
1643
1523
        gobject.io_add_watch(parent_pipe.fileno(),
1644
1524
                             gobject.IO_IN | gobject.IO_HUP,
1645
1525
                             functools.partial(self.handle_ipc,
1646
 
                                               parent_pipe =
1647
 
                                               parent_pipe,
1648
 
                                               proc = proc))
1649
 
    
 
1526
                                               parent_pipe = parent_pipe))
 
1527
        
1650
1528
    def handle_ipc(self, source, condition, parent_pipe=None,
1651
 
                   proc = None, client_object=None):
 
1529
                   client_object=None):
1652
1530
        condition_names = {
1653
1531
            gobject.IO_IN: "IN",   # There is data to read.
1654
1532
            gobject.IO_OUT: "OUT", # Data can be written (without
1663
1541
                                       for cond, name in
1664
1542
                                       condition_names.iteritems()
1665
1543
                                       if cond & condition)
1666
 
        # error, or the other end of multiprocessing.Pipe has closed
 
1544
        # error or the other end of multiprocessing.Pipe has closed
1667
1545
        if condition & (gobject.IO_ERR | condition & gobject.IO_HUP):
1668
 
            # Wait for other process to exit
1669
 
            proc.join()
1670
1546
            return False
1671
1547
        
1672
1548
        # Read a request from the child
1686
1562
                            "dress: %s", fpr, address)
1687
1563
                if self.use_dbus:
1688
1564
                    # Emit D-Bus signal
1689
 
                    mandos_dbus_service.ClientNotFound(fpr,
1690
 
                                                       address[0])
 
1565
                    mandos_dbus_service.ClientNotFound(fpr, address[0])
1691
1566
                parent_pipe.send(False)
1692
1567
                return False
1693
1568
            
1694
1569
            gobject.io_add_watch(parent_pipe.fileno(),
1695
1570
                                 gobject.IO_IN | gobject.IO_HUP,
1696
1571
                                 functools.partial(self.handle_ipc,
1697
 
                                                   parent_pipe =
1698
 
                                                   parent_pipe,
1699
 
                                                   proc = proc,
1700
 
                                                   client_object =
1701
 
                                                   client))
 
1572
                                                   parent_pipe = parent_pipe,
 
1573
                                                   client_object = client))
1702
1574
            parent_pipe.send(True)
1703
 
            # remove the old hook in favor of the new above hook on
1704
 
            # same fileno
 
1575
            # remove the old hook in favor of the new above hook on same fileno
1705
1576
            return False
1706
1577
        if command == 'funcall':
1707
1578
            funcname = request[1]
1708
1579
            args = request[2]
1709
1580
            kwargs = request[3]
1710
1581
            
1711
 
            parent_pipe.send(('data', getattr(client_object,
1712
 
                                              funcname)(*args,
1713
 
                                                         **kwargs)))
 
1582
            parent_pipe.send(('data', getattr(client_object, funcname)(*args, **kwargs)))
1714
1583
        
1715
1584
        if command == 'getattr':
1716
1585
            attrname = request[1]
1717
1586
            if callable(client_object.__getattribute__(attrname)):
1718
1587
                parent_pipe.send(('function',))
1719
1588
            else:
1720
 
                parent_pipe.send(('data', client_object
1721
 
                                  .__getattribute__(attrname)))
 
1589
                parent_pipe.send(('data', client_object.__getattribute__(attrname)))
1722
1590
        
1723
1591
        if command == 'setattr':
1724
1592
            attrname = request[1]
2013
1881
    # End of Avahi example code
2014
1882
    if use_dbus:
2015
1883
        try:
2016
 
            bus_name = dbus.service.BusName("se.recompile.Mandos",
 
1884
            bus_name = dbus.service.BusName("se.bsnet.fukt.Mandos",
2017
1885
                                            bus, do_not_queue=True)
2018
 
            old_bus_name = (dbus.service.BusName
2019
 
                            ("se.bsnet.fukt.Mandos", bus,
2020
 
                             do_not_queue=True))
2021
1886
        except dbus.exceptions.NameExistsException as e:
2022
1887
            logger.error(unicode(e) + ", disabling D-Bus")
2023
1888
            use_dbus = False
2036
1901
    
2037
1902
    client_class = Client
2038
1903
    if use_dbus:
2039
 
        client_class = functools.partial(ClientDBusTransitional,
2040
 
                                         bus = bus)
 
1904
        client_class = functools.partial(ClientDBus, bus = bus)
2041
1905
    def client_config_items(config, section):
2042
1906
        special_settings = {
2043
1907
            "approved_by_default":
2082
1946
            """A D-Bus proxy object"""
2083
1947
            def __init__(self):
2084
1948
                dbus.service.Object.__init__(self, bus, "/")
2085
 
            _interface = "se.recompile.Mandos"
 
1949
            _interface = "se.bsnet.fukt.Mandos"
2086
1950
            
2087
1951
            @dbus.service.signal(_interface, signature="o")
2088
1952
            def ClientAdded(self, objpath):
2130
1994
            
2131
1995
            del _interface
2132
1996
        
2133
 
        class MandosDBusServiceTransitional(MandosDBusService):
2134
 
            __metaclass__ = AlternateDBusNamesMetaclass
2135
 
        mandos_dbus_service = MandosDBusServiceTransitional()
 
1997
        mandos_dbus_service = MandosDBusService()
2136
1998
    
2137
1999
    def cleanup():
2138
2000
        "Cleanup function; run on exit"
2139
2001
        service.cleanup()
2140
2002
        
2141
 
        multiprocessing.active_children()
2142
2003
        while tcp_server.clients:
2143
2004
            client = tcp_server.clients.pop()
2144
2005
            if use_dbus:
2148
2009
            client.disable(quiet=True)
2149
2010
            if use_dbus:
2150
2011
                # Emit D-Bus signal
2151
 
                mandos_dbus_service.ClientRemoved(client
2152
 
                                                  .dbus_object_path,
 
2012
                mandos_dbus_service.ClientRemoved(client.dbus_object_path,
2153
2013
                                                  client.name)
2154
2014
    
2155
2015
    atexit.register(cleanup)