From a94ec0bdc3a6cdf000350bbfc724269d3d604238 Mon Sep 17 00:00:00 2001 From: Frank Benkstein Date: Sat, 28 Jul 2007 16:48:08 +0200 Subject: [PATCH] add service support to auth-pam --- auth-pam.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/auth-pam.c b/auth-pam.c index 2a851f8..0835ec2 100644 --- a/auth-pam.c +++ b/auth-pam.c @@ -16,11 +16,7 @@ #include #include -/* Try to authenticate the user. When the user is successfully authenticated - * this function returns 1. When the authentication fails for whatever reason - * the function returns 0. - */ -int auth(const char *user) { +int auth_service(const char *user, const char *service) { pam_handle_t *pamh; int pam_status; int pam_end_status; @@ -30,7 +26,7 @@ int auth(const char *user) { }; /* initialize pam */ - pam_status = pam_start("vlock", user, &pamc, &pamh); + pam_status = pam_start(service, user, &pamc, &pamh); if (pam_status != PAM_SUCCESS) { fprintf(stderr, "vlock-auth: %s\n", pam_strerror(pamh, pam_status)); @@ -56,3 +52,11 @@ end: return (pam_status == PAM_SUCCESS); } + +/* Try to authenticate the user. When the user is successfully authenticated + * this function returns 1. When the authentication fails for whatever reason + * the function returns 0. + */ +int auth(const char *user) { + return auth_service(user, "vlock"); +} -- 2.11.4.GIT