/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2008-08-24 10:49:09 UTC
  • mfrom: (24.1.63 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20080824104909-loh761dpgglkvos1
* mandos (fingerprint): Bug fix: Check crtverify.value, not crtverify.

* mandos-keygen (password): Also print "host = ".

* plugins.d/password-request.c (pgp_packet_decrypt): Only print
                                                     detailed result
                                                     of decryption if
                                                     it failed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
  if (new_plugin == NULL){
106
106
    return NULL;
107
107
  }
108
 
  char *copy_name = strdup(name);
109
 
  if(copy_name == NULL){
110
 
    return NULL;
 
108
  char *copy_name = NULL;
 
109
  if(name != NULL){
 
110
    copy_name = strdup(name);
 
111
    if(copy_name == NULL){
 
112
      return NULL;
 
113
    }
111
114
  }
112
115
  
113
116
  *new_plugin = (plugin) { .name = copy_name,
118
121
  
119
122
  new_plugin->argv = malloc(sizeof(char *) * 2);
120
123
  if (new_plugin->argv == NULL){
 
124
    free(copy_name);
121
125
    free(new_plugin);
122
126
    return NULL;
123
127
  }
126
130
 
127
131
  new_plugin->environ = malloc(sizeof(char *));
128
132
  if(new_plugin->environ == NULL){
 
133
    free(copy_name);
129
134
    free(new_plugin->argv);
130
135
    free(new_plugin);
131
136
    return NULL;
247
252
    return NULL;
248
253
  }
249
254
  argv[*argc-1] = arg;
250
 
  argv[*argc] = NULL;   
 
255
  argv[*argc] = NULL;
251
256
  return argv;
252
257
}
253
258
 
254
259
static void free_plugin_list(plugin *plugin_list){
255
 
  for(plugin *next = plugin_list; plugin_list != NULL; plugin_list = next){
 
260
  for(plugin *next; plugin_list != NULL; plugin_list = next){
256
261
    next = plugin_list->next;
257
 
    free(plugin_list->name);
258
262
    for(char **arg = plugin_list->argv; *arg != NULL; arg++){
259
263
      free(*arg);
260
 
    }    
 
264
    }
261
265
    free(plugin_list->argv);
262
266
    for(char **env = plugin_list->environ; *env != NULL; env++){
263
267
      free(*env);
264
268
    }
265
269
    free(plugin_list->environ);
266
270
    free(plugin_list);
267
 
  }  
 
271
  }
268
272
}
269
273
 
270
274
int main(int argc, char *argv[]){
298
302
  ret = sigaction(SIGCHLD, &sigchld_action, &old_sigchld_action);
299
303
  if(ret == -1){
300
304
    perror("sigaction");
301
 
    exitstatus = EXIT_FAILURE;    
 
305
    exitstatus = EXIT_FAILURE;
302
306
    goto fallback;
303
307
  }
304
308
  
680
684
      }
681
685
    }
682
686
    
683
 
    int pipefd[2]; 
 
687
    int pipefd[2];
684
688
    ret = pipe(pipefd);
685
689
    if (ret == -1){
686
690
      perror("pipe");
787
791
  }
788
792
  
789
793
  free_plugin_list(plugin_list);
 
794
  plugin_list = NULL;
790
795
  
791
796
  closedir(dir);
792
797
  dir = NULL;