#include <sd.h>
Collaboration diagram for fksec::sd:

Public Types | |
| enum | AbsOrRel { AbsoluteSD, SelfRelativeSD } |
Public Methods | |
| sd () | |
| sd ( const sd &s ) | |
| sd ( SECURITY_DESCRIPTOR *s ) | |
| sd ( SECURITY_DESCRIPTOR_RELATIVE *s ) | |
| sd ( WORD newControl, const PSID newOwner, const PSID newGroup, ACL *newDacl, ACL *newSacl ) | |
| virtual | ~sd () |
| const sd& | operator= ( const sd &s ) |
| const sd& | operator= ( SECURITY_DESCRIPTOR *s ) |
| const sd& | operator= ( SECURITY_DESCRIPTOR_RELATIVE *s ) |
| operator SECURITY_DESCRIPTOR * () const | |
| operator SECURITY_DESCRIPTOR_RELATIVE * () const | |
| WORD | GetControl () const |
| DWORD | GetRevision () const |
| get SD revision. More... | |
| SECURITY_INFORMATION | GetSecurityInformation () const |
| const sid& | GetOwnerSid () const |
| sid& | GetOwnerSid () |
| const sid& | GetGroupSid () const |
| sid& | GetGroupSid () |
| const acl& | GetDacl () const |
| acl& | GetDacl () |
| const acl& | GetSacl () const |
| acl& | GetSacl () |
| void | SetControl ( WORD newControl ) |
| void | ClearOwnerSid () |
| void | SetOwnerSid ( const sid &newSid ) |
| void | SetOwnerSid ( const PSID psid ) |
| void | SetOwnerSid ( const TCHAR *stringSid ) |
| void | ClearGroupSid () |
| void | SetGroupSid ( const sid &newSid ) |
| void | SetGroupSid ( const PSID psid ) |
| void | SetGroupSid ( const TCHAR *stringSid ) |
| void | ClearDacl () |
| void | SetDacl ( const acl &newAcl ) |
| void | SetDacl ( ACL *newAcl ) |
| bool | GetDaclProtection () const |
| void | SetDaclProtection ( bool newProtection ) |
| void | ClearSacl () |
| void | SetSacl ( const acl &newAcl ) |
| void | SetSacl ( ACL *newAcl ) |
| bool | GetSaclProtection () const |
| void | SetSaclProtection ( bool newProtection ) |
| DWORD | GetLength () const |
| void | StoreSd ( SECURITY_DESCRIPTOR *p, DWORD &sz, AbsOrRel sdtype = AbsoluteSD ) const |
| bool | IsValid ( bool checkPSD = true ) const |
| bool | IsObjectSD () const |
Private Methods | |
| void | Init () |
| void | ClearPSD () |
| void | ReleasePSD () |
| void | MakePSD () const |
Private Attributes | |
| WORD | control |
| DWORD | revision |
| bool | haveOwnerSid |
| fksec::sid | ownerSid |
| bool | haveGroupSid |
| fksec::sid | groupSid |
| bool | haveDacl |
| bool | protectedDacl |
| fksec::acl | dacl |
| bool | haveSacl |
| bool | protectedSacl |
| fksec::acl | sacl |
| bool | haveAbsoluteSD |
| SECURITY_DESCRIPTOR* | absoluteSD |
| bool | haveSelfRelativeSD |
| SECURITY_DESCRIPTOR* | selfRelativeSD |
Static Private Attributes | |
| fksec::sid | invalidSid |
| fksec::acl | invalidAcl |
Friends | |
| fkostream& | operator<< ( fkostream &o, const sd &s ) |
|
|
Definition at line 17 of file sd.h. 00017 { AbsoluteSD, SelfRelativeSD }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 63 of file sd.cpp. 00064 {
00065
00066 ClearPSD();
00067 Init();
00068
00069 try { SetControl( newControl ); }
00070 RETHROWEX( "sd::sd(components): sd::SetControl() complained" );
00071
00072 if ( newOwner != 0 )
00073 {
00074 try { ownerSid = newOwner; }
00075 RETHROWEX( "sd::sd(components): invalid owner SID" );
00076 haveOwnerSid = true;
00077 }
00078 else
00079 haveOwnerSid = false;
00080
00081 if ( newGroup != 0 )
00082 {
00083 try { groupSid = newGroup; }
00084 RETHROWEX( "sd::sd(components): invalid owner SID" );
00085 haveGroupSid = true;
00086 }
00087 else
00088 haveGroupSid = false;
00089
00090 if ( newDacl != 0 )
00091 {
00092 try { dacl = newDacl; }
00093 RETHROWEX( "sd::sd(components): cannot copy DACL" );
00094 haveDacl = true;
00095 protectedDacl = ( newControl & SE_DACL_PROTECTED ) != 0;
00096 }
00097 else
00098 haveDacl = protectedDacl = false;
00099
00100 if ( newSacl != 0 )
00101 {
00102 try { sacl = newSacl; }
00103 RETHROWEX( "sd::sd(components): cannot copy SACL" );
00104 haveSacl = true;
00105 protectedSacl = ( newControl & SE_SACL_PROTECTED ) != 0;
00106 }
00107 else
00108 haveSacl = protectedSacl = false;
00109 }
|
|
|
Definition at line 113 of file sd.cpp. 00114 {
00115 ReleasePSD();
00116 }
|
|
|
Definition at line 494 of file sd.cpp. 00495 {
00496 haveDacl = false;
00497 control &= ~ ( SE_DACL_PRESENT | SE_DACL_DEFAULTED );
00498 ReleasePSD();
00499 }
|
|
|
Definition at line 444 of file sd.cpp. 00445 {
00446 haveGroupSid = false;
00447 control &= ~ SE_GROUP_DEFAULTED;
00448 ReleasePSD();
00449 }
|
|
|
Definition at line 395 of file sd.cpp. 00396 {
00397 haveOwnerSid = false;
00398 control &= ~ SE_OWNER_DEFAULTED;
00399 ReleasePSD();
00400 }
|
|
|
Definition at line 815 of file sd.cpp. 00816 {
00817 absoluteSD = 0;
00818 haveAbsoluteSD = false;
00819 selfRelativeSD = 0;
00820 haveSelfRelativeSD = false;
00821 }
|
|
|
Definition at line 545 of file sd.cpp. 00546 {
00547 haveSacl = false;
00548 control &= ~ ( SE_SACL_PRESENT | SE_SACL_DEFAULTED );
00549 ReleasePSD();
00550 }
|
|
|
Definition at line 266 of file sd.cpp. 00267 {
00268 WORD c = control;
00269
00270 if ( haveDacl )
00271 c |= SE_DACL_PRESENT;
00272 else
00273 c &= ~SE_DACL_PRESENT;
00274 if ( protectedDacl )
00275 c |= SE_DACL_PROTECTED;
00276
00277 if ( haveSacl )
00278 c |= SE_SACL_PRESENT;
00279 else
00280 c &= ~SE_SACL_PRESENT;
00281 if ( protectedSacl )
00282 c |= SE_SACL_PROTECTED;
00283
00284 if ( haveOwnerSid )
00285 c &= ~ SE_OWNER_DEFAULTED;
00286 else
00287 c |= SE_OWNER_DEFAULTED;
00288
00289 if ( haveGroupSid )
00290 c &= ~ SE_GROUP_DEFAULTED;
00291 else
00292 c |= SE_GROUP_DEFAULTED;
00293
00294 if ( c & SE_DACL_AUTO_INHERITED )
00295 c |= SE_DACL_AUTO_INHERIT_REQ;
00296
00297 if ( c & SE_SACL_AUTO_INHERITED )
00298 c |= SE_SACL_AUTO_INHERIT_REQ;
00299
00300 return c;
00301 }
|
|
|
Definition at line 363 of file sd.cpp. 00364 {
00365 ReleasePSD();
00366 return haveDacl? dacl: invalidAcl;
00367 }
|
|
|
Definition at line 357 of file sd.cpp. 00358 {
00359 return haveDacl? dacl: invalidAcl;
00360 }
|
|
|
Definition at line 530 of file sd.cpp. 00531 {
00532 return haveDacl? protectedDacl: false;
00533 }
|
|
|
Definition at line 349 of file sd.cpp. 00350 {
00351 ReleasePSD();
00352 return haveGroupSid? groupSid: invalidSid;
00353 }
|
|
|
Definition at line 343 of file sd.cpp. 00344 {
00345 return haveGroupSid? groupSid: invalidSid;
00346 }
|
|
|
Definition at line 630 of file sd.cpp. 00631 {
00632 DWORD l;
00633
00634 l = sizeof SECURITY_DESCRIPTOR;
00635 if ( haveOwnerSid )
00636 try { l += ownerSid.GetLength(); }
00637 RETHROWEX( "sd::GetLength(): cannot size owner SID" )
00638 if ( haveGroupSid )
00639 try { l += groupSid.GetLength(); }
00640 RETHROWEX( "sd::GetLength(): cannot size group SID" )
00641 if ( haveDacl )
00642 try { l += dacl.GetSize(); }
00643 RETHROWEX( "sd::GetLength(): cannot size DACL" )
00644 if ( haveSacl )
00645 try { l += sacl.GetSize(); }
00646 RETHROWEX( "sd::GetLength(): cannot size SACL" )
00647
00648 return l;
00649 }
|
|
|
Definition at line 335 of file sd.cpp. 00336 {
00337 ReleasePSD();
00338 return haveOwnerSid? ownerSid: invalidSid;
00339 }
|
|
|
Definition at line 329 of file sd.cpp. 00330 {
00331 return haveOwnerSid? ownerSid: invalidSid;
00332 }
|
|
|
get SD revision.
Definition at line 304 of file sd.cpp. 00305 {
00306 return revision;
00307 }
|
|
|
Definition at line 377 of file sd.cpp. 00378 {
00379 ReleasePSD();
00380 return haveSacl? sacl: invalidAcl;
00381 }
|
|
|
Definition at line 371 of file sd.cpp. 00372 {
00373 return haveSacl? sacl: invalidAcl;
00374 }
|
|
|
Definition at line 581 of file sd.cpp. 00582 {
00583 return haveSacl? protectedSacl: false;
00584 }
|
|
|
Definition at line 311 of file sd.cpp. 00312 {
00313 SECURITY_INFORMATION i = 0;
00314
00315 if ( haveOwnerSid )
00316 i |= OWNER_SECURITY_INFORMATION;
00317 if ( haveGroupSid )
00318 i |= GROUP_SECURITY_INFORMATION;
00319 if ( haveDacl )
00320 i |= protectedDacl? PROTECTED_DACL_SECURITY_INFORMATION: DACL_SECURITY_INFORMATION;
00321 if ( haveSacl )
00322 i |= protectedSacl? PROTECTED_SACL_SECURITY_INFORMATION: SACL_SECURITY_INFORMATION;
00323
00324 return i;
00325 }
|
|
|
Definition at line 803 of file sd.cpp. 00804 {
00805 ClearPSD();
00806 control = 0;
00807 revision = SECURITY_DESCRIPTOR_REVISION;
00808 haveOwnerSid = haveGroupSid =
00809 haveDacl = protectedDacl =
00810 haveSacl = protectedSacl = false;
00811 }
|
|
|
Definition at line 788 of file sd.cpp. 00789 {
00790 if ( haveDacl )
00791 if ( dacl.IsObjectACL() )
00792 return true ;
00793
00794 if ( haveSacl )
00795 if ( dacl.IsObjectACL() )
00796 return true ;
00797
00798 return false ;
00799 }
|
|
|
Definition at line 747 of file sd.cpp. 00748 {
00749 // checkPSD is set to false in the IsValid() call in MakePSD()/StoreSd()
00750 // otherwise, infinite recursion ruins your day
00751 try
00752 {
00753 if ( haveOwnerSid )
00754 if ( ! ownerSid.IsValid() )
00755 return false;
00756
00757 if ( haveGroupSid )
00758 if ( ! groupSid.IsValid() )
00759 return false;
00760
00761 if ( haveDacl )
00762 if ( ! dacl.IsValid() )
00763 return false;
00764
00765 if ( haveSacl )
00766 if ( ! sacl.IsValid() )
00767 return false;
00768
00769 if ( checkPSD )
00770 {
00771 this->MakePSD();
00772 if ( ! ::IsValidSecurityDescriptor( absoluteSD ) )
00773 return false;
00774 if ( ! ::IsValidSecurityDescriptor( selfRelativeSD ) )
00775 return false;
00776 }
00777 }
00778 catch ( ex *e )
00779 {
00780 delete e;
00781 return false;
00782 }
00783
00784 return true;
00785 }
|
|
|
Definition at line 843 of file sd.cpp. 00844 {
00845 DWORD sz = (DWORD) -1;
00846
00847 if ( ! haveAbsoluteSD )
00848 {
00849 try { sz = GetLength(); }
00850 RETHROWEX( "sd::MakePSD() absolute: cannot size SD" )
00851
00852 absoluteSD = (SECURITY_DESCRIPTOR *) new byte[sz];
00853 if ( absoluteSD == 0 )
00854 throw NEWEX( errNoMemory, "sd::MakePSD() absolute: no memory for SD buffer" );
00855
00856 try { StoreSd( absoluteSD, sz, AbsoluteSD ); }
00857 catch ( ex *e )
00858 {
00859 e->FKSECADDHOP( "sd::MakePSD() absolute: sd::StoreSd() failed" );
00860 delete (byte *) absoluteSD;
00861 throw;
00862 }
00863
00864 haveAbsoluteSD = true;
00865 }
00866
00867 if ( ! haveSelfRelativeSD )
00868 {
00869 if ( sz == (DWORD) -1 )
00870 try { sz = GetLength(); }
00871 RETHROWEX( "sd::MakePSD() self-relative: cannot size SD" )
00872
00873 selfRelativeSD = (SECURITY_DESCRIPTOR *) new byte[sz];
00874 if ( selfRelativeSD == 0 )
00875 throw NEWEX( errNoMemory, "sd::MakePSD() self-relative: no memory for SD buffer" );
00876
00877 try { StoreSd( selfRelativeSD, sz, SelfRelativeSD ); }
00878 catch ( ex *e )
00879 {
00880 e->FKSECADDHOP( "sd::MakePSD() self-relative: sd::StoreSd() failed" );
00881 delete (byte *) selfRelativeSD;
00882 throw;
00883 }
00884
00885 haveSelfRelativeSD = true;
00886 }
00887 }
|
|
|
Definition at line 825 of file sd.cpp. 00826 {
00827 if ( haveAbsoluteSD )
00828 {
00829 delete [] (byte *) absoluteSD;
00830 absoluteSD = 0;
00831 haveAbsoluteSD = false;
00832 }
00833 if ( haveSelfRelativeSD )
00834 {
00835 delete [] (byte *) selfRelativeSD;
00836 selfRelativeSD = 0;
00837 haveSelfRelativeSD = false;
00838 }
00839 }
|
|
|
Definition at line 386 of file sd.cpp. 00387 {
00388 ReleasePSD();
00389 control = newControl & ~ ( SE_DACL_PRESENT | SE_SACL_PRESENT |
00390 SE_DACL_PROTECTED | SE_SACL_PROTECTED | SE_SELF_RELATIVE );
00391 }
|
|
|
Definition at line 512 of file sd.cpp. 00513 {
00514 if ( newAcl != 0 )
00515 {
00516 try { dacl = newAcl; }
00517 RETHROWEX( "sd::SetDacl(ACL *): assignment failed" )
00518 control |= SE_DACL_PRESENT;
00519 haveDacl = true;
00520 }
00521 else
00522 {
00523 haveDacl = false;
00524 control &= ~ ( SE_DACL_PRESENT | SE_DACL_DEFAULTED );
00525 }
00526 ReleasePSD();
00527 }
|
|
|
Definition at line 502 of file sd.cpp. 00503 {
00504 try { dacl = newAcl; }
00505 RETHROWEX( "sd::SetDacl(const acl &): assignment failed" )
00506 haveDacl = true;
00507 control |= SE_DACL_PRESENT;
00508 ReleasePSD();
00509 }
|
|
|
Definition at line 536 of file sd.cpp. 00537 {
00538 ReleasePSD();
00539 protectedDacl = newProtection;
00540 }
|
|
|
Definition at line 477 of file sd.cpp. 00478 {
00479 if ( stringSid != 0 )
00480 {
00481 try { groupSid = stringSid; }
00482 RETHROWEX( "sd::SetGroupSid(const TCHAR *): assignment failed" )
00483 haveGroupSid = true;
00484 }
00485 else
00486 haveGroupSid = false;
00487 control &= ~ SE_GROUP_DEFAULTED;
00488 ReleasePSD();
00489 }
|
|
|
Definition at line 462 of file sd.cpp. 00463 {
00464 if ( psid != 0 )
00465 {
00466 try { groupSid = psid; }
00467 RETHROWEX( "sd::SetGroupSid(const PSID): assignment failed" )
00468 haveGroupSid = true;
00469 }
00470 else
00471 haveGroupSid = false;
00472 control &= ~ SE_GROUP_DEFAULTED;
00473 ReleasePSD();
00474 }
|
|
|
Definition at line 452 of file sd.cpp. 00453 {
00454 try { groupSid = newSid; }
00455 RETHROWEX( "sd::SetGroupSid(const sid &): assignment failed" )
00456 haveGroupSid = true;
00457 control &= ~ SE_GROUP_DEFAULTED;
00458 ReleasePSD();
00459 }
|
|
|
Definition at line 428 of file sd.cpp. 00429 {
00430 if ( stringSid != 0 )
00431 {
00432 try { ownerSid = stringSid; }
00433 RETHROWEX( "sd::SetOwnerSid(const TCHAR *): assignment failed" )
00434 haveOwnerSid = true;
00435 }
00436 else
00437 haveOwnerSid = false;
00438 control &= ~ SE_OWNER_DEFAULTED;
00439 ReleasePSD();
00440 }
|
|
|
Definition at line 413 of file sd.cpp. 00414 {
00415 if ( psid != 0 )
00416 {
00417 try { ownerSid = psid; }
00418 RETHROWEX( "sd::SetOwnerSid(const PSID): assignment failed" )
00419 haveOwnerSid = true;
00420 }
00421 else
00422 haveOwnerSid = false;
00423 control &= ~ SE_OWNER_DEFAULTED;
00424 ReleasePSD();
00425 }
|
|
|
Definition at line 403 of file sd.cpp. 00404 {
00405 try { ownerSid = newSid; }
00406 RETHROWEX( "sd::SetOwnerSid(const sid &): assignment failed" )
00407 haveOwnerSid = true;
00408 control &= ~ SE_OWNER_DEFAULTED;
00409 ReleasePSD();
00410 }
|
|
|
Definition at line 563 of file sd.cpp. 00564 {
00565 if ( newAcl != 0 )
00566 {
00567 try { sacl = newAcl; }
00568 RETHROWEX( "sd::SetSacl(ACL *): assignment failed" )
00569 control |= SE_SACL_PRESENT;
00570 haveSacl = true;
00571 }
00572 else
00573 {
00574 haveSacl = false;
00575 control &= ~ ( SE_SACL_PRESENT | SE_SACL_DEFAULTED );
00576 }
00577 ReleasePSD();
00578 }
|
|
|
Definition at line 553 of file sd.cpp. 00554 {
00555 try { sacl = newAcl; }
00556 RETHROWEX( "sd::SetSacl(const acl &): assignment failed" )
00557 control |= SE_SACL_PRESENT;
00558 haveSacl = true;
00559 ReleasePSD();
00560 }
|
|
|
Definition at line 587 of file sd.cpp. 00588 {
00589 ReleasePSD();
00590 protectedSacl = newProtection;
00591 }
|
|
|
Definition at line 653 of file sd.cpp. 00654 {
00655 byte *next;
00656 PSID locOwner, locGroup;
00657 PACL locDacl, locSacl;
00658 DWORD l;
00659
00660 if ( ! IsValid( false ) )
00661 throw NEWEX( errInvalidSD, "sd::StoreSd(): invalid SD" );
00662
00663 try { l = GetLength(); }
00664 RETHROWEX( "sd::StoreSd(): cannot compute required buffer size" )
00665
00666 if ( sz < l )
00667 throw new ex( _T( __FILE__ ), __LINE__, errBufferTooSmall,
00668 _T( "sd::StoreSd(): insufficient buffer, see ex::GetData() for required size" ), 0, l );
00669
00670 if ( ! ::InitializeSecurityDescriptor( p, revision ) )
00671 throw NEWEX32( errInvalidSD, "sd::StoreSD(): InitializeSecurityDescriptor() failed inexplicably", GetLastError() );
00672
00673 next = (byte *) &p[1]; // point to right after the SD header
00674 locOwner = locGroup = locDacl = locSacl = 0;
00675
00676 if ( haveOwnerSid )
00677 {
00678 try
00679 {
00680 l = ownerSid.GetLength();
00681 locOwner = (PSID) next;
00682 ownerSid.StoreSid( locOwner, l );
00683 next += l;
00684 }
00685 RETHROWEX( "sd::StoreSd(): cannot size or store owner SID" )
00686 }
00687
00688 if ( haveGroupSid )
00689 {
00690 try
00691 {
00692 l = groupSid.GetLength();
00693 locGroup = (PSID) next;
00694 groupSid.StoreSid( locGroup, l );
00695 next += l;
00696 }
00697 RETHROWEX( "sd::StoreSd(): cannot size or store group SID" )
00698 }
00699
00700 if ( haveDacl )
00701 {
00702 try
00703 {
00704 l = dacl.GetSize();
00705 locDacl = (PACL) next;
00706 dacl.StoreAcl( locDacl, l );
00707 next += l;
00708 }
00709 RETHROWEX( "sd::StoreSd(): cannot size or store DACL" )
00710 }
00711
00712 if ( haveSacl )
00713 {
00714 try
00715 {
00716 l = sacl.GetSize();
00717 locSacl = (PACL) next;
00718 sacl.StoreAcl( locSacl, l );
00719 next += l;
00720 }
00721 RETHROWEX( "sd::StoreSd(): cannot size or store SACL" )
00722 }
00723
00724 try { p->Control |= GetControl(); }
00725 RETHROWEX( "sd::StoreSd(): sd::GetControl() failed, but why?" )
00726
00727 if ( sdtype == AbsoluteSD )
00728 {
00729 p->Control &= ~ SE_SELF_RELATIVE;
00730 p->Owner = locOwner;
00731 p->Group = locGroup;
00732 p->Dacl = locDacl;
00733 p->Sacl = locSacl;
00734 }
00735 else
00736 {
00737 p->Control |= SE_SELF_RELATIVE;
00738 p->Owner = (PSID) ( locOwner == 0? 0: (byte *) locOwner - (byte *) p );
00739 p->Group = (PSID) ( locGroup == 0? 0: (byte *) locGroup - (byte *) p );
00740 p->Dacl = (PACL) ( locDacl == 0? 0: (byte *) locDacl - (byte *) p );
00741 p->Sacl = (PACL) ( locSacl == 0? 0: (byte *) locSacl - (byte *) p );
00742 }
00743 }
|
|
|
|
|
|
|
|
|
Definition at line 233 of file sd.cpp. 00234 {
00235 try { *this = (SECURITY_DESCRIPTOR *) s; }
00236 RETHROWEX( "sd::operator=(SECURITY_DESCRIPTOR_RELATIVE *): cannot copy source SD" )
00237
00238 return *this;
00239 }
|
|
|
Definition at line 151 of file sd.cpp. 00152 {
00153 BOOL defaulted, present;
00154 PSID psid;
00155 PACL pacl;
00156 DWORD rev;
00157 WORD c;
00158
00159 if ( ( haveAbsoluteSD && absoluteSD == s ) ||
00160 ( haveSelfRelativeSD && selfRelativeSD == s ) )
00161 return *this;
00162
00163 ReleasePSD();
00164 Init();
00165
00166 if ( ::GetSecurityDescriptorControl( s, &c, &rev ) )
00167 {
00168 SetControl( c );
00169 revision = rev;
00170 }
00171 else
00172 throw NEWEX32( errUnreadableSD, "sd::operator=(SECURITY_DESCRIPTOR *): cannot read control word, see ex::GetErrWin32()",
00173 GetLastError() );
00174
00175 psid = 0;
00176 if ( ::GetSecurityDescriptorOwner( s, &psid, &defaulted ) && psid != 0 )
00177 {
00178 ownerSid = psid;
00179 haveOwnerSid = true;
00180 if ( defaulted )
00181 control |= SE_OWNER_DEFAULTED;
00182 }
00183 else
00184 haveOwnerSid = false;
00185
00186 psid = 0;
00187 if ( ::GetSecurityDescriptorGroup( s, &psid, &defaulted ) && psid != 0 )
00188 {
00189 groupSid = psid;
00190 haveGroupSid = true;
00191 if ( defaulted )
00192 control |= SE_GROUP_DEFAULTED;
00193 }
00194 else
00195 haveGroupSid = false;
00196
00197 pacl = 0;
00198 if ( ::GetSecurityDescriptorDacl( s, &present, &pacl, &defaulted ) )
00199 {
00200 if ( present && pacl != 0 )
00201 {
00202 try { dacl = pacl; }
00203 RETHROWEX( "sd::operator=(SECURITY_DESCRIPTOR *): cannot copy DACL" );
00204 haveDacl = true;
00205 protectedDacl = ( c & SE_DACL_PROTECTED ) != 0;
00206 }
00207 else
00208 haveDacl = protectedDacl = false;
00209 }
00210 else
00211 throw NEWEX32( errUnreadableSD, "sd::operator=(SECURITY_DESCRIPTOR *): cannot read DACL, see ex::GetErrWin32()", GetLastError() );
00212
00213 pacl = 0;
00214 if ( ::GetSecurityDescriptorSacl( s, &present, &pacl, &defaulted ) )
00215 {
00216 if ( present && pacl != 0 )
00217 {
00218 try { sacl = pacl; }
00219 RETHROWEX( "sd::operator=(SECURITY_DESCRIPTOR *): cannot copy SACL" );
00220 haveSacl = true;
00221 protectedSacl = ( c & SE_SACL_PROTECTED ) != 0;
00222 }
00223 else
00224 haveSacl = protectedSacl = false;
00225 }
00226 else
00227 throw NEWEX32( errUnreadableSD, "sd::operator=(SECURITY_DESCRIPTOR *): cannot read SACL, see ex::GetErrWin32()", GetLastError() );
00228
00229 return *this;
00230 }
|
|
|
Definition at line 123 of file sd.cpp. 00124 {
00125 if ( this != &s )
00126 {
00127 ClearPSD();
00128 try
00129 {
00130 control = s.control;
00131 revision = s.revision;
00132 haveOwnerSid = s.haveOwnerSid;
00133 ownerSid = s.ownerSid;
00134 haveGroupSid = s.haveGroupSid;
00135 groupSid = s.groupSid;
00136 haveDacl = s.haveDacl;
00137 protectedDacl = s.protectedDacl;
00138 dacl = s.dacl;
00139 haveSacl = s.haveSacl;
00140 protectedSacl = s.protectedSacl;
00141 sacl = s.sacl;
00142 }
00143 RETHROWEX( "sd::operator=(const sd &): cannot copy source SD" )
00144 }
00145
00146 return *this;
00147 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.2.2 written by Dimitri van Heesch,
© 1997-2000