IADsSecurityDescriptor 인터페이스는 ADSI 보안 설명자 개체의 속성에 대한 액세스를 제공합니다.
상속
IADsSecurityDescriptor 인터페이스는 IDispatch 인터페이스에서 상속됩니다. IADsSecurityDescriptor 에는 다음과 같은 유형의 멤버도 있습니다.
메서드
IADsSecurityDescriptor 인터페이스에는 이러한 메서드가 있습니다.
|
IADsSecurityDescriptor::CopySecurityDescriptor IADsSecurityDescriptor::CopySecurityDescriptor 메서드는 개체에 대한 보안 데이터를 보유하는 ADSI 보안 설명자 개체를 복사합니다. |
설명
이 인터페이스를 사용하여 액세스 제어를 검사하고 Active Directory 디렉터리 서비스 개체로 변경합니다. 보안 설명자의 복사본을 만드는 데 사용할 수도 있습니다. 이 인터페이스를 가져오려면 IADs.Get 메서드를 사용하여 개체의 ntSecurityDescriptor 특성을 가져옵니다. 새 보안 설명자를 만들고 개체에 설정하는 방법에 대한 자세한 내용은 새 디렉터리 개체 및 Null DACL 및 빈 DACL에 대한 보안 설명자 만들기를 참조하세요.
보안 설명자의 모든 부분을 수정할 수 없는 경우가 많습니다. 예를 들어 현재 사용자가 개체를 완전히 제어할 수 있지만 관리자가 아니고 개체를 소유하지 않는 경우 사용자는 DACL을 수정할 수 있지만 소유자를 수정할 수는 없습니다. 이로 인해 ntSecurityDescriptor 가 업데이트될 때 오류가 발생합니다. 이 문제를 방지하기 위해 IADsObjectOptions 인터페이스를 사용하여 수정해야 하는 보안 설명자의 특정 부분을 지정할 수 있습니다.
예제
다음 코드 예제에서는 IADsObjectOptions 인터페이스를 사용하여 보안 설명자의 특정 부분만 수정하는 방법을 보여 줍니다.
Const ADS_OPTION_SECURITY_MASK = 3
Const ADS_SECURITY_INFO_OWNER = 1
Const ADS_SECURITY_INFO_GROUP = 2
Const ADS_SECURITY_INFO_DACL = 4
Dim obj as IADs
Dim sd as IADsSecurityDescriptor
Dim oOptions as IADsObjectOptions
' Bind to the object.
Set obj = GetObject("LDAP://.....")
' Get the IADsSecurityDescriptor.
Set sd = obj.Get("ntSecurityDescriptor")
' Modify the DACL as required.
' Get the IADsObjectOptions for the object - not the IADsSecurityDescriptor.
Set oOptions = obj
' Set options so that only the DACL will be updated.
oOptions.SetOption ADS_OPTION_SECURITY_MASK, ADS_INFO_DACL
' Update the security descriptor.
obj.Put "ntSecurityDescriptor", sd
obj.SetInfo
다음 코드 예제에서는 보안 설명자의 데이터를 표시하는 방법을 보여 있습니다.
' Get the security descriptor.
Dim x As IADs
Dim sd As IADsSecurityDescriptor
On Error GoTo Cleanup
Set x = GetObject("LDAP://DC=Fabrikam,DC=com")
Set sd = x.Get("ntSecurityDescriptor")
Debug.Print sd.Control
Debug.Print sd.Group
Debug.Print sd.Owner
Debug.Print sd.Revision
Cleanup:
If (Err.Number<>0) Then
MsgBox("An error has occurred. " & Err.Number)
End If
Set x = Nothing
Set sd = Nothing
다음 코드 예제에서는 디렉터리 개체의 보안 설명자에서 데이터를 표시 하는 방법을 보여 입니다.
HRESULT DisplaySD(IADs *pObj)
{
IADsSecurityDescriptor *pSD = NULL;
BSTR bstr = NULL;
long lVal = 0;
HRESULT hr = S_OK;
VARIANT var;
VariantInit(&var);
if(pObj==NULL)
{
return E_FAIL;
}
hr = pObj->Get(CComBSTR("ntSecurityDescriptor"), &var);
if(FAILED(hr)){goto Cleanup;}
hr = V_DISPATCH(&var)->QueryInterface(IID_IADsSecurityDescriptor,(void**)&pSD);
if(FAILED(hr)){goto Cleanup;}
hr = pSD->get_Control(&lVal);
printf("SD Control = %d\n",lVal);
hr = pSD->get_Owner(&bstr);
printf("SD Owner = %S\n",bstr);
SysFreeString(bstr);
hr = pSD->get_Group(&bstr);
printf("SD Group = %S\n",bstr);
SysFreeString(bstr);
hr = pSD->get_Revision(&lVal);
printf("SD Revision= %d\n",lVal);
Cleanup:
VariantClear(&var);
if(pSD) pSD->Release();
return hr;
}
요구 사항
| 요구 사항 | 값 |
|---|---|
| 지원되는 최소 클라이언트 | Windows Vista |
| 지원되는 최소 서버 | Windows Server 2008 |
| 대상 플랫폼 | Windows |
| 헤더 | iads.h |