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.

163 lines
4.2 KiB

  1. /* ----------------------------------------------------------------------
  2. Module: ULS.DLL (Service Provider)
  3. File: spluser.h
  4. Content: This file contains the local user object definition.
  5. History:
  6. 10/15/96 Chu, Lon-Chan [lonchanc]
  7. Created.
  8. Copyright (c) Microsoft Corporation 1996-1997
  9. ---------------------------------------------------------------------- */
  10. #ifndef _ULS_SP_USEROBJ_H_
  11. #define _ULS_SP_USEROBJ_H_
  12. #include <pshpack8.h>
  13. enum
  14. {
  15. ENUM_USERATTR_CN,
  16. ENUM_USERATTR_FIRST_NAME,
  17. ENUM_USERATTR_LAST_NAME,
  18. ENUM_USERATTR_EMAIL_NAME,
  19. ENUM_USERATTR_CITY_NAME,
  20. #ifdef USE_DEFAULT_COUNTRY
  21. ENUM_USERATTR_COUNTRY_NAME,
  22. #endif
  23. ENUM_USERATTR_COMMENT,
  24. ENUM_USERATTR_IP_ADDRESS,
  25. ENUM_USERATTR_FLAGS,
  26. ENUM_USERATTR_C,
  27. /* -- the above are resolvable -- */
  28. ENUM_USERATTR_CLIENT_SIG,
  29. ENUM_USERATTR_TTL,
  30. /* -- the above are changeable standard attributes for RTPerson -- */
  31. ENUM_USERATTR_OBJECT_CLASS,
  32. ENUM_USERATTR_O,
  33. COUNT_ENUM_USERATTR
  34. };
  35. #ifdef USE_DEFAULT_COUNTRY
  36. #else
  37. #define ENUM_USERATTR_COUNTRY_NAME ENUM_USERATTR_C
  38. #endif
  39. #define COUNT_ENUM_USERINFO (ENUM_USERATTR_TTL + 1) // exclude uid, o, c
  40. #define COUNT_ENUM_DIRUSERINFO (ENUM_USERATTR_C + 1) // count of attrs in dir dlg
  41. #define COUNT_ENUM_RESUSERINFO (ENUM_USERATTR_C + 1) // count of attrs resolvable
  42. extern const TCHAR *c_apszUserStdAttrNames[];
  43. #define STR_CN (TCHAR *) c_apszUserStdAttrNames[ENUM_USERATTR_CN]
  44. #define STR_O (TCHAR *) c_apszUserStdAttrNames[ENUM_USERATTR_O]
  45. #define STR_C (TCHAR *) c_apszUserStdAttrNames[ENUM_USERATTR_C]
  46. #define USEROBJ_F_NAME 0x0001
  47. #define USEROBJ_F_FIRST_NAME 0x0002
  48. #define USEROBJ_F_LAST_NAME 0x0004
  49. #define USEROBJ_F_EMAIL_NAME 0x0008
  50. #define USEROBJ_F_CITY_NAME 0x0010
  51. #define USEROBJ_F_COUNTRY_NAME 0x0020
  52. #define USEROBJ_F_COMMENT 0x0040
  53. #define USEROBJ_F_IP_ADDRESS 0x0080
  54. #define USEROBJ_F_FLAGS 0x0100
  55. typedef struct
  56. {
  57. DWORD dwFlags;
  58. TCHAR *apszStdAttrValues[COUNT_ENUM_USERATTR];
  59. TCHAR szIPAddress[INTEGER_STRING_LENGTH];
  60. TCHAR szFlags[INTEGER_STRING_LENGTH];
  61. TCHAR szTTL[INTEGER_STRING_LENGTH];
  62. TCHAR szClientSig[INTEGER_STRING_LENGTH];
  63. }
  64. USER_INFO;
  65. #define USEROBJ_SIGNATURE ((ULONG) 0x12345678UL)
  66. class UlsLdap_CLocalUser : public UlsLdap_CStdAttrs
  67. {
  68. friend class UlsLdap_CRefreshScheduler;
  69. friend class UlsLdap_CLocalApp;
  70. friend class UlsLdap_CLocalProt;
  71. public:
  72. UlsLdap_CLocalUser ( VOID );
  73. ~UlsLdap_CLocalUser ( VOID );
  74. ULONG AddRef ( VOID );
  75. ULONG Release ( VOID );
  76. HRESULT Register ( ULONG *puRespID, SERVER_INFO *pServerInfo, LDAP_USERINFO *pInfo );
  77. HRESULT UnRegister ( ULONG *puRespID );
  78. HRESULT SetStdAttrs ( ULONG *puRespID, LDAP_USERINFO *pInfo );
  79. HRESULT UpdateIPAddress ( BOOL fPrimary );
  80. VOID SetRegNone ( VOID ) { m_RegStatus = ULS_REG_STATUS_NONE; }
  81. VOID SetRegLocally ( VOID ) { m_RegStatus = ULS_REG_STATUS_LOCALLY; }
  82. VOID SetRegRemotely ( VOID ) { m_RegStatus = ULS_REG_STATUS_REMOTELY; }
  83. BOOL IsRegistered ( VOID ) { return (m_RegStatus > ULS_REG_STATUS_NONE); }
  84. BOOL IsRegLocally ( VOID ) { return (m_RegStatus == ULS_REG_STATUS_LOCALLY); }
  85. BOOL IsRegRemotely ( VOID ) { return (m_RegStatus == ULS_REG_STATUS_REMOTELY); }
  86. BOOL IsValidObject ( VOID ) { return m_uSignature == USEROBJ_SIGNATURE; }
  87. VOID RollbackDN ( VOID );
  88. SERVER_INFO *GetServerInfo ( VOID ) { return &m_ServerInfo; }
  89. ULONG GetTTL ( VOID ) { return m_uTTL; }
  90. protected:
  91. TCHAR *GetDN ( VOID ) { return m_pszDN; }
  92. ULONG GetPrefixCount ( VOID ) { return 1; }
  93. TCHAR *GetPrefixString ( VOID ) { return g_pszUserPrefix; }
  94. HRESULT SendRefreshMsg ( VOID );
  95. private:
  96. HRESULT CacheInfo ( VOID *pInfo );
  97. HRESULT CacheUserInfo ( LDAP_USERINFO *pInfo );
  98. HRESULT CreateRegisterModArr ( LDAPMod ***pppMod );
  99. HRESULT CreateSetStdAttrsModArr ( LDAPMod ***pppMod );
  100. VOID FillModArrAttr ( LDAPMod *pMod, LONG AttrIdx );
  101. HRESULT BuildDN ( VOID );
  102. ULONG m_uSignature;
  103. LONG m_cRefs;
  104. USER_INFO m_UserInfo;
  105. SERVER_INFO m_ServerInfo;
  106. TCHAR *m_pszDN;
  107. TCHAR *m_pszOldDN;
  108. TCHAR *m_pszRefreshFilter;
  109. REG_STATUS m_RegStatus;
  110. DWORD m_dwIPAddress;
  111. ULONG m_uTTL;
  112. };
  113. #include <poppack.h>
  114. #endif // _ULS_SP_USEROBJ_H_