PC Review


Reply
Thread Tools Rate Thread

binding to a property within ad AD object for setting permissions?

 
 
Bob Weiner
Guest
Posts: n/a
 
      4th Jul 2003
I have posted this to exchange2000.development and server.scripting without
success. Forgive me if I'm being pushy but I have a deadline rushing at
me(like I'm the only one!).

This doesn't seem to me to be an overly difficult question though I admit
that I cannot figure it out. The fact that it can be done manually with the
ADUC makes me believe that it is scriptable.

********************************************************

I need to give users the ability to update specific properties on AD objects
but am having trouble retrieving security descriptors on individual AD
object attributes.

I am using ADSI (of course) and ADsSecurity.dll to do this. My best attempt
thus far (which failed with a "catastrophic failure") is below.

A pointer would be greatly appreciated.

thanks,
bob

---------------------------------------------
Public Sub grant ( ByVal iadObj As IADs, _
ByVal dnTrustee As String, _
ByVal strAttribute as String )

Dim sd As IADsSecurityDescriptor
Dim dacl As IADsAccessControlList
Dim ace As AccessControlEntry

Dim propList As IADsPropertyList
Dim propEntry As IADsPropertyEntry

' create new ace
Set ace = New AccessControlEntry
With ace
.AceType = ADS_ACETYPE_ACCESS_ALLOWED
.Trustee = dnTrustee
.AccessMask = ADS_RIGHT_GENERIC_WRITE
End With

' retrieve the attribute object
Set propList = iadObj
propList.GetInfo
Set propEntry = propList.GetPropertyItem ( _
strAttribute, _
ADSTYPE_CASE_IGNORE_STRING )

' set the acl on that property
Set sd = ADsSecure.GetSecurityDescriptor(propEntry) ' BOOM!!!
Set dacl = sd.DiscretionaryAcl
dacl.AddAce ace
Set sd.DiscretionaryAcl = dacl
ADsSecure.SetSecurityDescriptor sd

End Sub
---------------------------------------------





 
Reply With Quote
 
 
 
 
Jeromy Statia [MSFT]
Guest
Posts: n/a
 
      4th Jul 2003
Hello bob, do you have the error code that it fails with?

that might help us out further

tx

Jeromy Statia [MSFT]

"Bob Weiner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have posted this to exchange2000.development and server.scripting

without
> success. Forgive me if I'm being pushy but I have a deadline rushing at
> me(like I'm the only one!).
>
> This doesn't seem to me to be an overly difficult question though I admit
> that I cannot figure it out. The fact that it can be done manually with

the
> ADUC makes me believe that it is scriptable.
>
> ********************************************************
>
> I need to give users the ability to update specific properties on AD

objects
> but am having trouble retrieving security descriptors on individual AD
> object attributes.
>
> I am using ADSI (of course) and ADsSecurity.dll to do this. My best

attempt
> thus far (which failed with a "catastrophic failure") is below.
>
> A pointer would be greatly appreciated.
>
> thanks,
> bob
>
> ---------------------------------------------
> Public Sub grant ( ByVal iadObj As IADs, _
> ByVal dnTrustee As String, _
> ByVal strAttribute as String )
>
> Dim sd As IADsSecurityDescriptor
> Dim dacl As IADsAccessControlList
> Dim ace As AccessControlEntry
>
> Dim propList As IADsPropertyList
> Dim propEntry As IADsPropertyEntry
>
> ' create new ace
> Set ace = New AccessControlEntry
> With ace
> .AceType = ADS_ACETYPE_ACCESS_ALLOWED
> .Trustee = dnTrustee
> .AccessMask = ADS_RIGHT_GENERIC_WRITE
> End With
>
> ' retrieve the attribute object
> Set propList = iadObj
> propList.GetInfo
> Set propEntry = propList.GetPropertyItem ( _
> strAttribute, _
> ADSTYPE_CASE_IGNORE_STRING )
>
> ' set the acl on that property
> Set sd = ADsSecure.GetSecurityDescriptor(propEntry) ' BOOM!!!
> Set dacl = sd.DiscretionaryAcl
> dacl.AddAce ace
> Set sd.DiscretionaryAcl = dacl
> ADsSecure.SetSecurityDescriptor sd
>
> End Sub
> ---------------------------------------------
>
>
>
>
>



 
Reply With Quote
 
Bob Weiner
Guest
Posts: n/a
 
      4th Jul 2003
Does this mean it should be working? Am I at least on the right track?

The "Boom!!!" line is terminating with Runtime Error 430, "Class does not
support automation or does not support expected interface." Can you get a
security descriptor on an IADsPropertyEntry object? I didn't see that in
the documentation, it just seemed like a reasonable thing to try.

The problem is actually worse. After getting the runtime error, if I chose
to debug, Visual Studio crashes with the Application error:
*** The instruction at "0x773be416" referenced memory at "0x000000019".
The memory could not be "read". ***
I have also seen a different intstruction address which failed trying to
write.

I am working with VS 6.0. The program I am using tonight is not fully
patched so I will apply sp5 and try again. This may correct the VS problem
though I doubt it will help my code.

thanks,
bob


"Jeromy Statia [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello bob, do you have the error code that it fails with?
>
> that might help us out further
>
> tx
>
> Jeromy Statia [MSFT]
>
> "Bob Weiner" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have posted this to exchange2000.development and server.scripting

> without
> > success. Forgive me if I'm being pushy but I have a deadline rushing at
> > me(like I'm the only one!).
> >
> > This doesn't seem to me to be an overly difficult question though I

admit
> > that I cannot figure it out. The fact that it can be done manually with

> the
> > ADUC makes me believe that it is scriptable.
> >
> > ********************************************************
> >
> > I need to give users the ability to update specific properties on AD

> objects
> > but am having trouble retrieving security descriptors on individual AD
> > object attributes.
> >
> > I am using ADSI (of course) and ADsSecurity.dll to do this. My best

> attempt
> > thus far (which failed with a "catastrophic failure") is below.
> >
> > A pointer would be greatly appreciated.
> >
> > thanks,
> > bob
> >
> > ---------------------------------------------
> > Public Sub grant ( ByVal iadObj As IADs, _
> > ByVal dnTrustee As String, _
> > ByVal strAttribute as String )
> >
> > Dim sd As IADsSecurityDescriptor
> > Dim dacl As IADsAccessControlList
> > Dim ace As AccessControlEntry
> >
> > Dim propList As IADsPropertyList
> > Dim propEntry As IADsPropertyEntry
> >
> > ' create new ace
> > Set ace = New AccessControlEntry
> > With ace
> > .AceType = ADS_ACETYPE_ACCESS_ALLOWED
> > .Trustee = dnTrustee
> > .AccessMask = ADS_RIGHT_GENERIC_WRITE
> > End With
> >
> > ' retrieve the attribute object
> > Set propList = iadObj
> > propList.GetInfo
> > Set propEntry = propList.GetPropertyItem ( _
> > strAttribute, _
> > ADSTYPE_CASE_IGNORE_STRING )
> >
> > ' set the acl on that property
> > Set sd = ADsSecure.GetSecurityDescriptor(propEntry) ' BOOM!!!
> > Set dacl = sd.DiscretionaryAcl
> > dacl.AddAce ace
> > Set sd.DiscretionaryAcl = dacl
> > ADsSecure.SetSecurityDescriptor sd
> >
> > End Sub
> > ---------------------------------------------
> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Bob Weiner
Guest
Posts: n/a
 
      4th Jul 2003
FYI: VS6 SP5 still crashes at the same line with the same application
error.

I'm not concerned with the VS problem; hopefully, I'll be moving on to
VS.Net after this project is off my desk.

bob



"Jeromy Statia [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello bob, do you have the error code that it fails with?
>
> that might help us out further
>
> tx
>
> Jeromy Statia [MSFT]
>
> "Bob Weiner" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have posted this to exchange2000.development and server.scripting

> without
> > success. Forgive me if I'm being pushy but I have a deadline rushing at
> > me(like I'm the only one!).
> >
> > This doesn't seem to me to be an overly difficult question though I

admit
> > that I cannot figure it out. The fact that it can be done manually with

> the
> > ADUC makes me believe that it is scriptable.
> >
> > ********************************************************
> >
> > I need to give users the ability to update specific properties on AD

> objects
> > but am having trouble retrieving security descriptors on individual AD
> > object attributes.
> >
> > I am using ADSI (of course) and ADsSecurity.dll to do this. My best

> attempt
> > thus far (which failed with a "catastrophic failure") is below.
> >
> > A pointer would be greatly appreciated.
> >
> > thanks,
> > bob
> >
> > ---------------------------------------------
> > Public Sub grant ( ByVal iadObj As IADs, _
> > ByVal dnTrustee As String, _
> > ByVal strAttribute as String )
> >
> > Dim sd As IADsSecurityDescriptor
> > Dim dacl As IADsAccessControlList
> > Dim ace As AccessControlEntry
> >
> > Dim propList As IADsPropertyList
> > Dim propEntry As IADsPropertyEntry
> >
> > ' create new ace
> > Set ace = New AccessControlEntry
> > With ace
> > .AceType = ADS_ACETYPE_ACCESS_ALLOWED
> > .Trustee = dnTrustee
> > .AccessMask = ADS_RIGHT_GENERIC_WRITE
> > End With
> >
> > ' retrieve the attribute object
> > Set propList = iadObj
> > propList.GetInfo
> > Set propEntry = propList.GetPropertyItem ( _
> > strAttribute, _
> > ADSTYPE_CASE_IGNORE_STRING )
> >
> > ' set the acl on that property
> > Set sd = ADsSecure.GetSecurityDescriptor(propEntry) ' BOOM!!!
> > Set dacl = sd.DiscretionaryAcl
> > dacl.AddAce ace
> > Set sd.DiscretionaryAcl = dacl
> > ADsSecure.SetSecurityDescriptor sd
> >
> > End Sub
> > ---------------------------------------------
> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding TextBox.Text to property in nested (multi levels) object withbindingsource, Error if grandchild object is NULL Efy Microsoft Dot NET 0 14th Oct 2009 11:06 AM
Binding to property of property of object collection TS Microsoft ASP .NET 3 31st Aug 2006 01:57 PM
Property of object to binding Boniek Microsoft C# .NET 2 6th Apr 2004 05:01 PM
Property of object to Binding Boniek Microsoft C# .NET 1 30th Mar 2004 10:00 AM
binding to a property within ad AD object for setting permissions? Bob Weiner Microsoft Windows 2000 Active Directory 3 4th Jul 2003 08:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:55 AM.