/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: Björn Påhlsson
  • Date: 2011-06-23 22:27:15 UTC
  • mto: This revision was merged to the branch mainline in revision 485.
  • Revision ID: belorn@fukt.bsnet.se-20110623222715-q5wro9ma9iyjl367
* Makefile (CFLAGS): Added "-lrt" to include real time library.
* plugins.d/mandos-client.c: use scandir(3) instead of readdir(3)
                             Prefix all debug output with "Mandos plugin " + program_invocation_short_name
                             Retry servers that failed to provide password.
                             New option --retry SECONDS that sets the interval between rechecking.
                             --retry also controls how often it retries a server when using --connect.
* plugins.d/splashy.c:  Prefix all debug output with "Mandos plugin " + program_invocation_short_name
* plugins.d/usplash.c: --||--
* plugins.d/askpass-fifo.c: --||--
* plugins.d/password-prompt.c: --||--
* plugins.d/plymouth.c: --||--
* mandos: Lower logger level from warning to info on failed client requests because client was disabled or unknown fingerprint.
* plugins.d/plymouth.c (get_pid): bug fix. Was not calling free on direntries. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
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])