/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: 2014-08-09 23:37:07 UTC
  • mto: (237.7.304 trunk)
  • mto: This revision was merged to the branch mainline in revision 323.
  • Revision ID: teddy@recompile.se-20140809233707-6c5qyievp78lnzf1
askpass-fifo: Lower privileges after opening FIFO.

* plugins.d/askpass-fifo.c (main): Lower privileges after opening FIFO.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
if sys.version_info.major == 2:
92
92
    str = unicode
93
93
 
94
 
version = "1.6.9"
 
94
version = "1.6.8"
95
95
stored_state_file = "clients.pickle"
96
96
 
97
97
logger = logging.getLogger()
813
813
    """Decorator to annotate D-Bus methods, signals or properties
814
814
    Usage:
815
815
    
816
 
    @dbus_annotations({"org.freedesktop.DBus.Deprecated": "true",
817
 
                       "org.freedesktop.DBus.Property."
818
 
                       "EmitsChangedSignal": "false"})
819
816
    @dbus_service_property("org.example.Interface", signature="b",
820
817
                           access="r")
 
818
    @dbus_annotations({{"org.freedesktop.DBus.Deprecated": "true",
 
819
                        "org.freedesktop.DBus.Property."
 
820
                        "EmitsChangedSignal": "false"})
821
821
    def Property_dbus_property(self):
822
822
        return dbus.Boolean(False)
823
823
    """
946
946
                                           value.variant_level+1)
947
947
        return dbus.Dictionary(properties, signature="sv")
948
948
    
949
 
    @dbus.service.signal(dbus.PROPERTIES_IFACE, signature="sa{sv}as")
950
 
    def PropertiesChanged(self, interface_name, changed_properties,
951
 
                          invalidated_properties):
952
 
        """Standard D-Bus PropertiesChanged() signal, see D-Bus
953
 
        standard.
954
 
        """
955
 
        pass
956
 
    
957
949
    @dbus.service.method(dbus.INTROSPECTABLE_IFACE,
958
950
                         out_signature="s",
959
951
                         path_keyword='object_path',
1226
1218
    runtime_expansions = (Client.runtime_expansions
1227
1219
                          + ("dbus_object_path",))
1228
1220
    
1229
 
    _interface = "se.recompile.Mandos.Client"
1230
 
    
1231
1221
    # dbus.service.Object doesn't use super(), so we can't either.
1232
1222
    
1233
1223
    def __init__(self, bus = None, *args, **kwargs):
1245
1235
    
1246
1236
    def notifychangeproperty(transform_func,
1247
1237
                             dbus_name, type_func=lambda x: x,
1248
 
                             variant_level=1, invalidate_only=False,
1249
 
                             _interface=_interface):
 
1238
                             variant_level=1):
1250
1239
        """ Modify a variable so that it's a property which announces
1251
1240
        its changes to DBus.
1252
1241
        
1263
1252
                if (not hasattr(self, attrname) or
1264
1253
                    type_func(getattr(self, attrname, None))
1265
1254
                    != type_func(value)):
1266
 
                    if invalidate_only:
1267
 
                        self.PropertiesChanged(_interface,
1268
 
                                               dbus.Dictionary(),
1269
 
                                               dbus.Array
1270
 
                                               ((dbus_name,)))
1271
 
                    else:
1272
 
                        dbus_value = transform_func(type_func(value),
1273
 
                                                    variant_level
1274
 
                                                    =variant_level)
1275
 
                        self.PropertyChanged(dbus.String(dbus_name),
1276
 
                                             dbus_value)
1277
 
                        self.PropertiesChanged(_interface,
1278
 
                                               dbus.Dictionary({
1279
 
                                    dbus.String(dbus_name):
1280
 
                                        dbus_value }), dbus.Array())
 
1255
                    dbus_value = transform_func(type_func(value),
 
1256
                                                variant_level
 
1257
                                                =variant_level)
 
1258
                    self.PropertyChanged(dbus.String(dbus_name),
 
1259
                                         dbus_value)
1281
1260
            setattr(self, attrname, value)
1282
1261
        
1283
1262
        return property(lambda self: getattr(self, attrname), setter)
1321
1300
                                    lambda td: td.total_seconds()
1322
1301
                                    * 1000)
1323
1302
    checker_command = notifychangeproperty(dbus.String, "Checker")
1324
 
    secret = notifychangeproperty(dbus.ByteArray, "Secret",
1325
 
                                  invalidate_only=True)
1326
1303
    
1327
1304
    del notifychangeproperty
1328
1305
    
1375
1352
        self.send_changedstate()
1376
1353
    
1377
1354
    ## D-Bus methods, signals & properties
 
1355
    _interface = "se.recompile.Mandos.Client"
1378
1356
    
1379
1357
    ## Interfaces
1380
1358
    
 
1359
    @dbus_interface_annotations(_interface)
 
1360
    def _foo(self):
 
1361
        return { "org.freedesktop.DBus.Property.EmitsChangedSignal":
 
1362
                     "false"}
 
1363
    
1381
1364
    ## Signals
1382
1365
    
1383
1366
    # CheckerCompleted - signal
1393
1376
        pass
1394
1377
    
1395
1378
    # PropertyChanged - signal
1396
 
    @dbus_annotations({"org.freedesktop.DBus.Deprecated": "true"})
1397
1379
    @dbus.service.signal(_interface, signature="sv")
1398
1380
    def PropertyChanged(self, property, value):
1399
1381
        "D-Bus signal"
2727
2709
            def GetAllClientsWithProperties(self):
2728
2710
                "D-Bus method"
2729
2711
                return dbus.Dictionary(
2730
 
                    { c.dbus_object_path: c.GetAll("")
2731
 
                      for c in tcp_server.clients.itervalues() },
 
2712
                    ((c.dbus_object_path, c.GetAll(""))
 
2713
                     for c in tcp_server.clients.itervalues()),
2732
2714
                    signature="oa{sv}")
2733
2715
            
2734
2716
            @dbus.service.method(_interface, in_signature="o")