From c4fb9bc3c7b478d59da183e6c753cf2a8290468c Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Mon, 22 Jan 2018 13:31:10 -0700
Subject: [PATCH] Revert "Fix uid check when requesting a jobid from a pid."

This reverts commit d3141dc9c3549df35a8ba53ce5716a46304339b9.

Bug 4655

Turns out there are many ways to get this information directly from
the slurmstepd.  As you can already get this information from ps we
decided to just revert back to the old non-authenticated way of doing
things.

If we do need this in the future we need to patch the stepd as well as
the slurmd here in all the RPC's that try to grab this.

A user could easily run scontrol (or their own home baked thing)
on the node which will give them a direct contact with the slurmstepd.
---
 NEWS                    |  1 -
 src/slurmd/slurmd/req.c | 14 +-------------
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/NEWS b/NEWS
index b137a4f79e0..cb2e2f19aae 100644
--- a/NEWS
+++ b/NEWS
@@ -78,7 +78,6 @@ documents those changes that are of interest to users and administrators.
  -- Make logging prefix for slurmstepd to happen as soon as possible.
  -- mpi/pmix: Fix the job registration for the PMIx v2.1.
  -- Fix uid check for signaling a step with anything but SIGKILL.
- -- Fix uid check when requesting a jobid from a pid.
  -- Return ESLURM_TRANSITION_STATE_NO_UPDATE instead of EAGAIN when trying to
     signal a step that is still running a prolog.
  -- Update Cray slurm_playbook.yaml with latest recommended version.
diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c
index 7c838fa42c9..9d340503649 100644
--- a/src/slurmd/slurmd/req.c
+++ b/src/slurmd/slurmd/req.c
@@ -3861,15 +3861,9 @@ static void  _rpc_pid2jid(slurm_msg_t *msg)
 	slurm_msg_t           resp_msg;
 	job_id_response_msg_t resp;
 	bool         found = false;
-	bool         auth = false;
 	List         steps;
 	ListIterator i;
 	step_loc_t *stepd;
-	uid_t req_uid;
-
-	req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info);
-	if (_slurm_authorized_user(req_uid))
-		auth = true;
 
 	steps = stepd_available(conf->spooldir, conf->node_name);
 	i = list_iterator_create(steps);
@@ -3880,13 +3874,7 @@ static void  _rpc_pid2jid(slurm_msg_t *msg)
 				   &stepd->protocol_version);
 		if (fd == -1)
 			continue;
-		if (!auth &&
-		    (stepd_get_uid(fd, stepd->protocol_version) != req_uid)) {
-			close(fd);
-			debug3("%s: REQUEST_JOB_ID from uid=%d but they aren't the owner of job %u",
-			       __func__, req_uid, stepd->jobid);
-			continue;
-		}
+
 		if (stepd_pid_in_container(
 			    fd, stepd->protocol_version,
 			    req->job_pid)
-- 
GitLab