Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

711 lines
20 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. ShareAcl.cxx
  7. This file contains the implementation for the Shares Acl
  8. Editor. It is just a front end for the Generic ACL Editor that is
  9. specific to Shares,.
  10. FILE HISTORY:
  11. ChuckC 06-Aug-1992 Culled from NTFSACL.CXX
  12. Yi-HsinS 09-Oct-1992 Added ulHelpContext to EditShareAcl
  13. Yi-HsinS 20-Nov-1992 Make ntlanman.dll link dynamically to
  14. acledit.dll ( not statically ).
  15. DavidHov 17-Oct-1993 Made pSedDiscretionaryEditor extern "C"
  16. because mangling on Alpha didn't
  17. equate to that in LIBMAIN.CXX
  18. */
  19. #include <ntincl.hxx>
  20. extern "C"
  21. {
  22. #include <ntioapi.h>
  23. #include <ntseapi.h>
  24. #include <helpnums.h>
  25. }
  26. #define INCL_NETCONS
  27. #define INCL_WINDOWS
  28. #define INCL_NETERRORS
  29. #define INCL_DOSERRORS
  30. #define INCL_NETSHARE
  31. #define _WINNETWK_
  32. #include <lmui.hxx>
  33. #undef _WINNETWK_
  34. #define INCL_BLT_MSGPOPUP
  35. #include <blt.hxx>
  36. #include <dbgstr.hxx>
  37. #include <string.hxx>
  38. #include <strnumer.hxx>
  39. #include <security.hxx>
  40. #include <ntacutil.hxx>
  41. #include <uibuffer.hxx>
  42. #include <strlst.hxx>
  43. #include <errmap.hxx>
  44. extern "C"
  45. {
  46. #include <sedapi.h>
  47. #include <sharedlg.h>
  48. #include <lmapibuf.h>
  49. }
  50. #include <uiassert.hxx>
  51. #include <shareacl.hxx>
  52. typedef DWORD (*PSEDDISCRETIONARYACLEDITOR)( HWND, HANDLE, LPWSTR,
  53. PSED_OBJECT_TYPE_DESCRIPTOR, PSED_APPLICATION_ACCESSES,
  54. LPWSTR, PSED_FUNC_APPLY_SEC_CALLBACK, ULONG_PTR, PSECURITY_DESCRIPTOR,
  55. BOOLEAN, BOOLEAN, LPDWORD, DWORD );
  56. extern HMODULE hmodAclEditor;
  57. extern "C"
  58. {
  59. // BUGBUG: This needs to be in a header file so mangling will
  60. // work properly
  61. extern PSEDDISCRETIONARYACLEDITOR pSedDiscretionaryAclEditor;
  62. }
  63. #define ACLEDIT_DLL_STRING SZ("acledit.dll")
  64. #define SEDDISCRETIONARYACLEDITOR_STRING ("SedDiscretionaryAclEditor")
  65. /*
  66. * declare the callback routine based on typedef in sedapi.h.
  67. * CODEWORK - that file should declare for us!
  68. */
  69. DWORD SedCallback( HWND hwndParent,
  70. HANDLE hInstance,
  71. ULONG_PTR ulCallbackContext,
  72. PSECURITY_DESCRIPTOR psecdesc,
  73. PSECURITY_DESCRIPTOR psecdescNewObjects,
  74. BOOLEAN fApplyToSubContainers,
  75. BOOLEAN fApplyToSubObjects,
  76. LPDWORD StatusReturn
  77. ) ;
  78. /*
  79. * structure for callback function's usage.
  80. * all we do today during callback is set the
  81. * Dacl to be passed back to the Shared dialog,
  82. * and set a flag to tell us if the user actually
  83. * did anything. The flag is FALSE as long as the
  84. * user hits cancel.
  85. */
  86. typedef struct _SHARE_CALLBACK_INFO
  87. {
  88. OS_SECURITY_DESCRIPTOR * pOsSecDesc ;
  89. BOOL fSecDescModified ;
  90. } SHARE_CALLBACK_INFO ;
  91. /*
  92. * routine that sets up the right generic mappings
  93. */
  94. void InitializeShareGenericMapping( PGENERIC_MAPPING pSHAREGenericMapping ) ;
  95. /* The following two arrays define the permission names for NT Files. Note
  96. * that each index in one array corresponds to the index in the other array.
  97. * The second array will be modifed to contain a string pointer pointing to
  98. * the corresponding IDS_* in the first array.
  99. */
  100. MSGID msgidSharePermNames[] =
  101. {
  102. IDS_SHARE_PERM_GEN_NO_ACCESS,
  103. IDS_SHARE_PERM_GEN_READ,
  104. IDS_SHARE_PERM_GEN_MODIFY,
  105. IDS_SHARE_PERM_GEN_ALL
  106. } ;
  107. SED_APPLICATION_ACCESS sedappaccessSharePerms[] =
  108. {
  109. { SED_DESC_TYPE_RESOURCE, FILE_PERM_GEN_NO_ACCESS, 0, NULL },
  110. { SED_DESC_TYPE_RESOURCE, FILE_PERM_GEN_READ, 0, NULL },
  111. { SED_DESC_TYPE_RESOURCE, FILE_PERM_GEN_MODIFY, 0, NULL },
  112. { SED_DESC_TYPE_RESOURCE, FILE_PERM_GEN_ALL, 0, NULL }
  113. } ;
  114. #define COUNT_FILEPERMS_ARRAY (sizeof(sedappaccessSharePerms)/sizeof(SED_APPLICATION_ACCESS))
  115. /*******************************************************************
  116. NAME: EditShareAcl
  117. SYNOPSIS: This Procedure prepares the structures necessary for the
  118. generic ACL editor, specifically for NT Shares.
  119. ENTRY: hwndParent - Parent window handle
  120. pszServer - Name of server the resource resides on
  121. (in the form "\\server")
  122. pszResource - Fully qualified name of resource we will
  123. edit, basically a share name.
  124. pfSecDescModified - used to return to share dialog if
  125. the User cancelled or hit OK.
  126. ppOsSEcDesc - pointer to pointer to OS_SECURITY_DESCRIPTOR.
  127. *ppOsSecDesc is NULL if this is a new share or a share
  128. without any security descriptor, in which case we create
  129. one.
  130. EXIT:
  131. RETURNS:
  132. NOTES: We assume we are dealing with a SHARE by the time
  133. this function is called.
  134. HISTORY:
  135. ChuckC 10-Aug-1992 Created. Culled from NTFS ACL code.
  136. Yi-HsinS 09-Oct-1992 Added ulHelpContextBase
  137. ********************************************************************/
  138. APIERR EditShareAcl( HWND hwndParent,
  139. const TCHAR * pszServer,
  140. const TCHAR * pszResource,
  141. BOOL * pfSecDescModified,
  142. OS_SECURITY_DESCRIPTOR ** ppOsSecDesc,
  143. ULONG ulHelpContextBase )
  144. {
  145. UIASSERT(pszServer) ;
  146. UIASSERT(pszResource) ;
  147. UIASSERT(ppOsSecDesc) ;
  148. UIASSERT(pfSecDescModified) ;
  149. APIERR err = NERR_Success; // JonN 01/27/00: PREFIX bug 444914
  150. do { // error breakout
  151. /*
  152. * if we *ppsecdesc is NULL, this is new share or a share with no
  153. * security descriptor.
  154. * we go and create a new (default) security descriptor.
  155. */
  156. if (!*ppOsSecDesc)
  157. {
  158. APIERR err = ::CreateDefaultAcl(ppOsSecDesc) ;
  159. if (err != NERR_Success)
  160. break ;
  161. }
  162. /* Retrieve the resource strings appropriate for the type of object we
  163. * are looking at
  164. */
  165. RESOURCE_STR nlsTypeName( IDS_SHARE ) ;
  166. RESOURCE_STR nlsDefaultPermName( IDS_SHARE_PERM_GEN_READ ) ;
  167. if ( ( err = nlsTypeName.QueryError() ) ||
  168. ( err = nlsDefaultPermName.QueryError()) )
  169. {
  170. break ;
  171. }
  172. /*
  173. * other misc stuff we need pass to security editor
  174. */
  175. SED_OBJECT_TYPE_DESCRIPTOR sedobjdesc ;
  176. SED_HELP_INFO sedhelpinfo ;
  177. GENERIC_MAPPING SHAREGenericMapping ;
  178. // setup mappings
  179. InitializeShareGenericMapping( &SHAREGenericMapping ) ;
  180. // setup help
  181. RESOURCE_STR nlsHelpFileName( ulHelpContextBase == HC_UI_SHELL_BASE
  182. ? IDS_SHELLHELPFILENAME
  183. : IDS_SMHELPFILENAME ) ;
  184. if ( err = nlsHelpFileName.QueryError() )
  185. {
  186. DBGEOL("::EditShareAcl - Failed to retrieve help file name") ;
  187. break ;
  188. }
  189. sedhelpinfo.pszHelpFileName = (LPWSTR) nlsHelpFileName.QueryPch() ;
  190. sedhelpinfo.aulHelpContext[HC_MAIN_DLG] = ulHelpContextBase +
  191. HC_NTSHAREPERMS ;
  192. sedhelpinfo.aulHelpContext[HC_ADD_USER_DLG] = ulHelpContextBase +
  193. HC_SHAREADDUSER ;
  194. sedhelpinfo.aulHelpContext[HC_ADD_USER_MEMBERS_LG_DLG] =
  195. ulHelpContextBase +
  196. HC_SHAREADDUSER_LOCALGROUP ;
  197. sedhelpinfo.aulHelpContext[HC_ADD_USER_MEMBERS_GG_DLG] =
  198. ulHelpContextBase +
  199. HC_SHAREADDUSER_GLOBALGROUP ;
  200. sedhelpinfo.aulHelpContext[HC_ADD_USER_SEARCH_DLG] =
  201. ulHelpContextBase +
  202. HC_SHAREADDUSER_FINDUSER ;
  203. // These are not used, set to zero
  204. sedhelpinfo.aulHelpContext[HC_SPECIAL_ACCESS_DLG] = 0 ;
  205. sedhelpinfo.aulHelpContext[HC_NEW_ITEM_SPECIAL_ACCESS_DLG] = 0 ;
  206. // setup the object description
  207. sedobjdesc.Revision = SED_REVISION1 ;
  208. sedobjdesc.IsContainer = FALSE ;
  209. sedobjdesc.AllowNewObjectPerms = FALSE ;
  210. sedobjdesc.MapSpecificPermsToGeneric = TRUE ;
  211. sedobjdesc.GenericMapping = &SHAREGenericMapping ;
  212. sedobjdesc.GenericMappingNewObjects = &SHAREGenericMapping ;
  213. sedobjdesc.HelpInfo = &sedhelpinfo ;
  214. sedobjdesc.ObjectTypeName = (LPTSTR)nlsTypeName.QueryPch();
  215. sedobjdesc.SpecialObjectAccessTitle = NULL ;
  216. /* Now we need to load the global arrays with the permission names
  217. * from the resource file.
  218. */
  219. UINT cArrayItems = COUNT_FILEPERMS_ARRAY ;
  220. MSGID * msgidPermNames = msgidSharePermNames ;
  221. PSED_APPLICATION_ACCESS pappaccess = sedappaccessSharePerms ;
  222. /* Loop through each permission title retrieving the text from the
  223. * resource file and setting the pointer in the array. The memory
  224. * will be deleted when strlistPermNames is destructed.
  225. */
  226. STRLIST strlistPermNames ;
  227. for ( UINT i = 0 ; i < cArrayItems ; i++ )
  228. {
  229. RESOURCE_STR * pnlsPermName = new RESOURCE_STR( msgidPermNames[i]) ;
  230. err = (pnlsPermName==NULL) ? ERROR_NOT_ENOUGH_MEMORY :
  231. pnlsPermName->QueryError() ;
  232. if ( err ||
  233. (err = strlistPermNames.Add( pnlsPermName )) )
  234. {
  235. delete pnlsPermName ;
  236. break ;
  237. }
  238. pappaccess[i].PermissionTitle = (LPTSTR) pnlsPermName->QueryPch() ;
  239. }
  240. if ( err )
  241. break ;
  242. SED_APPLICATION_ACCESSES SedAppAccesses ;
  243. SedAppAccesses.Count = cArrayItems ;
  244. SedAppAccesses.AccessGroup = pappaccess ;
  245. SedAppAccesses.DefaultPermName = (LPTSTR)nlsDefaultPermName.QueryPch() ;
  246. DWORD dwSedReturnStatus ;
  247. /*
  248. * pass this along so when the call back function is called,
  249. * we can set it.
  250. */
  251. SHARE_CALLBACK_INFO callbackinfo ;
  252. callbackinfo.pOsSecDesc = *ppOsSecDesc ;
  253. callbackinfo.fSecDescModified = FALSE ;
  254. if ( ::hmodAclEditor == NULL )
  255. {
  256. ::hmodAclEditor = ::LoadLibraryEx( ACLEDIT_DLL_STRING,
  257. NULL,
  258. LOAD_WITH_ALTERED_SEARCH_PATH );
  259. if ( ::hmodAclEditor == NULL )
  260. {
  261. err = ::GetLastError();
  262. break;
  263. }
  264. ::pSedDiscretionaryAclEditor = (PSEDDISCRETIONARYACLEDITOR)
  265. ::GetProcAddress( ::hmodAclEditor,
  266. SEDDISCRETIONARYACLEDITOR_STRING );
  267. if ( ::pSedDiscretionaryAclEditor == NULL )
  268. {
  269. err = ::GetLastError();
  270. break;
  271. }
  272. }
  273. UIASSERT( ::pSedDiscretionaryAclEditor != NULL );
  274. err = (*pSedDiscretionaryAclEditor)( hwndParent,
  275. NULL, // dont need instance
  276. (LPWSTR) pszServer,
  277. &sedobjdesc,
  278. &SedAppAccesses,
  279. (LPWSTR) pszResource,
  280. (PSED_FUNC_APPLY_SEC_CALLBACK) SedCallback,
  281. (ULONG_PTR) &callbackinfo,
  282. (*ppOsSecDesc)->QueryDescriptor(),
  283. FALSE, // always can read
  284. FALSE, // If we can read, we can write
  285. &dwSedReturnStatus,
  286. 0 ) ;
  287. if (err)
  288. break ;
  289. *pfSecDescModified = callbackinfo.fSecDescModified ;
  290. } while (FALSE) ;
  291. return err ;
  292. }
  293. /*******************************************************************
  294. NAME: SedCallback
  295. SYNOPSIS: Security Editor callback for the SHARE ACL Editor
  296. ENTRY: See sedapi.hxx
  297. EXIT:
  298. RETURNS:
  299. NOTES: Normally, the callback is expected to perform the 'apply'.
  300. In this case, since the object may not exist yet, we defer
  301. the 'apply' till the user hits OK in the Shares dialog.
  302. All the CallBack does is simply save away that precious
  303. modified ACL in the OS_SECURITY_DESCRIPTOR object we were
  304. given in the first place.
  305. HISTORY:
  306. ChuckC 10-Aug-1992 Created
  307. ********************************************************************/
  308. DWORD SedCallback( HWND hwndParent,
  309. HANDLE hInstance,
  310. ULONG_PTR ulCallbackContext,
  311. PSECURITY_DESCRIPTOR psecdesc,
  312. PSECURITY_DESCRIPTOR psecdescNewObjects,
  313. BOOLEAN fApplyToSubContainers,
  314. BOOLEAN fApplyToSubObjects,
  315. LPDWORD StatusReturn
  316. )
  317. {
  318. UNREFERENCED( hInstance ) ;
  319. UNREFERENCED( psecdescNewObjects ) ;
  320. UNREFERENCED( fApplyToSubObjects ) ;
  321. UNREFERENCED( fApplyToSubContainers ) ;
  322. UNREFERENCED( StatusReturn ) ;
  323. APIERR err = NO_ERROR ;
  324. OS_SECURITY_DESCRIPTOR * pOsSecDesc =
  325. ((SHARE_CALLBACK_INFO *)ulCallbackContext)->pOsSecDesc ;
  326. do { // error breakout loop
  327. OS_SECURITY_DESCRIPTOR osNewSecDesc (psecdesc) ;
  328. if (err = osNewSecDesc.QueryError())
  329. break ;
  330. BOOL fDaclPresent ;
  331. OS_ACL * pOsDacl ;
  332. if (err = osNewSecDesc.QueryDACL(&fDaclPresent, &pOsDacl))
  333. break ;
  334. // set the new DACL
  335. err = pOsSecDesc->SetDACL(TRUE, pOsDacl) ;
  336. } while (FALSE) ;
  337. if ( err )
  338. ::MsgPopup( hwndParent, (MSGID) err ) ;
  339. else
  340. ((SHARE_CALLBACK_INFO *)ulCallbackContext)->fSecDescModified = TRUE ;
  341. return err ;
  342. }
  343. /*******************************************************************
  344. NAME: InitializeShareGenericMapping
  345. SYNOPSIS: Initializes the passed generic mapping structure
  346. for shares
  347. ENTRY: pSHAREGenericMapping - Pointer to GENERIC_MAPPING to be init.
  348. EXIT:
  349. RETURNS:
  350. NOTES: There currently is no public definition, replace if one
  351. ever becomes available.
  352. HISTORY:
  353. ChuckC 10-Aug-1992 Created
  354. ********************************************************************/
  355. void InitializeShareGenericMapping( PGENERIC_MAPPING pSHAREGenericMapping )
  356. {
  357. pSHAREGenericMapping->GenericRead = FILE_GENERIC_READ ;
  358. pSHAREGenericMapping->GenericWrite = FILE_GENERIC_WRITE ;
  359. pSHAREGenericMapping->GenericExecute = FILE_GENERIC_EXECUTE ;
  360. pSHAREGenericMapping->GenericAll = FILE_ALL_ACCESS ;
  361. }
  362. /*******************************************************************
  363. NAME: CreateDefaultAcl
  364. SYNOPSIS: Create a default ACL for either a new share or for
  365. a share that dont exist.
  366. ENTRY:
  367. EXIT:
  368. RETURNS: NERR_Success if OK, api error otherwise.
  369. NOTES:
  370. HISTORY:
  371. ChuckC 10-Aug-1992 Created
  372. ********************************************************************/
  373. APIERR CreateDefaultAcl( OS_SECURITY_DESCRIPTOR ** ppOsSecDesc )
  374. {
  375. UIASSERT(ppOsSecDesc) ;
  376. APIERR err ;
  377. OS_ACL aclDacl ;
  378. OS_ACE osace ;
  379. OS_SECURITY_DESCRIPTOR * pOsSecDesc ;
  380. *ppOsSecDesc = NULL ; // empty it.
  381. do
  382. { // error breakout
  383. /*
  384. * make sure we constructed OK
  385. */
  386. if ( (err = aclDacl.QueryError()) ||
  387. (err = osace.QueryError()) )
  388. {
  389. break ;
  390. }
  391. /*
  392. * create it! use NULL to mean we build it ourselves.
  393. */
  394. pOsSecDesc = new OS_SECURITY_DESCRIPTOR(NULL) ;
  395. if (pOsSecDesc == NULL)
  396. {
  397. err = ERROR_NOT_ENOUGH_MEMORY ;
  398. break ;
  399. }
  400. if (err = pOsSecDesc->QueryError())
  401. {
  402. break ;
  403. }
  404. /*
  405. * This sets up an ACE with Generic all access
  406. */
  407. osace.SetAccessMask( GENERIC_ALL ) ;
  408. osace.SetInheritFlags( 0 ) ;
  409. osace.SetType( ACCESS_ALLOWED_ACE_TYPE ) ;
  410. #if 0
  411. //
  412. // The server should set the owner/group before we get the security
  413. // descriptor so we don't need to do this anymore
  414. //
  415. /*
  416. * now set the group and owner to be the Administrators.
  417. * need create Adminstrators SID.
  418. */
  419. OS_SID ossidBuiltin ;
  420. if (err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_BuiltIn,
  421. &ossidBuiltin ))
  422. {
  423. break ;
  424. }
  425. OS_SID ossidAdmin (ossidBuiltin.QueryPSID(),
  426. (ULONG)DOMAIN_ALIAS_RID_ADMINS) ;
  427. if (err = ossidAdmin.QueryError())
  428. break ;
  429. if ( (err = pOsSecDesc->SetGroup( ossidAdmin, TRUE )) ||
  430. (err = pOsSecDesc->SetOwner( ossidAdmin, TRUE )) )
  431. {
  432. break ;
  433. }
  434. #endif
  435. /*
  436. * create a world SID, and add this to the full access ACE.
  437. * then put the ACE in the ACL, and the ACL in the Security
  438. * descriptor.
  439. */
  440. OS_SID ossidWorld ;
  441. if ( (err = ossidWorld.QueryError()) ||
  442. (err = NT_ACCOUNTS_UTILITY::QuerySystemSid(
  443. UI_SID_World,
  444. &ossidWorld )) ||
  445. (err = osace.SetSID( ossidWorld )) ||
  446. (err = aclDacl.AddACE( 0, osace )) ||
  447. (err = pOsSecDesc->SetDACL( TRUE, &aclDacl )) )
  448. {
  449. break ;
  450. }
  451. /*
  452. * all set, set the security descriptor
  453. */
  454. *ppOsSecDesc = pOsSecDesc ;
  455. } while (FALSE) ;
  456. return err ;
  457. }
  458. /*******************************************************************
  459. NAME: GetSharePerm
  460. SYNOPSIS: CAll the NETAPI to retrieve existing Security Descriptor
  461. from the Share.
  462. ENTRY:
  463. EXIT:
  464. RETURNS: NERR_Success if OK, api error otherwise.
  465. NOTES: CODEWORK. This should be a LMOBJ thing when we have time.
  466. Currently just direct call to NETAPI.
  467. HISTORY:
  468. ChuckC 10-Aug-1992 Created
  469. ********************************************************************/
  470. APIERR GetSharePerm (const TCHAR * pszServer,
  471. const TCHAR * pszShare,
  472. OS_SECURITY_DESCRIPTOR ** ppOsSecDesc )
  473. {
  474. #ifndef WIN32
  475. #error This is currently NOT 16 bit compatible.
  476. #endif
  477. APIERR err ;
  478. LPBYTE pBuffer ;
  479. PSECURITY_DESCRIPTOR psecdesc ;
  480. OS_SECURITY_DESCRIPTOR * pOsSecDesc ;
  481. /*
  482. * call API to get the security descriptor
  483. */
  484. err = NetShareGetInfo((LPTSTR) pszServer,
  485. (LPTSTR) pszShare,
  486. 502,
  487. &pBuffer) ;
  488. if (err != NERR_Success)
  489. return err ;
  490. if (*ppOsSecDesc)
  491. delete *ppOsSecDesc ;
  492. *ppOsSecDesc = NULL ;
  493. /*
  494. * if no such thang, just say none. we'll create later as need.
  495. */
  496. psecdesc = ((SHARE_INFO_502 *)pBuffer)->shi502_security_descriptor ;
  497. if (!psecdesc)
  498. {
  499. NetApiBufferFree(pBuffer) ;
  500. return NERR_Success ;
  501. }
  502. do { // error break out loop
  503. // create a new security descriptor
  504. pOsSecDesc = new OS_SECURITY_DESCRIPTOR(NULL) ;
  505. if (pOsSecDesc == NULL)
  506. {
  507. err = ERROR_NOT_ENOUGH_MEMORY ;
  508. break ;
  509. }
  510. if (err = pOsSecDesc->QueryError())
  511. {
  512. break ;
  513. }
  514. /*
  515. * create alias to the security descriptor we go from the API
  516. */
  517. OS_SECURITY_DESCRIPTOR osShareSecDesc (psecdesc) ;
  518. if (err = osShareSecDesc.QueryError())
  519. break ;
  520. /*
  521. * make copy of it for use by security editor
  522. */
  523. if ( (err = pOsSecDesc->Copy( osShareSecDesc )) )
  524. {
  525. break ;
  526. }
  527. } while (FALSE) ;
  528. if (err == NERR_Success)
  529. *ppOsSecDesc = pOsSecDesc ;
  530. NetApiBufferFree(pBuffer) ;
  531. return err ;
  532. }
  533. /*******************************************************************
  534. NAME: SetSharePerm
  535. SYNOPSIS: CAll the NETAPI to set the Security Descriptor
  536. for the Share.
  537. ENTRY:
  538. EXIT:
  539. RETURNS: NERR_Success if OK, api error otherwise.
  540. NOTES: CODEWORK. This should be a LMOBJ thing when we have time.
  541. Currently just direct call to NETAPI.
  542. HISTORY:
  543. ChuckC 10-Aug-1992 Created
  544. ********************************************************************/
  545. APIERR SetSharePerm (const TCHAR * pszServer,
  546. const TCHAR * pszShare,
  547. const OS_SECURITY_DESCRIPTOR * pOsSecDesc )
  548. {
  549. #ifndef WIN32
  550. #error This is currently NOT 16 bit compatible.
  551. #endif
  552. APIERR err ;
  553. SHARE_INFO_1501 shareinfo1501 ;
  554. ::ZeroMemory(&shareinfo1501,
  555. sizeof(shareinfo1501)); // JonN 01/27/00: PREFIX bug 444913
  556. shareinfo1501.shi1501_security_descriptor =
  557. pOsSecDesc->QueryDescriptor() ;
  558. /*
  559. * call API to get the security descriptor
  560. */
  561. err = NetShareSetInfo((LPTSTR) pszServer,
  562. (LPTSTR) pszShare,
  563. 1501,
  564. (LPBYTE)&shareinfo1501,
  565. NULL) ;
  566. return err ;
  567. }