/mandos/release

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

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2015-08-02 16:45:29 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 325.
  • Revision ID: teddy@recompile.se-20150802164529-pemtk1agiqluoiua
Deprecate some D-Bus methods in favor of D-Bus properties.

The following D-Bus methods on the interface
"se.recompile.Mandos.Client" are redundant, and are therefore
deprecated:  "Disable", "Enable", "StartChecker", and "StopChecker".
Instead, the D-Bus properties "Enabled" and "CheckerRunning" should be
set, as was always also possible.

* DBUS-API (se.recompile.Mandos.Client.Disable): Remove; deprecated.
  (se.recompile.Mandos.Client.Enable): - '' -
  (se.recompile.Mandos.Client.StartChecker): - '' -
  (se.recompile.Mandos.Client.StopChecker): - '' -
* mandos (ClientDBus.Enable): Annotate as deprecated.
  (ClientDBus.StartChecker): - '' -
  (ClientDBus.Disable): - '' -
  (ClientDBus.StopChecker): - '' -
* mandos-monitor (MandosClientWidget.keypress): Set properties instead
                                                of calling deprecated
                                                methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
395
395
                    logger.error(bad_states[state] + ": %r", error)
396
396
            self.cleanup()
397
397
        elif state == avahi.SERVER_RUNNING:
398
 
            self.add()
 
398
            try:
 
399
                self.add()
 
400
            except dbus.exceptions.DBusException as error:
 
401
                if (error.get_dbus_name()
 
402
                    == "org.freedesktop.Avahi.CollisionError"):
 
403
                    logger.info("Local Zeroconf service name"
 
404
                                " collision.")
 
405
                    return self.rename(remove=False)
 
406
                else:
 
407
                    logger.critical("D-Bus Exception", exc_info=error)
 
408
                    self.cleanup()
 
409
                    os._exit(1)
399
410
        else:
400
411
            if error is None:
401
412
                logger.debug("Unknown state: %r", state)
1454
1465
        self.checked_ok()
1455
1466
    
1456
1467
    # Enable - method
 
1468
    @dbus_annotations({"org.freedesktop.DBus.Deprecated": "true"})
1457
1469
    @dbus.service.method(_interface)
1458
1470
    def Enable(self):
1459
1471
        "D-Bus method"
1460
1472
        self.enable()
1461
1473
    
1462
1474
    # StartChecker - method
 
1475
    @dbus_annotations({"org.freedesktop.DBus.Deprecated": "true"})
1463
1476
    @dbus.service.method(_interface)
1464
1477
    def StartChecker(self):
1465
1478
        "D-Bus method"
1466
1479
        self.start_checker()
1467
1480
    
1468
1481
    # Disable - method
 
1482
    @dbus_annotations({"org.freedesktop.DBus.Deprecated": "true"})
1469
1483
    @dbus.service.method(_interface)
1470
1484
    def Disable(self):
1471
1485
        "D-Bus method"
1472
1486
        self.disable()
1473
1487
    
1474
1488
    # StopChecker - method
 
1489
    @dbus_annotations({"org.freedesktop.DBus.Deprecated": "true"})
1475
1490
    @dbus.service.method(_interface)
1476
1491
    def StopChecker(self):
1477
1492
        self.stop_checker()
1513
1528
        self.approval_duration = datetime.timedelta(0, 0, 0, value)
1514
1529
    
1515
1530
    # Name - property
 
1531
    @dbus_annotations(
 
1532
        {"org.freedesktop.DBus.Property.EmitsChangedSignal": "const"})
1516
1533
    @dbus_service_property(_interface, signature="s", access="read")
1517
1534
    def Name_dbus_property(self):
1518
1535
        return dbus.String(self.name)
1519
1536
    
1520
1537
    # Fingerprint - property
 
1538
    @dbus_annotations(
 
1539
        {"org.freedesktop.DBus.Property.EmitsChangedSignal": "const"})
1521
1540
    @dbus_service_property(_interface, signature="s", access="read")
1522
1541
    def Fingerprint_dbus_property(self):
1523
1542
        return dbus.String(self.fingerprint)
1532
1551
        self.host = str(value)
1533
1552
    
1534
1553
    # Created - property
 
1554
    @dbus_annotations(
 
1555
        {"org.freedesktop.DBus.Property.EmitsChangedSignal": "const"})
1535
1556
    @dbus_service_property(_interface, signature="s", access="read")
1536
1557
    def Created_dbus_property(self):
1537
1558
        return datetime_to_dbus(self.created)
1652
1673
            self.stop_checker()
1653
1674
    
1654
1675
    # ObjectPath - property
 
1676
    @dbus_annotations(
 
1677
        {"org.freedesktop.DBus.Property.EmitsChangedSignal": "const"})
1655
1678
    @dbus_service_property(_interface, signature="o", access="read")
1656
1679
    def ObjectPath_dbus_property(self):
1657
1680
        return self.dbus_object_path # is already a dbus.ObjectPath
1658
1681
    
1659
1682
    # Secret = property
 
1683
    @dbus_annotations(
 
1684
        {"org.freedesktop.DBus.Property.EmitsChangedSignal":
 
1685
         "invalidates"})
1660
1686
    @dbus_service_property(_interface,
1661
1687
                           signature="ay",
1662
1688
                           access="write",
2386
2412
                        "debug": "False",
2387
2413
                        "priority":
2388
2414
                        "SECURE256:!CTYPE-X.509:+CTYPE-OPENPGP:!RSA"
2389
 
                        ":+SIGN-RSA-SHA224:+SIGN-RSA-RMD160",
 
2415
                        ":+SIGN-DSA-SHA256",
2390
2416
                        "servicename": "Mandos",
2391
2417
                        "use_dbus": "True",
2392
2418
                        "use_ipv6": "True",