/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-09-01 16:19:32 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080901161932-ostp7tulh9aijulh
* plugin-runner.c (add_environment): Never insert existing environment
                                     variables.
  (main): Rename "--global-envs" to "--global-env" and "--envs-for" to
          "--env-for".

* plugin-runner.xml (SYNOPSIS): Rename "--global-envs" to
                                "--global-env" and "--envs-for" to
                                "--env-for".
  (OPTIONS): Added "--global-env" and "--env-for".
  (FALLBACK): Add id attribute.
  (EXIT STATUS): Add text.
  (ENVIRONMENT): New section.
  (FILES): Document configuration file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
  }
133
133
  new_plugin->argv[0] = copy_name;
134
134
  new_plugin->argv[1] = NULL;
135
 
 
 
135
  
136
136
  new_plugin->environ = malloc(sizeof(char *));
137
137
  if(new_plugin->environ == NULL){
138
138
    free(copy_name);
141
141
    return NULL;
142
142
  }
143
143
  new_plugin->environ[0] = NULL;
144
 
 
 
144
  
145
145
  /* Append the new plugin to the list */
146
146
  plugin_list = new_plugin;
147
147
  return new_plugin;
183
183
  if(p == NULL){
184
184
    return false;
185
185
  }
 
186
  /* namelen = length of name of environment variable */
 
187
  size_t namelen = (size_t)(strchrnul(def, '=') - def);
 
188
  /* Search for this environment variable */
 
189
  for(char **e = p->environ; *e != NULL; e++){
 
190
    if(strncmp(*e, def, namelen+1) == 0){
 
191
      /* Refuse to add an existing variable */
 
192
      return true;
 
193
    }
 
194
  }
186
195
  return add_to_char_array(def, &(p->environ), &(p->envc));
187
196
}
188
197
 
327
336
    { .name = "global-options", .key = 'g',
328
337
      .arg = "OPTION[,OPTION[,...]]",
329
338
      .doc = "Options passed to all plugins" },
330
 
    { .name = "global-envs", .key = 'e',
 
339
    { .name = "global-env", .key = 'e',
331
340
      .arg = "VAR=value",
332
341
      .doc = "Environment variable passed to all plugins" },
333
342
    { .name = "options-for", .key = 'o',
334
343
      .arg = "PLUGIN:OPTION[,OPTION[,...]]",
335
344
      .doc = "Options passed only to specified plugin" },
336
 
    { .name = "envs-for", .key = 'f',
 
345
    { .name = "env-for", .key = 'f',
337
346
      .arg = "PLUGIN:ENV=value",
338
347
      .doc = "Environment variable passed to specified plugin" },
339
348
    { .name = "disable", .key = 'd',
375
384
        }
376
385
      }
377
386
      break;
378
 
    case 'e':                   /* --global-envs */
 
387
    case 'e':                   /* --global-env */
379
388
      if(arg == NULL){
380
389
        break;
381
390
      }
413
422
        }
414
423
      }
415
424
      break;
416
 
    case 'f':                   /* --envs-for */
 
425
    case 'f':                   /* --env-for */
417
426
      if(arg == NULL){
418
427
        break;
419
428
      }