aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2016-05-06 03:37:58 +0200
committerDuncaen <mail@duncano.de>2016-05-06 05:27:03 +0200
commite0dd9ee353048757566541f18e04a96e2c76a479 (patch)
tree3606fe7613939d9148a813040321c0e671178003
parenta424761ab8312a14f52e42e32ae11654d55d722b (diff)
downloadopendoas-e0dd9ee353048757566541f18e04a96e2c76a479.tar.gz
Actually open pam sessions
-rw-r--r--libopenbsd/auth_userokay.c11
1 files 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;
}
-