Skip to content

Commit fc7b9a7

Browse files
mcmultgaijin03
authored andcommitted
pam_slurm_adopt - switch to internal version of _pam_drop_reply()
Linux-PAM deprecated _pam_drop_reply(). Implement a basic replacement internally and use that function instead. For our use case the response message is simply a single NULL string. Cherry-picked: 07d30f8 Ticket: 17724
1 parent 58eca19 commit fc7b9a7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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)