Skip to content

Commit 8fe40c5

Browse files
committed
Merge branch 'cherrypick-ticket17724-23.02' into 'slurm-23.02'
Cherry-pick Ticket 17724 into slurm-23.02 See merge request SchedMD/dev/slurm!305
2 parents 854a8cc + fc7b9a7 commit 8fe40c5

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

contribs/pam/pam_slurm.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,19 @@ _log_msg(int level, const char *format, ...)
176176
return;
177177
}
178178

179+
/*
180+
* pam 1.5.3 stopped providing _pam_drop_reply(). Our use does not currently
181+
* fetch sensitive data so simply free this structure.
182+
*/
183+
static void _pam_slurm_drop_response(struct pam_response *reply, int replies)
184+
{
185+
for (int i = 0; i < replies; i++) {
186+
if (reply[i].resp)
187+
free(reply[i].resp);
188+
}
189+
free(reply);
190+
}
191+
179192
/*
180193
* Parses module args passed via PAM's config.
181194
*/
@@ -414,7 +427,7 @@ _send_denial_msg(pam_handle_t *pamh, struct _options *opts,
414427
_log_msg(LOG_ERR, "unable to converse with app: %s",
415428
pam_strerror(pamh, retval));
416429
if (prsp != NULL)
417-
_pam_drop_reply(prsp, 1);
430+
_pam_slurm_drop_response(prsp, 1);
418431

419432
return;
420433
}

contribs/pam_slurm_adopt/helper.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ _log_msg(int level, const char *format, ...)
100100
return;
101101
}
102102

103+
/*
104+
* pam 1.5.3 stopped providing _pam_drop_reply(). Our use does not currently
105+
* fetch sensitive data so simply free this structure.
106+
*/
107+
static void _pam_slurm_drop_response(struct pam_response *reply, int replies)
108+
{
109+
for (int i = 0; i < replies; i++) {
110+
if (reply[i].resp)
111+
free(reply[i].resp);
112+
}
113+
free(reply);
114+
}
115+
103116
/*
104117
* Sends a message to the application informing the user
105118
* that access was denied due to Slurm.
@@ -141,7 +154,7 @@ send_user_msg(pam_handle_t *pamh, const char *mesg)
141154
_log_msg(LOG_ERR, "unable to converse with app: %s",
142155
pam_strerror(pamh, retval));
143156
if (prsp != NULL)
144-
_pam_drop_reply(prsp, 1);
157+
_pam_slurm_drop_response(prsp, 1);
145158

146159
return;
147160
}

0 commit comments

Comments
 (0)