/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-08-08 21:12:37 UTC
  • Revision ID: teddy@fukt.bsnet.se-20110808211237-jejsz5brjytrjot8
* Makefile (DOCS): Added "intro.8mandos".
  (intro.8mandos, intro.8mandos.xhtml): New.
* README: Replaced text with link, reference and short summary.
* intro.xml: New.
* mandos-clients.conf.xml (SEE ALSO): Added "intro(8mandos)".
* mandos-ctl.xml (SEE ALSO): - '' -
* mandos-keygen.xml (SEE ALSO): - '' -
* mandos-monitor.xml (SEE ALSO): - '' -
* mandos.conf.xml (SEE ALSO): - '' -
* mandos.xml (SEE ALSO): - '' -
* plugin-runner.xml (SEE ALSO): - '' -
* plugins.d/askpass-fifo.xml (SEE ALSO): - '' -
* plugins.d/mandos-client.xml (SEE ALSO): - '' -
* plugins.d/password-prompt.xml (SEE ALSO): - '' -
* plugins.d/plymouth.xml (SEE ALSO): - '' -
* plugins.d/splashy.xml (SEE ALSO): - '' -
* plugins.d/usplash.xml (SEE ALSO): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        SO_BINDTODEVICE = None
83
83
 
84
84
 
85
 
version = "1.3.0"
 
85
version = "1.3.1"
86
86
 
87
87
#logger = logging.getLogger('mandos')
88
88
logger = logging.Logger('mandos')
176
176
        self.rename_count += 1
177
177
    def remove(self):
178
178
        """Derived from the Avahi example code"""
179
 
        if self.group is not None:
180
 
            try:
181
 
                self.group.Free()
182
 
            except (dbus.exceptions.UnknownMethodException,
183
 
                    dbus.exceptions.DBusException) as e:
184
 
                pass
185
 
            self.group = None
186
179
        if self.entry_group_state_changed_match is not None:
187
180
            self.entry_group_state_changed_match.remove()
188
181
            self.entry_group_state_changed_match = None
 
182
        if self.group is not None:
 
183
            self.group.Reset()
189
184
    def add(self):
190
185
        """Derived from the Avahi example code"""
191
186
        self.remove()
192
 
        self.group = dbus.Interface(
193
 
            self.bus.get_object(avahi.DBUS_NAME,
194
 
                                self.server.EntryGroupNew(),
195
 
                                follow_name_owner_changes=True),
196
 
            avahi.DBUS_INTERFACE_ENTRY_GROUP)
 
187
        if self.group is None:
 
188
            self.group = dbus.Interface(
 
189
                self.bus.get_object(avahi.DBUS_NAME,
 
190
                                    self.server.EntryGroupNew()),
 
191
                avahi.DBUS_INTERFACE_ENTRY_GROUP)
197
192
        self.entry_group_state_changed_match = (
198
193
            self.group.connect_to_signal(
199
194
                'StateChanged', self .entry_group_state_changed))
224
219
                                  % unicode(error))
225
220
    def cleanup(self):
226
221
        """Derived from the Avahi example code"""
 
222
        if self.group is not None:
 
223
            try:
 
224
                self.group.Free()
 
225
            except (dbus.exceptions.UnknownMethodException,
 
226
                    dbus.exceptions.DBusException) as e:
 
227
                pass
 
228
            self.group = None
227
229
        self.remove()
228
230
    def server_state_changed(self, state, error=None):
229
231
        """Derived from the Avahi example code"""
236
238
                       avahi.SERVER_FAILURE:
237
239
                           "Zeroconf server failure" }
238
240
        if state in bad_states:
239
 
            if bad_states[state]:
240
 
                logger.error(bad_states[state])
241
 
            self.remove()
 
241
            if bad_states[state] is not None:
 
242
                if error is None:
 
243
                    logger.error(bad_states[state])
 
244
                else:
 
245
                    logger.error(bad_states[state] + ": %r", error)
 
246
            self.cleanup()
242
247
        elif state == avahi.SERVER_RUNNING:
243
248
            self.add()
244
249
        else:
245
 
            logger.debug("Unknown state: %r", state)
 
250
            if error is None:
 
251
                logger.debug("Unknown state: %r", state)
 
252
            else:
 
253
                logger.debug("Unknown state: %r: %r", state, error)
246
254
    def activate(self):
247
255
        """Derived from the Avahi example code"""
248
256
        if self.server is None:
1260
1268
                
1261
1269
                while True:
1262
1270
                    if not client.enabled:
1263
 
                        logger.warning("Client %s is disabled",
 
1271
                        logger.info("Client %s is disabled",
1264
1272
                                       client.name)
1265
1273
                        if self.server.use_dbus:
1266
1274
                            # Emit D-Bus signal
1561
1569
                    client = c
1562
1570
                    break
1563
1571
            else:
1564
 
                logger.warning("Client not found for fingerprint: %s, ad"
1565
 
                               "dress: %s", fpr, address)
 
1572
                logger.info("Client not found for fingerprint: %s, ad"
 
1573
                            "dress: %s", fpr, address)
1566
1574
                if self.use_dbus:
1567
1575
                    # Emit D-Bus signal
1568
1576
                    mandos_dbus_service.ClientNotFound(fpr, address[0])