Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- printf("Starting open_plugin_open_v1........n");
- struct plugin_context *context;
- context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
- /*
- * Set the username/password we will require.
- */
- context->user_name = "s***";
- context->pass_word = "r***";
- /*
- * We are only interested in intercepting the
- * --auth-user-pass-verify callback.
- */
- *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
- printf("Ending open_plugin_open_v1");
- return (openvpn_plugin_handle_t) context;
- /* get username/password from envp string array */
- const char *username = get_env("Username", envp);
- const char *password = get_env("Password", envp);
- if(username && password){
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
- /* check entered username/password against what we require */
- if (!strcmp(username, context->user_name) && !strcmp(password, context->pass_word))
- {
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- }
- else
- {
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement