Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 07-07-06   #1 (permalink)
<= Humanaut
 
FrankenPC's Avatar
 
intel nvidia

Join Date: Jun 2006
Location: Bay Area
Posts: 5,548

Rep: 372 FrankenPC is a proven memberFrankenPC is a proven memberFrankenPC is a proven memberFrankenPC is a proven member
Unique Rep: 243
FAQs Submitted: 1
Trader Rating: 4
Default ADODB, DACL's and Exchange...oh my!

How in the heck do you get a DACL updated on a public folder in Exchange using ADODB. Here is the test code. I get an error: The parameter is incorrect. This is an ADODB error. BUT, this code was taken directly from an example from Microsoft. So, if THEY don't know how to use the security descriptor parameter...who does? Help me! I'm in hell!

Sub TestSecurity(ByVal RootFolder As String, ByVal FolderName As String, ByVal USER As String)

Dim con As New ADODB.Connection
Dim rec As New ADODB.Record
Dim fld As ADODB.Field
Dim strDomainName As String
Dim strLocalPath As String
Dim strURL As String

USER = "NETELELECTRONICA\" & USER

'Create URL to folder
strDomainName = "NETELECTRONICA.LOCAL"
strLocalPath = "public folders/CLIENTS/" & FolderName
strURL = "file://./backofficestorage/" & strDomainName & "/" & strLocalPath

'Explicit connection for testing
con.Provider = "ExOLEDB.Datasource"
con.ConnectionString = strURL
con.Open()

'Great for dumping the existing DACL list
rec.Open(strURL, con)

'List the SD as XML
fld = rec.Fields("http://schemas.microsoft.com/exchange/security/descriptor")
'MsgBox(fld.Value)

rec.Close()

'Open it again
rec.Open(strURL, con, ADODB.ConnectModeEnum.adModeReadWrite)

'Modify SD
'Owner masks
'Dim allowedAccessMask As String = "1fc9bf"
'Dim deniedAccessMask As String = "0"
'Dim subContainerAllowedAccessMask As String = "1fc9bf"
'Dim subContainerDeniedAccessMask As String = "0"
'Dim subItemAllowedAccessMask As String = "1f0fbf"
'Dim subItemDeniedAccessMask As String = "0"
'Visible masks
'Dim allowedAccessMask As String = "1208a9"
'Dim deniedAccessMask As String = "dc916"
'Dim subContainerAllowedAccessMask As String = "1208a9"
'Dim subContainerDeniedAccessMask As String = "dc916"
'Dim subItemAllowedAccessMask As String = "0"
'Dim subItemDeniedAccessMask As String = "1f0fbf"

Dim allowedAccessMask As String = "1208a9"
Dim deniedAccessMask As String = "dc916"
Dim subContainerAllowedAccessMask As String = "1208a9"
Dim subContainerDeniedAccessMask As String = "dc916"
Dim subItemAllowedAccessMask As String = "0"
Dim subItemDeniedAccessMask As String = "1f0fbf"

Dim effectiveAce As String

effectiveAce = "" & _
"<S:access_allowed_ace S:inherited=""0"">" & _
"<S:access_mask>" & allowedAccessMask & "</S:access_mask>" & _
"<S:sid>" & _
"<S:nt4_compatible_name>" & USER & "</S:nt4_compatible_name>" & _
"</S:sid>" & _
"</S:access_allowed_ace>" & _
"<S:access_denied_ace S:inherited=""0"">" & _
"<S:access_mask>" & deniedAccessMask & "</S:access_mask>" & _
"<S:sid>" & _
"<S:nt4_compatible_name>" & USER & "</S:nt4_compatible_name>" & _
"</S:sid>" & _
"</S:access_denied_ace>"

Dim SubContainerAce As String

SubContainerAce = "" & _
"<S:access_allowed_ace S:inherited=""0"" S:no_propagate_inherit=""0"">" & _
"<S:access_mask>" & subContainerAllowedAccessMask & "</S:access_mask>" & _
"<S:sid>" & _
"<S:nt4_compatible_name>" & USER & "</S:nt4_compatible_name>" & _
"</S:sid>" & _
"</S:access_allowed_ace>" & _
"<S:access_denied_ace S:inherited=""0"" S:no_propagate_inherit=""0"">" & _
"<S:access_mask>" & subContainerDeniedAccessMask & "</S:access_mask>" & _
"<S:sid>" & _
"<S:nt4_compatible_name>" & USER & "</S:nt4_compatible_name>" & _
"</S:sid>" & _
"</S:access_denied_ace>"

Dim SubItemAce As String

SubItemAce = "" & _
"<S:access_allowed_ace S:inherited=""1"" S:no_propagate_inherit=""0"">" & _
"<S:access_mask>" & subItemAllowedAccessMask & "</S:access_mask>" & _
"<S:sid>" & _
"<S:nt4_compatible_name>" & USER & "</S:nt4_compatible_name>" & _
"</S:sid>" & _
"</S:access_allowed_ace>" & _
"<S:access_denied_ace S:inherited=""1"" S:no_propagate_inherit=""0"">" & _
"<S:access_mask>" & subItemDeniedAccessMask & "</S:access_mask>" & _
"<S:sid>" & _
"<S:nt4_compatible_name>" & USER & "</S:nt4_compatible_name>" & _
"</S:sid>" & _
"</S:access_denied_ace>"

Dim Descriptor As String

