/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-23 23:17:42 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090123231742-joje60549e3qagy0
* mandos (peer_certificate): Handle NULL pointer from
                             "gnutls_certificate_get_peers" slightly
                             better.
  (TCP_handler.handle): Added some extra debug output.

  (MandosServer.GetAllClients,
  MandosServer.GetAllClientsWithProperties,
  MandosServer.RemoveClient): Added doc string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
595
595
        != gnutls.library.constants.GNUTLS_CRT_OPENPGP):
596
596
        # ...do the normal thing
597
597
        return session.peer_certificate
598
 
    list_size = ctypes.c_uint()
 
598
    list_size = ctypes.c_uint(1)
599
599
    cert_list = (gnutls.library.functions
600
600
                 .gnutls_certificate_get_peers
601
601
                 (session._c_object, ctypes.byref(list_size)))
 
602
    if not bool(cert_list) and list_size.value != 0:
 
603
        raise gnutls.errors.GNUTLSError("error getting peer"
 
604
                                        " certificate")
602
605
    if list_size.value == 0:
603
606
        return None
604
607
    cert = cert_list[0]
688
691
            # Do not run session.bye() here: the session is not
689
692
            # established.  Just abandon the request.
690
693
            return
 
694
        logger.debug(u"Handshake succeeded")
691
695
        try:
692
696
            fpr = fingerprint(peer_certificate(session))
693
697
        except (TypeError, gnutls.errors.GNUTLSError), error:
1113
1117
            
1114
1118
            @dbus.service.method(_interface, out_signature="ao")
1115
1119
            def GetAllClients(self):
 
1120
                "D-Bus method"
1116
1121
                return dbus.Array(c.dbus_object_path for c in clients)
1117
1122
            
1118
1123
            @dbus.service.method(_interface, out_signature="a{oa{sv}}")
1119
1124
            def GetAllClientsWithProperties(self):
 
1125
                "D-Bus method"
1120
1126
                return dbus.Dictionary(
1121
1127
                    ((c.dbus_object_path, c.GetAllProperties())
1122
1128
                     for c in clients),
1124
1130
            
1125
1131
            @dbus.service.method(_interface, in_signature="o")
1126
1132
            def RemoveClient(self, object_path):
 
1133
                "D-Bus method"
1127
1134
                for c in clients:
1128
1135
                    if c.dbus_object_path == object_path:
1129
1136
                        clients.remove(c)