/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 plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2009-01-12 22:02:33 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090112220233-lawxo4uvyzb38u1f
* README (The Plugin System): Removed redundant text about options and
                              files for the plugins, this is now
                              documented in the manuals for the
                              plugins.

* plugins.d/mandos-client.c (main): Remove comment which was copied
                                    from another program by mistake.
                                    Use "sscanf" instead of "strtol"
                                    to parse numbers; this uses the
                                    correct type instead of casting.
                                    Don't report errors when removing
                                    temporary directory if directory
                                    is already gone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
463
463
      /* This is already done by parse_opt_config_file() */
464
464
      break;
465
465
    case 130:                   /* --userid */
466
 
      /* In the GNU C library, uid_t is always unsigned int */
467
 
      ret = sscanf(arg, "%u", &uid);
468
 
      if(ret != 1){
469
 
        fprintf(stderr, "Bad user ID number: \"%s\", using %u\n", arg,
470
 
                uid);
471
 
      }
 
466
      uid = (uid_t)strtol(arg, NULL, 10);
472
467
      break;
473
468
    case 131:                   /* --groupid */
474
 
      /* In the GNU C library, gid_t is always unsigned int */
475
 
      ret = sscanf(arg, "%u", &gid);
476
 
      if(ret != 1){
477
 
        fprintf(stderr, "Bad group ID number: \"%s\", using %u\n",
478
 
                arg, gid);
479
 
      }
 
469
      gid = (gid_t)strtol(arg, NULL, 10);
480
470
      break;
481
471
    case 132:                   /* --debug */
482
472
      debug = true;
483
473
      break;
484
 
/*
485
 
 * When adding more options before this line, remember to also add a
486
 
 * "case" to the "parse_opt_config_file" function below.
487
 
 */
488
474
    case ARGP_KEY_ARG:
489
475
      /* Cryptsetup always passes an argument, which is an empty
490
476
         string if "none" was specified in /etc/crypttab.  So if
539
525
                       .args_doc = "",
540
526
                       .doc = "Mandos plugin runner -- Run plugins" };
541
527
  
542
 
  /* Parse using parse_opt_config_file() in order to get the custom
 
528
  /* Parse using the parse_opt_config_file in order to get the custom
543
529
     config file location, if any. */
544
530
  ret = argp_parse (&argp, argc, argv, ARGP_IN_ORDER, 0, NULL);
545
531
  if (ret == ARGP_ERR_UNKNOWN){
968
954
                      (unsigned int) (proc->pid),
969
955
                      WTERMSIG(proc->status));
970
956
            } else if(WCOREDUMP(proc->status)){
971
 
              fprintf(stderr, "Plugin %u dumped core\n",
 
957
              fprintf(stderr, "Plugin %d dumped core\n",
972
958
                      (unsigned int) (proc->pid));
973
959
            }
974
960
          }