Descriptor = "" & _
"<E:descriptor " & _
"xmlns:E=""http://schemas.microsoft.com/exchange/security"" " & _
"xmlns:S=""http://schemas.microsoft.com/security"" " & _
"xmlns=""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882"" " & _
"D:dt=""microsoft.security_descriptor"">" & _
"<S:security_descriptor xmlns:S=""http://schemas.microsoft.com/security/"" xmlns=""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"" D:dt=""microsoft.security_descriptor"" S:from_mapi_tlh=""1"">" & _
"<S:dacl S:defaulted=""0"" Srotected=""0"" S:autoinherited=""1"">" & _
"<S:revision>2</S:revision>" & _
"<S:effective_aces>" & effectiveAce & "</S:effective_aces>" & _
"<S:subcontainer_inheritable_aces>" & SubContainerAce & "</S:subcontainer_inheritable_aces>" & _
"<S:subitem_inheritable_aces>" & SubItemAce & "</S:subitem_inheritable_aces>" & _
"</S:dacl>" & _
"</S:security_descriptor>" & _
"</E:descriptor>"

rec.Fields.Append("http://schemas.microsoft.com/exchange/security/descriptor", ADODB.DataTypeEnum.adBSTR, Len(Descriptor), , Descriptor)

Try
rec.Fields.Update()
Catch ex As Exception
MsgBox(ex.Message) 'Message:The parameter is Incorrect
End Try

'Close it
rec.Close()
con.Close()

End Sub
__________________
Previous Member of Team Owners - 1st to hit 200k and 250K

Previous member of Rough Riders - 1st to hit 300k!!!

Adios everyone! I've been proud to be a member of Owners and Riders.

System: TITAN-2
CPU
Q6600 G0 @ 3.4GHZ
Motherboard
ASUS P5K-E
Memory
4GB GSkill DDR2-1000 CAS5
Graphics Card
BFG 8800GT OC
Hard Drive
340GB Raptor SATA II
Sound Card
SB X-FI
Power Supply
SilverStone 750W 4-rail
Case
Lian Li Mid-tower
CPU cooling
OCZ Vindicator
GPU cooling
Stock
OS
Vista Home Premium 32bit
Monitor
Sceptre 24" LCD
FrankenPC is offline Overclocked Account   Reply With Quote
Old 07-07-06   #2 (permalink)
ETERNAL SUNSHINE
 
ENTERPRISE's Avatar
 
intel nvidia

Join Date: Oct 2004
Location: Gravenhurst,UK
Posts: 38,184

FAQs Submitted: 11
Folding Team Rank: 479
Hardware Reviews: 16
Trader Rating: 7
Default

This is a question for a Coding or programmer person really . Anyone ?
__________________
Quote:
Gordon, the whole world has been taken over by a race of malevolent aliens. All of humanity is depending on you. Here's a goddamned crowbar.
Fold For The Cause ! Fold For The People

System: CyberDruids TS ENTERPRISE Edition!Folding Goodness
CPU
E6750 G0 @ 3.7Ghz Vcore 1.43
Motherboard
ASUS P5Q P45 Chipset
Memory
4GB Patriot + Kingston DDR2 800Mhz @ 911Mhz
Graphics Card
eVGA 8800GTS 320MB Flashed 700/1800/2100
Hard Drive
Seagate 250GB SATA 2 + 120GB BKUP
Sound Card
Creative Audigy 4
Power Supply
Corsair HX 520Watt Modular
Case
CyberDruid TechStation V3
CPU cooling
DTEK FuZion WB + MCR320 RAD
GPU cooling
SwiftTech MCW60 WB
OS
Windows Vista Ultimate X64
Monitor
Advent 15"
ENTERPRISE is online now I fold for Overclock.net Overclocked Account   Reply With Quote
Old 07-07-06   #3 (permalink)
<= Humanaut
 
FrankenPC's Avatar
 
intel nvidia

Join Date: Jun 2006
Location: Bay Area
Posts: 5,548

Rep: 372 FrankenPC is a proven memberFrankenPC is a proven memberFrankenPC is a proven memberFrankenPC is a proven member
Unique Rep: 243
FAQs Submitted: 1
Trader Rating: 4
Default

I think I got a good answer from Microsoft...I have to convert the existing XML security descriptor into a XMLDOM object and add the new security nodes manually. Then re-save the whole XML blob back into the Exchange database. (sounds of newspaper and wind). Anyway, if anyone ever tries exchange programming, I have some experience.
__________________
Previous Member of Team Owners - 1st to hit 200k and 250K

Previous member of Rough Riders - 1st to hit 300k!!!

Adios everyone! I've been proud to be a member of Owners and Riders.

System: TITAN-2
CPU
Q6600 G0 @ 3.4GHZ
Motherboard
ASUS P5K-E
Memory
4GB GSkill DDR2-1000 CAS5
Graphics Card
BFG 8800GT OC
Hard Drive
340GB Raptor SATA II
Sound Card
SB X-FI
Power Supply
SilverStone 750W 4-rail
Case
Lian Li Mid-tower
CPU cooling
OCZ Vindicator
GPU cooling
Stock
OS
Vista Home Premium 32bit
Monitor
Sceptre 24" LCD
FrankenPC is offline Overclocked Account   Reply With Quote
Old 07-07-06   #4 (permalink)
<3 TB303
 
Xaimus's Avatar
 
amd nvidia

Join Date: Dec 2004
Location: Manhattan, KS
Posts: 575

Trader Rating: 0
Default

I think I'm going to do my best to stay far, far away from Exchange. : D
__________________
3030303030303030303 <33333333

System: Turd
CPU
Sempron 2800+ :(
Motherboard
GA7NF-RZ :(
Memory
1.25GB
Graphics Card
geForce 6800XT
Hard Drive
80GB + 120GB
Sound Card
M-Audio Audiophile 192 :D
Power Supply
500W Seasonic S12
Case
Black Antec P180 :D
OS
FreeBSD 6.2-RELEASE :D :D
Monitor
Two 17" CRTs
Xaimus is offline Overclocked Account   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 11:53 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.26605 seconds with 8 queries