diff --git a/include/sudo_util.h b/include/sudo_util.h index 551bd8f3c..9fc832f37 100644 --- a/include/sudo_util.h +++ b/include/sudo_util.h @@ -252,7 +252,10 @@ __dso_public long long sudo_strtonum(const char *, long long, long long, const c /* strtoid.c */ __dso_public id_t sudo_strtoid_v1(const char *str, const char *sep, char **endp, const char **errstr); -#define sudo_strtoid(_a, _b, _c, _d) sudo_strtoid_v1((_a), (_b), (_c), (_d)) +__dso_public id_t sudo_strtoid_v2(const char *str, const char **errstr); +#define sudo_strtoid(_a, _b) sudo_strtoid_v2((_a), (_b)) +__dso_public id_t sudo_strtoidx_v1(const char *str, const char *sep, char **endp, const char **errstr); +#define sudo_strtoidx(_a, _b, _c, _d) sudo_strtoidx_v1((_a), (_b), (_c), (_d)) /* strtomode.c */ __dso_public int sudo_strtomode_v1(const char *cp, const char **errstr); diff --git a/lib/util/getgrouplist.c b/lib/util/getgrouplist.c index 91d398e2f..bd53eeefc 100644 --- a/lib/util/getgrouplist.c +++ b/lib/util/getgrouplist.c @@ -165,7 +165,7 @@ sudo_getgrouplist2_v1(const char *name, GETGROUPS_T basegid, groups[0] = basegid; for (cp = strtok_r(grset, ",", &last); cp != NULL; cp = strtok_r(NULL, ",", &last)) { - gid = sudo_strtoid(cp, NULL, NULL, &errstr); + gid = sudo_strtoid(cp, &errstr); if (errstr == NULL && gid != basegid) { if (ngroups == grpsize) goto done; @@ -251,7 +251,7 @@ str2grp(const char *instr, int inlen, void *ent, char *buf, int buflen) if ((fieldsep = strchr(cp = fieldsep, ':')) == NULL) return yp ? NSS_STR_PARSE_SUCCESS : NSS_STR_PARSE_PARSE; *fieldsep++ = '\0'; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) { /* * A range error is always a fatal error, but ignore garbage diff --git a/lib/util/gidlist.c b/lib/util/gidlist.c index 85a6b8915..8d08abd02 100644 --- a/lib/util/gidlist.c +++ b/lib/util/gidlist.c @@ -76,7 +76,7 @@ sudo_parse_gids_v1(const char *gidstr, const gid_t *basegid, GETGROUPS_T **gidsp gids[ngids++] = *basegid; cp = gidstr; do { - gids[ngids] = (GETGROUPS_T) sudo_strtoid(cp, ",", &ep, &errstr); + gids[ngids] = (GETGROUPS_T) sudo_strtoidx(cp, ",", &ep, &errstr); if (errstr != NULL) { sudo_warnx(U_("%s: %s"), cp, U_(errstr)); free(gids); diff --git a/lib/util/regress/strtofoo/strtoid_test.c b/lib/util/regress/strtofoo/strtoid_test.c index 4502ca100..c97f98c1c 100644 --- a/lib/util/regress/strtofoo/strtoid_test.c +++ b/lib/util/regress/strtofoo/strtoid_test.c @@ -29,14 +29,14 @@ __dso_public int main(int argc, char *argv[]); -/* sudo_strtoid() tests */ -static struct strtoid_data { +/* sudo_strtoidx() tests */ +static struct strtoidx_data { const char *idstr; id_t id; const char *sep; const char *ep; int errnum; -} strtoid_data[] = { +} strtoidx_data[] = { { "0,1", 0, ",", ",", 0 }, { "10", 10, NULL, NULL, 0 }, { "-1", 0, NULL, NULL, EINVAL }, @@ -52,12 +52,12 @@ static struct strtoid_data { }; /* - * Simple tests for sudo_strtoid() + * Simple tests for sudo_strtoidx() */ int main(int argc, char *argv[]) { - struct strtoid_data *d; + struct strtoidx_data *d; const char *errstr; char *ep; int errors = 0; @@ -66,10 +66,10 @@ main(int argc, char *argv[]) initprogname(argc > 0 ? argv[0] : "strtoid_test"); - for (d = strtoid_data; d->idstr != NULL; d++) { + for (d = strtoidx_data; d->idstr != NULL; d++) { ntests++; errstr = "some error"; - value = sudo_strtoid(d->idstr, d->sep, &ep, &errstr); + value = sudo_strtoidx(d->idstr, d->sep, &ep, &errstr); if (d->errnum != 0) { if (errstr == NULL) { sudo_warnx_nodebug("FAIL: %s: missing errstr for errno %d", diff --git a/lib/util/strtoid.c b/lib/util/strtoid.c index cefc021d9..1312aa6a4 100644 --- a/lib/util/strtoid.c +++ b/lib/util/strtoid.c @@ -79,7 +79,7 @@ valid_separator(const char *p, const char *ep, const char *sep) * On error, returns 0 and sets errstr. */ id_t -sudo_strtoid_v1(const char *p, const char *sep, char **endp, const char **errstrp) +sudo_strtoidx_v1(const char *p, const char *sep, char **endp, const char **errstrp) { const char *errstr; char *ep; @@ -104,3 +104,17 @@ sudo_strtoid_v1(const char *p, const char *sep, char **endp, const char **errstr *endp = ep; debug_return_id_t(ret); } + +/* Backwards compatibility */ +id_t +sudo_strtoid_v1(const char *p, const char *sep, char **endp, const char **errstrp) +{ + return sudo_strtoidx_v1(p, sep, endp, errstrp); +} + +/* Simplified interface */ +id_t +sudo_strtoid_v2(const char *p, const char **errstrp) +{ + return sudo_strtoidx_v1(p, NULL, NULL, errstrp); +} diff --git a/lib/util/util.exp.in b/lib/util/util.exp.in index 1f74b4f3f..6dd3095d8 100644 --- a/lib/util/util.exp.in +++ b/lib/util/util.exp.in @@ -98,6 +98,8 @@ sudo_setgroups_v1 sudo_strsplit_v1 sudo_strtobool_v1 sudo_strtoid_v1 +sudo_strtoid_v2 +sudo_strtoidx_v1 sudo_strtomode_v1 sudo_strtonum sudo_term_cbreak_v1 diff --git a/plugins/group_file/getgrent.c b/plugins/group_file/getgrent.c index 7932fb874..59bf3adff 100644 --- a/plugins/group_file/getgrent.c +++ b/plugins/group_file/getgrent.c @@ -116,7 +116,7 @@ next_entry: if ((colon = strchr(cp = colon, ':')) == NULL) goto next_entry; *colon++ = '\0'; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) goto next_entry; gr.gr_gid = (gid_t)id; diff --git a/plugins/sudoers/cvtsudoers.c b/plugins/sudoers/cvtsudoers.c index b4321359f..fe4fc3805 100644 --- a/plugins/sudoers/cvtsudoers.c +++ b/plugins/sudoers/cvtsudoers.c @@ -707,7 +707,7 @@ userlist_matches_filter(struct sudoers_parse_tree *parse_tree, if (s->str[0] == '#') { const char *errstr; - uid_t uid = sudo_strtoid(s->str + 1, NULL, NULL, &errstr); + uid_t uid = sudo_strtoid(s->str + 1, &errstr); if (errstr == NULL) pw = sudo_getpwuid(uid); } diff --git a/plugins/sudoers/cvtsudoers_json.c b/plugins/sudoers/cvtsudoers_json.c index ecc5a9dc9..ad70738e2 100644 --- a/plugins/sudoers/cvtsudoers_json.c +++ b/plugins/sudoers/cvtsudoers_json.c @@ -372,7 +372,7 @@ print_member_json_int(FILE *fp, struct sudoers_parse_tree *parse_tree, value.u.string++; typestr = "nonunixgroup"; if (*value.u.string == '#') { - id = sudo_strtoid(value.u.string + 1, NULL, NULL, &errstr); + id = sudo_strtoid(value.u.string + 1, &errstr); if (errstr != NULL) { sudo_warnx("internal error: non-Unix group ID %s: \"%s\"", errstr, value.u.string + 1); @@ -385,7 +385,7 @@ print_member_json_int(FILE *fp, struct sudoers_parse_tree *parse_tree, } else { typestr = "usergroup"; if (*value.u.string == '#') { - id = sudo_strtoid(value.u.string + 1, NULL, NULL, &errstr); + id = sudo_strtoid(value.u.string + 1, &errstr); if (errstr != NULL) { sudo_warnx("internal error: group ID %s: \"%s\"", errstr, value.u.string + 1); @@ -424,7 +424,7 @@ print_member_json_int(FILE *fp, struct sudoers_parse_tree *parse_tree, case TYPE_USERNAME: typestr = "username"; if (*value.u.string == '#') { - id = sudo_strtoid(value.u.string + 1, NULL, NULL, &errstr); + id = sudo_strtoid(value.u.string + 1, &errstr); if (errstr != NULL) { sudo_warnx("internal error: user ID %s: \"%s\"", errstr, name); diff --git a/plugins/sudoers/cvtsudoers_pwutil.c b/plugins/sudoers/cvtsudoers_pwutil.c index a8d97732d..459ee6e09 100644 --- a/plugins/sudoers/cvtsudoers_pwutil.c +++ b/plugins/sudoers/cvtsudoers_pwutil.c @@ -106,7 +106,7 @@ cvtsudoers_make_pwitem(uid_t uid, const char *name) if (s->str[0] != '#') continue; - filter_uid = sudo_strtoid(s->str + 1, NULL, NULL, &errstr); + filter_uid = sudo_strtoid(s->str + 1, &errstr); if (errstr == NULL) { if (uid != filter_uid) continue; @@ -213,7 +213,7 @@ cvtsudoers_make_gritem(gid_t gid, const char *name) if (s->str[0] != '#') continue; - filter_gid = sudo_strtoid(s->str + 1, NULL, NULL, &errstr); + filter_gid = sudo_strtoid(s->str + 1, &errstr); if (errstr == NULL) { if (gid != filter_gid) continue; @@ -335,7 +335,7 @@ cvtsudoers_make_gidlist_item(const struct passwd *pw, char * const *unused1, STAILQ_FOREACH(s, &filters->groups, entries) { if (s->str[0] == '#') { const char *errstr; - gid_t gid = sudo_strtoid(s->str + 1, NULL, NULL, &errstr); + gid_t gid = sudo_strtoid(s->str + 1, &errstr); if (errstr == NULL) { /* Valid gid. */ gids[ngids++] = gid; @@ -462,7 +462,7 @@ again: STAILQ_FOREACH(s, &filters->groups, entries) { if (s->str[0] == '#') { const char *errstr; - sudo_strtoid(s->str + 1, NULL, NULL, &errstr); + sudo_strtoid(s->str + 1, &errstr); if (errstr == NULL) { /* Group ID not name, ignore it. */ continue; diff --git a/plugins/sudoers/iolog.c b/plugins/sudoers/iolog.c index 5770e48e9..8422631fd 100644 --- a/plugins/sudoers/iolog.c +++ b/plugins/sudoers/iolog.c @@ -742,7 +742,7 @@ iolog_deserialize_info(struct iolog_details *details, char * const user_info[], if (runas_euid_str != NULL) runas_uid_str = runas_euid_str; if (runas_uid_str != NULL) { - id = sudo_strtoid(runas_uid_str, NULL, NULL, &errstr); + id = sudo_strtoid(runas_uid_str, &errstr); if (errstr != NULL) sudo_warnx("runas uid %s: %s", runas_uid_str, U_(errstr)); else @@ -751,7 +751,7 @@ iolog_deserialize_info(struct iolog_details *details, char * const user_info[], if (runas_egid_str != NULL) runas_gid_str = runas_egid_str; if (runas_gid_str != NULL) { - id = sudo_strtoid(runas_gid_str, NULL, NULL, &errstr); + id = sudo_strtoid(runas_gid_str, &errstr); if (errstr != NULL) sudo_warnx("runas gid %s: %s", runas_gid_str, U_(errstr)); else diff --git a/plugins/sudoers/match.c b/plugins/sudoers/match.c index 165a8f758..20f908201 100644 --- a/plugins/sudoers/match.c +++ b/plugins/sudoers/match.c @@ -453,7 +453,7 @@ userpw_matches(const char *sudoers_user, const char *user, const struct passwd * debug_decl(userpw_matches, SUDOERS_DEBUG_MATCH) if (pw != NULL && *sudoers_user == '#') { - uid = (uid_t) sudo_strtoid(sudoers_user + 1, NULL, NULL, &errstr); + uid = (uid_t) sudo_strtoid(sudoers_user + 1, &errstr); if (errstr == NULL && uid == pw->pw_uid) { rc = true; goto done; @@ -483,7 +483,7 @@ group_matches(const char *sudoers_group, const struct group *gr) debug_decl(group_matches, SUDOERS_DEBUG_MATCH) if (*sudoers_group == '#') { - gid = (gid_t) sudo_strtoid(sudoers_group + 1, NULL, NULL, &errstr); + gid = (gid_t) sudo_strtoid(sudoers_group + 1, &errstr); if (errstr == NULL && gid == gr->gr_gid) { rc = true; goto done; diff --git a/plugins/sudoers/policy.c b/plugins/sudoers/policy.c index d894426ac..c920e37e0 100644 --- a/plugins/sudoers/policy.c +++ b/plugins/sudoers/policy.c @@ -129,7 +129,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) } if (MATCHES(*cur, "sudoers_uid=")) { p = *cur + sizeof("sudoers_uid=") - 1; - sudoers_uid = (uid_t) sudo_strtoid(p, NULL, NULL, &errstr); + sudoers_uid = (uid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_("%s: %s"), *cur, U_(errstr)); goto bad; @@ -138,7 +138,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) } if (MATCHES(*cur, "sudoers_gid=")) { p = *cur + sizeof("sudoers_gid=") - 1; - sudoers_gid = (gid_t) sudo_strtoid(p, NULL, NULL, &errstr); + sudoers_gid = (gid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_("%s: %s"), *cur, U_(errstr)); goto bad; @@ -343,7 +343,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) } if (MATCHES(*cur, "uid=")) { p = *cur + sizeof("uid=") - 1; - user_uid = (uid_t) sudo_strtoid(p, NULL, NULL, &errstr); + user_uid = (uid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_("%s: %s"), *cur, U_(errstr)); goto bad; @@ -353,7 +353,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) } if (MATCHES(*cur, "gid=")) { p = *cur + sizeof("gid=") - 1; - user_gid = (gid_t) sudo_strtoid(p, NULL, NULL, &errstr); + user_gid = (gid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_("%s: %s"), *cur, U_(errstr)); goto bad; @@ -416,7 +416,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) } if (MATCHES(*cur, "sid=")) { p = *cur + sizeof("sid=") - 1; - user_sid = (pid_t) sudo_strtoid(p, NULL, NULL, &errstr); + user_sid = (pid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_("%s: %s"), *cur, U_(errstr)); goto bad; diff --git a/plugins/sudoers/pwutil.c b/plugins/sudoers/pwutil.c index 19f4e6a18..69b60a0dc 100644 --- a/plugins/sudoers/pwutil.c +++ b/plugins/sudoers/pwutil.c @@ -436,7 +436,7 @@ sudo_fakepwnam(const char *user, gid_t gid) uid_t uid; debug_decl(sudo_fakepwnam, SUDOERS_DEBUG_NSS) - uid = (uid_t) sudo_strtoid(user + 1, NULL, NULL, &errstr); + uid = (uid_t) sudo_strtoid(user + 1, &errstr); if (errstr != NULL) { sudo_debug_printf(SUDO_DEBUG_DIAG|SUDO_DEBUG_LINENO, "uid %s %s", user, errstr); @@ -671,7 +671,7 @@ sudo_fakegrnam(const char *group) debug_return_ptr(NULL); } gr = &gritem->gr; - gr->gr_gid = (gid_t) sudo_strtoid(group + 1, NULL, NULL, &errstr); + gr->gr_gid = (gid_t) sudo_strtoid(group + 1, &errstr); gr->gr_name = (char *)(gritem + 1); memcpy(gr->gr_name, group, name_len + 1); if (errstr != NULL) { @@ -1019,7 +1019,7 @@ user_in_group(const struct passwd *pw, const char *group) */ if (group[0] == '#') { const char *errstr; - gid_t gid = (gid_t) sudo_strtoid(group + 1, NULL, NULL, &errstr); + gid_t gid = (gid_t) sudo_strtoid(group + 1, &errstr); if (errstr != NULL) { sudo_debug_printf(SUDO_DEBUG_DIAG|SUDO_DEBUG_LINENO, "gid %s %s", group, errstr); diff --git a/plugins/sudoers/regress/iolog_path/check_iolog_path.c b/plugins/sudoers/regress/iolog_path/check_iolog_path.c index 56db1e44b..817f9ac2b 100644 --- a/plugins/sudoers/regress/iolog_path/check_iolog_path.c +++ b/plugins/sudoers/regress/iolog_path/check_iolog_path.c @@ -146,7 +146,7 @@ main(int argc, char *argv[]) user_name = strdup(line); break; case 2: - user_gid = (gid_t)sudo_strtoid(line, NULL, NULL, &errstr); + user_gid = (gid_t)sudo_strtoid(line, &errstr); if (errstr != NULL) sudo_fatalx("group ID %s: %s", line, errstr); break; @@ -156,7 +156,7 @@ main(int argc, char *argv[]) runas_pw->pw_name = strdup(line); break; case 4: - runas_pw->pw_gid = (gid_t)sudo_strtoid(line, NULL, NULL, &errstr); + runas_pw->pw_gid = (gid_t)sudo_strtoid(line, &errstr); if (errstr != NULL) sudo_fatalx("group ID %s: %s", line, errstr); break; diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index eb1d5b8ad..e3c052ed5 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -344,7 +344,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], if (*def_timestampowner == '#') { const char *errstr; - uid_t uid = sudo_strtoid(def_timestampowner + 1, NULL, NULL, &errstr); + uid_t uid = sudo_strtoid(def_timestampowner + 1, &errstr); if (errstr == NULL) pw = sudo_getpwuid(uid); } @@ -1151,7 +1151,7 @@ set_runaspw(const char *user, bool quiet) if (*user == '#') { const char *errstr; - uid_t uid = sudo_strtoid(user + 1, NULL, NULL, &errstr); + uid_t uid = sudo_strtoid(user + 1, &errstr); if (errstr == NULL) { if ((pw = sudo_getpwuid(uid)) == NULL) pw = sudo_fakepwnam(user, user_gid); @@ -1182,7 +1182,7 @@ set_runasgr(const char *group, bool quiet) if (*group == '#') { const char *errstr; - gid_t gid = sudo_strtoid(group + 1, NULL, NULL, &errstr); + gid_t gid = sudo_strtoid(group + 1, &errstr); if (errstr == NULL) { if ((gr = sudo_getgrgid(gid)) == NULL) gr = sudo_fakegrnam(group); diff --git a/plugins/sudoers/testsudoers.c b/plugins/sudoers/testsudoers.c index 83775bb1b..691e8a469 100644 --- a/plugins/sudoers/testsudoers.c +++ b/plugins/sudoers/testsudoers.c @@ -155,7 +155,7 @@ main(int argc, char *argv[]) dflag = 1; break; case 'G': - sudoers_gid = (gid_t)sudo_strtoid(optarg, NULL, NULL, &errstr); + sudoers_gid = (gid_t)sudo_strtoid(optarg, &errstr); if (errstr != NULL) sudo_fatalx("group ID %s: %s", optarg, errstr); break; @@ -186,7 +186,7 @@ main(int argc, char *argv[]) trace_print = testsudoers_error; break; case 'U': - sudoers_uid = (uid_t)sudo_strtoid(optarg, NULL, NULL, &errstr); + sudoers_uid = (uid_t)sudo_strtoid(optarg, &errstr); if (errstr != NULL) sudo_fatalx("user ID %s: %s", optarg, errstr); break; @@ -389,7 +389,7 @@ set_runaspw(const char *user) if (*user == '#') { const char *errstr; - uid_t uid = sudo_strtoid(user + 1, NULL, NULL, &errstr); + uid_t uid = sudo_strtoid(user + 1, &errstr); if (errstr == NULL) { if ((pw = sudo_getpwuid(uid)) == NULL) pw = sudo_fakepwnam(user, user_gid); @@ -413,7 +413,7 @@ set_runasgr(const char *group) if (*group == '#') { const char *errstr; - gid_t gid = sudo_strtoid(group + 1, NULL, NULL, &errstr); + gid_t gid = sudo_strtoid(group + 1, &errstr); if (errstr == NULL) { if ((gr = sudo_getgrgid(gid)) == NULL) gr = sudo_fakegrnam(group); diff --git a/plugins/sudoers/tsgetgrpw.c b/plugins/sudoers/tsgetgrpw.c index 282046591..b416755fb 100644 --- a/plugins/sudoers/tsgetgrpw.c +++ b/plugins/sudoers/tsgetgrpw.c @@ -137,14 +137,14 @@ next_entry: if ((colon = strchr(cp = colon, ':')) == NULL) goto next_entry; *colon++ = '\0'; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) goto next_entry; pw.pw_uid = (uid_t)id; if ((colon = strchr(cp = colon, ':')) == NULL) goto next_entry; *colon++ = '\0'; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) goto next_entry; pw.pw_gid = (gid_t)id; @@ -267,7 +267,7 @@ next_entry: if ((colon = strchr(cp = colon, ':')) == NULL) goto next_entry; *colon++ = '\0'; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) goto next_entry; gr.gr_gid = (gid_t)id; diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index ade2dee81..80d5f0b6e 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -1210,14 +1210,14 @@ parse_sudoers_options(void) } if (MATCHES(*cur, "sudoers_uid=")) { p = *cur + sizeof("sudoers_uid=") - 1; - id = sudo_strtoid(p, NULL, NULL, &errstr); + id = sudo_strtoid(p, &errstr); if (errstr == NULL) sudoers_uid = (uid_t) id; continue; } if (MATCHES(*cur, "sudoers_gid=")) { p = *cur + sizeof("sudoers_gid=") - 1; - id = sudo_strtoid(p, NULL, NULL, &errstr); + id = sudo_strtoid(p, &errstr); if (errstr == NULL) sudoers_gid = (gid_t) id; continue; diff --git a/plugins/system_group/system_group.c b/plugins/system_group/system_group.c index d1fa6e46d..c010ff8ab 100644 --- a/plugins/system_group/system_group.c +++ b/plugins/system_group/system_group.c @@ -130,7 +130,7 @@ sysgroup_query(const char *user, const char *group, const struct passwd *pwd) grp = sysgroup_getgrnam(group); if (grp == NULL && group[0] == '#' && group[1] != '\0') { const char *errstr; - gid_t gid = sudo_strtoid(group + 1, NULL, NULL, &errstr); + gid_t gid = sudo_strtoid(group + 1, &errstr); if (errstr == NULL) grp = sysgroup_getgrgid(gid); } diff --git a/src/sudo.c b/src/sudo.c index 015ec8d38..aada25319 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -724,7 +724,7 @@ command_info_to_details(char * const info[], struct command_details *details) case 'r': if (strncmp("runas_egid=", info[i], sizeof("runas_egid=") - 1) == 0) { cp = info[i] + sizeof("runas_egid=") - 1; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) sudo_fatalx(U_("%s: %s"), info[i], U_(errstr)); details->egid = (gid_t)id; @@ -733,7 +733,7 @@ command_info_to_details(char * const info[], struct command_details *details) } if (strncmp("runas_euid=", info[i], sizeof("runas_euid=") - 1) == 0) { cp = info[i] + sizeof("runas_euid=") - 1; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) sudo_fatalx(U_("%s: %s"), info[i], U_(errstr)); details->euid = (uid_t)id; @@ -742,7 +742,7 @@ command_info_to_details(char * const info[], struct command_details *details) } if (strncmp("runas_gid=", info[i], sizeof("runas_gid=") - 1) == 0) { cp = info[i] + sizeof("runas_gid=") - 1; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) sudo_fatalx(U_("%s: %s"), info[i], U_(errstr)); details->gid = (gid_t)id; @@ -759,7 +759,7 @@ command_info_to_details(char * const info[], struct command_details *details) } if (strncmp("runas_uid=", info[i], sizeof("runas_uid=") - 1) == 0) { cp = info[i] + sizeof("runas_uid=") - 1; - id = sudo_strtoid(cp, NULL, NULL, &errstr); + id = sudo_strtoid(cp, &errstr); if (errstr != NULL) sudo_fatalx(U_("%s: %s"), info[i], U_(errstr)); details->uid = (uid_t)id;