The OpenBSD strtonum() uses very short error strings that can't

be translated usefully.  Convert them to longer strings on error.
Also use the longer strings for atomode() and atoid().
This commit is contained in:
Todd C. Miller
2013-12-11 13:43:10 -07:00
parent d83bfb9fe6
commit cbf41b8b96
12 changed files with 94 additions and 27 deletions

View File

@@ -178,7 +178,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
char *cp, **env_add, **settings;
const char *runas_user = NULL;
const char *runas_group = NULL;
const char *debug_flags, *errstr;
const char *debug_flags;
int nenv = 0;
int env_size = 32;
debug_decl(parse_args, SUDO_DEBUG_ARGS)
@@ -242,9 +242,8 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
SET(flags, MODE_BACKGROUND);
break;
case 'C':
strtonum(optarg, 4, INT_MAX, &errstr);
if (errstr != NULL) {
warningx(U_("the argument to -C was %s"), U_(errstr));
if (strtonum(optarg, 3, INT_MAX, NULL) == 0) {
warningx(_("the argument to -C must be a number greater than or equal to 3"));
usage(1);
}
sudo_settings[ARG_CLOSEFROM].value = optarg;