=== modified file 'README' --- README 2009-01-04 21:54:55 +0000 +++ README 2009-01-12 22:02:33 +0000 @@ -152,8 +152,6 @@ cryptsetup, this plugin listens to the same FIFO as askpass would do. - (None of these take any options or reads any files.) - More plugins could easily be written and added by the system administrator; see the section called "WRITING PLUGINS" in plugin-runner(8mandos) to learn the plugin requirements. === modified file 'TODO' --- TODO 2008-12-29 02:44:54 +0000 +++ TODO 2009-01-12 22:02:33 +0000 @@ -55,11 +55,14 @@ * [#A] Package ** /usr/share/initramfs-tools/hooks/mandos -*** TODO Do not install in initrd.img if configured not to. +*** TODO [#C] Do not install in initrd.img if configured not to. Use "/etc/initramfs-tools/conf.d/mandos"? Definitely a debconf question. -** TODO /etc/bash_completion.d/mandos +** TODO [#C] /etc/bash_completion.d/mandos From XML sources directly? +** TODO initramfs-tools-script :test: + Do not insert plugin-runner as keyscript if a kernel parameter + "mandos=off" is passed. #+STARTUP: showall === modified file 'plugins.d/mandos-client.c' --- plugins.d/mandos-client.c 2009-01-10 06:00:50 +0000 +++ plugins.d/mandos-client.c 2009-01-12 22:02:33 +0000 @@ -36,7 +36,7 @@ #define _GNU_SOURCE /* TEMP_FAILURE_RETRY(), asprintf() */ #include /* fprintf(), stderr, fwrite(), - stdout, ferror() */ + stdout, ferror(), sscanf */ #include /* uint16_t, uint32_t */ #include /* NULL, size_t, ssize_t */ #include /* free(), EXIT_SUCCESS, EXIT_FAILURE, @@ -55,7 +55,7 @@ connect() */ #include /* open() */ #include /* opendir(), struct dirent, readdir() */ -#include /* PRIu16 */ +#include /* PRIu16, SCNu16 */ #include /* assert() */ #include /* perror(), errno */ #include /* time() */ @@ -67,7 +67,7 @@ getuid(), getgid(), setuid(), setgid() */ #include /* inet_pton(), htons */ -#include /* not, and */ +#include /* not, and, or */ #include /* struct argp_option, error_t, struct argp_state, struct argp, argp_parse(), ARGP_KEY_ARG, @@ -866,8 +866,6 @@ error_t parse_opt (int key, char *arg, struct argp_state *state) { - /* Get the INPUT argument from `argp_parse', which we know is - a pointer to our plugin list pointer. */ switch (key) { case 128: /* --debug */ debug = true; @@ -885,10 +883,9 @@ pubkey = arg; break; case 129: /* --dh-bits */ - errno = 0; - mc.dh_bits = (unsigned int) strtol(arg, NULL, 10); - if (errno){ - perror("strtol"); + ret = sscanf(arg, "%u", &mc.dh_bits); + if(ret == 0 or mc.dh_bits == 0){ + fprintf(stderr, "Bad number of DH bits\n"); exit(EXIT_FAILURE); } break; @@ -998,10 +995,10 @@ exitcode = EXIT_FAILURE; goto end; } - errno = 0; - uint16_t port = (uint16_t) strtol(address+1, NULL, 10); - if(errno){ - perror("Bad port number"); + uint16_t port; + ret = sscanf(address+1, "%" SCNu16, &port); + if(ret == 0 or port == 0){ + fprintf(stderr, "Bad port number\n"); exitcode = EXIT_FAILURE; goto end; } @@ -1110,7 +1107,9 @@ struct dirent *direntry; d = opendir(tempdir); if(d == NULL){ - perror("opendir"); + if(errno != ENOENT){ + perror("opendir"); + } } else { while(true){ direntry = readdir(d); @@ -1136,7 +1135,7 @@ closedir(d); } ret = rmdir(tempdir); - if(ret == -1){ + if(ret == -1 and errno != ENOENT){ perror("rmdir"); } }