Leaked source code of windows server 2003
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.

85 lines
2.0 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // namemapper.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file declares the class NameMapper.
  12. //
  13. ///////////////////////////////////////////////////////////////////////////////
  14. #ifndef NAMEMAPPER_H_
  15. #define NAMEMAPPER_H_
  16. #pragma once
  17. #include "iastl.h"
  18. #include "iastlutl.h"
  19. #include <ntdsapi.h>
  20. class NameCracker;
  21. class IdentityHelper;
  22. ///////////////////////////////////////////////////////////////////////////////
  23. //
  24. // CLASS
  25. //
  26. // NameMapper
  27. //
  28. // DESCRIPTION
  29. //
  30. // Implements a request handler that converts the RADIUS User-Name
  31. // attribute to a fully qualified NT4 account name.
  32. //
  33. //
  34. ///////////////////////////////////////////////////////////////////////////////
  35. class NameMapper :
  36. public IASTL::IASRequestHandlerSync
  37. {
  38. public:
  39. NameMapper(bool iniAllowAltSecId = false) throw ();
  40. //////////
  41. // IIasComponent.
  42. //////////
  43. STDMETHOD(Initialize)() const throw();
  44. STDMETHOD(Shutdown)() const throw();
  45. protected:
  46. virtual IASREQUESTSTATUS onSyncRequest(IRequest* pRequest) throw ();
  47. // Prepends the default domain to username.
  48. PWSTR prependDefaultDomain(PCWSTR username);
  49. bool isCrackable(
  50. const wchar_t* szIdentity,
  51. DS_NAME_FORMAT& format
  52. ) const throw ();
  53. void mapName(
  54. const wchar_t* identity,
  55. IASTL::IASAttribute& nt4Name,
  56. DS_NAME_FORMAT formatOffered,
  57. const wchar_t* suffix
  58. );
  59. static NameCracker cracker;
  60. static IdentityHelper identityHelper;
  61. private:
  62. // Indicates whether altSecurityIdentities are allowed. We only allow
  63. // altSecurityIdentities for users that are authenticated by a remote RADIUS
  64. // server.
  65. bool allowAltSecId;
  66. };
  67. inline NameMapper::NameMapper(bool iniAllowAltSecId) throw ()
  68. : allowAltSecId(iniAllowAltSecId)
  69. {
  70. }
  71. #endif // NAMEMAPPER_H_