/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 plugins.d/password-request.c

  • Committer: Teddy Hogeborn
  • Date: 2008-08-16 03:29:08 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080816032908-ihw7c05r2mnyk389
Add feature to specify custom environment variables for plugins.

* plugin-runner.c (plugin): New members "environ" and "envc" to
                            contain possible custom environment.
  (getplugin): Return NULL on failure instead of doing exit(); all
               callers changed.
  (add_to_char_array): New helper function for "add_argument" and
                       "add_environment".
  (addargument): Renamed to "add_argument".  Return bool.  Call
                 "add_to_char_array" to actually do things.
  (add_environment): New; analogous to "add_argument".
  (addcustomargument): Renamed to "add_to_argv" to avoid confusion
                       with "add_argument".
  (main): New options "--global-envs" and "--envs-for" to specify
          custom environment for plugins.  Print environment for
          plugins in debug mode.  Use asprintf instead of strcpy and
          strcat.  Use execve() for plugins with custom environments.
          Free environment for plugin when freeing plugin list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
302
302
}
303
303
 
304
304
static const char * safer_gnutls_strerror (int value) {
305
 
  const char *ret = gnutls_strerror (value); /* Spurious warning */
 
305
  const char *ret = gnutls_strerror (value);
306
306
  if (ret == NULL)
307
307
    ret = "(unknown)";
308
308
  return ret;
341
341
  /* OpenPGP credentials */
342
342
  gnutls_certificate_allocate_credentials(&mc->cred);
343
343
  if (ret != GNUTLS_E_SUCCESS){
344
 
    fprintf (stderr, "GnuTLS memory error: %s\n", /* Spurious
345
 
                                                     warning */
 
344
    fprintf (stderr, "GnuTLS memory error: %s\n",
346
345
             safer_gnutls_strerror(ret));
347
346
    gnutls_global_deinit ();
348
347
    return -1;
476
475
    fprintf(stderr, "Binding to interface %s\n", interface);
477
476
  }
478
477
  
479
 
  memset(&to, 0, sizeof(to));
 
478
  memset(&to, 0, sizeof(to));   /* Spurious warning */
480
479
  to.in6.sin6_family = AF_INET6;
481
480
  /* It would be nice to have a way to detect if we were passed an
482
481
     IPv4 address here.   Now we assume an IPv6 address. */
662
661
                             flags,
663
662
                             void* userdata) {
664
663
  mandos_context *mc = userdata;
665
 
  assert(r);
 
664
  assert(r);                    /* Spurious warning */
666
665
  
667
666
  /* Called whenever a service has been resolved successfully or
668
667
     timed out */
704
703
                             flags,
705
704
                             void* userdata) {
706
705
  mandos_context *mc = userdata;
707
 
  assert(b);
 
706
  assert(b);                    /* Spurious warning */
708
707
  
709
708
  /* Called whenever a new services becomes available on the LAN or
710
709
     is removed from the LAN */
898
897
        exitcode = EXIT_FAILURE;
899
898
        goto end;
900
899
      }
901
 
      strcpy(network.ifr_name, interface);
 
900
      strcpy(network.ifr_name, interface); /* Spurious warning */
902
901
      ret = ioctl(sd, SIOCGIFFLAGS, &network);
903
902
      if(ret == -1){
904
903
        perror("ioctl SIOCGIFFLAGS");