Skip to content
Snippets Groups Projects
Commit cec07b18 authored by jwindley's avatar jwindley
Browse files

Previously unsubmitted support for --uid and --gid

parent 4c3d84e3
No related branches found
No related tags found
No related merge requests found
...@@ -113,6 +113,7 @@ typedef struct slurmd_job { ...@@ -113,6 +113,7 @@ typedef struct slurmd_job {
qsw_jobinfo_t qsw_job; /* Elan-specific job information */ qsw_jobinfo_t qsw_job; /* Elan-specific job information */
#endif #endif
uid_t uid; /* user id for job */ uid_t uid; /* user id for job */
gid_t gid; /* group ID for job */
bool batch; /* true if this is a batch job */ bool batch; /* true if this is a batch job */
bool run_prolog; /* true if need to run prolog */ bool run_prolog; /* true if need to run prolog */
......
...@@ -149,7 +149,7 @@ _session_mgr(slurmd_job_t *job) ...@@ -149,7 +149,7 @@ _session_mgr(slurmd_job_t *job)
if (_become_user(job) < 0) if (_become_user(job) < 0)
exit(2); exit(2);
if (setsid() < (pid_t) 0) { if (setsid() < (pid_t) 0) {
error("setsid: %m"); error("setsid: %m");
exit(3); exit(3);
...@@ -212,7 +212,7 @@ _cleanup_file_descriptors(slurmd_job_t *j) ...@@ -212,7 +212,7 @@ _cleanup_file_descriptors(slurmd_job_t *j)
static int static int
_become_user(slurmd_job_t *job) _become_user(slurmd_job_t *job)
{ {
if (setgid(job->pwd->pw_gid) < 0) { if (setgid(job->gid) < 0) {
error("setgid: %m"); error("setgid: %m");
return -1; return -1;
} }
...@@ -249,7 +249,6 @@ _exec_all_tasks(slurmd_job_t *job) ...@@ -249,7 +249,6 @@ _exec_all_tasks(slurmd_job_t *job)
if (xsignal_block(smgr_sigarray) < 0) if (xsignal_block(smgr_sigarray) < 0)
return error ("Unable to block signals"); return error ("Unable to block signals");
for (i = 0; i < job->ntasks; i++) { for (i = 0; i < job->ntasks; i++) {
pid_t pid = fork(); pid_t pid = fork();
......
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