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.

428 lines
8.8 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. if (pIpsecPolicyObject->pRsopInfo) {
  88. FreeRsopInfo(
  89. pIpsecPolicyObject->pRsopInfo
  90. );
  91. }
  92. FreePolMem(pIpsecPolicyObject);
  93. return;
  94. }
  95. void
  96. FreeIpsecFilterObject(
  97. PIPSEC_FILTER_OBJECT pIpsecFilterObject
  98. )
  99. {
  100. if (pIpsecFilterObject->pszDistinguishedName) {
  101. FreePolStr(pIpsecFilterObject->pszDistinguishedName);
  102. }
  103. if (pIpsecFilterObject->pszDescription) {
  104. FreePolStr(pIpsecFilterObject->pszDescription);
  105. }
  106. if (pIpsecFilterObject->pszIpsecName) {
  107. FreePolStr(pIpsecFilterObject->pszIpsecName);
  108. }
  109. if (pIpsecFilterObject->pszIpsecID) {
  110. FreePolStr(pIpsecFilterObject->pszIpsecID);
  111. }
  112. if (pIpsecFilterObject->pIpsecData) {
  113. FreePolMem(pIpsecFilterObject->pIpsecData);
  114. }
  115. if (pIpsecFilterObject->ppszIpsecNFAReferences) {
  116. FreeNFAReferences(
  117. pIpsecFilterObject->ppszIpsecNFAReferences,
  118. pIpsecFilterObject->dwNFACount
  119. );
  120. }
  121. FreePolMem(pIpsecFilterObject);
  122. return;
  123. }
  124. void
  125. FreeIpsecNegPolObject(
  126. PIPSEC_NEGPOL_OBJECT pIpsecNegPolObject
  127. )
  128. {
  129. if (pIpsecNegPolObject->pszDescription) {
  130. FreePolStr(pIpsecNegPolObject->pszDescription);
  131. }
  132. if (pIpsecNegPolObject->pszDistinguishedName) {
  133. FreePolStr(pIpsecNegPolObject->pszDistinguishedName);
  134. }
  135. if (pIpsecNegPolObject->pszIpsecName) {
  136. FreePolStr(pIpsecNegPolObject->pszIpsecName);
  137. }
  138. if (pIpsecNegPolObject->pszIpsecID) {
  139. FreePolStr(pIpsecNegPolObject->pszIpsecID);
  140. }
  141. if (pIpsecNegPolObject->pszIpsecNegPolAction) {
  142. FreePolStr(pIpsecNegPolObject->pszIpsecNegPolAction);
  143. }
  144. if (pIpsecNegPolObject->pszIpsecNegPolType) {
  145. FreePolStr(pIpsecNegPolObject->pszIpsecNegPolType);
  146. }
  147. if (pIpsecNegPolObject->pIpsecData) {
  148. FreePolMem(pIpsecNegPolObject->pIpsecData);
  149. }
  150. if (pIpsecNegPolObject->ppszIpsecNFAReferences) {
  151. FreeNFAReferences(
  152. pIpsecNegPolObject->ppszIpsecNFAReferences,
  153. pIpsecNegPolObject->dwNFACount
  154. );
  155. }
  156. FreePolMem(pIpsecNegPolObject);
  157. return;
  158. }
  159. void
  160. FreeIpsecISAKMPObject(
  161. PIPSEC_ISAKMP_OBJECT pIpsecISAKMPObject
  162. )
  163. {
  164. if (pIpsecISAKMPObject->pszDistinguishedName) {
  165. FreePolStr(pIpsecISAKMPObject->pszDistinguishedName);
  166. }
  167. if (pIpsecISAKMPObject->pszIpsecName) {
  168. FreePolStr(pIpsecISAKMPObject->pszIpsecName);
  169. }
  170. if (pIpsecISAKMPObject->pszIpsecID) {
  171. FreePolStr(pIpsecISAKMPObject->pszIpsecID);
  172. }
  173. if (pIpsecISAKMPObject->pIpsecData) {
  174. FreePolMem(pIpsecISAKMPObject->pIpsecData);
  175. }
  176. if (pIpsecISAKMPObject->ppszIpsecNFAReferences) {
  177. FreeNFAReferences(
  178. pIpsecISAKMPObject->ppszIpsecNFAReferences,
  179. pIpsecISAKMPObject->dwNFACount
  180. );
  181. }
  182. FreePolMem(pIpsecISAKMPObject);
  183. return;
  184. }
  185. void
  186. FreeNFAReferences(
  187. LPWSTR * ppszNFAReferences,
  188. DWORD dwNumNFAReferences
  189. )
  190. {
  191. DWORD i = 0;
  192. for (i = 0; i < dwNumNFAReferences; i++) {
  193. if (*(ppszNFAReferences + i)) {
  194. FreePolStr(*(ppszNFAReferences + i));
  195. }
  196. }
  197. FreePolMem(ppszNFAReferences);
  198. return;
  199. }
  200. void
  201. FreeFilterReferences(
  202. LPWSTR * ppszFilterReferences,
  203. DWORD dwNumFilterReferences
  204. )
  205. {
  206. DWORD i = 0;
  207. for (i = 0; i < dwNumFilterReferences; i++) {
  208. if (*(ppszFilterReferences + i)) {
  209. FreePolStr(*(ppszFilterReferences + i));
  210. }
  211. }
  212. FreePolMem(ppszFilterReferences);
  213. return;
  214. }
  215. void
  216. FreeNegPolReferences(
  217. LPWSTR * ppszNegPolReferences,
  218. DWORD dwNumNegPolReferences
  219. )
  220. {
  221. DWORD i = 0;
  222. for (i = 0; i < dwNumNegPolReferences; i++) {
  223. if (*(ppszNegPolReferences + i)) {
  224. FreePolStr(*(ppszNegPolReferences + i));
  225. }
  226. }
  227. FreePolMem(ppszNegPolReferences);
  228. return;
  229. }
  230. void
  231. FreeIpsecNFAObjects(
  232. PIPSEC_NFA_OBJECT * ppIpsecNFAObjects,
  233. DWORD dwNumNFAObjects
  234. )
  235. {
  236. DWORD i = 0;
  237. for (i = 0; i < dwNumNFAObjects; i++) {
  238. if (*(ppIpsecNFAObjects + i)) {
  239. FreeIpsecNFAObject(*(ppIpsecNFAObjects + i));
  240. }
  241. }
  242. FreePolMem(ppIpsecNFAObjects);
  243. return;
  244. }
  245. void
  246. FreeIpsecFilterObjects(
  247. PIPSEC_FILTER_OBJECT * ppIpsecFilterObjects,
  248. DWORD dwNumFilterObjects
  249. )
  250. {
  251. DWORD i = 0;
  252. for (i = 0; i < dwNumFilterObjects; i++) {
  253. if (*(ppIpsecFilterObjects + i)) {
  254. FreeIpsecFilterObject(*(ppIpsecFilterObjects + i));
  255. }
  256. }
  257. FreePolMem(ppIpsecFilterObjects);
  258. return;
  259. }
  260. void
  261. FreeIpsecNegPolObjects(
  262. PIPSEC_NEGPOL_OBJECT * ppIpsecNegPolObjects,
  263. DWORD dwNumNegPolObjects
  264. )
  265. {
  266. DWORD i = 0;
  267. for (i = 0; i < dwNumNegPolObjects; i++) {
  268. if (*(ppIpsecNegPolObjects + i)) {
  269. FreeIpsecNegPolObject(*(ppIpsecNegPolObjects + i));
  270. }
  271. }
  272. FreePolMem(ppIpsecNegPolObjects);
  273. return;
  274. }
  275. void
  276. FreeIpsecISAKMPObjects(
  277. PIPSEC_ISAKMP_OBJECT * ppIpsecISAKMPObjects,
  278. DWORD dwNumISAKMPObjects
  279. )
  280. {
  281. DWORD i = 0;
  282. for (i = 0; i < dwNumISAKMPObjects; i++) {
  283. if (*(ppIpsecISAKMPObjects + i)) {
  284. FreeIpsecISAKMPObject(*(ppIpsecISAKMPObjects + i));
  285. }
  286. }
  287. FreePolMem(ppIpsecISAKMPObjects);
  288. return;
  289. }
  290. void
  291. FreeIpsecPolicyObjects(
  292. PIPSEC_POLICY_OBJECT * ppIpsecPolicyObjects,
  293. DWORD dwNumPolicyObjects
  294. )
  295. {
  296. DWORD i = 0;
  297. for (i = 0; i < dwNumPolicyObjects; i++) {
  298. if (*(ppIpsecPolicyObjects + i)) {
  299. FreeIpsecPolicyObject(*(ppIpsecPolicyObjects + i));
  300. }
  301. }
  302. FreePolMem(ppIpsecPolicyObjects);
  303. return;
  304. }