From e0dd9ee353048757566541f18e04a96e2c76a479 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Fri, 6 May 2016 03:37:58 +0200 Subject: [PATCH] Actually open pam sessions --- libopenbsd/auth_userokay.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libopenbsd/auth_userokay.c b/libopenbsd/auth_userokay.c index 465cb1c..6a9841b 100644 --- a/libopenbsd/auth_userokay.c +++ b/libopenbsd/auth_userokay.c @@ -26,7 +26,7 @@ #include "includes.h" -#define PAM_SERVICE "doas" +#define PAM_SERVICE_NAME "doas" static char * pam_prompt(const char *msg, int echo_on, int *pam) @@ -93,17 +93,20 @@ auth_userokay(char *name, char *style, char *type, char *password) if (style || type || password) errx(1, "auth_userokay(name, NULL, NULL, NULL)!\n"); - ret = pam_start(PAM_SERVICE, name, &conv, &pamh); + ret = pam_start(PAM_SERVICE_NAME, name, &conv, &pamh); if (ret != PAM_SUCCESS) errx(1, "pam_start(\"%s\", \"%s\", ?, ?): failed\n", - PAM_SERVICE, name); + PAM_SERVICE_NAME, name); auth = pam_authenticate(pamh, 0); + ret = pam_open_session(pamh, 0); + if (ret != PAM_SUCCESS) + errx(1, "pam_open_session(): %s\n", pam_strerror(pamh, ret)); + ret = pam_close_session(pamh, 0); if (ret != PAM_SUCCESS) errx(1, "pam_close_session(): %s\n", pam_strerror(pamh, ret)); return auth == PAM_SUCCESS; } - -- 2.39.2