opendoas

A portable version of the OpenBSD `doas` command
git clone https://pi.duncano.de/git/opendoas.git
Log | Files | Refs | README | LICENSE

commit e0dd9ee353048757566541f18e04a96e2c76a479
parent a424761ab8312a14f52e42e32ae11654d55d722b
Author: Duncaen <mail@duncano.de>
Date:   Fri,  6 May 2016 03:37:58 +0200

Actually open pam sessions

Diffstat:
libopenbsd/auth_userokay.c | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 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; } -