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.

122 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. msgsec.c
  5. Abstract:
  6. This module contains the Messenger service support routines
  7. which create security objects and enforce security _access checking.
  8. Author:
  9. Dan Lafferty (danl) 07-Aug-1991
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. 07-Aug-1991 danl
  14. created
  15. --*/
  16. //
  17. // Includes
  18. //
  19. #include <nt.h>
  20. #include <ntrtl.h>
  21. #include <nturtl.h>
  22. #include <windef.h>
  23. #include <lmcons.h> // NET_API_STATUS.
  24. #include <lmerr.h>
  25. #include <netlibnt.h>
  26. #include "msgdbg.h"
  27. #include "msgsec.h"
  28. #include "msgdata.h"
  29. //
  30. // Global Variables -
  31. //
  32. // Security Descriptor for Messenger Name object. This is used to control
  33. // access to the Messenger Name Table.
  34. //
  35. PSECURITY_DESCRIPTOR MessageNameSd;
  36. //
  37. // Structure that describes the mapping of Generic access rights to object
  38. // specific access rights for the Messenger Name Object.
  39. //
  40. GENERIC_MAPPING MsgMessageNameMapping = {
  41. STANDARD_RIGHTS_READ | // Generic Read
  42. MSGR_MESSAGE_NAME_INFO_GET |
  43. MSGR_MESSAGE_NAME_ENUM,
  44. STANDARD_RIGHTS_WRITE | // Generic Write
  45. MSGR_MESSAGE_NAME_ADD |
  46. MSGR_MESSAGE_NAME_DEL,
  47. STANDARD_RIGHTS_EXECUTE, // Generic Execute
  48. MSGR_MESSAGE_ALL_ACCESS // Generic all
  49. };
  50. NET_API_STATUS
  51. MsgCreateMessageNameObject(
  52. VOID
  53. )
  54. /*++
  55. Routine Description:
  56. This function creates the Messenger Message Name Object.
  57. Arguments:
  58. None.
  59. Return Value:
  60. NET_API_STATUS - translated status returned from NetpCreateSecurityObject.
  61. --*/
  62. {
  63. NTSTATUS ntStatus;
  64. //
  65. // Order matters! These ACEs are inserted into the DACL in the
  66. // following order. Security access is granted or denied based on
  67. // the order of the ACEs in the DACL.
  68. //
  69. // Admins, and local users are allowed to get and change all information.
  70. //
  71. #define MESSAGE_NAME_ACES 2 // Number of ACES in this DACL
  72. ACE_DATA AceData[MESSAGE_NAME_ACES] = {
  73. {ACCESS_ALLOWED_ACE_TYPE, 0, 0, GENERIC_ALL, &MsgsvcGlobalData->LocalSid},
  74. {ACCESS_ALLOWED_ACE_TYPE, 0, 0, GENERIC_ALL, &MsgsvcGlobalData->AliasAdminsSid}
  75. };
  76. ntStatus = NetpCreateSecurityObject(
  77. AceData, // Ace Data
  78. MESSAGE_NAME_ACES, // Ace Count
  79. MsgsvcGlobalData->LocalSystemSid, // Owner Sid
  80. MsgsvcGlobalData->LocalSystemSid, // Group Sid
  81. &MsgMessageNameMapping, // Generic Mapping
  82. &MessageNameSd); // New Descriptor
  83. return(NetpNtStatusToApiStatus(ntStatus));
  84. }