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.

422 lines
8.3 KiB

  1. #include "precomp.h"
  2. void
  3. FreeIpsecNFAObject(
  4. PIPSEC_NFA_OBJECT pIpsecNFAObject
  5. )
  6. {
  7. if (pIpsecNFAObject->pszDistinguishedName) {
  8. FreePolStr(pIpsecNFAObject->pszDistinguishedName);
  9. }
  10. if (pIpsecNFAObject->pszIpsecName) {
  11. FreePolStr(pIpsecNFAObject->pszIpsecName);
  12. }
  13. if (pIpsecNFAObject->pszDescription) {
  14. FreePolStr(pIpsecNFAObject->pszDescription);
  15. }
  16. if (pIpsecNFAObject->pszIpsecID) {
  17. FreePolStr(pIpsecNFAObject->pszIpsecID);
  18. }
  19. if (pIpsecNFAObject->pIpsecData) {
  20. FreePolMem(pIpsecNFAObject->pIpsecData);
  21. }
  22. if (pIpsecNFAObject->pszIpsecOwnersReference) {
  23. FreePolStr(pIpsecNFAObject->pszIpsecOwnersReference);
  24. }
  25. if (pIpsecNFAObject->pszIpsecFilterReference) {
  26. FreePolStr(pIpsecNFAObject->pszIpsecFilterReference);
  27. }
  28. if (pIpsecNFAObject->pszIpsecNegPolReference) {
  29. FreePolStr(pIpsecNFAObject->pszIpsecNegPolReference);
  30. }
  31. FreePolMem(pIpsecNFAObject);
  32. return;
  33. }
  34. void
  35. FreeIpsecPolicyObject(
  36. PIPSEC_POLICY_OBJECT pIpsecPolicyObject
  37. )
  38. {
  39. if (pIpsecPolicyObject->pszDescription) {
  40. FreePolStr(pIpsecPolicyObject->pszDescription);
  41. }
  42. if (pIpsecPolicyObject->pszIpsecOwnersReference) {
  43. FreePolStr(pIpsecPolicyObject->pszIpsecOwnersReference);
  44. }
  45. if (pIpsecPolicyObject->pszIpsecName) {
  46. FreePolStr(pIpsecPolicyObject->pszIpsecName);
  47. }
  48. if (pIpsecPolicyObject->pszIpsecID) {
  49. FreePolStr(pIpsecPolicyObject->pszIpsecID);
  50. }
  51. if (pIpsecPolicyObject->pIpsecData) {
  52. FreePolMem(pIpsecPolicyObject->pIpsecData);
  53. }
  54. if (pIpsecPolicyObject->pszIpsecISAKMPReference) {
  55. FreePolStr(pIpsecPolicyObject->pszIpsecISAKMPReference);
  56. }
  57. if (pIpsecPolicyObject->ppszIpsecNFAReferences) {
  58. FreeNFAReferences(
  59. pIpsecPolicyObject->ppszIpsecNFAReferences,
  60. pIpsecPolicyObject->NumberofRules
  61. );
  62. }
  63. if (pIpsecPolicyObject->ppIpsecNFAObjects) {
  64. FreeIpsecNFAObjects(
  65. pIpsecPolicyObject->ppIpsecNFAObjects,
  66. pIpsecPolicyObject->NumberofRulesReturned
  67. );
  68. }
  69. if (pIpsecPolicyObject->ppIpsecFilterObjects) {
  70. FreeIpsecFilterObjects(
  71. pIpsecPolicyObject->ppIpsecFilterObjects,
  72. pIpsecPolicyObject->NumberofFilters
  73. );
  74. }
  75. if (pIpsecPolicyObject->ppIpsecNegPolObjects) {
  76. FreeIpsecNegPolObjects(
  77. pIpsecPolicyObject->ppIpsecNegPolObjects,
  78. pIpsecPolicyObject->NumberofNegPols
  79. );
  80. }
  81. if (pIpsecPolicyObject->ppIpsecISAKMPObjects) {
  82. FreeIpsecISAKMPObjects(
  83. pIpsecPolicyObject->ppIpsecISAKMPObjects,
  84. pIpsecPolicyObject->NumberofISAKMPs
  85. );
  86. }
  87. FreePolMem(pIpsecPolicyObject);
  88. return;
  89. }
  90. void
  91. FreeIpsecFilterObject(
  92. PIPSEC_FILTER_OBJECT pIpsecFilterObject
  93. )
  94. {
  95. if (pIpsecFilterObject->pszDistinguishedName) {
  96. FreePolStr(pIpsecFilterObject->pszDistinguishedName);
  97. }
  98. if (pIpsecFilterObject->pszDescription) {
  99. FreePolStr(pIpsecFilterObject->pszDescription);
  100. }
  101. if (pIpsecFilterObject->pszIpsecName) {
  102. FreePolStr(pIpsecFilterObject->pszIpsecName);
  103. }
  104. if (pIpsecFilterObject->pszIpsecID) {
  105. FreePolStr(pIpsecFilterObject->pszIpsecID);
  106. }
  107. if (pIpsecFilterObject->pIpsecData) {
  108. FreePolMem(pIpsecFilterObject->pIpsecData);
  109. }
  110. if (pIpsecFilterObject->ppszIpsecNFAReferences) {
  111. FreeNFAReferences(
  112. pIpsecFilterObject->ppszIpsecNFAReferences,
  113. pIpsecFilterObject->dwNFACount
  114. );
  115. }
  116. FreePolMem(pIpsecFilterObject);
  117. return;
  118. }
  119. void
  120. FreeIpsecNegPolObject(
  121. PIPSEC_NEGPOL_OBJECT pIpsecNegPolObject
  122. )
  123. {
  124. if (pIpsecNegPolObject->pszDescription) {
  125. FreePolStr(pIpsecNegPolObject->pszDescription);
  126. }
  127. if (pIpsecNegPolObject->pszDistinguishedName) {
  128. FreePolStr(pIpsecNegPolObject->pszDistinguishedName);
  129. }
  130. if (pIpsecNegPolObject->pszIpsecName) {
  131. FreePolStr(pIpsecNegPolObject->pszIpsecName);
  132. }
  133. if (pIpsecNegPolObject->pszIpsecID) {
  134. FreePolStr(pIpsecNegPolObject->pszIpsecID);
  135. }
  136. if (pIpsecNegPolObject->pszIpsecNegPolAction) {
  137. FreePolStr(pIpsecNegPolObject->pszIpsecNegPolAction);
  138. }
  139. if (pIpsecNegPolObject->pszIpsecNegPolType) {
  140. FreePolStr(pIpsecNegPolObject->pszIpsecNegPolType);
  141. }
  142. if (pIpsecNegPolObject->pIpsecData) {
  143. FreePolMem(pIpsecNegPolObject->pIpsecData);
  144. }
  145. if (pIpsecNegPolObject->ppszIpsecNFAReferences) {
  146. FreeNFAReferences(
  147. pIpsecNegPolObject->ppszIpsecNFAReferences,
  148. pIpsecNegPolObject->dwNFACount
  149. );
  150. }
  151. FreePolMem(pIpsecNegPolObject);
  152. return;
  153. }
  154. void
  155. FreeIpsecISAKMPObject(
  156. PIPSEC_ISAKMP_OBJECT pIpsecISAKMPObject
  157. )
  158. {
  159. if (pIpsecISAKMPObject->pszDistinguishedName) {
  160. FreePolStr(pIpsecISAKMPObject->pszDistinguishedName);
  161. }
  162. if (pIpsecISAKMPObject->pszIpsecName) {
  163. FreePolStr(pIpsecISAKMPObject->pszIpsecName);
  164. }
  165. if (pIpsecISAKMPObject->pszIpsecID) {
  166. FreePolStr(pIpsecISAKMPObject->pszIpsecID);
  167. }
  168. if (pIpsecISAKMPObject->pIpsecData) {
  169. FreePolMem(pIpsecISAKMPObject->pIpsecData);
  170. }
  171. if (pIpsecISAKMPObject->ppszIpsecNFAReferences) {
  172. FreeNFAReferences(
  173. pIpsecISAKMPObject->ppszIpsecNFAReferences,
  174. pIpsecISAKMPObject->dwNFACount
  175. );
  176. }
  177. FreePolMem(pIpsecISAKMPObject);
  178. return;
  179. }
  180. void
  181. FreeNFAReferences(
  182. LPWSTR * ppszNFAReferences,
  183. DWORD dwNumNFAReferences
  184. )
  185. {
  186. DWORD i = 0;
  187. for (i = 0; i < dwNumNFAReferences; i++) {
  188. if (*(ppszNFAReferences + i)) {
  189. FreePolStr(*(ppszNFAReferences + i));
  190. }
  191. }
  192. FreePolMem(ppszNFAReferences);
  193. return;
  194. }
  195. void
  196. FreeFilterReferences(
  197. LPWSTR * ppszFilterReferences,
  198. DWORD dwNumFilterReferences
  199. )
  200. {
  201. DWORD i = 0;
  202. for (i = 0; i < dwNumFilterReferences; i++) {
  203. if (*(ppszFilterReferences + i)) {
  204. FreePolStr(*(ppszFilterReferences + i));
  205. }
  206. }
  207. FreePolMem(ppszFilterReferences);
  208. return;
  209. }
  210. void
  211. FreeNegPolReferences(
  212. LPWSTR * ppszNegPolReferences,
  213. DWORD dwNumNegPolReferences
  214. )
  215. {
  216. DWORD i = 0;
  217. for (i = 0; i < dwNumNegPolReferences; i++) {
  218. if (*(ppszNegPolReferences + i)) {
  219. FreePolStr(*(ppszNegPolReferences + i));
  220. }
  221. }
  222. FreePolMem(ppszNegPolReferences);
  223. return;
  224. }
  225. void
  226. FreeIpsecNFAObjects(
  227. PIPSEC_NFA_OBJECT * ppIpsecNFAObjects,
  228. DWORD dwNumNFAObjects
  229. )
  230. {
  231. DWORD i = 0;
  232. for (i = 0; i < dwNumNFAObjects; i++) {
  233. if (*(ppIpsecNFAObjects + i)) {
  234. FreeIpsecNFAObject(*(ppIpsecNFAObjects + i));
  235. }
  236. }
  237. FreePolMem(ppIpsecNFAObjects);
  238. return;
  239. }
  240. void
  241. FreeIpsecFilterObjects(
  242. PIPSEC_FILTER_OBJECT * ppIpsecFilterObjects,
  243. DWORD dwNumFilterObjects
  244. )
  245. {
  246. DWORD i = 0;
  247. for (i = 0; i < dwNumFilterObjects; i++) {
  248. if (*(ppIpsecFilterObjects + i)) {
  249. FreeIpsecFilterObject(*(ppIpsecFilterObjects + i));
  250. }
  251. }
  252. FreePolMem(ppIpsecFilterObjects);
  253. return;
  254. }
  255. void
  256. FreeIpsecNegPolObjects(
  257. PIPSEC_NEGPOL_OBJECT * ppIpsecNegPolObjects,
  258. DWORD dwNumNegPolObjects
  259. )
  260. {
  261. DWORD i = 0;
  262. for (i = 0; i < dwNumNegPolObjects; i++) {
  263. if (*(ppIpsecNegPolObjects + i)) {
  264. FreeIpsecNegPolObject(*(ppIpsecNegPolObjects + i));
  265. }
  266. }
  267. FreePolMem(ppIpsecNegPolObjects);
  268. return;
  269. }
  270. void
  271. FreeIpsecISAKMPObjects(
  272. PIPSEC_ISAKMP_OBJECT * ppIpsecISAKMPObjects,
  273. DWORD dwNumISAKMPObjects
  274. )
  275. {
  276. DWORD i = 0;
  277. for (i = 0; i < dwNumISAKMPObjects; i++) {
  278. if (*(ppIpsecISAKMPObjects + i)) {
  279. FreeIpsecISAKMPObject(*(ppIpsecISAKMPObjects + i));
  280. }
  281. }
  282. FreePolMem(ppIpsecISAKMPObjects);
  283. return;
  284. }
  285. void
  286. FreeIpsecPolicyObjects(
  287. PIPSEC_POLICY_OBJECT * ppIpsecPolicyObjects,
  288. DWORD dwNumPolicyObjects
  289. )
  290. {
  291. DWORD i = 0;
  292. for (i = 0; i < dwNumPolicyObjects; i++) {
  293. if (*(ppIpsecPolicyObjects + i)) {
  294. FreeIpsecPolicyObject(*(ppIpsecPolicyObjects + i));
  295. }
  296. }
  297. FreePolMem(ppIpsecPolicyObjects);
  298. return;
  299. }