security.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /**
  2. * WinPR: Windows Portable Runtime
  3. * Base Security Functions
  4. *
  5. * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. #ifdef HAVE_CONFIG_H
  20. #include "config.h"
  21. #endif
  22. #include <winpr/crt.h>
  23. #ifdef HAVE_UNISTD_H
  24. #include <unistd.h>
  25. #endif
  26. #include <winpr/security.h>
  27. /**
  28. * api-ms-win-security-base-l1-2-0.dll:
  29. *
  30. * AccessCheck
  31. * AccessCheckAndAuditAlarmW
  32. * AccessCheckByType
  33. * AccessCheckByTypeAndAuditAlarmW
  34. * AccessCheckByTypeResultList
  35. * AccessCheckByTypeResultListAndAuditAlarmByHandleW
  36. * AccessCheckByTypeResultListAndAuditAlarmW
  37. * AddAccessAllowedAce
  38. * AddAccessAllowedAceEx
  39. * AddAccessAllowedObjectAce
  40. * AddAccessDeniedAce
  41. * AddAccessDeniedAceEx
  42. * AddAccessDeniedObjectAce
  43. * AddAce
  44. * AddAuditAccessAce
  45. * AddAuditAccessAceEx
  46. * AddAuditAccessObjectAce
  47. * AddMandatoryAce
  48. * AddResourceAttributeAce
  49. * AddScopedPolicyIDAce
  50. * AdjustTokenGroups
  51. * AdjustTokenPrivileges
  52. * AllocateAndInitializeSid
  53. * AllocateLocallyUniqueId
  54. * AreAllAccessesGranted
  55. * AreAnyAccessesGranted
  56. * CheckTokenCapability
  57. * CheckTokenMembership
  58. * CheckTokenMembershipEx
  59. * ConvertToAutoInheritPrivateObjectSecurity
  60. * CopySid
  61. * CreatePrivateObjectSecurity
  62. * CreatePrivateObjectSecurityEx
  63. * CreatePrivateObjectSecurityWithMultipleInheritance
  64. * CreateRestrictedToken
  65. * CreateWellKnownSid
  66. * DeleteAce
  67. * DestroyPrivateObjectSecurity
  68. * DuplicateToken
  69. * DuplicateTokenEx
  70. * EqualDomainSid
  71. * EqualPrefixSid
  72. * EqualSid
  73. * FindFirstFreeAce
  74. * FreeSid
  75. * GetAce
  76. * GetAclInformation
  77. * GetAppContainerAce
  78. * GetCachedSigningLevel
  79. * GetFileSecurityW
  80. * GetKernelObjectSecurity
  81. * GetLengthSid
  82. * GetPrivateObjectSecurity
  83. * GetSidIdentifierAuthority
  84. * GetSidLengthRequired
  85. * GetSidSubAuthority
  86. * GetSidSubAuthorityCount
  87. * GetTokenInformation
  88. * GetWindowsAccountDomainSid
  89. * ImpersonateAnonymousToken
  90. * ImpersonateLoggedOnUser
  91. * ImpersonateSelf
  92. * InitializeAcl
  93. * InitializeSid
  94. * IsTokenRestricted
  95. * IsValidAcl
  96. * IsValidSid
  97. * IsWellKnownSid
  98. * MakeAbsoluteSD
  99. * MakeSelfRelativeSD
  100. * MapGenericMask
  101. * ObjectCloseAuditAlarmW
  102. * ObjectDeleteAuditAlarmW
  103. * ObjectOpenAuditAlarmW
  104. * ObjectPrivilegeAuditAlarmW
  105. * PrivilegeCheck
  106. * PrivilegedServiceAuditAlarmW
  107. * QuerySecurityAccessMask
  108. * RevertToSelf
  109. * SetAclInformation
  110. * SetCachedSigningLevel
  111. * SetFileSecurityW
  112. * SetKernelObjectSecurity
  113. * SetPrivateObjectSecurity
  114. * SetPrivateObjectSecurityEx
  115. * SetSecurityAccessMask
  116. * SetTokenInformation
  117. */
  118. #ifndef _WIN32
  119. #include "security.h"
  120. BOOL InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
  121. {
  122. return TRUE;
  123. }
  124. DWORD GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR pSecurityDescriptor)
  125. {
  126. return 0;
  127. }
  128. BOOL IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor)
  129. {
  130. return TRUE;
  131. }
  132. BOOL GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
  133. PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
  134. {
  135. return TRUE;
  136. }
  137. BOOL SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
  138. SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
  139. SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet)
  140. {
  141. return TRUE;
  142. }
  143. BOOL GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent,
  144. PACL* pDacl, LPBOOL lpbDaclDefaulted)
  145. {
  146. return TRUE;
  147. }
  148. BOOL SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent,
  149. PACL pDacl, BOOL bDaclDefaulted)
  150. {
  151. return TRUE;
  152. }
  153. BOOL GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pGroup,
  154. LPBOOL lpbGroupDefaulted)
  155. {
  156. return TRUE;
  157. }
  158. BOOL SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup,
  159. BOOL bGroupDefaulted)
  160. {
  161. return TRUE;
  162. }
  163. BOOL GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pOwner,
  164. LPBOOL lpbOwnerDefaulted)
  165. {
  166. return TRUE;
  167. }
  168. BOOL SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner,
  169. BOOL bOwnerDefaulted)
  170. {
  171. return TRUE;
  172. }
  173. DWORD GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl)
  174. {
  175. return 0;
  176. }
  177. DWORD SetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl)
  178. {
  179. return 0;
  180. }
  181. BOOL GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent,
  182. PACL* pSacl, LPBOOL lpbSaclDefaulted)
  183. {
  184. return TRUE;
  185. }
  186. BOOL SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent,
  187. PACL pSacl, BOOL bSaclDefaulted)
  188. {
  189. return TRUE;
  190. }
  191. #endif