/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: 2019-04-08 21:53:22 UTC
  • Revision ID: teddy@recompile.se-20190408215322-y3hmfxzdgs9t84l1
plugin-runner: Fix minor memory leak

* plugin-runner.c (free_plugin): Even if argv[0] is NULL, as for the
                                 pseudo-plugin for global options,
                                 free all other arguments by simply
                                 starting at argv[1] and freeing
                                 plugin_node->name (which is always
                                 argv[0]) separately.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
if sys.version_info.major == 2:
116
116
    str = unicode
117
117
 
118
 
version = "1.8.5"
 
118
version = "1.8.3"
119
119
stored_state_file = "clients.pickle"
120
120
 
121
121
logger = logging.getLogger()
586
586
        def __init__(self, socket, credentials=None):
587
587
            self._c_object = gnutls.session_t()
588
588
            gnutls_flags = gnutls.CLIENT
589
 
            if gnutls.check_version(b"3.5.6"):
 
589
            if gnutls.check_version("3.5.6"):
590
590
                gnutls_flags |= gnutls.NO_TICKETS
591
591
            if gnutls.has_rawpk:
592
592
                gnutls_flags |= gnutls.ENABLE_RAWPK
794
794
                                                    ctypes.c_size_t)]
795
795
        openpgp_crt_get_fingerprint.restype = _error_code
796
796
 
797
 
    if check_version(b"3.6.4"):
 
797
    if check_version("3.6.4"):
798
798
        certificate_type_get2 = _library.gnutls_certificate_type_get2
799
799
        certificate_type_get2.argtypes = [session_t, ctypes.c_int]
800
800
        certificate_type_get2.restype = _error_code
821
821
    approved:   bool(); 'None' if not yet approved/disapproved
822
822
    approval_delay: datetime.timedelta(); Time to wait for approval
823
823
    approval_duration: datetime.timedelta(); Duration of one approval
824
 
    checker: multiprocessing.Process(); a running checker process used
825
 
             to see if the client lives. 'None' if no process is
826
 
             running.
 
824
    checker:    subprocess.Popen(); a running checker process used
 
825
                                    to see if the client lives.
 
826
                                    'None' if no process is running.
827
827
    checker_callback_tag: a GLib event source tag, or None
828
828
    checker_command: string; External command which is run to check
829
829
                     if client lives.  %() expansions are done at
1036
1036
    def checker_callback(self, source, condition, connection,
1037
1037
                         command):
1038
1038
        """The checker has completed, so take appropriate actions."""
 
1039
        self.checker_callback_tag = None
 
1040
        self.checker = None
1039
1041
        # Read return code from connection (see call_pipe)
1040
1042
        returncode = connection.recv()
1041
1043
        connection.close()
1042
 
        self.checker.join()
1043
 
        self.checker_callback_tag = None
1044
 
        self.checker = None
1045
1044
 
1046
1045
        if returncode >= 0:
1047
1046
            self.last_checker_status = returncode
2288
2287
            approval_required = False
2289
2288
            try:
2290
2289
                if gnutls.has_rawpk:
2291
 
                    fpr = b""
 
2290
                    fpr = ""
2292
2291
                    try:
2293
2292
                        key_id = self.key_id(
2294
2293
                            self.peer_certificate(session))
2298
2297
                    logger.debug("Key ID: %s", key_id)
2299
2298
 
2300
2299
                else:
2301
 
                    key_id = b""
 
2300
                    key_id = ""
2302
2301
                    try:
2303
2302
                        fpr = self.fingerprint(
2304
2303
                            self.peer_certificate(session))
2606
2605
                    raise
2607
2606
        # Only bind(2) the socket if we really need to.
2608
2607
        if self.server_address[0] or self.server_address[1]:
2609
 
            if self.server_address[1]:
2610
 
                self.allow_reuse_address = True
2611
2608
            if not self.server_address[0]:
2612
2609
                if self.address_family == socket.AF_INET6:
2613
2610
                    any_address = "::"  # in6addr_any
3245
3242
                        for k in ("name", "host"):
3246
3243
                            if isinstance(value[k], bytes):
3247
3244
                                value[k] = value[k].decode("utf-8")
3248
 
                        if "key_id" not in value:
 
3245
                        if not value.has_key("key_id"):
3249
3246
                            value["key_id"] = ""
3250
 
                        elif "fingerprint" not in value:
 
3247
                        elif not value.has_key("fingerprint"):
3251
3248
                            value["fingerprint"] = ""
3252
3249
                    #  old_client_settings
3253
3250
                    # .keys()