=== modified file 'plugin-runner.c' --- plugin-runner.c 2009-01-06 22:49:50 +0000 +++ plugin-runner.c 2009-01-13 01:36:46 +0000 @@ -463,14 +463,28 @@ /* This is already done by parse_opt_config_file() */ break; case 130: /* --userid */ - uid = (uid_t)strtol(arg, NULL, 10); + /* In the GNU C library, uid_t is always unsigned int */ + ret = sscanf(arg, "%ud", &uid); + if(ret != 1){ + fprintf(stderr, "Bad user ID number: \"%s\", using %ud\n", + arg, uid); + } break; case 131: /* --groupid */ - gid = (gid_t)strtol(arg, NULL, 10); + /* In the GNU C library, gid_t is always unsigned int */ + ret = sscanf(arg, "%ud", &gid); + if(ret != 1){ + fprintf(stderr, "Bad group ID number: \"%s\", using %ud\n", + arg, gid); + } break; case 132: /* --debug */ debug = true; break; +/* + * When adding more options before this line, remember to also add a + * "case" to the "parse_opt_config_file" function below. + */ case ARGP_KEY_ARG: /* Cryptsetup always passes an argument, which is an empty string if "none" was specified in /etc/crypttab. So if === modified file 'plugins.d/mandos-client.c' --- plugins.d/mandos-client.c 2009-01-12 22:02:33 +0000 +++ plugins.d/mandos-client.c 2009-01-13 01:36:46 +0000 @@ -884,7 +884,7 @@ break; case 129: /* --dh-bits */ ret = sscanf(arg, "%u", &mc.dh_bits); - if(ret == 0 or mc.dh_bits == 0){ + if(ret != 1){ fprintf(stderr, "Bad number of DH bits\n"); exit(EXIT_FAILURE); } @@ -997,7 +997,7 @@ } uint16_t port; ret = sscanf(address+1, "%" SCNu16, &port); - if(ret == 0 or port == 0){ + if(ret != 1){ fprintf(stderr, "Bad port number\n"); exitcode = EXIT_FAILURE; goto end; === modified file 'plugins.d/splashy.c' --- plugins.d/splashy.c 2009-01-10 06:23:04 +0000 +++ plugins.d/splashy.c 2009-01-13 01:36:46 +0000 @@ -30,8 +30,8 @@ SIG_IGN, kill(), SIGKILL */ #include /* NULL */ #include /* getenv() */ -#include /* asprintf(), perror() */ -#include /* EXIT_FAILURE, free(), strtoul(), +#include /* asprintf(), perror(), sscanf() */ +#include /* EXIT_FAILURE, free(), EXIT_SUCCESS */ #include /* pid_t, DIR, struct dirent, ssize_t */ @@ -97,8 +97,10 @@ for(struct dirent *proc_ent = readdir(proc_dir); proc_ent != NULL; proc_ent = readdir(proc_dir)){ - pid_t pid = (pid_t) strtoul(proc_ent->d_name, NULL, 10); - if(pid == 0){ + pid_t pid; + /* In the GNU C library, pid_t is always int */ + ret = sscanf(proc_ent->d_name, "%d", &pid); + if(ret != 1){ /* Not a process */ continue; } === modified file 'plugins.d/usplash.c' --- plugins.d/usplash.c 2009-01-10 06:23:04 +0000 +++ plugins.d/usplash.c 2009-01-13 01:36:46 +0000 @@ -36,15 +36,14 @@ dirent */ #include /* NULL */ #include /* strlen(), memcmp() */ -#include /* asprintf(), perror() */ +#include /* asprintf(), perror(), sscanf() */ #include /* close(), write(), readlink(), read(), STDOUT_FILENO, sleep(), fork(), setuid(), geteuid(), setsid(), chdir(), dup2(), STDERR_FILENO, execv() */ -#include /* free(), EXIT_FAILURE, strtoul(), - realloc(), EXIT_SUCCESS, malloc(), - _exit() */ +#include /* free(), EXIT_FAILURE, realloc(), + EXIT_SUCCESS, malloc(), _exit() */ #include /* getenv() */ #include /* opendir(), readdir(), closedir() */ #include /* struct stat, lstat(), S_ISLNK */ @@ -170,8 +169,10 @@ for(struct dirent *proc_ent = readdir(proc_dir); proc_ent != NULL; proc_ent = readdir(proc_dir)){ - pid_t pid = (pid_t) strtoul(proc_ent->d_name, NULL, 10); - if(pid == 0){ + pid_t pid; + /* In the GNU C library, pid_t is always int */ + ret = sscanf(proc_ent->d_name, "%d", &pid); + if(ret != 1){ /* Not a process */ continue; }