Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.1 KiB

  1. /*--
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name: AUTHHLP
  4. Abstract: NTLM Authentication for telnetd.
  5. --*/
  6. /****************************************************************************
  7. USAGE
  8. Call AuthHelpValidateUser(A/W), depending on whether the user name and
  9. password are in ANSI or UNICODE strings. The ACL is always in UNICODE
  10. in CE because it is typically read from the registry. The function will
  11. return TRUE if access is allowed and FALSE if it is not allowed.
  12. Access may be denied if the user is not a valid user on the domain, or
  13. if they are not in the Access Control List (ACL).
  14. The ACL is a string, each element separeted by a semicolon, that specifies
  15. the name of a group or user to either allow or deny service to. To specify
  16. a group, put a "@" immediatly before it. To specify either a user or a group
  17. is to be denied access, put a "-" before it.
  18. For instance, ACL = "good_user1; @good_group1; -bad_user1; -@bad_group1; good_user2"
  19. will allow users named good_user1, good_user2, and anyone who is a member of
  20. the group good_group1 access (assuming they've succesfully been authenticated
  21. by NTLM). It will deny access to anyone named bad_user1 and in bad_group1.
  22. The checks are made from left to right, and the check will stop being made
  23. as soon as a match (either positive or negative) is made.
  24. In the above example, if good_user1 is also a member of bad_group1, they will
  25. recieve access because good_user1 came before bad_group1. However, if
  26. good_user2 is a member of bad_group1, they will be denied access because
  27. bad_group1 came before good_user2.
  28. A "*" in the ACL list means that all users are granted access, provided they
  29. have not been disqualified by any of the arguments to the left of the arg
  30. list.
  31. For instance, if ACL = "-bad_user1; *" then all users will be granted
  32. access, except for bad_user1.
  33. IMPORTANT SECURITY CONSIDERATIONS
  34. Note that there is some danger in using this API set over a public network
  35. such as the Internet if the passwords are not encrypted by the calling
  36. application. It is possible for a malicious user to intercept packets sent
  37. to your network application and to learn the password, either on the
  38. Domain or on the CE device, depending on which options are used. Use
  39. this with care.
  40. See the telnetd sample for an example of how to use this API.
  41. ****************************************************************************/
  42. #ifndef _AUTH_H_
  43. #define _AUTH_H_
  44. #ifndef UNDER_CE
  45. #define SECURITY_WIN32
  46. #endif
  47. #include <windows.h>
  48. #include <sspi.h>
  49. #include <issperr.h>
  50. #include <tchar.h>
  51. BOOL AuthHelpValidateUserA(PSTR pszRemoteUser, PSTR pszPassword, TCHAR *pszACL, DWORD dwFlags);
  52. BOOL AuthHelpValidateUserW(PWSTR wszRemoteUser, PWSTR wszPassword, TCHAR *pszACL, DWORD dwFlags);
  53. BOOL AuthHelpValidateUser(TCHAR *pszRemoteUser, TCHAR *pszPassword, TCHAR * pszACL, DWORD dwFlags);
  54. BOOL IsAccessAllowed(TCHAR *pszRemoteUser, TCHAR *pszRemoteUserGroups, TCHAR *pszACL, BOOL fPeek);
  55. BOOL AuthHelpUnload();
  56. BOOL AuthHelpInitialize();
  57. #define AUTH_HELP_FLAGS_NO_NTLM 0x01 // Set if we skip NTLM checking
  58. #endif // _AUTH_H_