xauth-pam: Avoid race for multiple concurrent authentication attempts
The previously static pam_conv instance could get reused by multiple threads, causing one to use the password of the other.
This commit is contained in:
@@ -77,13 +77,13 @@ static int auth_conv(int num_msg, const struct pam_message **msg,
|
|||||||
*/
|
*/
|
||||||
static bool authenticate(char *service, char *user, char *password)
|
static bool authenticate(char *service, char *user, char *password)
|
||||||
{
|
{
|
||||||
|
struct pam_conv conv = {
|
||||||
|
.conv = (void*)auth_conv,
|
||||||
|
.appdata_ptr = password,
|
||||||
|
};
|
||||||
pam_handle_t *pamh = NULL;
|
pam_handle_t *pamh = NULL;
|
||||||
static struct pam_conv conv;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
conv.conv = (void*)auth_conv;
|
|
||||||
conv.appdata_ptr = password;
|
|
||||||
|
|
||||||
ret = pam_start(service, user, &conv, &pamh);
|
ret = pam_start(service, user, &conv, &pamh);
|
||||||
if (ret != PAM_SUCCESS)
|
if (ret != PAM_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user