=== modified file 'plugin-runner.c' --- plugin-runner.c 2008-09-06 15:41:27 +0000 +++ plugin-runner.c 2008-09-07 01:44:44 +0000 @@ -394,14 +394,8 @@ if(arg == NULL){ break; } - { - char *envdef = strdup(arg); - if(envdef == NULL){ - break; - } - if(not add_environment(getplugin(NULL), envdef, true)){ - perror("add_environment"); - } + if(not add_environment(getplugin(NULL), arg, true)){ + perror("add_environment"); } break; case 'o': /* --options-for */ @@ -435,12 +429,8 @@ if(envdef == NULL){ break; } - char *p_name = strndup(arg, (size_t) (envdef-arg)); - if(p_name == NULL){ - break; - } - envdef++; - if(not add_environment(getplugin(p_name), envdef, true)){ + *envdef = '\0'; + if(not add_environment(getplugin(arg), envdef+1, true)){ perror("add_environment"); } } @@ -464,6 +454,7 @@ } break; case 128: /* --plugin-dir */ + free(plugindir); plugindir = strdup(arg); if(plugindir == NULL){ perror("strdup"); @@ -507,6 +498,7 @@ case 128: /* --plugin-dir */ break; case 129: /* --config-file */ + free(argfile); argfile = strdup(arg); if(argfile == NULL){ perror("strdup"); @@ -941,7 +933,7 @@ } /* OK, now either a process completed, or something can be read from one of them */ - for(plugin *proc = plugin_list; proc != NULL; proc = proc->next){ + for(plugin *proc = plugin_list; proc != NULL;){ /* Is this process completely done? */ if(proc->eof and proc->completed){ /* Only accept the plugin output if it exited cleanly */ @@ -974,7 +966,7 @@ exitstatus = EXIT_FAILURE; goto fallback; } - free_plugin(proc); + /* We are done modifying process list, so unblock signal */ ret = sigprocmask (SIG_UNBLOCK, &sigchld_action.sa_mask, NULL); @@ -987,6 +979,10 @@ if(plugin_list == NULL){ break; } + + plugin *next_plugin = proc->next; + free_plugin(proc); + proc = next_plugin; continue; } @@ -1004,6 +1000,7 @@ /* This process has not completed. Does it have any output? */ if(proc->eof or not FD_ISSET(proc->fd, &rfds)){ /* This process had nothing to say at this time */ + proc = proc->next; continue; } /* Before reading, make the process' data buffer large enough */ @@ -1022,6 +1019,7 @@ BUFFER_SIZE); if(ret < 0){ /* Read error from this process; ignore the error */ + proc = proc->next; continue; } if(ret == 0){ === modified file 'plugins.d/mandos-client.c' --- plugins.d/mandos-client.c 2008-09-06 16:31:49 +0000 +++ plugins.d/mandos-client.c 2008-09-07 01:44:44 +0000 @@ -315,7 +315,7 @@ /* Seek back to the beginning of the GPGME plaintext data buffer */ if (gpgme_data_seek(dh_plain, (off_t) 0, SEEK_SET) == -1){ - perror("pgpme_data_seek"); + perror("gpgme_data_seek"); plaintext_length = -1; goto decrypt_end; } @@ -451,6 +451,7 @@ gnutls_certificate_free_credentials(mc->cred); gnutls_global_deinit(); + gnutls_dh_params_deinit(mc->dh_params); return -1; } @@ -830,7 +831,7 @@ .dh_bits = 1024, .priority = "SECURE256" ":!CTYPE-X.509:+CTYPE-OPENPGP" }; bool gnutls_initalized = false; - bool pgpme_initalized = false; + bool gpgme_initalized = false; { struct argp_option options[] = { @@ -977,11 +978,11 @@ } if(not init_gpgme(&mc, pubkey, seckey, tempdir)){ - fprintf(stderr, "pgpme_initalized failed\n"); + fprintf(stderr, "gpgme_initalized failed\n"); exitcode = EXIT_FAILURE; goto end; } else { - pgpme_initalized = true; + gpgme_initalized = true; } if_index = (AvahiIfIndex) if_nametoindex(interface); @@ -1098,9 +1099,10 @@ if (gnutls_initalized){ gnutls_certificate_free_credentials(mc.cred); gnutls_global_deinit (); + gnutls_dh_params_deinit(mc.dh_params); } - if(pgpme_initalized){ + if(gpgme_initalized){ gpgme_release(mc.ctx); } @@ -1133,6 +1135,7 @@ free(fullname); } } + closedir(d); } ret = rmdir(tempdir); if(ret == -1){ === modified file 'plugins.d/password-prompt.c' --- plugins.d/password-prompt.c 2008-09-06 15:34:21 +0000 +++ plugins.d/password-prompt.c 2008-09-07 01:44:44 +0000 @@ -249,6 +249,8 @@ fprintf(stderr, "getline() returned 0, retrying.\n"); } } + + free(buffer); if (debug){ fprintf(stderr, "Restoring terminal attributes\n");