Skip to content
Snippets Groups Projects
Commit 2231f768 authored by Moe Jette's avatar Moe Jette
Browse files

Patch #22: Prevents a user from setting negative nice values using sbatch #PBS directives.

parent cb68cce8
No related branches found
No related tags found
No related merge requests found
...@@ -1756,6 +1756,15 @@ static void _set_pbs_options(int argc, char **argv) ...@@ -1756,6 +1756,15 @@ static void _set_pbs_options(int argc, char **argv)
"-%d and %d", NICE_OFFSET, NICE_OFFSET); "-%d and %d", NICE_OFFSET, NICE_OFFSET);
exit(error_exit); exit(error_exit);
} }
if (opt.nice < 0) {
uid_t my_uid = getuid();
if ((my_uid != 0) &&
(my_uid != slurm_get_slurm_user_id())) {
error("Nice value must be "
"non-negative, value ignored");
opt.nice = 0;
}
}
break; break;
case 'q': case 'q':
xfree(opt.partition); xfree(opt.partition);
...@@ -1976,6 +1985,15 @@ static void _parse_pbs_resource_list(char *rl) ...@@ -1976,6 +1985,15 @@ static void _parse_pbs_resource_list(char *rl)
"-%d and %d", NICE_OFFSET, NICE_OFFSET); "-%d and %d", NICE_OFFSET, NICE_OFFSET);
exit(error_exit); exit(error_exit);
} }
if (opt.nice < 0) {
uid_t my_uid = getuid();
if ((my_uid != 0) &&
(my_uid != slurm_get_slurm_user_id())) {
error("Nice value must be "
"non-negative, value ignored");
opt.nice = 0;
}
}
xfree(temp); xfree(temp);
} else if(!strncmp(rl+i, "nodes=", 6)) { } else if(!strncmp(rl+i, "nodes=", 6)) {
i+=6; i+=6;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment