/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-01-18 10:56:33 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090118105633-mbv0h5auszo1rsak
* mandos (Client.GetAllProperties): Also send Client.dbus_object_path
                                    as property "object_path".
  (main/MandosServer.ClientRemoved): Change signature to "os".  All
                                     emitters changed.
  (main/MandosServer.RemoveClientByName): New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
178
178
class Client(dbus.service.Object):
179
179
    """A representation of a client host served by this server.
180
180
    Attributes:
181
 
    name:       string; from the config file, used in log messages
 
181
    name:       string; from the config file, used in log messages and
 
182
                        D-Bus identifiers
182
183
    fingerprint: string (40 or 32 hexadecimal digits); used to
183
184
                 uniquely identify the client
184
185
    secret:     bytestring; sent verbatim (over TLS) to client
503
504
                dbus.String("checker_running"):
504
505
                    dbus.Boolean(self.checker is not None,
505
506
                                 variant_level=1),
 
507
                dbus.String("object_path"):
 
508
                    dbus.ObjectPath(self.dbus_object_path,
 
509
                                    variant_level=1)
506
510
                }, signature="sv")
507
511
    
508
512
    # IsStillValid - method
1095
1099
                dbus.service.Object.__init__(self, bus,
1096
1100
                                             "/Mandos")
1097
1101
            _interface = u"org.mandos_system.Mandos"
1098
 
 
 
1102
            
1099
1103
            @dbus.service.signal(_interface, signature="oa{sv}")
1100
1104
            def ClientAdded(self, objpath, properties):
1101
1105
                "D-Bus signal"
1102
1106
                pass
1103
 
 
1104
 
            @dbus.service.signal(_interface, signature="o")
1105
 
            def ClientRemoved(self, objpath):
 
1107
            
 
1108
            @dbus.service.signal(_interface, signature="os")
 
1109
            def ClientRemoved(self, objpath, name):
1106
1110
                "D-Bus signal"
1107
1111
                pass
1108
 
 
 
1112
            
1109
1113
            @dbus.service.method(_interface, out_signature="ao")
1110
1114
            def GetAllClients(self):
1111
1115
                return dbus.Array(c.dbus_object_path for c in clients)
1112
 
 
 
1116
            
1113
1117
            @dbus.service.method(_interface, out_signature="a{oa{sv}}")
1114
1118
            def GetAllClientsWithProperties(self):
1115
1119
                return dbus.Dictionary(
1116
1120
                    ((c.dbus_object_path, c.GetAllProperties())
1117
1121
                     for c in clients),
1118
1122
                    signature="oa{sv}")
1119
 
 
 
1123
            
1120
1124
            @dbus.service.method(_interface, in_signature="o")
1121
1125
            def RemoveClient(self, object_path):
1122
1126
                for c in clients:
1126
1130
                        c.use_dbus = False
1127
1131
                        c.disable()
1128
1132
                        # Emit D-Bus signal
1129
 
                        self.ClientRemoved(object_path)
1130
 
                        return
1131
 
                raise KeyError
 
1133
                        self.ClientRemoved(object_path, c.name)
 
1134
                        return
 
1135
                raise KeyError
 
1136
            
 
1137
            @dbus.service.method(_interface, in_signature="s")
 
1138
            def RemoveClientByName(self, name):
 
1139
                for c in clients:
 
1140
                    if c.name == name:
 
1141
                        clients.remove(c)
 
1142
                        # Don't signal anything except ClientRemoved
 
1143
                        c.use_dbus = False
 
1144
                        c.disable()
 
1145
                        # Emit D-Bus signal
 
1146
                        self.ClientRemoved(c.dbus_object_path, name)
 
1147
                        return
 
1148
                raise KeyError
 
1149
            
1132
1150
            @dbus.service.method(_interface)
1133
1151
            def Quit(self):
1134
1152
                main_loop.quit()
1135
 
 
 
1153
            
1136
1154
            del _interface
1137
 
    
 
1155
        
1138
1156
        mandos_server = MandosServer()
1139
1157
    
1140
1158
    for client in clients: