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.

248 lines
11 KiB

  1. TODO LIST
  2. 1. Get code to compile with strsafe macros.
  3. 2. Run buffy and do any needed cleanup.
  4. 3. Proper return values on not-found case.
  5. 09/09/01 JosephJ LoadLibrary failed because CNlbsNic was initialized as static.
  6. ERROR_NOACCESS, etc, etc...
  7. Turns out that CNlbsNic is a static ("CNlbsNic MyNlbsNicSet ...", in
  8. nlbsnic.cpp). So we were calling .
  9. Plan:
  10. 0. Remove non-trivial stuff from constructors of static objects.
  11. 1. Identify stuff that *CAN* be run in the context of DLL_PROCESS_ATTACH,
  12. and call them.
  13. 2. Create DynamicInitialize, DynamicDeinitialize methods, that
  14. contain non-trivial initializations
  15. CfgUtilsInitialize is non-trivial -- *must* be called in the
  16. context of DynamicInitialize.
  17. UpdateConfiguration::Initialize currently has InitializeCriticalSection --
  18. so should be part of static-init (PROCESS ATTACH) but it currently
  19. also calls CfgUtilsInitialize -- this should be removed.
  20. WPP_INIT -- can be called in the context of DLL_PROCESS_ATTACH?
  21. 09/23/2001 JosephJ Managing remote control passwords.
  22. Bug: 326514
  23. NlbManager: Allow user to modify remote control password; report password
  24. mismatches across hosts
  25. We can not provide a way to read the remote control password in plain text
  26. -- because the password is not saved in a recoverable manner
  27. -- it is hashed to a dword before saving to the registry.
  28. See WlbsSetRemotePassword implementation:
  29. reg_data -> i_rct_password = License_wstring_encode ((WCHAR*)password);
  30. NLBMPROV.DLL can support setting this hashed version of the password.
  31. From a security perspective, Wlbsdisplay displays it, afterall, and one can
  32. easily find the has value that corresponds to a plain-text version by
  33. setting up a bogus cluster and looking in the registry).
  34. We can then report to the nlbmgr user when the passwords do not match.
  35. When adding a new host we simply set the hashed-version in the properties.
  36. To avoid having to have the nlbmgr code include the plain-to-hashing
  37. functionality (currently it lives in wlbs\api\license.c), NLBMPROV will
  38. also support a plain text password. This field is set when the nlbmgr user
  39. changes the password.
  40. 09/23/2001 JosephJ New WMI Methods!
  41. RegisterManagementApplication(
  42. IN szGUID, // globally and uniquely identifies the application
  43. IN szApplication, // "Application Center", "ISA", etc.
  44. IN szCompany, // "Microsoft Corp.", etc.
  45. OUT dwRet // ok, error-existing, other error
  46. OUT szExistingApplication,
  47. OUT szExistingCompany,
  48. );
  49. If the function fails because of error-existing, the out params will
  50. be filled out with the existing application name and company.
  51. UnregisterManagementApplication(
  52. IN szGUID, // Application GUID
  53. OUT dwRet // -- ok, not-found
  54. );
  55. ControlCluster(
  56. IN szAdapterGuid, // GUID of adapter on which op is performed
  57. IN szClusterIpAddress, // OPTIONAL clustered IP address
  58. IN szPort, // OPTIONAL port
  59. IN dwOperation, // Operation: NOOP, START, STOP, etc.
  60. OUT dwResult, // success, fail, etc.
  61. OUT dwCurrentState, // State *after* initiating operation.
  62. OUT dwHostMap // Current host map.
  63. );
  64. ControlCluster is used to perform LOCAL operations on a specific
  65. adapter (specified by szAdapterGuid).
  66. ControlCluster can be used to query the current local operational state
  67. of the cluster -- this is done by specifying NOOP as the operation.
  68. The operation can be targeted at a specific cluster IP (relevant for
  69. per-port-rule cluster IPs) and at a specific port rule.
  70. 09/28/2001 JosephJ HostingModel = "NetworkServiceHost" hassles.
  71. Gary and I have spent the last few hours getting to the bottom of
  72. this problem, with debug ndis, netcfg, ndis and netcfg tracing and whatnot.
  73. It finally turns out that this problem is a problem of nlbmprov run in
  74. NetworkServiceHost as opposed to LocalHost! It was failing further on than
  75. before (before Karthics SetThreadToken fix), but failing nevertherless.
  76. So we went back to using LocalHost (and not calling ImpersonateClient) and
  77. things work perfectly we tried with both tprov and nlbmgr2.exe.
  78. To enable the NetworkService code ...
  79. - Uncomment the following line in nlbmprov.mof:
  80. // HostingModel = "NetworkServiceHost";
  81. - Uncomment the following line in private.h
  82. // #define NLB_USE_NETWORK_HOST 1
  83. TODO: take our time and fix this once and for all (and test thoroughly,
  84. using tprov.exe), and if there are probles, back out of it and instead
  85. get out provider audited by the security folks.
  86. 10/02/01 JosephJ update ...
  87. Even with properly signed netcfgx.dll, setupapi.log reports the following
  88. with networkservicehost enabled:
  89. #E358 An unsigned or incorrectly signed file
  90. "E:\WINDOWS\System32\NetCfgx.dll" for driver
  91. "Network Load Balancing Filter Device" blocked (server install).
  92. Error 5: Access is denied.
  93. Windows could not load the installer for Net. Contact your hardware
  94. vendor for a ssistance. Error 5: Access is denied.
  95. Traceformat output for the same showed:
  96. [0]0CE0.04F0::10/02/2001-16:26:40.425 [api]->WlbsOpen
  97. [0]0CE0.04F0::10/02/2001-16:26:40.425 [api]WlbsOpen creating handle
  98. to the device object failed with 2
  99. So it looks like the bind was improperly completing due to the above
  100. setupapi error, resulting in wlbs.sys not being loaded, so the
  101. subsequent call to WlbsOpen filed.
  102. params.cpp:wlbsctrl!WlbsSetRemotePassword
  103. does work with NULL password -- sets to default.
  104. netcfgconfig.cpp:
  105. CNetcfgCluster::InitializeWithDefault
  106. time_t cur_time;
  107. m_CurrentConfig.install_date = time(& cur_time);
  108. 10/15/2001 JosephJ Changes of this checkin:
  109. - Got rid of obsolete code for handling instances (mof change)
  110. - Add support for AddDedicatedIp, AddClusterIps
  111. - Implemented support for Read/Write HashedRemoteControlPassword
  112. - fix for bug 480120 nlb:cluster converged when duplicate host ID exist
  113. - If there are no ip addresses we put in an "autonet like" address.
  114. - Cluster is set in the suspended state, not stopped state, before
  115. major operations.
  116. - Moved "analyze" functionality to cfgutillib
  117. - Re-implemented analyze functionality default behaviour to keep old
  118. Ip addresses if possible.
  119. - If there is a mode change we do NOT add back the cluster IP addresses
  120. (so there's less chance of an ip address conflict).
  121. 12/7/2001 ChrisDar
  122. 457437 NLBManager: Add NT event logging to the wmi provider
  123. To add event logging do the following:
  124. - Create a log_msgs.mc file which will contain the text for the events.
  125. Reserve some message ID space since many components use the 'WLBS' source
  126. for logging. Tdit the comments in each of these files to update the
  127. range of IDs reserved for this binary.
  128. - Create a .rc resource file if you don't have one (e,g,. nlbmprov.rc). Every
  129. component has a version.rc already. Build will freak out if you add more
  130. than one .rc file to the list of sources. So, the new .rc is a container
  131. for other resource files. Add lines to #include version.rc and log_msgs.rc,
  132. and any other .rc files you have. Note that log_msgs.rc will be built
  133. automatically from log_msgs.mc.
  134. - Edit the sources file, adding log_msgs.mc and the .rc to the SOURCES list.
  135. Remove all other .rc files from the SOURCES list.
  136. - Edit nt\net\config\netcfg\inf\netwlbsm.inx and add the name of the binary
  137. that will contain these event messages (nlbmprov.dll in this case) to
  138. 'EventMessageFile' in the section [WLBSMP.AddEventLog.AddReg]
  139. - API calls for writing NT events
  140. * RegisterEventSource opens the event log and returns a handle for
  141. writing to the log.
  142. * ReportEvent logs and event to the log. This requires the handle to the
  143. event.
  144. * DeregisterEventSource closes the event log. Pass the handle from the
  145. RegisterEventSource call.
  146. template to flag code-review TODOs:
  147. 2/13/02 JosephJ SECURITY BUGBUG:
  148. 02/27/2002 JosephJ: Cleaning up properly on exit...
  149. Currently nlbmprov.dll doesn't cleanup properly -- it tries to clean up
  150. on dll-detach and on execution of the destructor of static object
  151. NlbConfigurationUpdate. This causes the global crit section
  152. NlbConfigurationUpdate::s_Crit to be entered
  153. (in the context of CNlbsNic::~CNlbsNic) AFTER it is deleted
  154. (in the context of DllMain). The following call trees illustrates
  155. this:
  156. DllMain
  157. PROCESS_DETATCH: NlbConfigurationUpdate::StaticDeinitialize
  158. DeleteCriticalSection
  159. (happens later)...
  160. CNlbsNic::~CNlbsNic
  161. CNlbsNic::mfn_DelayedDeinitialize();
  162. NlbConfigurationUpdate::PrepareForDeinitialization();
  163. NlbConfigurationUpdate::sfn_Lock
  164. EnterCriticalSection (AVs, because it's been deinitialized).
  165. Fix:
  166. Do non-trivial cleanup in the context of DlLCanUnloadNow.
  167. Move static init/deinit to one place -- probabaly to
  168. CNlbsNic's contsructor/distructor -- only thing it does should
  169. be to Delete critical sections, really.
  170. DllCanUnloadNow -- should check if there are pending operations, and fail
  171. if there are any. If there are NO pending operations, it should
  172. block new ones.
  173. Note: turns out we can get called to exec methods even after returning
  174. true to DllCanUnloadNow, so we don't block new ones. We rely on WMI
  175. making sure that it doesn't call us to exec methods between the last
  176. call to DllCanUnloadNow and actually unloading the DLL.
  177. 03/25/2002 Checked in fixes for ...
  178. 1. Fix registry handle leak.
  179. 2. Fix deinitialization problem that avrf catches -- fold in
  180. the CanUnloadNow mechanism.
  181. Now the static denitialization functions are called from
  182. the CNlbsNic destructor. The "delayed-deinitialize" function
  183. is called from DLL-detach notifier, which is called BEFORE
  184. the static destructor.
  185. strcpy: StringCbCopy(LPTSTR pszDest, size_t cbDest, LPCTSTR pszSrc);
  186. StringCchCopy(LPTSTR pszDest, size_t cchDest, LPCTSTR pszSrc);
  187. strcat: StringCchCat(LPTSTR pszDest, size_t cchDest, LPCTSTR pszSrc);
  188. StringCbCat(LPTSTR pszDest, size_t cbDest, LPCTSTR pszSrc);
  189. wsprintf:
  190. StringCbPrintf(LPTSTR pszDest, size_t cbDest, LPCTSTR pszFormat, ...);
  191. 04/09/2002 JosephJ Code review results
  192. updatecfg.cpp: CfgUtilsValidateNicGuid -- we check
  193. SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"
  194. is there a better way? Could we be excluding NICS that are not yet
  195. bound to TCP.
  196. 04/09/2002 JosephJ Code review notes
  197. Replace %08p by %p