Source code of Windows XP (NT5)
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.

391 lines
12 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. ea.c
  5. Abstract:
  6. This module implements the mini redirector call down routines pertaining to query/set ea/security.
  7. Author:
  8. joelinn [joelinn] 12-jul-95
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. ////
  14. //// The Bug check file id for this module
  15. ////
  16. //
  17. //#define BugCheckFileId (RDBSS_BUG_CHECK_LOCAL_CREATE)
  18. //
  19. // The local debug trace level
  20. //
  21. #define Dbg (DEBUG_TRACE_EA)
  22. NTSTATUS
  23. MRxProxyQueryEaInformation (
  24. IN OUT PRX_CONTEXT RxContext
  25. )
  26. {
  27. NTSTATUS Status;
  28. RxCaptureFobx;
  29. PVOID Buffer = RxContext->Info.Buffer;
  30. PLONG pLengthRemaining = &RxContext->Info.LengthRemaining;
  31. PUCHAR UserEaList = RxContext->QueryEa.UserEaList;
  32. ULONG UserEaListLength = RxContext->QueryEa.UserEaListLength;
  33. ULONG UserEaIndex = RxContext->QueryEa.UserEaIndex;
  34. BOOLEAN RestartScan = RxContext->QueryEa.RestartScan;
  35. BOOLEAN ReturnSingleEntry = RxContext->QueryEa.ReturnSingleEntry;
  36. BOOLEAN IndexSpecified = RxContext->QueryEa.IndexSpecified;
  37. //PFEALIST ServerEaList = NULL;
  38. PAGED_CODE();
  39. RxDbgTrace(+1, Dbg, ("MRxProxyQueryEaInformation\n"));
  40. #if 0
  41. Status = MRxProxyDeferredCreate(RxContext);
  42. if (Status!=STATUS_SUCCESS) {
  43. goto FINALLY;
  44. }
  45. Status = MRxProxyLoadEaList( RxContext, UserEaList, UserEaListLength, &ServerEaList );
  46. if (( !NT_SUCCESS( Status ) )||
  47. ( ServerEaList == NULL )) {
  48. goto FINALLY;
  49. }
  50. if (IndexSpecified) {
  51. //CODE.IMPROVEMENT this name is poor....it owes back to the fastfat heritage and is not so meaningful
  52. // for a rdr
  53. capFobx->OffsetOfNextEaToReturn = UserEaIndex;
  54. Status = MRxProxyQueryEasFromServer(
  55. RxContext,
  56. ServerEaList,
  57. Buffer,
  58. pLengthRemaining,
  59. ReturnSingleEntry,
  60. (BOOLEAN)(UserEaList != NULL) );
  61. //
  62. // if there are no Ea's on the file, and the user supplied an EA
  63. // index, we want to map the error to STATUS_NONEXISTANT_EA_ENTRY.
  64. //
  65. if ( Status == STATUS_NO_EAS_ON_FILE ) {
  66. Status = STATUS_NONEXISTENT_EA_ENTRY;
  67. }
  68. } else {
  69. if ( ( RestartScan == TRUE ) || (UserEaList != NULL) ){
  70. //
  71. // Ea Indices start at 1, not 0....
  72. //
  73. capFobx->OffsetOfNextEaToReturn = 1;
  74. }
  75. Status = MRxProxyQueryEasFromServer( //it is offensive to have two identical calls but oh, well.....
  76. RxContext,
  77. ServerEaList,
  78. Buffer,
  79. pLengthRemaining,
  80. ReturnSingleEntry,
  81. (BOOLEAN)(UserEaList != NULL) );
  82. }
  83. FINALLY:
  84. if ( ServerEaList != NULL) {
  85. RxFreePool(ServerEaList);
  86. }
  87. #endif //0
  88. Status = STATUS_NOT_SUPPORTED;
  89. RxDbgTrace(-1, Dbg, ("MRxProxyQueryEaInformation st=%08lx\n",Status));
  90. return Status;
  91. }
  92. NTSTATUS
  93. MRxProxySetEaInformation (
  94. IN OUT struct _RX_CONTEXT * RxContext
  95. )
  96. {
  97. NTSTATUS Status;
  98. RxCaptureFcb; RxCaptureFobx;
  99. PVOID Buffer = RxContext->Info.Buffer;
  100. ULONG Length = RxContext->Info.Length;
  101. #if 0
  102. PFEALIST ServerEaList = NULL;
  103. ULONG Size;
  104. PPROXYCEDB_SERVER_ENTRY pServerEntry;
  105. #endif //0
  106. PAGED_CODE();
  107. RxDbgTrace(+1, Dbg, ("MRxProxySetEaInformation\n"));
  108. #if 0
  109. pServerEntry = ProxyCeGetAssociatedServerEntry(capFcb->pNetRoot->pSrvCall);
  110. //get rid of nonEA guys right now
  111. if (!FlagOn(pServerEntry->Server.DialectFlags,DF_SUPPORTEA)) {
  112. RxDbgTrace(-1, Dbg, ("EAs w/o EA support!\n"));
  113. return((STATUS_NOT_SUPPORTED));
  114. }
  115. Status = MRxProxyDeferredCreate(RxContext);
  116. if (Status!=STATUS_SUCCESS) {
  117. goto FINALLY;
  118. }
  119. //
  120. // Convert Nt format FEALIST to OS/2 format
  121. //
  122. Size = MRxProxyNtFullEaSizeToOs2 ( Buffer );
  123. if ( Size > 0x0000ffff ) {
  124. Status = STATUS_EA_TOO_LARGE;
  125. goto FINALLY;
  126. }
  127. //CODE.IMPROVEMENT since |os2eas|<=|nteas| we really don't need a maximum buffer
  128. ServerEaList = RxAllocatePool ( PagedPool, EA_QUERY_SIZE );
  129. if ( ServerEaList == NULL ) {
  130. Status = STATUS_INSUFFICIENT_RESOURCES;
  131. goto FINALLY;
  132. }
  133. MRxProxyNtFullListToOs2 ( Buffer, ServerEaList );
  134. //
  135. // Set EAs on the file/directory; if the error is EA_ERROR then SetEaList
  136. // sets iostatus.information to the offset of the offender
  137. //
  138. Status = MRxProxySetEaList( RxContext, ServerEaList);
  139. FINALLY:
  140. if ( ServerEaList != NULL) {
  141. RxFreePool(ServerEaList);
  142. }
  143. #endif //0
  144. Status = STATUS_NOT_SUPPORTED;
  145. RxDbgTrace(-1, Dbg, ("MRxProxySetEaInformation st=%08lx\n",Status));
  146. return Status;
  147. }
  148. NTSTATUS
  149. MRxProxyQuerySecurityInformation (
  150. IN OUT PRX_CONTEXT RxContext
  151. )
  152. /*++
  153. Routine Description:
  154. This routine implements the NtQuerySecurityFile api.
  155. Arguments:
  156. Return Value:
  157. Status - Result of the operation.
  158. --*/
  159. {
  160. RxCaptureFobx;
  161. PVOID Buffer = RxContext->Info.Buffer;
  162. PLONG pLengthRemaining = &RxContext->Info.LengthRemaining;
  163. //PMRX_PROXY_SRV_OPEN proxySrvOpen;
  164. NTSTATUS Status;
  165. #if 0
  166. PBYTE pInputParamBuffer = NULL;
  167. PBYTE pOutputParamBuffer = NULL;
  168. PBYTE pInputDataBuffer = NULL;
  169. PBYTE pOutputDataBuffer = NULL;
  170. ULONG InputParamBufferLength = 0;
  171. ULONG OutputParamBufferLength = 0;
  172. ULONG InputDataBufferLength = 0;
  173. ULONG OutputDataBufferLength = 0;
  174. #endif //0
  175. PAGED_CODE();
  176. RxDbgTrace(+1, Dbg, ("MRxProxyQuerySecurityInformation...\n"));
  177. #if 0
  178. Status = MRxProxyDeferredCreate(RxContext);
  179. if (Status!=STATUS_SUCCESS) {
  180. goto FINALLY;
  181. }
  182. Status = STATUS_MORE_PROCESSING_REQUIRED;
  183. proxySrvOpen = MRxProxyGetSrvOpenExtension(capFobx->pSrvOpen);
  184. ASSERT (!FlagOn(proxySrvOpen->Flags,PROXY_SRVOPEN_FLAG_NOT_REALLY_OPEN));
  185. if (Status == STATUS_MORE_PROCESSING_REQUIRED) {
  186. PROXY_TRANSACTION_OPTIONS TransactionOptions = RxDefaultTransactionOptions;
  187. PROXY_TRANSACTION_RESUMPTION_CONTEXT ResumptionContext;
  188. //BOOLEAN printflag;
  189. TransactionOptions.NtTransactFunction = NT_TRANSACT_QUERY_SECURITY_DESC;
  190. //TransactionOptions.Flags |= PROXY_XACT_FLAGS_COPY_ON_ERROR;
  191. QuerySecurityRequest.Fid = proxySrvOpen->Fid;
  192. QuerySecurityRequest.Reserved = 0;
  193. QuerySecurityRequest.SecurityInformation = RxContext->QuerySecurity.SecurityInformation;
  194. QuerySecurityResponse.LengthNeeded = 0xbaadbaad;
  195. //printflag = RxDbgTraceDisableGlobally();//this is debug code anyway!
  196. //RxDbgTraceEnableGlobally(FALSE);
  197. Status = ProxyCeTransact(
  198. RxContext, // the RXContext for the transaction
  199. &TransactionOptions, // transaction options
  200. NULL, // the setup buffer
  201. 0, // setup buffer length
  202. &QuerySecurityRequest, // Input Param Buffer
  203. sizeof(QuerySecurityRequest), // Input param buffer length
  204. &QuerySecurityResponse, // Output param buffer
  205. sizeof(QuerySecurityResponse),// output param buffer length
  206. NULL, // Input data buffer
  207. 0, // Input data buffer length
  208. Buffer, // output data buffer
  209. *pLengthRemaining, // output data buffer length
  210. &ResumptionContext // the resumption context
  211. );
  212. //DbgPrint("QSR.len=%x\n", QuerySecurityResponse.LengthNeeded);
  213. if (NT_SUCCESS(Status) || (Status == STATUS_BUFFER_TOO_SMALL)) {
  214. ULONG ReturnedDataCount = ResumptionContext.DataBytesReceived;
  215. RxContext->InformationToReturn = QuerySecurityResponse.LengthNeeded;;
  216. RxDbgTrace(0, Dbg, ("MRxProxyQuerySecurityInformation...ReturnedDataCount=%08lx\n",ReturnedDataCount));
  217. ASSERT(ResumptionContext.ParameterBytesReceived == sizeof(RESP_QUERY_SECURITY_DESCRIPTOR));
  218. if (((LONG)(QuerySecurityResponse.LengthNeeded)) > *pLengthRemaining) {
  219. Status = STATUS_BUFFER_OVERFLOW;
  220. }
  221. }
  222. //RxDbgTraceEnableGlobally(printflag);
  223. }
  224. FINALLY:
  225. #endif //0
  226. Status = STATUS_NOT_SUPPORTED;
  227. RxDbgTrace(-1, Dbg, ("MRxProxyQuerySecurityInformation...exit, st=%08lx,info=%08lx\n",
  228. Status, RxContext->InformationToReturn));
  229. return Status;
  230. }
  231. NTSTATUS
  232. MRxProxySetSecurityInformation (
  233. IN OUT struct _RX_CONTEXT * RxContext
  234. )
  235. {
  236. RxCaptureFobx;
  237. //PMRX_PROXY_SRV_OPEN proxySrvOpen;
  238. NTSTATUS Status;
  239. RxDbgTrace(+1, Dbg, ("MRxProxySetSecurityInformation...\n"));
  240. #if 0
  241. Status = MRxProxyDeferredCreate(RxContext);
  242. if (Status!=STATUS_SUCCESS) {
  243. goto FINALLY;
  244. }
  245. Status = STATUS_MORE_PROCESSING_REQUIRED;
  246. proxySrvOpen = MRxProxyGetSrvOpenExtension(capFobx->pSrvOpen);
  247. if (Status == STATUS_MORE_PROCESSING_REQUIRED) {
  248. PROXY_TRANSACTION_OPTIONS TransactionOptions = RxDefaultTransactionOptions;
  249. PROXY_TRANSACTION_RESUMPTION_CONTEXT ResumptionContext;
  250. ULONG SdLength = RtlLengthSecurityDescriptor(RxContext->SetSecurity.SecurityDescriptor);
  251. TransactionOptions.NtTransactFunction = NT_TRANSACT_SET_SECURITY_DESC;
  252. SetSecurityRequest.Fid = proxySrvOpen->Fid;
  253. SetSecurityRequest.Reserved = 0;
  254. SetSecurityRequest.SecurityInformation = RxContext->SetSecurity.SecurityInformation;
  255. Status = ProxyCeTransact(
  256. RxContext, // the RXContext for the transaction
  257. &TransactionOptions, // transaction options
  258. NULL, // the setup buffer
  259. 0, // setup buffer length
  260. &SetSecurityRequest, // Input Param Buffer
  261. sizeof(SetSecurityRequest), // Input param buffer length
  262. NULL, // Output param buffer
  263. 0, // output param buffer length
  264. RxContext->SetSecurity.SecurityDescriptor, // Input data buffer
  265. SdLength, // Input data buffer length
  266. NULL, // output data buffer
  267. 0, // output data buffer length
  268. &ResumptionContext // the resumption context
  269. );
  270. //the old rdr doesn't return any info...................
  271. //RxContext->InformationToReturn = SetSecurityResponse.LengthNeeded;
  272. if ( NT_SUCCESS(Status) ) {
  273. ULONG ReturnedDataCount = ResumptionContext.DataBytesReceived;
  274. RxDbgTrace(0, Dbg, ("MRxProxySetSecurityInformation...ReturnedDataCount=%08lx\n",ReturnedDataCount));
  275. ASSERT(ResumptionContext.ParameterBytesReceived == 0);
  276. ASSERT(ResumptionContext.SetupBytesReceived == 0);
  277. ASSERT(ResumptionContext.DataBytesReceived == 0);
  278. }
  279. }
  280. FINALLY:
  281. #endif //0
  282. Status = STATUS_NOT_SUPPORTED;
  283. RxDbgTrace(-1, Dbg, ("MRxProxySetSecurityInformation...exit, st=%08lx,info=%08lx\n",
  284. Status, RxContext->InformationToReturn));
  285. return Status;
  286. }
  287.