Esempio n. 1
0
		public static extern BOOL EqualPrefixSid(PSID pSid1, PSID pSid2);
Esempio n. 2
0
		public static extern BOOL IsValidSid(PSID pSid);
Esempio n. 3
0
		public static extern PUCHAR GetSidSubAuthorityCount(PSID pSid);
Esempio n. 4
0
 /// <summary>Returns the length, in bytes, of a valid security identifier (SID).</summary>
 /// <param name="pSid">A pointer to the SID structure whose length is returned. The structure is assumed to be valid.</param>
 /// <returns>
 /// If the SID structure is valid, the return value is the length, in bytes, of the SID structure. If the SID structure is not valid,
 /// the return value is 0.
 /// </returns>
 public static int Length(this PSID pSid) => AdvApi32.IsValidSid(pSid) ? AdvApi32.GetLengthSid(pSid) : 0;
 internal static extern DWORD GetSecurityInfo(
     SafeFileHandle handle,
     ObjectType objectType,
     SecurityInformationClass infoClass,
     PSID owner,
     PSID group,
     PACL dacl,
     PACL sacl,
     out PSECURITY_DESCRIPTOR securityDescriptor);
Esempio n. 6
0
		public static extern BOOL GetSecurityDescriptorOwner(
			PSECURITY_DESCRIPTOR pSecurityDescriptor, 
			out PSID pOwner, 
			out BOOL lpbOwnerDefaulted
			);
Esempio n. 7
0
 /// <summary>Gets the binary form of the SID structure.</summary>
 /// <param name="pSid">The SID structure pointer.</param>
 /// <returns>The binary form (byte array) of the SID structure.</returns>
 public static byte[] GetBinaryForm(this PSID pSid) => pSid.IsValidSid() ? ((IntPtr)pSid).ToArray <byte>(pSid.Length()) : (new byte[0]);
Esempio n. 8
0
 public static extern PSID_IDENTIFIER_AUTHORITY GetSidIdentifierAuthority(PSID pSid);
Esempio n. 9
0
 public static extern BOOL EqualPrefixSid(PSID pSid1, PSID pSid2);
Esempio n. 10
0
 public static extern PDWORD GetSidSubAuthority(PSID pSid, DWORD nSubAuthority);
Esempio n. 11
0
 public static extern PUCHAR GetSidSubAuthorityCount(PSID pSid);
Esempio n. 12
0
 public static extern BOOL IsValidSid(PSID pSid);
Esempio n. 13
0
 public static extern DWORD GetLengthSid(PSID pSid);
Esempio n. 14
0
 public Sid(PSID psid) : this(psid, "")
 {
 }
Esempio n. 15
0
		public static extern BOOL LookupAccountSid(
			string lpSystemName, 
			PSID Sid,
			[Out] char[] Name,
			ref DWORD cchName,
			[Out] char [] ReferencedDomainName,
			ref DWORD cchReferencedDomainName,
			out SID_NAME_USE peUse);
Esempio n. 16
0
 public static extern BOOL InitializeSid(PSID Sid, [In] ref SID_IDENTIFIER_AUTHORITY pIdentifierAuthority, UCHAR nSubAuthorityCount);
Esempio n. 17
0
		public static extern BOOL ConvertSidToStringSid(PSID Sid, out IntPtr StringSid);
Esempio n. 18
0
 public static extern BOOL ConvertSidToStringSid(PSID Sid, out IntPtr StringSid);
Esempio n. 19
0
 /// <summary>Determines equality of two PSID instances.</summary>
 /// <param name="psid1">The first PSID.</param>
 /// <param name="psid2">The second PSID.</param>
 /// <returns><see langword="true"/> if the SID structures are equal; <see langword="false"/> otherwise.</returns>
 public static bool Equals(this PSID psid1, PSID psid2) => AdvApi32.EqualSid(psid1, psid2);
Esempio n. 20
0
 public static extern BOOL GetSecurityDescriptorGroup(
     PSECURITY_DESCRIPTOR pSecurityDescriptor,
     out PSID pGroup,
     out BOOL lpbGroupDefaulted
     );
Esempio n. 21
0
 /// <summary>
 /// Validates a security identifier (SID) by verifying that the revision number is within a known range, and that the number of
 /// subauthorities is less than the maximum.
 /// </summary>
 /// <param name="pSid">A pointer to the SID structure to validate. This parameter cannot be NULL.</param>
 /// <returns>
 /// If the SID structure is valid, the return value is <see langword="true"/>. If the SID structure is not valid, the return value is <see langword="false"/>.
 /// </returns>
 public static bool IsValidSid(this PSID pSid) => AdvApi32.IsValidSid(pSid);
