Advertisement
Guest User

Untitled

a guest
Aug 25th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. printf("Starting open_plugin_open_v1........n");
  2. struct plugin_context *context;
  3. context = (struct plugin_context *) calloc(1, sizeof(struct plugin_context));
  4.  
  5. /*
  6. * Set the username/password we will require.
  7. */
  8. context->user_name = "s***";
  9. context->pass_word = "r***";
  10.  
  11.  
  12. /*
  13. * We are only interested in intercepting the
  14. * --auth-user-pass-verify callback.
  15. */
  16. *type_mask = OPENVPN_PLUGIN_MASK(OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
  17.  
  18. printf("Ending open_plugin_open_v1");
  19.  
  20. return (openvpn_plugin_handle_t) context;
  21.  
  22. /* get username/password from envp string array */
  23. const char *username = get_env("Username", envp);
  24. const char *password = get_env("Password", envp);
  25. if(username && password){
  26. return OPENVPN_PLUGIN_FUNC_ERROR;
  27. }
  28. /* check entered username/password against what we require */
  29. if (!strcmp(username, context->user_name) && !strcmp(password, context->pass_word))
  30. {
  31. return OPENVPN_PLUGIN_FUNC_SUCCESS;
  32. }
  33. else
  34. {
  35. return OPENVPN_PLUGIN_FUNC_ERROR;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement