From 8aa7faa94e3f72184b7a4dfe4bf07f92293290cc Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Tue, 1 Dec 2015 23:39:06 +1000 Subject: [PATCH] * plugin.c : update openvpn_plugin_func_v1 --- src/plugin.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index 1e69a3c..5333ddb 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -72,6 +72,7 @@ openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const char *envp[]) { oal_config_t *config = (oal_config_t *) handle; + short int rc = 0; /* get username/password from envp string array */ const char *username = get_env("username", envp); @@ -79,11 +80,17 @@ openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, if (type == OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY) { /* check entered username/password against what we require */ - if (check_against_ldap(config, username, password) == 0) - return OPENVPN_PLUGIN_FUNC_SUCCESS; + rc = oal_check_cred(config, username, password); + switch (rc) { + case 1 : return OPENVPN_PLUGIN_FUNC_SUCCESS; break; + case 0 : return OPENVPN_PLUGIN_FUNC_ERROR; break; + default : + fprintf(stderr, "auth error: %s", config->error); + break; + } } - return OPENVPN_PLUGIN_FUNC_ERROR; + return OPENVPN_PLUGIN_FUNC_ERROR; /* never reached */ } OPENVPN_EXPORT void