Esempio n. 22
0
 public static extern BOOL GetSecurityDescriptorOwner(
     PSECURITY_DESCRIPTOR pSecurityDescriptor,
     out PSID pOwner,
     out BOOL lpbOwnerDefaulted
     );
Esempio n. 23
0
 public Sid(PSID psid, string machineName)
 {
     _machineName = machineName;
     _psid        = CopySid(psid);
 }
Esempio n. 24
0
 public static extern BOOL CopySid(
     DWORD nDestinationSidLength,
     PSID pDestinationSid,
     PSID pSourceSid
     );
Esempio n. 25
0
		public static extern DWORD GetLengthSid(PSID pSid);
Esempio n. 26
0
 public static extern BOOL SetSecurityDescriptorGroup(
     PSECURITY_DESCRIPTOR pSecurityDescriptor,
     PSID pGroup,
     BOOL bGroupDefaulted
     );
Esempio n. 27
0
		public static extern PDWORD GetSidSubAuthority(PSID pSid, DWORD nSubAuthority);
Esempio n. 28
0
 public static extern BOOL SetSecurityDescriptorOwner(
     PSECURITY_DESCRIPTOR pSecurityDescriptor,
     PSID pOwner,
     BOOL bOwnerDefaulted
     );
Esempio n. 29
0
		public static extern PSID_IDENTIFIER_AUTHORITY GetSidIdentifierAuthority(PSID pSid);
Esempio n. 30
0
        /// <summary>
        /// Gets the effective permissions for the provided Sid within the Security Descriptor.
        /// </summary>
        /// <param name="pUserSid">A pointer to the Sid of the identity to check.</param>
        /// <param name="serverName">Name of the server. This can be <c>null</c>.</param>
        /// <param name="pSecurityDescriptor">A pointer to the security descriptor.</param>
        /// <returns>An array of access masks.</returns>
        public virtual ACCESS_MASK[] GetEffectivePermission(PSID pUserSid, string serverName, PSECURITY_DESCRIPTOR pSecurityDescriptor)
        {
            ACCESS_MASK mask = pUserSid.GetEffectiveRights(pSecurityDescriptor);

            return(new[] { mask });
        }
Esempio n. 31
0
		public static extern BOOL InitializeSid(PSID Sid, [In]ref SID_IDENTIFIER_AUTHORITY pIdentifierAuthority, UCHAR nSubAuthorityCount);
Esempio n. 32
0
 /// <summary>
 /// Gets the effective permissions for the provided Sid within the Security Descriptor.
 /// Called only when an object type identifier is specified.
 /// </summary>
 /// <param name="objTypeId">The object type identifier.</param>
 /// <param name="pUserSid">A pointer to the Sid of the identity to check.</param>
 /// <param name="serverName">Name of the server. This can be <c>null</c>.</param>
 /// <param name="pSecurityDescriptor">A pointer to the security descriptor.</param>
 /// <param name="objectTypeList">The object type list.</param>
 /// <param name="grantedAccessList">An array of access masks.</param>
 /// <returns></returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public virtual HRESULT GetEffectivePermission(Guid objTypeId, PSID pUserSid, string serverName, PSECURITY_DESCRIPTOR pSecurityDescriptor, out OBJECT_TYPE_LIST[] objectTypeList, out ACCESS_MASK[] grantedAccessList)
 {
     objectTypeList    = null;
     grantedAccessList = null;
     return(HRESULT.E_NOTIMPL);
 }
Esempio n. 33
0
		public static extern BOOL LookupAccountName(
			string lpSystemName, 
			string lpAccountName, 
			PSID Sid, 
			ref DWORD cbSid, 
			[Out] char[] DomainName, 
			ref DWORD cbDomainName, 
			out SID_NAME_USE peUse
			);
Esempio n. 34
0
 /// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.</returns>
 public bool Equals(PSID other) => Equals(other.DangerousGetHandle());
Esempio n. 35
0
		public static extern BOOL GetSecurityDescriptorGroup(
			PSECURITY_DESCRIPTOR pSecurityDescriptor, 
			out PSID pGroup, 
			out BOOL lpbGroupDefaulted
			);
