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.

350 lines
10 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. w2kfuncs.c
  5. Abstract:
  6. Domain Name System (DNS) Server
  7. Frozen routines for processing W2K structures.
  8. Author:
  9. Jeff Westhead (jwesth) October, 2000
  10. Revision History:
  11. --*/
  12. #include "dnsclip.h"
  13. //
  14. // External functions
  15. //
  16. VOID
  17. DnsPrint_RpcServerInfo_W2K(
  18. IN PRINT_ROUTINE PrintRoutine,
  19. IN OUT PPRINT_CONTEXT pPrintContext,
  20. IN LPSTR pszHeader,
  21. IN PDNS_RPC_SERVER_INFO_W2K pServerInfo
  22. )
  23. {
  24. DnsPrint_Lock();
  25. if ( pszHeader )
  26. {
  27. PrintRoutine( pPrintContext, pszHeader );
  28. }
  29. if ( ! pServerInfo )
  30. {
  31. PrintRoutine( pPrintContext, "NULL server info ptr.\n" );
  32. }
  33. else
  34. {
  35. int majorVer = pServerInfo->dwVersion & 0x000000FF;
  36. int minorVer = ( pServerInfo->dwVersion & 0x0000FF00 ) >> 8;
  37. int buildNum = pServerInfo->dwVersion >> 16;
  38. PrintRoutine( pPrintContext,
  39. "Server info W2K:\n"
  40. "\tptr = %p\n"
  41. "\tserver name = %s\n",
  42. pServerInfo,
  43. pServerInfo->pszServerName );
  44. //
  45. // Sanitize build number for older versions where build number is wacked.
  46. //
  47. if ( buildNum < 1 || buildNum > 5000 )
  48. {
  49. PrintRoutine( pPrintContext,
  50. "\tversion = %08lX (%d.%d)\n",
  51. pServerInfo->dwVersion,
  52. majorVer,
  53. minorVer );
  54. }
  55. else
  56. {
  57. PrintRoutine( pPrintContext,
  58. "\tversion = %08lX (%d.%d build %d)\n",
  59. pServerInfo->dwVersion,
  60. majorVer,
  61. minorVer,
  62. buildNum );
  63. }
  64. PrintRoutine( pPrintContext,
  65. "\tDS container = %S\n",
  66. ( PWSTR ) pServerInfo->pszDsContainer );
  67. PrintRoutine( pPrintContext,
  68. " Configuration:\n"
  69. "\tdwLogLevel = %p\n"
  70. "\tdwDebugLevel = %p\n"
  71. "\tdwRpcProtocol = %p\n"
  72. "\tdwNameCheckFlag = %p\n"
  73. "\tcAddressAnswerLimit = %d\n"
  74. "\tdwRecursionRetry = %d\n"
  75. "\tdwRecursionTimeout = %d\n"
  76. "\tdwDsPollingInterval = %d\n",
  77. pServerInfo->dwLogLevel,
  78. pServerInfo->dwDebugLevel,
  79. pServerInfo->dwRpcProtocol,
  80. pServerInfo->dwNameCheckFlag,
  81. pServerInfo->cAddressAnswerLimit,
  82. pServerInfo->dwRecursionRetry,
  83. pServerInfo->dwRecursionTimeout,
  84. pServerInfo->dwDsPollingInterval
  85. );
  86. PrintRoutine( pPrintContext,
  87. " Configuration Flags:\n"
  88. "\tfBootMethod = %d\n"
  89. "\tfAdminConfigured = %d\n"
  90. "\tfAllowUpdate = %d\n"
  91. "\tfDsAvailable = %d\n"
  92. "\tfAutoReverseZones = %d\n"
  93. "\tfAutoCacheUpdate = %d\n"
  94. "\tfSlave = %d\n"
  95. "\tfNoRecursion = %d\n"
  96. "\tfRoundRobin = %d\n"
  97. "\tfLocalNetPriority = %d\n"
  98. "\tfStrictFileParsing = %d\n"
  99. "\tfLooseWildcarding = %d\n"
  100. "\tfBindSecondaries = %d\n"
  101. "\tfWriteAuthorityNs = %d\n",
  102. pServerInfo->fBootMethod,
  103. pServerInfo->fAdminConfigured,
  104. pServerInfo->fAllowUpdate,
  105. pServerInfo->fDsAvailable,
  106. pServerInfo->fAutoReverseZones,
  107. pServerInfo->fAutoCacheUpdate,
  108. pServerInfo->fSlave,
  109. pServerInfo->fNoRecursion,
  110. pServerInfo->fRoundRobin,
  111. pServerInfo->fLocalNetPriority,
  112. pServerInfo->fStrictFileParsing,
  113. pServerInfo->fLooseWildcarding,
  114. pServerInfo->fBindSecondaries,
  115. pServerInfo->fWriteAuthorityNs
  116. );
  117. PrintRoutine(
  118. pPrintContext,
  119. " Aging Configuration:\n"
  120. "\tScavengingInterval = %d\n"
  121. "\tDefaultAgingState = %d\n"
  122. "\tDefaultRefreshInterval = %d\n"
  123. "\tDefaultNoRefreshInterval = %d\n",
  124. pServerInfo->dwScavengingInterval,
  125. pServerInfo->fDefaultAgingState,
  126. pServerInfo->dwDefaultRefreshInterval,
  127. pServerInfo->dwDefaultNoRefreshInterval
  128. );
  129. DnsPrint_Ip4Array(
  130. PrintRoutine,
  131. pPrintContext,
  132. " ServerAddresses:\n",
  133. "\tAddr",
  134. pServerInfo->aipServerAddrs );
  135. DnsPrint_Ip4Array(
  136. PrintRoutine,
  137. pPrintContext,
  138. " ListenAddresses:\n",
  139. "\tAddr",
  140. pServerInfo->aipListenAddrs );
  141. DnsPrint_Ip4Array(
  142. PrintRoutine,
  143. pPrintContext,
  144. " Forwarders:\n",
  145. "\tAddr",
  146. pServerInfo->aipForwarders );
  147. PrintRoutine(
  148. pPrintContext,
  149. "\tforward timeout = %d\n"
  150. "\tslave = %d\n",
  151. pServerInfo->dwForwardTimeout,
  152. pServerInfo->fSlave );
  153. }
  154. DnsPrint_Unlock();
  155. }
  156. VOID
  157. DnsPrint_RpcZoneInfo_W2K(
  158. IN PRINT_ROUTINE PrintRoutine,
  159. IN OUT PPRINT_CONTEXT pPrintContext,
  160. IN LPSTR pszHeader,
  161. IN PDNS_RPC_ZONE_INFO_W2K pZoneInfo
  162. )
  163. {
  164. DnsPrint_Lock();
  165. PrintRoutine( pPrintContext, (pszHeader ? pszHeader : "") );
  166. if ( ! pZoneInfo )
  167. {
  168. PrintRoutine( pPrintContext, "NULL zone info ptr.\n" );
  169. }
  170. else
  171. {
  172. PrintRoutine( pPrintContext,
  173. "Zone info W2K:\n"
  174. "\tptr = %p\n"
  175. "\tzone name = %s\n"
  176. "\tzone type = %d\n"
  177. "\tupdate = %d\n"
  178. "\tDS integrated = %d\n"
  179. "\tdata file = %s\n"
  180. "\tusing WINS = %d\n"
  181. "\tusing Nbstat = %d\n"
  182. "\taging = %d\n"
  183. "\t refresh interval = %lu\n"
  184. "\t no refresh = %lu\n"
  185. "\t scavenge available = %lu\n",
  186. pZoneInfo,
  187. pZoneInfo->pszZoneName,
  188. pZoneInfo->dwZoneType,
  189. pZoneInfo->fAllowUpdate,
  190. pZoneInfo->fUseDatabase,
  191. pZoneInfo->pszDataFile,
  192. pZoneInfo->fUseWins,
  193. pZoneInfo->fUseNbstat,
  194. pZoneInfo->fAging,
  195. pZoneInfo->dwRefreshInterval,
  196. pZoneInfo->dwNoRefreshInterval,
  197. pZoneInfo->dwAvailForScavengeTime
  198. );
  199. DnsPrint_Ip4Array(
  200. PrintRoutine, pPrintContext,
  201. "\tZone Masters\n",
  202. "\tMaster",
  203. pZoneInfo->aipMasters );
  204. DnsPrint_Ip4Array(
  205. PrintRoutine, pPrintContext,
  206. "\tZone Secondaries\n",
  207. "\tSecondary",
  208. pZoneInfo->aipSecondaries );
  209. PrintRoutine( pPrintContext,
  210. "\tsecure secs = %d\n",
  211. pZoneInfo->fSecureSecondaries );
  212. if ( pZoneInfo->aipScavengeServers )
  213. {
  214. DnsPrint_Ip4Array(
  215. PrintRoutine, pPrintContext,
  216. "\tScavenge Servers\n",
  217. "\tServer",
  218. pZoneInfo->aipScavengeServers );
  219. }
  220. }
  221. DnsPrint_Unlock();
  222. }
  223. VOID
  224. DnsPrint_RpcZone_W2K(
  225. IN PRINT_ROUTINE PrintRoutine,
  226. IN OUT PPRINT_CONTEXT pPrintContext,
  227. IN LPSTR pszHeader,
  228. IN PDNS_RPC_ZONE_W2K pZone
  229. )
  230. {
  231. if ( ! pZone )
  232. {
  233. PrintRoutine( pPrintContext,
  234. "%sNULL zone info ptr.\n",
  235. ( pszHeader ? pszHeader : "" ) );
  236. }
  237. else
  238. {
  239. // print zone per line
  240. PrintRoutine( pPrintContext,
  241. "%s\n"
  242. " %-29S",
  243. pszHeader
  244. ? pszHeader
  245. : "",
  246. pZone->pszZoneName );
  247. PrintRoutine( pPrintContext,
  248. " %1d %2s %3s %4s Up=%1d %5s %6s %6s\n",
  249. pZone->ZoneType,
  250. pZone->Flags.DsIntegrated ? "DS " : "file",
  251. pZone->Flags.Reverse ? "Rev" : "",
  252. pZone->Flags.AutoCreated ? "Auto" : "",
  253. pZone->Flags.Update,
  254. pZone->Flags.Aging ? "Aging" : "",
  255. pZone->Flags.Paused ? "Paused" : "",
  256. pZone->Flags.Shutdown ? "Shutdn" : "" );
  257. }
  258. }
  259. VOID
  260. DNS_API_FUNCTION
  261. DnsPrint_RpcZoneList_W2K(
  262. IN PRINT_ROUTINE PrintRoutine,
  263. IN OUT PPRINT_CONTEXT pPrintContext,
  264. IN LPSTR pszHeader,
  265. IN PDNS_RPC_ZONE_LIST_W2K pZoneList
  266. )
  267. {
  268. DWORD i;
  269. DnsPrint_Lock();
  270. if ( pszHeader )
  271. {
  272. PrintRoutine( pPrintContext, "%s\n", pszHeader );
  273. }
  274. if ( !pZoneList )
  275. {
  276. PrintRoutine( pPrintContext, "NULL zone list pointer.\n" );
  277. }
  278. else
  279. {
  280. PrintRoutine( pPrintContext, "\tZone Count = %d (W2K)\n", pZoneList->dwZoneCount );
  281. if ( pZoneList->dwZoneCount )
  282. {
  283. DnsPrint_RpcZone_W2K(
  284. PrintRoutine, pPrintContext,
  285. NULL, // print default header
  286. pZoneList->ZoneArray[0] );
  287. }
  288. for ( i=1; i<pZoneList->dwZoneCount; i++ )
  289. {
  290. DnsPrint_RpcZone_W2K(
  291. PrintRoutine, pPrintContext,
  292. " ", // not to print default header
  293. pZoneList->ZoneArray[i] );
  294. }
  295. PrintRoutine( pPrintContext, "\n" );
  296. }
  297. DnsPrint_Unlock();
  298. }
  299. //
  300. // End of w2kfuncs.c
  301. //