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.

358 lines
16 KiB

  1. //
  2. // Microsoft Windows
  3. // Copyright (C) Microsoft Corporation, 1992 - 2000
  4. //
  5. // File: querybld.h
  6. //
  7. // Contents: Contains declarations of functions to build query.
  8. //
  9. // History: 24-Sep-2000 Hiteshr Created
  10. //
  11. //
  12. //--------------------------------------------------------------------------
  13. //+--------------------------------------------------------------------------
  14. //
  15. // Function: CommonFilterFunc
  16. //
  17. // Synopsis: This function takes the input filter from the commandline
  18. // and converts it into ldapfilter.
  19. // For ex -user (ab* | bc*) is converted to |(cn=ab*)(cn=bc*)
  20. // The pEntry->pszName given the attribute name to use in
  21. // filter( cn in above example).
  22. //
  23. // Arguments: [pRecord - IN] : the command line argument structure used
  24. // to retrieve the filter entered by user
  25. // [pObjectEntry - IN] : pointer to the DSQUERY_ATTR_TABLE_ENTRY
  26. // which has info on attribute corresponding
  27. // switch in pRecord
  28. // [pVoid - IN] :Not used.
  29. // [strFilter - OUT] :Contains the output filter.
  30. // Returns: HRESULT : S_OK if everything succeeded
  31. // E_INVALIDARG if the object entry wasn't found
  32. // Anything else is a failure code from an ADSI call
  33. //
  34. // History: 25-Sep-2000 hiteshr Created
  35. //
  36. //---------------------------------------------------------------------------
  37. HRESULT CommonFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  38. IN ARG_RECORD* pRecord,
  39. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  40. IN CDSCmdCredentialObject& refCredentialObject,
  41. IN PVOID pVoid,
  42. OUT CComBSTR& strFilter);
  43. //+--------------------------------------------------------------------------
  44. //
  45. // Function: StarFilterFunc
  46. //
  47. // Synopsis: Filter Function for dsquery *. It returns the value of
  48. // -filter flag.
  49. //
  50. // Arguments: [pRecord - IN] : the command line argument structure used
  51. // to retrieve the filter entered by user
  52. // [pObjectEntry - IN] : pointer to the DSQUERY_ATTR_TABLE_ENTRY
  53. // which has info on attribute corresponding
  54. // switch in pRecord
  55. // [pVoid - IN] :Not used.
  56. // [strFilter - OUT] :Contains the output filter.
  57. // Returns: HRESULT : S_OK if everything succeeded
  58. // E_INVALIDARG if the object entry wasn't found
  59. // Anything else is a failure code from an ADSI call
  60. //
  61. // History: 25-Sep-2000 hiteshr Created
  62. //
  63. //---------------------------------------------------------------------------
  64. HRESULT StarFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  65. IN ARG_RECORD* pRecord,
  66. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  67. IN CDSCmdCredentialObject& refCredentialObject,
  68. IN PVOID pVoid,
  69. OUT CComBSTR& strFilter);
  70. //
  71. // Function: DisabledFilterFunc
  72. //
  73. // Synopsis: Filter Function for account disabled query.
  74. //
  75. // Arguments: [pRecord - IN] : Not Used
  76. // [pObjectEntry - IN] : Not Used
  77. // [pVoid - IN] :Not used.
  78. // [strFilter - OUT] :Contains the output filter.
  79. // Returns: HRESULT : S_OK if everything succeeded
  80. // E_INVALIDARG if the object entry wasn't found
  81. // Anything else is a failure code from an ADSI call
  82. //
  83. // History: 25-Sep-2000 hiteshr Created
  84. //
  85. //---------------------------------------------------------------------------
  86. HRESULT DisabledFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *,
  87. IN ARG_RECORD* ,
  88. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  89. IN CDSCmdCredentialObject& refCredentialObject,
  90. IN PVOID ,
  91. OUT CComBSTR& strFilter);
  92. //+--------------------------------------------------------------------------
  93. //
  94. // Function: InactiveFilterFunc
  95. //
  96. // Synopsis: Filter Function for account inactive query.
  97. //
  98. // Arguments: [pRecord - IN] : Not Used
  99. // [pObjectEntry - IN] : Not Used
  100. // [pVoid - IN] :Not used.
  101. // [strFilter - OUT] :Contains the output filter.
  102. // [bComputer]: if true query is for inactive computer accounts
  103. // Returns: HRESULT : S_OK if everything succeeded
  104. // E_INVALIDARG if the object entry wasn't found
  105. // Anything else is a failure code from an ADSI call
  106. //
  107. // History: 25-Sep-2000 hiteshr Created
  108. //
  109. //---------------------------------------------------------------------------
  110. HRESULT InactiveFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  111. IN ARG_RECORD* pRecord,
  112. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  113. IN CDSCmdCredentialObject& refCredentialObject,
  114. IN PVOID ,
  115. OUT CComBSTR& strFilter,
  116. bool bComputer = false);
  117. //+--------------------------------------------------------------------------
  118. //
  119. // Function: StalepwdFilterFunc
  120. //
  121. // Synopsis: Filter Function for Stale Password query.
  122. //
  123. // Arguments: [pRecord - IN] : Not Used
  124. // [pObjectEntry - IN] : Not Used
  125. // [pVoid - IN] :Not used.
  126. // [strFilter - OUT] :Contains the output filter.
  127. // [bComputer]: if true query is for inactive computer accounts
  128. // Returns: HRESULT : S_OK if everything succeeded
  129. // E_INVALIDARG if the object entry wasn't found
  130. // Anything else is a failure code from an ADSI call
  131. //
  132. // History: 25-Sep-2000 hiteshr Created
  133. //
  134. //---------------------------------------------------------------------------
  135. HRESULT StalepwdFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  136. IN ARG_RECORD* pRecord,
  137. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  138. IN CDSCmdCredentialObject& refCredentialObject,
  139. IN PVOID ,
  140. OUT CComBSTR& strFilter,
  141. bool bComputer);
  142. //+--------------------------------------------------------------------------
  143. //
  144. // Function: SubnetSiteFilterFunc
  145. //
  146. // Synopsis: Filter Function for -site switch in dsquery subnet.
  147. //
  148. // Arguments: [pEntry - IN] : Not Used
  149. // [pRecord - IN] : Command Line value supplied by user
  150. // [pVoid - IN] : suffix for the siteobject attribute.
  151. // [strFilter - OUT] :Contains the output filter.
  152. // Returns: HRESULT : S_OK if everything succeeded
  153. //
  154. // History: 24-April-2001 hiteshr Created
  155. //
  156. //---------------------------------------------------------------------------
  157. HRESULT SubnetSiteFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  158. IN ARG_RECORD* pRecord,
  159. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  160. IN CDSCmdCredentialObject& refCredentialObject,
  161. IN PVOID pParam,
  162. OUT CComBSTR& strFilter);
  163. //+--------------------------------------------------------------------------
  164. //
  165. // Function: BuildQueryFilter
  166. //
  167. // Synopsis: This function builds the LDAP query filter for given object type.
  168. //
  169. // Arguments: [pCommandArgs - IN] :the command line argument structure used
  170. // to retrieve the values of switches
  171. // [pObjectEntry - IN] :Contains info about the object type
  172. // [pParam -IN] :This value is passed to filter function.
  173. // [strLDAPFilter - OUT] :Contains the output filter.
  174. // Returns: HRESULT : S_OK if everything succeeded
  175. // E_INVALIDARG if the object entry wasn't found
  176. // Anything else is a failure code from an ADSI call
  177. //
  178. // History: 25-Sep-2000 hiteshr Created
  179. //
  180. //---------------------------------------------------------------------------
  181. HRESULT BuildQueryFilter(PARG_RECORD pCommandArgs,
  182. PDSQueryObjectTableEntry pObjectEntry,
  183. CDSCmdBasePathsInfo& refBasePathsInfo,
  184. CDSCmdCredentialObject& refCredentialObject,
  185. PVOID pParam,
  186. CComBSTR& strLDAPFilter);
  187. //+--------------------------------------------------------------------------
  188. //
  189. // Function: InactiveComputerFilterFunc
  190. //
  191. // Synopsis: Filter Function for computer inactive query.
  192. //
  193. // Arguments: [pRecord - IN] : Not Used
  194. // [pObjectEntry - IN] : Not Used
  195. // [pVoid - IN] :Not used.
  196. // [strFilter - OUT] :Contains the output filter.
  197. // Returns: HRESULT : S_OK if everything succeeded
  198. // E_INVALIDARG if the object entry wasn't found
  199. // Anything else is a failure code from an ADSI call
  200. //
  201. // History: 06-05-2002 hiteshr Created
  202. //
  203. //---------------------------------------------------------------------------
  204. HRESULT InactiveComputerFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  205. IN ARG_RECORD* pRecord,
  206. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  207. IN CDSCmdCredentialObject& refCredentialObject,
  208. IN PVOID pData,
  209. OUT CComBSTR& strFilter);
  210. //+--------------------------------------------------------------------------
  211. //
  212. // Function: InactiveUserFilterFunc
  213. //
  214. // Synopsis: Filter Function for user inactive query.
  215. //
  216. // Arguments: [pRecord - IN] : Not Used
  217. // [pObjectEntry - IN] : Not Used
  218. // [pVoid - IN] :Not used.
  219. // [strFilter - OUT] :Contains the output filter.
  220. // Returns: HRESULT : S_OK if everything succeeded
  221. // E_INVALIDARG if the object entry wasn't found
  222. // Anything else is a failure code from an ADSI call
  223. //
  224. // History: 25-Sep-2000 hiteshr Created
  225. //
  226. //---------------------------------------------------------------------------
  227. HRESULT InactiveUserFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  228. IN ARG_RECORD* pRecord,
  229. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  230. IN CDSCmdCredentialObject& refCredentialObject,
  231. IN PVOID pData,
  232. OUT CComBSTR& strFilter);
  233. //+--------------------------------------------------------------------------
  234. //
  235. // Function: StalepwdComputerFilterFunc
  236. //
  237. // Synopsis: Filter Function for Stale Computer Password query.
  238. //
  239. // Arguments: [pRecord - IN] : Not Used
  240. // [pObjectEntry - IN] : Not Used
  241. // [pVoid - IN] :Not used.
  242. // [strFilter - OUT] :Contains the output filter.
  243. // Returns: HRESULT : S_OK if everything succeeded
  244. // E_INVALIDARG if the object entry wasn't found
  245. // Anything else is a failure code from an ADSI call
  246. //
  247. // History: 25-Sep-2000 hiteshr Created
  248. //
  249. //---------------------------------------------------------------------------
  250. HRESULT StalepwdComputerFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  251. IN ARG_RECORD* pRecord,
  252. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  253. IN CDSCmdCredentialObject& refCredentialObject,
  254. IN PVOID pData,
  255. OUT CComBSTR& strFilter);
  256. //+--------------------------------------------------------------------------
  257. //
  258. // Function: StalepwdUserFilterFunc
  259. //
  260. // Synopsis: Filter Function for Stale User Password query.
  261. //
  262. // Arguments: [pRecord - IN] : Not Used
  263. // [pObjectEntry - IN] : Not Used
  264. // [pVoid - IN] :Not used.
  265. // [strFilter - OUT] :Contains the output filter.
  266. // Returns: HRESULT : S_OK if everything succeeded
  267. // E_INVALIDARG if the object entry wasn't found
  268. // Anything else is a failure code from an ADSI call
  269. //
  270. // History: 25-Sep-2000 hiteshr Created
  271. //
  272. //---------------------------------------------------------------------------
  273. HRESULT StalepwdUserFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  274. IN ARG_RECORD* pRecord,
  275. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  276. IN CDSCmdCredentialObject& refCredentialObject,
  277. IN PVOID pData,
  278. OUT CComBSTR& strFilter);
  279. //+--------------------------------------------------------------------------
  280. //
  281. // Function: QLimitFilterFunc
  282. //
  283. // Synopsis: Filter Function for -qlimit switch in dsquery quota.
  284. //
  285. // Arguments: [pEntry - IN] : Not Used
  286. // [pRecord - IN] : Command Line value supplied by user
  287. // [pVoid - IN] : suffix for the quota attribute.
  288. // [strFilter - OUT] :Contains the output filter.
  289. // Returns: HRESULT : S_OK if everything succeeded
  290. //
  291. // History: 13-Aug-2002 ronmart Created
  292. //
  293. //---------------------------------------------------------------------------
  294. HRESULT QLimitFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *,
  295. IN ARG_RECORD* pRecord,
  296. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  297. IN CDSCmdCredentialObject& refCredentialObject,
  298. IN PVOID pParam,
  299. OUT CComBSTR& strFilter);
  300. //+--------------------------------------------------------------------------
  301. //
  302. // Function: AccountFilterFunc
  303. //
  304. // Synopsis: Filter Function for -acct switch in dsquery quota.
  305. //
  306. // Arguments: [pEntry - IN] : Not Used
  307. // [pRecord - IN] : Command Line value supplied by user
  308. // [pVoid - IN] : suffix for the quota attribute.
  309. // [strFilter - OUT] :Contains the output filter.
  310. // Returns: HRESULT : S_OK if everything succeeded
  311. //
  312. // History: 14-Aug-2002 ronmart Created
  313. //
  314. //---------------------------------------------------------------------------
  315. HRESULT AccountFilterFunc(IN DSQUERY_ATTR_TABLE_ENTRY *pEntry,
  316. IN ARG_RECORD* pRecord,
  317. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  318. IN CDSCmdCredentialObject& refCredentialObject,
  319. IN PVOID pData,
  320. OUT CComBSTR& strFilter);
  321. //+--------------------------------------------------------------------------
  322. //
  323. // Function: AddSingleAccountFilter
  324. //
  325. // Synopsis: Appends an account string to strFilter for the specified user
  326. //
  327. // Arguments: [lpszUser - IN] : User whose sid string is requested
  328. // [strFilter - OUT] : Contains the output filter to append to
  329. // Returns: HRESULT : S_OK if everything succeeded
  330. //
  331. // History: 14-Aug-2002 ronmart Created
  332. //
  333. //---------------------------------------------------------------------------
  334. HRESULT AddSingleAccountFilter(IN LPCWSTR lpszValue,
  335. IN CDSCmdBasePathsInfo& refBasePathsInfo,
  336. IN CDSCmdCredentialObject& refCredentialObject,
  337. OUT CComBSTR& strFilter);