Esempio n. 36
0
 public static extern bool LogonUserEx(string lpszUserName, string lpszDomain, string lpszPassword, LogonUserType dwLogonType, LogonUserProvider dwLogonProvider,
                                       out SafeHTOKEN phObject, out PSID ppLogonSid, out SafeLsaReturnBufferHandle ppProfileBuffer, out uint pdwProfileLength, out QUOTA_LIMITS pQuotaLimits);
Esempio n. 37
0
		private byte[] CopySid(PSID psid)
		{
			BOOL rc = Win32.IsValidSid(psid);
			Win32.CheckCall(rc);

			DWORD cbLength = Win32.GetLengthSid(psid);

			byte[] psidBytes = new byte[cbLength];
			Marshal.Copy(psid, psidBytes, 0, (int)cbLength);
			return psidBytes;
		}
Esempio n. 38
0
 /// <summary>
 /// Gets the effective permissions for the provided Sid within the Security Descriptor.
 /// Called only when an object type identifier is specified.
 /// </summary>
 /// <param name="objTypeId">The object type identifier.</param>
 /// <param name="pUserSid">A pointer to the Sid of the identity to check.</param>
 /// <param name="serverName">Name of the server. This can be <c>null</c>.</param>
 /// <param name="pSecurityDescriptor">A pointer to the security descriptor.</param>
 /// <param name="objectTypeList">The object type list.</param>
 /// <returns>An array of access masks.</returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public virtual uint[] GetEffectivePermission(Guid objTypeId, PSID pUserSid, string serverName, PSECURITY_DESCRIPTOR pSecurityDescriptor, out OBJECT_TYPE_LIST[] objectTypeList)
 {
     throw new NotImplementedException();
 }
Esempio n. 39
0
		public Sid(PSID psid, string machineName)
		{
			_machineName = machineName;
			_psid = CopySid(psid);
		}
Esempio n. 40
0
		public Sid(PSID psid) : this(psid, "")
		{
		}
Esempio n. 41
0
		public static extern DWORD SetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE ObjectType,
			SECURITY_INFORMATION SecurityInfo,
			PSID psidOwner,
			PSID psidGroup,
			PACL pDacl,
			PACL pSacl);
Esempio n. 42
0
		public static extern DWORD GetNamedSecurityInfo(
			LPCTSTR pObjectName,		//REVIEW: Why is it documented as LPTSTR
			SE_OBJECT_TYPE ObjectType,
			SECURITY_INFORMATION SecurityInfo,
			ref PSID ppsidOwner,
			ref PSID ppsidGroup,
			ref PACL ppDacl,
			ref PACL ppSacl,
			ref PSECURITY_DESCRIPTOR ppSecurityDescriptor);
Esempio n. 43
0
		public static extern DWORD GetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE ObjectType,
			SECURITY_INFORMATION SecurityInfo,
			ref PSID ppsidOwner,
			ref PSID ppsidGroup,
			ref PACL ppDacl,
			ref PACL ppSacl,
			ref PSECURITY_DESCRIPTOR ppSecurityDescriptor);
Esempio n. 44
0
		public static extern BOOL SetSecurityDescriptorOwner(
			PSECURITY_DESCRIPTOR pSecurityDescriptor, 
			PSID pOwner, 
			BOOL bOwnerDefaulted
			);
Esempio n. 45
0
		public static extern BOOL SetSecurityDescriptorGroup(
			PSECURITY_DESCRIPTOR pSecurityDescriptor, 
			PSID pGroup, 
			BOOL bGroupDefaulted
			);
Esempio n. 46
0
		public static extern BOOL CopySid(
			DWORD nDestinationSidLength, 
			PSID pDestinationSid, 
			PSID pSourceSid
			);
Esempio n. 47
-2
		public static extern BOOL MakeAbsoluteSD(
			PSECURITY_DESCRIPTOR pSelfRelativeSD, 
			PSECURITY_DESCRIPTOR pAbsoluteSD, 
			ref DWORD lpdwAbsoluteSDSize, 
			PACL pDacl, 
			ref DWORD lpdwDaclSize, 
			PACL pSacl, 
			ref DWORD lpdwSaclSize, 
			PSID pOwner, 
			ref DWORD lpdwOwnerSize, 
			PSID pPrimaryGroup, 
			ref DWORD lpdwPrimaryGroupSize
			);