Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/uid.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ int gid_from_string(const char *name, gid_t *gidp)
errno = 0;
l = strtol(name, &p, 10);
if (((errno == ERANGE) && ((l == LONG_MIN) || (l == LONG_MAX))) ||
(name == p) || (*p != '\0') || (l < 0) || (l > INT_MAX)) {
(name == p) || (*p != '\0') || (l < 0) || (l > UINT32_MAX)) {
xfree(buf_malloc);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/auth/jwt/auth_jwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ static void _handle_identity(jwt_t *jwt, auth_token_t *cred)

if (cred->id) {
if (cred->username &&
!xstrcmp(cred->username, cred->id->pw_name)) {
xstrcmp(cred->username, cred->id->pw_name)) {
error("%s: cannot override identity for %s with requested user %s",
__func__, cred->id->pw_name, cred->username);
FREE_NULL_IDENTITY(cred->id);
Expand Down
30 changes: 18 additions & 12 deletions src/plugins/data_parser/v0.0.43/parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2158,8 +2158,16 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
uid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID (overflow): %" PRId64,
tmp_val);
uid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2197,11 +2205,6 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (uid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID: %d", uid);

*uid_ptr = uid;

return SLURM_SUCCESS;
Expand All @@ -2222,8 +2225,16 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
gid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID (overflow): %" PRId64,
tmp_val);
gid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2261,11 +2272,6 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (gid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID: %d", gid);

*gid_ptr = gid;

return SLURM_SUCCESS;
Expand Down
30 changes: 18 additions & 12 deletions src/plugins/data_parser/v0.0.44/parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2169,8 +2169,16 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
uid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID (overflow): %" PRId64,
tmp_val);
uid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2208,11 +2216,6 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (uid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID: %d", uid);

*uid_ptr = uid;

return SLURM_SUCCESS;
Expand All @@ -2233,8 +2236,16 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
gid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID (overflow): %" PRId64,
tmp_val);
gid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2272,11 +2283,6 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (gid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID: %d", gid);

*gid_ptr = gid;

return SLURM_SUCCESS;
Expand Down
30 changes: 18 additions & 12 deletions src/plugins/data_parser/v0.0.45/parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2182,8 +2182,16 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
uid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID (overflow): %" PRId64,
tmp_val);
uid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2221,11 +2229,6 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (uid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID: %d", uid);

*uid_ptr = uid;

return SLURM_SUCCESS;
Expand Down Expand Up @@ -2273,8 +2276,16 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
gid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID (overflow): %" PRId64,
tmp_val);
gid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2312,11 +2323,6 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (gid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID: %d", gid);

*gid_ptr = gid;

return SLURM_SUCCESS;
Expand Down
30 changes: 18 additions & 12 deletions src/plugins/data_parser/v0.0.46/parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2182,8 +2182,16 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
uid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID (overflow): %" PRId64,
tmp_val);
uid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2221,11 +2229,6 @@ static int PARSE_FUNC(USER_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (uid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_USER_ID_INVALID,
"Invalid user ID: %d", uid);

*uid_ptr = uid;

return SLURM_SUCCESS;
Expand Down Expand Up @@ -2273,8 +2276,16 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
src);
/* fall through */
case DATA_TYPE_INT_64:
gid = data_get_int(src);
{
int64_t tmp_val = data_get_int(src);
if ((tmp_val < 0) || (tmp_val > UINT32_MAX))
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID (overflow): %" PRId64,
tmp_val);
gid = tmp_val;
break;
}
case DATA_TYPE_STRING:
{
int rc;
Expand Down Expand Up @@ -2312,11 +2323,6 @@ static int PARSE_FUNC(GROUP_ID)(const parser_t *const parser, void *obj,
fatal_abort("invalid type");
}

if (gid >= INT_MAX)
return parse_error(parser, args, parent_path,
ESLURM_GROUP_ID_INVALID,
"Invalid group ID: %d", gid);

*gid_ptr = gid;

return SLURM_SUCCESS;
Expand Down
13 changes: 10 additions & 3 deletions src/squeue/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,13 @@ int _print_int(int number, int width, bool right, bool cut_output)
return _print_str(buf, width, right, cut_output);
}

static int _print_uint(unsigned int number, int width, bool right, bool cut_output)
{
char buf[32];

snprintf(buf, 32, "%u", number);
return _print_str(buf, width, right, cut_output);
}

int _print_secs(long time, int width, bool right, bool cut_output)
{
Expand Down Expand Up @@ -846,7 +853,7 @@ int _print_job_user_id(job_info_t * job, int width, bool right, char* suffix)
if (job == NULL) /* Print the Header instead */
_print_str("UID", width, right, true);
else
_print_int(job->user_id, width, right, true);
_print_uint(job->user_id, width, right, true);
if (suffix)
printf("%s", suffix);
return SLURM_SUCCESS;
Expand All @@ -870,7 +877,7 @@ int _print_job_group_id(job_info_t * job, int width, bool right, char* suffix)
if (job == NULL) /* Print the Header instead */
_print_str("GROUP", width, right, true);
else
_print_int(job->group_id, width, right, true);
_print_uint(job->group_id, width, right, true);
if (suffix)
printf("%s", suffix);
return SLURM_SUCCESS;
Expand Down Expand Up @@ -2706,7 +2713,7 @@ int _print_step_user_id(job_step_info_t * step, int width, bool right,
if (step == NULL) /* Print the Header instead */
_print_str("UID", width, right, true);
else
_print_int(step->user_id, width, right, true);
_print_uint(step->user_id, width, right, true);
if (suffix)
printf("%s", suffix);
return SLURM_SUCCESS;
Expand Down