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.

2574 lines
100 KiB

  1. /*++
  2. Copyright (c) 1992-1996 Microsoft Corporation
  3. Module Name:
  4. mibfuncs.c
  5. Abstract:
  6. Contains MIB functions for GET's and SET's for LM MIB.
  7. Environment:
  8. User Mode - Win32
  9. Revision History:
  10. 10-May-1996 DonRyan
  11. Removed banner from Technology Dynamics, Inc.
  12. --*/
  13. //--------------------------- WINDOWS DEPENDENCIES --------------------------
  14. //--------------------------- STANDARD DEPENDENCIES -- #include<xxxxx.h> ----
  15. #ifdef DOS
  16. #if 0
  17. #define INCL_NETWKSTA
  18. #define INCL_NETERRORS
  19. #include <lan.h>
  20. #endif
  21. #endif
  22. #ifdef WIN32
  23. #include <windows.h>
  24. #include <lm.h>
  25. #endif
  26. #include <tchar.h>
  27. #include <stdio.h>
  28. #include <string.h>
  29. #include <stdlib.h>
  30. #include <time.h>
  31. //--------------------------- MODULE DEPENDENCIES -- #include"xxxxx.h" ------
  32. #include <snmp.h>
  33. #include <snmputil.h>
  34. //---ft:07/13---LsaGetUserName substitutes NetWkstaGetUserInfo
  35. #include <subauth.h> // needed for the definition of PUNICODE_STRING
  36. #include <ntlsa.h> // LSA APIs
  37. //---tf---
  38. #include "mib.h"
  39. #include "lmcache.h"
  40. //--------------------------- SELF-DEPENDENCY -- ONE #include"module.h" -----
  41. #include "mibfuncs.h"
  42. #include "odom_tbl.h"
  43. #include "user_tbl.h"
  44. #include "shar_tbl.h"
  45. #include "srvr_tbl.h"
  46. #include "prnt_tbl.h"
  47. #include "uses_tbl.h"
  48. //--------------------------- PUBLIC VARIABLES --(same as in module.h file)--
  49. //--------------------------- PRIVATE CONSTANTS -----------------------------
  50. #define SafeBufferFree(x) if(NULL != x) NetApiBufferFree( x )
  51. //--------------------------- PRIVATE STRUCTS -------------------------------
  52. //--------------------------- PRIVATE VARIABLES -----------------------------
  53. //--------------------------- PRIVATE PROTOTYPES ----------------------------
  54. //--------------------------- PRIVATE PROCEDURES ----------------------------
  55. //--------------------------- PUBLIC PROCEDURES -----------------------------
  56. void * MIB_common_func(
  57. IN UINT Action, // Action to perform on Data
  58. IN LDATA LMData, // LM Data to manipulate
  59. IN void *SetData
  60. )
  61. {
  62. SNMPAPI nResult;
  63. unsigned lmCode;
  64. WKSTA_INFO_101 *wksta_info_one;
  65. SERVER_INFO_102 *server_info_two;
  66. STAT_SERVER_0 *server_stats_zero;
  67. STAT_WORKSTATION_0 *wrk_stats_zero;
  68. LPBYTE bufptr;
  69. lan_return_info_type *retval=NULL;
  70. BYTE *stream;
  71. char temp[80];
  72. BOOL cache_it ;
  73. time_t curr_time ;
  74. UNREFERENCED_PARAMETER(SetData);
  75. time(&curr_time); // get the time
  76. switch ( Action )
  77. {
  78. case MIB_ACTION_GET:
  79. // Check to see if data is cached
  80. //if ( Cached )
  81. //{
  82. // Retrieve from cache
  83. //}
  84. //else
  85. //{
  86. // Call LM call to get data
  87. // Put data in cache
  88. //}
  89. // See if data is supported
  90. switch ( LMData )
  91. {
  92. case MIB_LM_COMVERSIONMAJ:
  93. if((NULL == cache_table[C_NETWKSTAGETINFO].bufptr) ||
  94. (curr_time >
  95. (cache_table[C_NETWKSTAGETINFO].acquisition_time
  96. + cache_expire[C_NETWKSTAGETINFO] ) ) )
  97. { // it has expired!
  98. //
  99. // remember to free the existing data
  100. //
  101. SafeBufferFree( cache_table[C_NETWKSTAGETINFO].bufptr ) ;
  102. //
  103. lmCode =
  104. NetWkstaGetInfo( NULL, // local server
  105. 101, // level 10, no admin priv.
  106. &bufptr // data structure to return
  107. );
  108. cache_it = TRUE ;
  109. } else {
  110. lmCode = 0 ; // fake a sucessful lan man call
  111. bufptr = cache_table[C_NETWKSTAGETINFO].bufptr ;
  112. cache_it = FALSE ;
  113. }
  114. if(lmCode == 0) { // valid so return it, otherwise error NULL
  115. if(NULL ==
  116. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  117. )
  118. goto Exit ;
  119. retval->data_element_type = ASN_OCTETSTRING ;
  120. wksta_info_one = (WKSTA_INFO_101 *) bufptr ;
  121. _itoa(wksta_info_one->wki101_ver_major,temp,10) ;
  122. if(NULL ==
  123. (stream = SnmpUtilMemAlloc( strlen(temp) ))
  124. ) {
  125. SnmpUtilMemFree(retval);
  126. retval=NULL;
  127. goto Exit ;
  128. }
  129. memcpy(stream,&temp,strlen(temp));
  130. retval->d.octstrval.stream = stream;
  131. retval->d.octstrval.length = strlen(temp);
  132. retval->d.octstrval.dynamic = TRUE;
  133. if(cache_it) {
  134. // now save it in the cache
  135. cache_table[C_NETWKSTAGETINFO].acquisition_time =
  136. curr_time ;
  137. cache_table[C_NETWKSTAGETINFO].bufptr = bufptr ;
  138. } // if (cache_it)
  139. }
  140. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_COMVERSIONMAJ.\n" ));
  141. break;
  142. case MIB_LM_COMVERSIONMIN:
  143. if((NULL == cache_table[C_NETWKSTAGETINFO].bufptr) ||
  144. (curr_time >
  145. (cache_table[C_NETWKSTAGETINFO].acquisition_time
  146. + cache_expire[C_NETWKSTAGETINFO] ) ) )
  147. { // it has expired!
  148. //
  149. // remember to free the existing data
  150. //
  151. SafeBufferFree( cache_table[C_NETWKSTAGETINFO].bufptr ) ;
  152. //
  153. lmCode =
  154. NetWkstaGetInfo( NULL, // local server
  155. 101, // level 10, no admin priv.
  156. &bufptr // data structure to return
  157. );
  158. cache_it = TRUE ;
  159. } else {
  160. lmCode = 0 ; // fake a sucessful lan man call
  161. bufptr = cache_table[C_NETWKSTAGETINFO].bufptr ;
  162. cache_it = FALSE ;
  163. }
  164. if(lmCode == 0) { // valid so return it, otherwise error NULL
  165. if(NULL ==
  166. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  167. )
  168. goto Exit ;
  169. retval->data_element_type = ASN_OCTETSTRING ;
  170. wksta_info_one = (WKSTA_INFO_101 *) bufptr ;
  171. _itoa(wksta_info_one->wki101_ver_minor,temp,10) ;
  172. if(NULL ==
  173. (stream = SnmpUtilMemAlloc( strlen(temp) ))
  174. ){
  175. SnmpUtilMemFree(retval);
  176. retval=NULL;
  177. goto Exit ;
  178. }
  179. memcpy(stream,&temp,strlen(temp));
  180. retval->d.octstrval.stream = stream;
  181. retval->d.octstrval.length = strlen(temp);
  182. retval->d.octstrval.dynamic = TRUE;
  183. if(cache_it) {
  184. // now save it in the cache
  185. cache_table[C_NETWKSTAGETINFO].acquisition_time =
  186. curr_time ;
  187. cache_table[C_NETWKSTAGETINFO].bufptr = bufptr ;
  188. } // if (cache_it)
  189. }
  190. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_COMVERSIONMIN.\n" ));
  191. break;
  192. case MIB_LM_COMTYPE:
  193. if((NULL == cache_table[C_NETSERVERGETINFO].bufptr) ||
  194. (curr_time >
  195. (cache_table[C_NETSERVERGETINFO].acquisition_time
  196. + cache_expire[C_NETSERVERGETINFO] ) ) )
  197. { // it has expired!
  198. //
  199. // remember to free the existing data
  200. //
  201. SafeBufferFree( cache_table[C_NETSERVERGETINFO].bufptr ) ;
  202. lmCode =
  203. NetServerGetInfo( NULL, // local server
  204. 102, // level 10, no admin priv.
  205. &bufptr // data structure to return
  206. );
  207. cache_it = TRUE ;
  208. } else {
  209. lmCode = 0 ; // fake a sucessful lan man call
  210. bufptr = cache_table[C_NETSERVERGETINFO].bufptr ;
  211. cache_it = FALSE ;
  212. }
  213. if(lmCode == 0) { // valid so return it, otherwise error NULL
  214. if(NULL ==
  215. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  216. )
  217. goto Exit ;
  218. retval->data_element_type = ASN_OCTETSTRING ;
  219. server_info_two = (SERVER_INFO_102 *) bufptr ;
  220. if(NULL ==
  221. (stream = SnmpUtilMemAlloc( 4 * sizeof(BYTE) ))
  222. ){
  223. SnmpUtilMemFree(retval);
  224. retval=NULL;
  225. goto Exit ;
  226. }
  227. *(DWORD*)stream=server_info_two->sv102_type & 0x000000FF;
  228. retval->d.octstrval.stream = stream;
  229. retval->d.octstrval.length = 4 * sizeof(BYTE);
  230. retval->d.octstrval.dynamic = TRUE;
  231. if(cache_it) {
  232. // now save it in the cache
  233. cache_table[C_NETSERVERGETINFO].acquisition_time =
  234. curr_time ;
  235. cache_table[C_NETSERVERGETINFO].bufptr = bufptr ;
  236. } // if (cache_it)
  237. }
  238. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_COMTYPE.\n" ));
  239. break;
  240. case MIB_LM_COMSTATSTART:
  241. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  242. (curr_time >
  243. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  244. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  245. { // it has expired!
  246. //
  247. // remember to free the existing data
  248. //
  249. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr);
  250. lmCode =
  251. NetStatisticsGet( NULL, // local server
  252. SERVICE_SERVER, // get server stats
  253. 0, // level 0
  254. 0, // don't clear stats
  255. &bufptr // data structure to return
  256. );
  257. cache_it = TRUE ;
  258. } else {
  259. lmCode = 0 ; // fake a sucessful lan man call
  260. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  261. cache_it = FALSE ;
  262. }
  263. if(lmCode == 0) { // valid so return it, otherwise error NULL
  264. if(NULL ==
  265. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  266. )
  267. goto Exit ;
  268. retval->data_element_type = ASN_INTEGER ;
  269. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  270. retval->d.intval = server_stats_zero->sts0_start;
  271. if(cache_it) {
  272. // now save it in the cache
  273. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  274. curr_time ;
  275. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  276. } // if (cache_it)
  277. }
  278. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_STATSTART.\n" ));
  279. break;
  280. case MIB_LM_COMSTATNUMNETIOS:
  281. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  282. (curr_time >
  283. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  284. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  285. { // it has expired!
  286. //
  287. // remember to free the existing data
  288. //
  289. SafeBufferFree( cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  290. lmCode =
  291. NetStatisticsGet( NULL, // local server
  292. SERVICE_WORKSTATION, // get server stats
  293. 0, // level 0
  294. 0, // don't clear stats
  295. &bufptr // data structure to return
  296. );
  297. cache_it = TRUE ;
  298. } else {
  299. lmCode = 0 ; // fake a sucessful lan man call
  300. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  301. cache_it = FALSE ;
  302. }
  303. if(lmCode == 0) { // valid so return it, otherwise error NULL
  304. if(NULL ==
  305. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  306. )
  307. goto Exit ;
  308. retval->data_element_type = ASN_INTEGER ;
  309. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  310. retval->d.intval =
  311. (wrk_stats_zero->SmbsReceived).LowPart +
  312. (wrk_stats_zero->SmbsTransmitted).LowPart;
  313. if(cache_it) {
  314. // now save it in the cache
  315. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  316. curr_time ;
  317. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  318. } // if (cache_it)
  319. }
  320. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_STATNUMNETIOS.\n" ));
  321. break;
  322. case MIB_LM_COMSTATFINETIOS:
  323. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  324. (curr_time >
  325. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  326. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  327. { // it has expired!
  328. //
  329. // remember to free the existing data
  330. //
  331. SafeBufferFree( cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  332. lmCode =
  333. NetStatisticsGet( NULL, // local server
  334. SERVICE_WORKSTATION, // get server stats
  335. 0, // level 0
  336. 0, // don't clear stats
  337. &bufptr // data structure to return
  338. );
  339. cache_it = TRUE ;
  340. } else {
  341. lmCode = 0 ; // fake a sucessful lan man call
  342. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  343. cache_it = FALSE ;
  344. }
  345. if(lmCode == 0) { // valid so return it, otherwise error NULL
  346. if(NULL ==
  347. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  348. )
  349. goto Exit ;
  350. retval->data_element_type = ASN_INTEGER ;
  351. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  352. retval->d.intval = wrk_stats_zero->InitiallyFailedOperations;
  353. if(cache_it) {
  354. // now save it in the cache
  355. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  356. curr_time ;
  357. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  358. } // if (cache_it)
  359. }
  360. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_STATFINETIOS.\n" ));
  361. break;
  362. case MIB_LM_COMSTATFCNETIOS:
  363. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  364. (curr_time >
  365. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  366. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  367. { // it has expired!
  368. //
  369. // remember to free the existing data
  370. //
  371. SafeBufferFree( cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  372. lmCode =
  373. NetStatisticsGet( NULL, // local server
  374. SERVICE_WORKSTATION, // get server stats
  375. 0, // level 0
  376. 0, // don't clear stats
  377. &bufptr // data structure to return
  378. );
  379. cache_it = TRUE ;
  380. } else {
  381. lmCode = 0 ; // fake a sucessful lan man call
  382. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  383. cache_it = FALSE ;
  384. }
  385. if(lmCode == 0) { // valid so return it, otherwise error NULL
  386. if(NULL ==
  387. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  388. )
  389. goto Exit ;
  390. retval->data_element_type = ASN_INTEGER ;
  391. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  392. retval->d.intval = wrk_stats_zero->FailedCompletionOperations;
  393. if(cache_it) {
  394. // now save it in the cache
  395. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  396. curr_time ;
  397. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  398. } // if (cache_it)
  399. }
  400. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_STATFCNETIOS.\n" ));
  401. break;
  402. default:
  403. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: Data not supported by function.\n" ));
  404. nResult = SNMPAPI_ERROR;
  405. goto Exit;
  406. }
  407. break;
  408. case MIB_ACTION_SET:
  409. break;
  410. default:
  411. // Signal an error
  412. nResult = SNMPAPI_ERROR;
  413. goto Exit;
  414. }
  415. Exit:
  416. return retval /*nResult*/;
  417. } // MIB_common_func
  418. void * MIB_server_func(
  419. IN UINT Action, // Action to perform on Data
  420. IN LDATA LMData, // LM Data to manipulate
  421. IN void *SetData
  422. )
  423. {
  424. lan_return_info_type *retval=NULL;
  425. SERVER_INFO_102 *server_info_two;
  426. SERVER_INFO_102 server_info_10two;
  427. STAT_SERVER_0 *server_stats_zero;
  428. SERVER_INFO_102 *server_info_102 ;
  429. SERVER_INFO_403 *server_info_four ;
  430. SESSION_INFO_2 * session_info_two;
  431. SERVER_INFO_402 *server_info_402 ;
  432. #if 1
  433. USER_INFO_0 *user_info_zero ;
  434. #endif
  435. unsigned lmCode;
  436. BYTE *stream;
  437. AsnOctetString *strvalue;
  438. AsnInteger intvalue;
  439. DWORD entriesread;
  440. DWORD totalentries;
  441. SNMPAPI nResult;
  442. LPBYTE bufptr;
  443. BOOL cache_it ;
  444. time_t curr_time ;
  445. #ifdef UNICODE
  446. LPWSTR unitemp ;
  447. #endif
  448. time(&curr_time); // get the time
  449. switch ( Action )
  450. {
  451. case MIB_ACTION_GET:
  452. // Check to see if data is cached
  453. //if ( Cached )
  454. //{
  455. // Retrieve from cache
  456. //}
  457. //else
  458. //{
  459. // Call LM call to get data
  460. // Put data in cache
  461. //}
  462. // See if data is supported
  463. switch ( LMData )
  464. {
  465. case MIB_LM_SVDESCRIPTION:
  466. if((NULL == cache_table[C_NETSERVERGETINFO].bufptr) ||
  467. (curr_time >
  468. (cache_table[C_NETSERVERGETINFO].acquisition_time
  469. + cache_expire[C_NETSERVERGETINFO] ) ) )
  470. { // it has expired!
  471. //
  472. // remember to free the existing data
  473. //
  474. SafeBufferFree( cache_table[C_NETSERVERGETINFO].bufptr );
  475. lmCode =
  476. NetServerGetInfo( NULL, // local server
  477. 102, // level 10, no admin priv.
  478. &bufptr // data structure to return
  479. );
  480. cache_it = TRUE ;
  481. } else {
  482. lmCode = 0 ; // fake a sucessful lan man call
  483. bufptr = cache_table[C_NETSERVERGETINFO].bufptr ;
  484. cache_it = FALSE ;
  485. }
  486. if(lmCode == 0) { // valid so return it, otherwise error NULL
  487. if(NULL ==
  488. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  489. )
  490. goto Exit ;
  491. retval->data_element_type = ASN_OCTETSTRING ;
  492. server_info_two = (SERVER_INFO_102 *) bufptr ;
  493. #ifdef UNICODE
  494. if (SnmpUtilUnicodeToUTF8(
  495. &stream,
  496. server_info_two->sv102_comment,
  497. TRUE))
  498. {
  499. SnmpUtilMemFree(retval);
  500. retval = NULL;
  501. goto Exit;
  502. }
  503. #else
  504. if(NULL ==
  505. (stream = SnmpUtilMemAlloc( strlen(server_info_two->sv102_comment) + 1 ))
  506. ) {
  507. SnmpUtilMemFree(retval);
  508. retval=NULL;
  509. goto Exit ;
  510. }
  511. memcpy(stream,server_info_two->sv102_comment,
  512. strlen(server_info_two->sv102_comment));
  513. #endif
  514. retval->d.octstrval.stream = stream;
  515. retval->d.octstrval.length =
  516. strlen(stream);
  517. retval->d.octstrval.dynamic = TRUE;
  518. if(cache_it) {
  519. // now save it in the cache
  520. cache_table[C_NETSERVERGETINFO].acquisition_time =
  521. curr_time ;
  522. cache_table[C_NETSERVERGETINFO].bufptr = bufptr ;
  523. } // if (cache_it)
  524. }
  525. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVDESCRIPTION.\n" ));
  526. break;
  527. case MIB_LM_SVSVCNUMBER:
  528. if((NULL == cache_table[C_NETSERVICEENUM].bufptr) ||
  529. (curr_time >
  530. (cache_table[C_NETSERVICEENUM].acquisition_time
  531. + cache_expire[C_NETSERVICEENUM] ) ) )
  532. { // it has expired!
  533. //
  534. // remember to free the existing data
  535. //
  536. SafeBufferFree( cache_table[C_NETSERVICEENUM].bufptr) ;
  537. lmCode =
  538. NetServiceEnum( NULL, // local server
  539. 0, // level 0
  540. &bufptr, // data structure to return
  541. MAX_PREFERRED_LENGTH,
  542. &entriesread,
  543. &totalentries,
  544. NULL);
  545. cache_it = TRUE ;
  546. } else {
  547. lmCode = 0 ; // fake a sucessful lan man call
  548. bufptr = cache_table[C_NETSERVICEENUM].bufptr ;
  549. totalentries = cache_table[C_NETSERVICEENUM].totalentries ;
  550. entriesread = cache_table[C_NETSERVICEENUM].entriesread ;
  551. cache_it = FALSE ;
  552. }
  553. if(lmCode == 0) { // valid so return it, otherwise error NULL
  554. if(NULL ==
  555. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  556. )
  557. goto Exit ;
  558. retval->data_element_type = ASN_INTEGER ;
  559. retval->d.intval = totalentries; // LOOK OUT!!
  560. if(cache_it) {
  561. // now save it in the cache
  562. cache_table[C_NETSERVICEENUM].acquisition_time =
  563. curr_time ;
  564. cache_table[C_NETSERVICEENUM].bufptr = bufptr ;
  565. cache_table[C_NETSERVICEENUM].totalentries =
  566. totalentries ;
  567. cache_table[C_NETSERVICEENUM].entriesread =
  568. entriesread ;
  569. } // if (cache_it)
  570. }
  571. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSVCNUMBER.\n" ));
  572. break;
  573. case MIB_LM_SVSTATOPENS:
  574. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  575. (curr_time >
  576. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  577. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  578. { // it has expired!
  579. //
  580. // remember to free the existing data
  581. //
  582. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  583. lmCode =
  584. NetStatisticsGet( NULL, // local server
  585. SERVICE_SERVER, // get server stats
  586. 0, // level 0
  587. 0, // don't clear stats
  588. &bufptr // data structure to return
  589. );
  590. cache_it = TRUE ;
  591. } else {
  592. lmCode = 0 ; // fake a sucessful lan man call
  593. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  594. cache_it = FALSE ;
  595. }
  596. if(lmCode == 0) { // valid so return it, otherwise error NULL
  597. if(NULL ==
  598. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  599. )
  600. goto Exit ;
  601. retval->data_element_type = ASN_INTEGER ;
  602. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  603. retval->d.intval = server_stats_zero->sts0_fopens;
  604. if(cache_it) {
  605. // now save it in the cache
  606. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  607. curr_time ;
  608. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  609. } // if (cache_it)
  610. }
  611. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATOPENS.\n" ));
  612. break;
  613. case MIB_LM_SVSTATDEVOPENS:
  614. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  615. (curr_time >
  616. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  617. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  618. { // it has expired!
  619. //
  620. // remember to free the existing data
  621. //
  622. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  623. lmCode =
  624. NetStatisticsGet( NULL, // local server
  625. SERVICE_SERVER, // get server stats
  626. 0, // level 0
  627. 0, // don't clear stats
  628. &bufptr // data structure to return
  629. );
  630. cache_it = TRUE ;
  631. } else {
  632. lmCode = 0 ; // fake a sucessful lan man call
  633. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  634. cache_it = FALSE ;
  635. }
  636. if(lmCode == 0) { // valid so return it, otherwise error NULL
  637. if(NULL ==
  638. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  639. )
  640. goto Exit ;
  641. retval->data_element_type = ASN_INTEGER ;
  642. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  643. retval->d.intval = server_stats_zero->sts0_devopens;
  644. if(cache_it) {
  645. // now save it in the cache
  646. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  647. curr_time ;
  648. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  649. } // if (cache_it)
  650. }
  651. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATDEVOPENS.\n" ));
  652. break;
  653. case MIB_LM_SVSTATQUEUEDJOBS:
  654. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  655. (curr_time >
  656. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  657. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  658. { // it has expired!
  659. //
  660. // remember to free the existing data
  661. //
  662. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  663. lmCode =
  664. NetStatisticsGet( NULL, // local server
  665. SERVICE_SERVER, // get server stats
  666. 0, // level 0
  667. 0, // don't clear stats
  668. &bufptr // data structure to return
  669. );
  670. cache_it = TRUE ;
  671. } else {
  672. lmCode = 0 ; // fake a sucessful lan man call
  673. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  674. cache_it = FALSE ;
  675. }
  676. if(lmCode == 0) { // valid so return it, otherwise error NULL
  677. if(NULL ==
  678. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  679. )
  680. goto Exit ;
  681. retval->data_element_type = ASN_INTEGER ;
  682. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  683. retval->d.intval = server_stats_zero->sts0_jobsqueued;
  684. if(cache_it) {
  685. // now save it in the cache
  686. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  687. curr_time ;
  688. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  689. } // if (cache_it)
  690. }
  691. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATQUEUEDJOBS.\n" ));
  692. break;
  693. case MIB_LM_SVSTATSOPENS:
  694. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  695. (curr_time >
  696. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  697. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  698. { // it has expired!
  699. //
  700. // remember to free the existing data
  701. //
  702. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  703. lmCode =
  704. NetStatisticsGet( NULL, // local server
  705. SERVICE_SERVER, // get server stats
  706. 0, // level 0
  707. 0, // don't clear stats
  708. &bufptr // data structure to return
  709. );
  710. cache_it = TRUE ;
  711. } else {
  712. lmCode = 0 ; // fake a sucessful lan man call
  713. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  714. cache_it = FALSE ;
  715. }
  716. if(lmCode == 0) { // valid so return it, otherwise error NULL
  717. if(NULL ==
  718. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  719. )
  720. goto Exit ;
  721. retval->data_element_type = ASN_INTEGER ;
  722. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  723. retval->d.intval = server_stats_zero->sts0_sopens;
  724. if(cache_it) {
  725. // now save it in the cache
  726. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  727. curr_time ;
  728. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  729. } // if (cache_it)
  730. }
  731. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATSOPENS.\n" ));
  732. break;
  733. case MIB_LM_SVSTATERROROUTS:
  734. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  735. (curr_time >
  736. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  737. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  738. { // it has expired!
  739. //
  740. // remember to free the existing data
  741. //
  742. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  743. lmCode =
  744. NetStatisticsGet( NULL, // local server
  745. SERVICE_SERVER, // get server stats
  746. 0, // level 0
  747. 0, // don't clear stats
  748. &bufptr // data structure to return
  749. );
  750. cache_it = TRUE ;
  751. } else {
  752. lmCode = 0 ; // fake a sucessful lan man call
  753. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  754. cache_it = FALSE ;
  755. }
  756. if(lmCode == 0) { // valid so return it, otherwise error NULL
  757. if(NULL ==
  758. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  759. )
  760. goto Exit ;
  761. retval->data_element_type = ASN_INTEGER ;
  762. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  763. retval->d.intval = server_stats_zero->sts0_serrorout;
  764. if(cache_it) {
  765. // now save it in the cache
  766. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  767. curr_time ;
  768. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  769. } // if (cache_it)
  770. }
  771. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATSERROROUTS.\n" ));
  772. break;
  773. case MIB_LM_SVSTATPWERRORS:
  774. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  775. (curr_time >
  776. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  777. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  778. { // it has expired!
  779. //
  780. // remember to free the existing data
  781. //
  782. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  783. lmCode =
  784. NetStatisticsGet( NULL, // local server
  785. SERVICE_SERVER, // get server stats
  786. 0, // level 0
  787. 0, // don't clear stats
  788. &bufptr // data structure to return
  789. );
  790. cache_it = TRUE ;
  791. } else {
  792. lmCode = 0 ; // fake a sucessful lan man call
  793. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  794. cache_it = FALSE ;
  795. }
  796. if(lmCode == 0) { // valid so return it, otherwise error NULL
  797. if(NULL ==
  798. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  799. )
  800. goto Exit ;
  801. retval->data_element_type = ASN_INTEGER ;
  802. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  803. retval->d.intval = server_stats_zero->sts0_pwerrors;
  804. if(cache_it) {
  805. // now save it in the cache
  806. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  807. curr_time ;
  808. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  809. } // if (cache_it)
  810. }
  811. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATPWERRORS.\n" ));
  812. break;
  813. case MIB_LM_SVSTATPERMERRORS:
  814. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  815. (curr_time >
  816. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  817. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  818. { // it has expired!
  819. //
  820. // remember to free the existing data
  821. //
  822. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  823. lmCode =
  824. NetStatisticsGet( NULL, // local server
  825. SERVICE_SERVER, // get server stats
  826. 0, // level 0
  827. 0, // don't clear stats
  828. &bufptr // data structure to return
  829. );
  830. cache_it = TRUE ;
  831. } else {
  832. lmCode = 0 ; // fake a sucessful lan man call
  833. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  834. cache_it = FALSE ;
  835. }
  836. if(lmCode == 0) { // valid so return it, otherwise error NULL
  837. if(NULL ==
  838. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  839. )
  840. goto Exit ;
  841. retval->data_element_type = ASN_INTEGER ;
  842. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  843. retval->d.intval = server_stats_zero->sts0_permerrors;
  844. if(cache_it) {
  845. // now save it in the cache
  846. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  847. curr_time ;
  848. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  849. } // if (cache_it)
  850. }
  851. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATPERMERRORS.\n" ));
  852. break;
  853. case MIB_LM_SVSTATSYSERRORS:
  854. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  855. (curr_time >
  856. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  857. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  858. { // it has expired!
  859. //
  860. // remember to free the existing data
  861. //
  862. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  863. lmCode =
  864. NetStatisticsGet( NULL, // local server
  865. SERVICE_SERVER, // get server stats
  866. 0, // level 0
  867. 0, // don't clear stats
  868. &bufptr // data structure to return
  869. );
  870. cache_it = TRUE ;
  871. } else {
  872. lmCode = 0 ; // fake a sucessful lan man call
  873. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  874. cache_it = FALSE ;
  875. }
  876. if(lmCode == 0) { // valid so return it, otherwise error NULL
  877. if(NULL ==
  878. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  879. )
  880. goto Exit ;
  881. retval->data_element_type = ASN_INTEGER ;
  882. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  883. retval->d.intval = server_stats_zero->sts0_syserrors;
  884. if(cache_it) {
  885. // now save it in the cache
  886. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  887. curr_time ;
  888. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  889. } // if (cache_it)
  890. }
  891. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATSYSERRORS.\n" ));
  892. break;
  893. case MIB_LM_SVSTATSENTBYTES:
  894. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  895. (curr_time >
  896. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  897. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  898. { // it has expired!
  899. //
  900. // remember to free the existing data
  901. //
  902. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  903. lmCode =
  904. NetStatisticsGet( NULL, // local server
  905. SERVICE_SERVER, // get server stats
  906. 0, // level 0
  907. 0, // don't clear stats
  908. &bufptr // data structure to return
  909. );
  910. cache_it = TRUE ;
  911. } else {
  912. lmCode = 0 ; // fake a sucessful lan man call
  913. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  914. cache_it = FALSE ;
  915. }
  916. if(lmCode == 0) { // valid so return it, otherwise error NULL
  917. if(NULL ==
  918. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  919. )
  920. goto Exit ;
  921. retval->data_element_type = ASN_INTEGER ;
  922. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  923. retval->d.intval = server_stats_zero->sts0_bytessent_low;
  924. if(cache_it) {
  925. // now save it in the cache
  926. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  927. curr_time ;
  928. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  929. } // if (cache_it)
  930. }
  931. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATSENTBYTES.\n" ));
  932. break;
  933. case MIB_LM_SVSTATRCVDBYTES:
  934. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  935. (curr_time >
  936. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  937. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  938. { // it has expired!
  939. //
  940. // remember to free the existing data
  941. //
  942. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  943. lmCode =
  944. NetStatisticsGet( NULL, // local server
  945. SERVICE_SERVER, // get server stats
  946. 0, // level 0
  947. 0, // don't clear stats
  948. &bufptr // data structure to return
  949. );
  950. cache_it = TRUE ;
  951. } else {
  952. lmCode = 0 ; // fake a sucessful lan man call
  953. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  954. cache_it = FALSE ;
  955. }
  956. if(lmCode == 0) { // valid so return it, otherwise error NULL
  957. if(NULL ==
  958. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  959. )
  960. goto Exit ;
  961. retval->data_element_type = ASN_INTEGER ;
  962. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  963. retval->d.intval = server_stats_zero->sts0_bytesrcvd_low;
  964. if(cache_it) {
  965. // now save it in the cache
  966. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  967. curr_time ;
  968. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  969. } // if (cache_it)
  970. }
  971. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATRCVDBYTES.\n" ));
  972. break;
  973. case MIB_LM_SVSTATAVRESPONSE:
  974. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  975. (curr_time >
  976. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  977. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  978. { // it has expired!
  979. //
  980. // remember to free the existing data
  981. //
  982. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  983. lmCode =
  984. NetStatisticsGet( NULL, // local server
  985. SERVICE_SERVER, // get server stats
  986. 0, // level 0
  987. 0, // don't clear stats
  988. &bufptr // data structure to return
  989. );
  990. cache_it = TRUE ;
  991. } else {
  992. lmCode = 0 ; // fake a sucessful lan man call
  993. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  994. cache_it = FALSE ;
  995. }
  996. if(lmCode == 0) { // valid so return it, otherwise error NULL
  997. if(NULL ==
  998. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  999. )
  1000. goto Exit ;
  1001. retval->data_element_type = ASN_INTEGER ;
  1002. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  1003. retval->d.intval = server_stats_zero->sts0_avresponse;
  1004. if(cache_it) {
  1005. // now save it in the cache
  1006. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  1007. curr_time ;
  1008. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  1009. } // if (cache_it)
  1010. }
  1011. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATAVRESPONSE.\n" ));
  1012. break;
  1013. case MIB_LM_SVSECURITYMODE:
  1014. // hard code USER security per dwaink
  1015. //
  1016. if(NULL ==
  1017. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1018. )
  1019. goto Exit ;
  1020. retval->data_element_type = ASN_INTEGER ;
  1021. retval->d.intval = 2 ;
  1022. #if 0
  1023. if((NULL == cache_table[C_NETSERVERGETINFO_403].bufptr) ||
  1024. (curr_time >
  1025. (cache_table[C_NETSERVERGETINFO_403].acquisition_time
  1026. + cache_expire[C_NETSERVERGETINFO_403] ) ) )
  1027. { // it has expired!
  1028. //
  1029. // remember to free the existing data
  1030. //
  1031. SafeBufferFree( cache_table[C_NETSERVERGETINFO_403].bufptr) ;
  1032. lmCode =
  1033. NetServerGetInfo( NULL, // local server
  1034. 403, // level 10, no admin priv.
  1035. &bufptr // data structure to return
  1036. );
  1037. cache_it = TRUE ;
  1038. } else {
  1039. lmCode = 0 ; // fake a sucessful lan man call
  1040. bufptr = cache_table[C_NETSERVERGETINFO_403].bufptr ;
  1041. cache_it = FALSE ;
  1042. }
  1043. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1044. if(NULL ==
  1045. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1046. )
  1047. goto Exit ;
  1048. retval->data_element_type = ASN_INTEGER ;
  1049. server_info_four = (SERVER_INFO_403 *) bufptr ;
  1050. retval->d.intval = server_info_four->sv403_security;
  1051. if(cache_it) {
  1052. // now save it in the cache
  1053. cache_table[C_NETSERVERGETINFO_403].acquisition_time =
  1054. curr_time ;
  1055. cache_table[C_NETSERVERGETINFO_403].bufptr = bufptr ;
  1056. } // if (cache_it)
  1057. }
  1058. #endif
  1059. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSECURITYMODE.\n" ));
  1060. break;
  1061. case MIB_LM_SVUSERS:
  1062. if((NULL == cache_table[C_NETSERVERGETINFO].bufptr) ||
  1063. (curr_time >
  1064. (cache_table[C_NETSERVERGETINFO].acquisition_time
  1065. + cache_expire[C_NETSERVERGETINFO] ) ) )
  1066. { // it has expired!
  1067. //
  1068. // remember to free the existing data
  1069. //
  1070. SafeBufferFree( cache_table[C_NETSERVERGETINFO].bufptr) ;
  1071. lmCode =
  1072. NetServerGetInfo( NULL, // local server
  1073. 102, // level 10, no admin priv.
  1074. &bufptr // data structure to return
  1075. );
  1076. cache_it = TRUE ;
  1077. } else {
  1078. lmCode = 0 ; // fake a sucessful lan man call
  1079. bufptr = cache_table[C_NETSERVERGETINFO].bufptr ;
  1080. cache_it = FALSE ;
  1081. }
  1082. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1083. if(NULL ==
  1084. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1085. )
  1086. goto Exit ;
  1087. retval->data_element_type = ASN_INTEGER ;
  1088. server_info_102 = (SERVER_INFO_102 *) bufptr ;
  1089. retval->d.intval = server_info_102->sv102_users;
  1090. if(cache_it) {
  1091. // now save it in the cache
  1092. cache_table[C_NETSERVERGETINFO].acquisition_time =
  1093. curr_time ;
  1094. cache_table[C_NETSERVERGETINFO].bufptr = bufptr ;
  1095. } // if (cache_it)
  1096. }
  1097. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVUSERS.\n" ));
  1098. break;
  1099. case MIB_LM_SVSTATREQBUFSNEEDED:
  1100. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  1101. (curr_time >
  1102. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  1103. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  1104. { // it has expired!
  1105. //
  1106. // remember to free the existing data
  1107. //
  1108. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  1109. lmCode =
  1110. NetStatisticsGet( NULL, // local server
  1111. SERVICE_SERVER, // get server stats
  1112. 0, // level 0
  1113. 0, // don't clear stats
  1114. &bufptr // data structure to return
  1115. );
  1116. cache_it = TRUE ;
  1117. } else {
  1118. lmCode = 0 ; // fake a sucessful lan man call
  1119. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  1120. cache_it = FALSE ;
  1121. }
  1122. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1123. if(NULL ==
  1124. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1125. )
  1126. goto Exit ;
  1127. retval->data_element_type = ASN_INTEGER ;
  1128. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  1129. retval->d.intval = server_stats_zero->sts0_reqbufneed;
  1130. if(cache_it) {
  1131. // now save it in the cache
  1132. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  1133. curr_time ;
  1134. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  1135. } // if (cache_it)
  1136. }
  1137. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATREQBUFSNEEDED.\n" ));
  1138. break;
  1139. case MIB_LM_SVSTATBIGBUFSNEEDED:
  1140. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  1141. (curr_time >
  1142. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  1143. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  1144. { // it has expired!
  1145. //
  1146. // remember to free the existing data
  1147. //
  1148. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ;
  1149. lmCode =
  1150. NetStatisticsGet( NULL, // local server
  1151. SERVICE_SERVER, // get server stats
  1152. 0, // level 0
  1153. 0, // don't clear stats
  1154. &bufptr // data structure to return
  1155. );
  1156. cache_it = TRUE ;
  1157. } else {
  1158. lmCode = 0 ; // fake a sucessful lan man call
  1159. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  1160. cache_it = FALSE ;
  1161. }
  1162. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1163. if(NULL ==
  1164. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1165. )
  1166. goto Exit ;
  1167. retval->data_element_type = ASN_INTEGER ;
  1168. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  1169. retval->d.intval = server_stats_zero->sts0_bigbufneed;
  1170. if(cache_it) {
  1171. // now save it in the cache
  1172. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  1173. curr_time ;
  1174. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  1175. } // if (cache_it)
  1176. }
  1177. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATBIGBUFNEEDED.\n" ));
  1178. break;
  1179. case MIB_LM_SVSESSIONNUMBER:
  1180. if((NULL == cache_table[C_NETSESSIONENUM].bufptr) ||
  1181. (curr_time >
  1182. (cache_table[C_NETSESSIONENUM].acquisition_time
  1183. + cache_expire[C_NETSESSIONENUM] ) ) )
  1184. { // it has expired!
  1185. //
  1186. // remember to free the existing data
  1187. //
  1188. SafeBufferFree( cache_table[C_NETSESSIONENUM].bufptr) ;
  1189. lmCode =
  1190. NetSessionEnum( NULL, // local server
  1191. NULL, // get server stats
  1192. NULL,
  1193. 2, // level
  1194. &bufptr, // data structure to return
  1195. MAX_PREFERRED_LENGTH,
  1196. &entriesread,
  1197. &totalentries,
  1198. NULL // no resume handle
  1199. );
  1200. cache_it = TRUE ;
  1201. } else {
  1202. lmCode = 0 ; // fake a sucessful lan man call
  1203. bufptr = cache_table[C_NETSESSIONENUM].bufptr ;
  1204. totalentries = cache_table[C_NETSESSIONENUM].totalentries ;
  1205. entriesread = cache_table[C_NETSESSIONENUM].entriesread ;
  1206. cache_it = FALSE ;
  1207. }
  1208. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1209. if(NULL ==
  1210. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1211. )
  1212. goto Exit ;
  1213. retval->data_element_type = ASN_INTEGER ;
  1214. session_info_two = (SESSION_INFO_2 *) bufptr ;
  1215. retval->d.intval = totalentries;
  1216. if(cache_it) {
  1217. // now save it in the cache
  1218. cache_table[C_NETSESSIONENUM].acquisition_time =
  1219. curr_time ;
  1220. cache_table[C_NETSESSIONENUM].bufptr = bufptr ;
  1221. cache_table[C_NETSESSIONENUM].totalentries =
  1222. totalentries ;
  1223. cache_table[C_NETSESSIONENUM].entriesread =
  1224. entriesread ;
  1225. } // if (cache_it)
  1226. }
  1227. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSESSIONNUMBER.\n" ));
  1228. break;
  1229. case MIB_LM_SVAUTODISCONNECTS:
  1230. if((NULL == cache_table[C_NETSTATISTICSGET_SERVER].bufptr) ||
  1231. (curr_time >
  1232. (cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time
  1233. + cache_expire[C_NETSTATISTICSGET_SERVER] ) ) )
  1234. { // it has expired!
  1235. //
  1236. // remember to free the existing data
  1237. //
  1238. SafeBufferFree( cache_table[C_NETSTATISTICSGET_SERVER].bufptr);
  1239. lmCode =
  1240. NetStatisticsGet( NULL, // local server
  1241. SERVICE_SERVER, // get server stats
  1242. 0, // level 0
  1243. 0, // don't clear stats
  1244. &bufptr // data structure to return
  1245. );
  1246. cache_it = TRUE ;
  1247. } else {
  1248. lmCode = 0 ; // fake a sucessful lan man call
  1249. bufptr = cache_table[C_NETSTATISTICSGET_SERVER].bufptr ;
  1250. cache_it = FALSE ;
  1251. }
  1252. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1253. if(NULL ==
  1254. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1255. )
  1256. goto Exit ;
  1257. retval->data_element_type = ASN_INTEGER ;
  1258. server_stats_zero = (STAT_SERVER_0 *) bufptr ;
  1259. retval->d.intval = server_stats_zero->sts0_stimedout;
  1260. if(cache_it) {
  1261. // now save it in the cache
  1262. cache_table[C_NETSTATISTICSGET_SERVER].acquisition_time =
  1263. curr_time ;
  1264. cache_table[C_NETSTATISTICSGET_SERVER].bufptr = bufptr ;
  1265. } // if (cache_it)
  1266. }
  1267. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSTATAUTODISCONNECT.\n" ));
  1268. break;
  1269. case MIB_LM_SVDISCONTIME:
  1270. if((NULL == cache_table[C_NETSERVERGETINFO].bufptr) ||
  1271. (curr_time >
  1272. (cache_table[C_NETSERVERGETINFO].acquisition_time
  1273. + cache_expire[C_NETSERVERGETINFO] ) ) )
  1274. { // it has expired!
  1275. //
  1276. // remember to free the existing data
  1277. //
  1278. SafeBufferFree( cache_table[C_NETSERVERGETINFO].bufptr) ;
  1279. lmCode =
  1280. NetServerGetInfo( NULL, // local server
  1281. 102, // level 10, no admin priv.
  1282. &bufptr // data structure to return
  1283. );
  1284. cache_it = TRUE ;
  1285. } else {
  1286. lmCode = 0 ; // fake a sucessful lan man call
  1287. bufptr = cache_table[C_NETSERVERGETINFO].bufptr ;
  1288. cache_it = FALSE ;
  1289. }
  1290. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1291. if(NULL ==
  1292. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1293. )
  1294. goto Exit ;
  1295. retval->data_element_type = ASN_INTEGER ;
  1296. server_info_102 = (SERVER_INFO_102 *) bufptr ;
  1297. retval->d.intval = server_info_102->sv102_disc ;
  1298. if(cache_it) {
  1299. // now save it in the cache
  1300. cache_table[C_NETSERVERGETINFO].acquisition_time =
  1301. curr_time ;
  1302. cache_table[C_NETSERVERGETINFO].bufptr = bufptr ;
  1303. } // if (cache_it)
  1304. }
  1305. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVDISCONTIME.\n" ));
  1306. break;
  1307. case MIB_LM_SVAUDITLOGSIZE:
  1308. {
  1309. HANDLE hEventLog;
  1310. DWORD cRecords;
  1311. hEventLog = OpenEventLog( NULL,
  1312. TEXT("APPLICATION"));
  1313. if(NULL ==
  1314. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1315. )
  1316. goto Exit ;
  1317. retval->data_element_type = ASN_INTEGER ;
  1318. if(GetNumberOfEventLogRecords( hEventLog, &cRecords )){
  1319. retval->d.intval = cRecords ;
  1320. } else {
  1321. retval->d.intval = 0 ;
  1322. }
  1323. DeregisterEventSource( hEventLog );
  1324. }
  1325. #if 0
  1326. if((NULL == cache_table[C_NETSERVERGETINFO_402].bufptr) ||
  1327. (curr_time >
  1328. (cache_table[C_NETSERVERGETINFO_402].acquisition_time
  1329. + cache_expire[C_NETSERVERGETINFO_402] ) ) )
  1330. { // it has expired!
  1331. //
  1332. // remember to free the existing data
  1333. //
  1334. SafeBufferFree( cache_table[C_NETSERVERGETINFO_402].bufptr) ;
  1335. lmCode =
  1336. NetServerGetInfo( NULL, // local server
  1337. 402, // level 10, no admin priv.
  1338. &bufptr // data structure to return
  1339. );
  1340. cache_it = TRUE ;
  1341. } else {
  1342. lmCode = 0 ; // fake a sucessful lan man call
  1343. bufptr = cache_table[C_NETSERVERGETINFO_402].bufptr ;
  1344. cache_it = FALSE ;
  1345. }
  1346. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1347. if(NULL ==
  1348. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1349. )
  1350. goto Exit ;
  1351. retval->data_element_type = ASN_INTEGER ;
  1352. server_info_402 = (SERVER_INFO_402 *) bufptr ;
  1353. retval->d.intval = server_info_402->sv402_maxauditsz ;
  1354. if(cache_it) {
  1355. // now save it in the cache
  1356. cache_table[C_NETSERVERGETINFO_402].acquisition_time =
  1357. curr_time ;
  1358. cache_table[C_NETSERVERGETINFO_402].bufptr = bufptr ;
  1359. } // if (cache_it)
  1360. }
  1361. #endif
  1362. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVAUDITLOGSIZE.\n" ));
  1363. break;
  1364. case MIB_LM_SVUSERNUMBER:
  1365. MIB_users_lmget(); // fire off the table get
  1366. if(NULL ==
  1367. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1368. )
  1369. goto Exit ;
  1370. retval->data_element_type = ASN_INTEGER ;
  1371. retval->d.intval = MIB_UserTable.Len;
  1372. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVUSERNUMBER.\n" ));
  1373. break;
  1374. case MIB_LM_SVSHARENUMBER:
  1375. MIB_shares_lmget(); // fire off the table get
  1376. if(NULL ==
  1377. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ) )
  1378. )
  1379. goto Exit ;
  1380. retval->data_element_type = ASN_INTEGER ;
  1381. retval->d.intval = MIB_ShareTable.Len;
  1382. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_SVSHARENUMBER.\n" ));
  1383. break;
  1384. case MIB_LM_SVPRINTQNUMBER:
  1385. MIB_prntq_lmget(); // fire off the table get
  1386. if(NULL ==
  1387. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1388. )
  1389. goto Exit ;
  1390. retval->data_element_type = ASN_INTEGER ;
  1391. retval->d.intval = MIB_PrintQTable.Len;
  1392. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_PRINTQNUMBER.\n" ));
  1393. break;
  1394. default:
  1395. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: Data not supported by function.\n" ));
  1396. nResult = SNMPAPI_ERROR;
  1397. goto Exit;
  1398. }
  1399. break;
  1400. case MIB_ACTION_SET:
  1401. switch ( LMData )
  1402. {
  1403. case MIB_LM_SVDESCRIPTION:
  1404. // retrieve string to be written
  1405. strvalue = (AsnOctetString *) SetData ;
  1406. // convert it to zero terminated string
  1407. stream = SnmpUtilMemAlloc( strvalue->length+1 );
  1408. if (stream == NULL) {
  1409. retval = (void *) FALSE;
  1410. break;
  1411. }
  1412. memcpy(stream,strvalue->stream,strvalue->length);
  1413. stream[strvalue->length] = 0;
  1414. SNMPDBG((
  1415. SNMP_LOG_TRACE,
  1416. "LMMIB2: changing server description to %s.\n",
  1417. stream
  1418. ));
  1419. #ifdef UNICODE
  1420. if (SnmpUtilUTF8ToUnicode(&unitemp,
  1421. stream,
  1422. TRUE
  1423. )) {
  1424. SnmpUtilMemFree(stream);
  1425. retval = (void *) FALSE;
  1426. break;
  1427. }
  1428. SnmpUtilMemFree(stream);
  1429. stream = (LPBYTE)unitemp;
  1430. #endif
  1431. lmCode = NetServerSetInfo(
  1432. NULL, // this server
  1433. SV_COMMENT_INFOLEVEL, // level
  1434. (LPBYTE)&stream, // data
  1435. NULL ); // option
  1436. SnmpUtilMemFree(stream);
  1437. if(NERR_Success == lmCode) {
  1438. retval = (void *) TRUE;
  1439. cache_table[C_NETSERVERGETINFO].acquisition_time = 0;
  1440. SNMPDBG((
  1441. SNMP_LOG_TRACE,
  1442. "LMMIB2: server description changed, invalidating cache.\n"
  1443. ));
  1444. } else {
  1445. retval = (void *) FALSE;
  1446. SNMPDBG((
  1447. SNMP_LOG_TRACE,
  1448. "LMMIB2: server description not changed 0x%08lx.\n",
  1449. lmCode
  1450. ));
  1451. }
  1452. break ;
  1453. case MIB_LM_SVDISCONTIME:
  1454. intvalue = (AsnInteger)((ULONG_PTR) SetData) ;
  1455. memset(&server_info_10two,0,sizeof(server_info_10two));
  1456. server_info_10two.sv102_disc = intvalue ;
  1457. lmCode = NetServerSetInfo(
  1458. NULL, // this server
  1459. SV_DISC_INFOLEVEL, // level
  1460. (LPBYTE)&server_info_10two, // data
  1461. NULL ); // option
  1462. if(NERR_Success == lmCode) {
  1463. retval = (void *)TRUE;
  1464. } else {
  1465. retval = (void *) FALSE;
  1466. }
  1467. break ;
  1468. case MIB_LM_SVAUDITLOGSIZE:
  1469. retval = (void *) FALSE;
  1470. break ;
  1471. } // switch(LMData)
  1472. break;
  1473. default:
  1474. // Signal an error
  1475. nResult = SNMPAPI_ERROR;
  1476. goto Exit;
  1477. }
  1478. Exit:
  1479. return retval /*nResult*/;
  1480. } // MIB_server_func
  1481. void * MIB_workstation_func(
  1482. IN UINT Action, // Action to perform on Data
  1483. IN LDATA LMData, // LM Data to manipulate
  1484. IN void *SetData
  1485. )
  1486. {
  1487. SNMPAPI nResult;
  1488. unsigned lmCode;
  1489. STAT_WORKSTATION_0 *wrk_stats_zero;
  1490. WKSTA_INFO_502 *wksta_info_five;
  1491. LPBYTE bufptr;
  1492. lan_return_info_type *retval=NULL;
  1493. DWORD entriesread;
  1494. DWORD totalentries;
  1495. BOOL cache_it ;
  1496. time_t curr_time ;
  1497. UNREFERENCED_PARAMETER(SetData);
  1498. time(&curr_time); // get the time
  1499. switch ( Action )
  1500. {
  1501. case MIB_ACTION_GET:
  1502. // Check to see if data is cached
  1503. //if ( Cached )
  1504. //{
  1505. // Retrieve from cache
  1506. //}
  1507. //else
  1508. //{
  1509. // Call LM call to get data
  1510. // Put data in cache
  1511. //}
  1512. // See if data is supported
  1513. switch ( LMData )
  1514. {
  1515. case MIB_LM_WKSTASTATSESSSTARTS:
  1516. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  1517. (curr_time >
  1518. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  1519. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  1520. { // it has expired!
  1521. //
  1522. // remember to free the existing data
  1523. //
  1524. SafeBufferFree(cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  1525. lmCode =
  1526. NetStatisticsGet( NULL, // local server
  1527. SERVICE_WORKSTATION, // get server stats
  1528. 0, // level 0
  1529. 0, // don't clear stats
  1530. &bufptr // data structure to return
  1531. );
  1532. cache_it = TRUE ;
  1533. } else {
  1534. lmCode = 0 ; // fake a sucessful lan man call
  1535. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  1536. cache_it = FALSE ;
  1537. }
  1538. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1539. if(NULL ==
  1540. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1541. )
  1542. goto Exit ;
  1543. retval->data_element_type = ASN_INTEGER ;
  1544. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  1545. retval->d.intval = wrk_stats_zero->Sessions;
  1546. if(cache_it) {
  1547. // now save it in the cache
  1548. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  1549. curr_time ;
  1550. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  1551. } // if (cache_it)
  1552. }
  1553. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_WKSTASTATSESSSTARTS.\n" ));
  1554. break;
  1555. case MIB_LM_WKSTASTATSESSFAILS:
  1556. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  1557. (curr_time >
  1558. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  1559. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  1560. { // it has expired!
  1561. //
  1562. // remember to free the existing data
  1563. //
  1564. SafeBufferFree(cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  1565. lmCode =
  1566. NetStatisticsGet( NULL, // local server
  1567. SERVICE_WORKSTATION, // get server stats
  1568. 0, // level 0
  1569. 0, // don't clear stats
  1570. &bufptr // data structure to return
  1571. );
  1572. cache_it = TRUE ;
  1573. } else {
  1574. lmCode = 0 ; // fake a sucessful lan man call
  1575. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  1576. cache_it = FALSE ;
  1577. }
  1578. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1579. if(NULL ==
  1580. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1581. )
  1582. goto Exit ;
  1583. retval->data_element_type = ASN_INTEGER ;
  1584. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  1585. retval->d.intval = wrk_stats_zero->FailedSessions;
  1586. if(cache_it) {
  1587. // now save it in the cache
  1588. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  1589. curr_time ;
  1590. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  1591. } // if (cache_it)
  1592. }
  1593. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_WKSTASTATSESSFAILS.\n" ));
  1594. break;
  1595. case MIB_LM_WKSTASTATUSES:
  1596. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  1597. (curr_time >
  1598. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  1599. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  1600. { // it has expired!
  1601. //
  1602. // remember to free the existing data
  1603. //
  1604. SafeBufferFree(cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  1605. lmCode =
  1606. NetStatisticsGet( NULL, // local server
  1607. SERVICE_WORKSTATION, // get server stats
  1608. 0, // level 0
  1609. 0, // don't clear stats
  1610. &bufptr // data structure to return
  1611. );
  1612. cache_it = TRUE ;
  1613. } else {
  1614. lmCode = 0 ; // fake a sucessful lan man call
  1615. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  1616. cache_it = FALSE ;
  1617. }
  1618. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1619. if(NULL ==
  1620. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1621. )
  1622. goto Exit ;
  1623. retval->data_element_type = ASN_INTEGER ;
  1624. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  1625. retval->d.intval = wrk_stats_zero->UseCount;
  1626. if(cache_it) {
  1627. // now save it in the cache
  1628. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  1629. curr_time ;
  1630. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  1631. } // if (cache_it)
  1632. }
  1633. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_WKSTASTATUSES.\n" ));
  1634. break;
  1635. case MIB_LM_WKSTASTATUSEFAILS:
  1636. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  1637. (curr_time >
  1638. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  1639. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  1640. { // it has expired!
  1641. //
  1642. // remember to free the existing data
  1643. //
  1644. SafeBufferFree(cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  1645. lmCode =
  1646. NetStatisticsGet( NULL, // local server
  1647. SERVICE_WORKSTATION, // get server stats
  1648. 0, // level 0
  1649. 0, // don't clear stats
  1650. &bufptr // data structure to return
  1651. );
  1652. cache_it = TRUE ;
  1653. } else {
  1654. lmCode = 0 ; // fake a sucessful lan man call
  1655. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  1656. cache_it = FALSE ;
  1657. }
  1658. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1659. if(NULL ==
  1660. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1661. )
  1662. goto Exit ;
  1663. retval->data_element_type = ASN_INTEGER ;
  1664. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  1665. retval->d.intval = wrk_stats_zero->FailedUseCount;
  1666. if(cache_it) {
  1667. // now save it in the cache
  1668. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  1669. curr_time ;
  1670. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  1671. } // if (cache_it)
  1672. }
  1673. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_WKSTASTATUSEFAILS.\n" ));
  1674. break;
  1675. case MIB_LM_WKSTASTATAUTORECS:
  1676. if((NULL == cache_table[C_NETSTATISTICSGET_WORKST].bufptr) ||
  1677. (curr_time >
  1678. (cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time
  1679. + cache_expire[C_NETSTATISTICSGET_WORKST] ) ) )
  1680. { // it has expired!
  1681. //
  1682. // remember to free the existing data
  1683. //
  1684. SafeBufferFree(cache_table[C_NETSTATISTICSGET_WORKST].bufptr);
  1685. lmCode =
  1686. NetStatisticsGet( NULL, // local server
  1687. SERVICE_WORKSTATION, // get server stats
  1688. 0, // level 0
  1689. 0, // don't clear stats
  1690. &bufptr // data structure to return
  1691. );
  1692. cache_it = TRUE ;
  1693. } else {
  1694. lmCode = 0 ; // fake a sucessful lan man call
  1695. bufptr = cache_table[C_NETSTATISTICSGET_WORKST].bufptr ;
  1696. cache_it = FALSE ;
  1697. }
  1698. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1699. if(NULL ==
  1700. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1701. )
  1702. goto Exit ;
  1703. retval->data_element_type = ASN_INTEGER ;
  1704. wrk_stats_zero = (STAT_WORKSTATION_0 *) bufptr ;
  1705. retval->d.intval = wrk_stats_zero->Reconnects;
  1706. if(cache_it) {
  1707. // now save it in the cache
  1708. cache_table[C_NETSTATISTICSGET_WORKST].acquisition_time =
  1709. curr_time ;
  1710. cache_table[C_NETSTATISTICSGET_WORKST].bufptr = bufptr ;
  1711. } // if (cache_it)
  1712. }
  1713. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_WKSTASTATAUTORECS.\n" ));
  1714. break;
  1715. case MIB_LM_WKSTAERRORLOGSIZE:
  1716. if((NULL == cache_table[C_NETWKSTAGETINFO_502].bufptr) ||
  1717. (curr_time >
  1718. (cache_table[C_NETWKSTAGETINFO_502].acquisition_time
  1719. + cache_expire[C_NETWKSTAGETINFO_502] ) ) )
  1720. { // it has expired!
  1721. //
  1722. // remember to free the existing data
  1723. //
  1724. SafeBufferFree(cache_table[C_NETWKSTAGETINFO_502].bufptr) ;
  1725. lmCode =
  1726. NetWkstaGetInfo( NULL, // local server
  1727. 502, // level 10, no admin priv.
  1728. &bufptr // data structure to return
  1729. );
  1730. cache_it = TRUE ;
  1731. } else {
  1732. lmCode = 0 ; // fake a sucessful lan man call
  1733. bufptr = cache_table[C_NETWKSTAGETINFO_502].bufptr ;
  1734. cache_it = FALSE ;
  1735. }
  1736. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1737. if(NULL ==
  1738. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1739. )
  1740. goto Exit ;
  1741. retval->data_element_type = ASN_INTEGER ;
  1742. wksta_info_five = (WKSTA_INFO_502 *) bufptr ;
  1743. retval->d.intval =
  1744. wksta_info_five->wki502_maximum_collection_count ;
  1745. if(cache_it) {
  1746. // now save it in the cache
  1747. cache_table[C_NETWKSTAGETINFO_502].acquisition_time =
  1748. curr_time ;
  1749. cache_table[C_NETWKSTAGETINFO_502].bufptr = bufptr ;
  1750. } // if (cache_it)
  1751. }
  1752. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_WKSTAERRORLOGSIZE.\n" ));
  1753. break;
  1754. case MIB_LM_WKSTAUSENUMBER:
  1755. MIB_wsuses_lmget(); // fire off the table get
  1756. if(NULL ==
  1757. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1758. )
  1759. goto Exit ;
  1760. retval->data_element_type = ASN_INTEGER ;
  1761. retval->d.intval = MIB_WkstaUsesTable.Len;
  1762. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_WKSTAUSENUMBER.\n" ));
  1763. break;
  1764. default:
  1765. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: Data not supported by function.\n" ));
  1766. nResult = SNMPAPI_ERROR;
  1767. goto Exit;
  1768. }
  1769. break;
  1770. case MIB_ACTION_SET:
  1771. switch ( LMData )
  1772. {
  1773. case MIB_LM_WKSTAERRORLOGSIZE:
  1774. ;
  1775. }
  1776. break;
  1777. default:
  1778. // Signal an error
  1779. nResult = SNMPAPI_ERROR;
  1780. goto Exit;
  1781. }
  1782. Exit:
  1783. return retval /*nResult*/;
  1784. }
  1785. void * MIB_domain_func(
  1786. IN UINT Action, // Action to perform on Data
  1787. IN LDATA LMData, // LM Data to manipulate
  1788. void *SetData
  1789. )
  1790. {
  1791. SNMPAPI nResult;
  1792. unsigned lmCode;
  1793. WKSTA_INFO_101 *wksta_info_one;
  1794. LPBYTE bufptr;
  1795. lan_return_info_type *retval=NULL;
  1796. DWORD entriesread;
  1797. DWORD totalentries;
  1798. BYTE *stream;
  1799. BOOL cache_it ;
  1800. time_t curr_time ;
  1801. UNREFERENCED_PARAMETER(SetData);
  1802. time(&curr_time); // get the time
  1803. switch ( Action )
  1804. {
  1805. case MIB_ACTION_GET:
  1806. // Check to see if data is cached
  1807. //if ( Cached )
  1808. //{
  1809. // Retrieve from cache
  1810. //}
  1811. //else
  1812. //{
  1813. // Call LM call to get data
  1814. // Put data in cache
  1815. //}
  1816. // See if data is supported
  1817. switch ( LMData )
  1818. {
  1819. case MIB_LM_DOMPRIMARYDOMAIN:
  1820. if((NULL == cache_table[C_NETWKSTAGETINFO_101].bufptr) ||
  1821. (curr_time >
  1822. (cache_table[C_NETWKSTAGETINFO_101].acquisition_time
  1823. + cache_expire[C_NETWKSTAGETINFO_101] ) ) )
  1824. { // it has expired!
  1825. //
  1826. // remember to free the existing data
  1827. //
  1828. SafeBufferFree(cache_table[C_NETWKSTAGETINFO_101].bufptr) ;
  1829. lmCode =
  1830. NetWkstaGetInfo( NULL, // local server
  1831. 101, // level 101,
  1832. &bufptr // data structure to return
  1833. );
  1834. cache_it = TRUE ;
  1835. } else {
  1836. lmCode = 0 ; // fake a sucessful lan man call
  1837. bufptr = cache_table[C_NETWKSTAGETINFO_101].bufptr ;
  1838. cache_it = FALSE ;
  1839. }
  1840. if(lmCode == 0) { // valid so return it, otherwise error NULL
  1841. if(NULL ==
  1842. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1843. )
  1844. goto Exit ;
  1845. retval->data_element_type = ASN_OCTETSTRING ;
  1846. wksta_info_one = (WKSTA_INFO_101 *) bufptr ;
  1847. #ifdef UNICODE
  1848. if (SnmpUtilUnicodeToUTF8(
  1849. &stream,
  1850. wksta_info_one->wki101_langroup,
  1851. TRUE))
  1852. {
  1853. SnmpUtilMemFree(retval);
  1854. retval=NULL;
  1855. goto Exit ;
  1856. }
  1857. #else
  1858. if(NULL ==
  1859. (stream = SnmpUtilMemAlloc( strlen(wksta_info_one->wki101_langroup)+2 ))){
  1860. SnmpUtilMemFree(retval);
  1861. retval=NULL;
  1862. goto Exit ;
  1863. }
  1864. memcpy(stream,
  1865. wksta_info_one->wki101_langroup,
  1866. strlen(wksta_info_one->wki101_langroup));
  1867. #endif
  1868. retval->d.octstrval.stream = stream;
  1869. retval->d.octstrval.length = strlen(stream);
  1870. retval->d.octstrval.dynamic = TRUE;
  1871. if(cache_it) {
  1872. // now save it in the cache
  1873. cache_table[C_NETWKSTAGETINFO_101].acquisition_time =
  1874. curr_time ;
  1875. cache_table[C_NETWKSTAGETINFO_101].bufptr = bufptr ;
  1876. } // if (cache_it)
  1877. }
  1878. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_DOMPRIMARYDOMAIN.\n" ));
  1879. break;
  1880. case MIB_LM_DOMLOGONDOMAIN:
  1881. if((NULL == cache_table[C_NETWKSTAUSERGETINFO].bufptr) ||
  1882. (curr_time >
  1883. (cache_table[C_NETWKSTAUSERGETINFO].acquisition_time
  1884. + cache_expire[C_NETWKSTAUSERGETINFO] ) ) )
  1885. {
  1886. // it has expired!
  1887. PLSA_UNICODE_STRING logonUserName, logonDomainName;
  1888. //
  1889. // remember to free the existing data
  1890. //
  1891. SafeBufferFree(cache_table[C_NETWKSTAUSERGETINFO].bufptr) ;
  1892. logonUserName = logonDomainName = NULL;
  1893. // sensible point. Hard to get a call that is returning the logonDomainName:
  1894. // NetWkstaUserGetInfo() is returning NO_LOGON_SESSION (for level 1)
  1895. // LsaGetUserName() is returning inaccurate info when running from service controller.
  1896. lmCode = LsaGetUserName( &logonUserName, &logonDomainName);
  1897. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: got '%c'\n", (LPBYTE)(logonDomainName->Buffer)[0] ));
  1898. if (lmCode == 0)
  1899. bufptr = (LPBYTE)logonDomainName->Buffer;
  1900. cache_it = TRUE ;
  1901. }
  1902. else
  1903. {
  1904. lmCode = 0 ; // fake a sucessful lan man call
  1905. bufptr = cache_table[C_NETWKSTAUSERGETINFO].bufptr ;
  1906. cache_it = FALSE ;
  1907. }
  1908. if(lmCode == 0)
  1909. {
  1910. // valid so return it, otherwise error NULL
  1911. if(NULL == (retval = SnmpUtilMemAlloc(sizeof(lan_return_info_type))) )
  1912. goto Exit ;
  1913. retval->data_element_type = ASN_OCTETSTRING ;
  1914. #ifdef UNICODE
  1915. if (SnmpUtilUnicodeToUTF8(
  1916. &stream,
  1917. (LPWSTR)bufptr,
  1918. TRUE))
  1919. {
  1920. SnmpUtilMemFree(retval);
  1921. retval=NULL;
  1922. goto Exit ;
  1923. }
  1924. #else
  1925. if(NULL == (stream = SnmpUtilMemAlloc(strlen((LPWSTR)bufptr)+2)) )
  1926. {
  1927. SnmpUtilMemFree(retval);
  1928. retval=NULL;
  1929. goto Exit ;
  1930. }
  1931. memcpy(stream,
  1932. bufptr,
  1933. strlen(bufptr));
  1934. #endif
  1935. retval->d.octstrval.stream = stream;
  1936. retval->d.octstrval.length = strlen(stream);
  1937. retval->d.octstrval.dynamic = TRUE;
  1938. if(cache_it)
  1939. {
  1940. // now save it in the cache
  1941. cache_table[C_NETWKSTAUSERGETINFO].acquisition_time = curr_time ;
  1942. cache_table[C_NETWKSTAUSERGETINFO].bufptr = bufptr ;
  1943. } // if (cache_it)
  1944. }
  1945. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_DOMLOGONDOMAIN.\n" ));
  1946. break;
  1947. case MIB_LM_DOMOTHERDOMAINNUMBER:
  1948. MIB_odoms_lmget(); // fire off the table get
  1949. if(NULL ==
  1950. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1951. )
  1952. goto Exit ;
  1953. retval->data_element_type = ASN_INTEGER ;
  1954. retval->d.intval = MIB_DomOtherDomainTable.Len;
  1955. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_DOMOTHERDOMAINNUMBER.\n" ));
  1956. break;
  1957. case MIB_LM_DOMSERVERNUMBER:
  1958. MIB_svsond_lmget(); // fire off the table get
  1959. if(NULL ==
  1960. (retval = SnmpUtilMemAlloc( sizeof(lan_return_info_type) ))
  1961. )
  1962. goto Exit ;
  1963. retval->data_element_type = ASN_INTEGER ;
  1964. retval->d.intval = MIB_DomServerTable.Len;
  1965. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: processing MIB_LM_DOMSERVERNUMBER.\n" ));
  1966. break;
  1967. //
  1968. // OPENISSUE --> NETLOGONENUM permanently eliminated
  1969. //
  1970. #if 0
  1971. // did some of these guys get lost ???
  1972. // double check there is a mistake in the mib table
  1973. //
  1974. case MIB_LM_DOMLOGONNUMBER:
  1975. case MIB_LM_DOMLOGONTABLE:
  1976. case MIB_LM_DOMLOGONENTRY:
  1977. case MIB_LM_DOMLOGONUSER:
  1978. case MIB_LM_DOMLOGONMACHINE:
  1979. #endif
  1980. default:
  1981. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: Data not supported by function.\n" ));
  1982. nResult = SNMPAPI_ERROR;
  1983. goto Exit;
  1984. }
  1985. break;
  1986. case MIB_ACTION_SET:
  1987. switch ( LMData )
  1988. {
  1989. case MIB_LM_DOMOTHERNAME:
  1990. ;
  1991. }
  1992. break;
  1993. default:
  1994. // Signal an error
  1995. nResult = SNMPAPI_ERROR;
  1996. goto Exit;
  1997. }
  1998. Exit:
  1999. return retval /*nResult*/;
  2000. }
  2001. //
  2002. // MIB_leaf_func
  2003. // Performs actions on LEAF variables in the MIB.
  2004. //
  2005. // Notes:
  2006. //
  2007. // Return Codes:
  2008. // None.
  2009. //
  2010. // Error Codes:
  2011. // None.
  2012. //
  2013. UINT MIB_leaf_func(
  2014. IN UINT Action,
  2015. IN MIB_ENTRY *MibPtr,
  2016. IN RFC1157VarBind *VarBind
  2017. )
  2018. {
  2019. lan_return_info_type *MibVal;
  2020. UINT nResult;
  2021. switch ( Action )
  2022. {
  2023. case MIB_ACTION_GETNEXT:
  2024. if ( MibPtr->MibNext == NULL )
  2025. {
  2026. nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
  2027. goto Exit;
  2028. }
  2029. nResult = (*MibPtr->MibNext->MibFunc)( MIB_ACTION_GETFIRST,
  2030. MibPtr->MibNext, VarBind );
  2031. break;
  2032. case MIB_ACTION_GETFIRST:
  2033. // Check to see if this variable is accessible for GET
  2034. if ( MibPtr->Access != MIB_ACCESS_READ &&
  2035. MibPtr->Access != MIB_ACCESS_READWRITE )
  2036. {
  2037. if ( MibPtr->MibNext != NULL )
  2038. {
  2039. nResult = (*MibPtr->MibNext->MibFunc)( Action,
  2040. MibPtr->MibNext,
  2041. VarBind );
  2042. }
  2043. else
  2044. {
  2045. nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
  2046. }
  2047. break;
  2048. }
  2049. else
  2050. {
  2051. // Place correct OID in VarBind
  2052. SnmpUtilOidFree( &VarBind->name );
  2053. SnmpUtilOidCpy( &VarBind->name, &MIB_OidPrefix );
  2054. SnmpUtilOidAppend( &VarBind->name, &MibPtr->Oid );
  2055. }
  2056. // Purposefully let fall through to GET
  2057. case MIB_ACTION_GET:
  2058. // Make sure that this variable is GET'able
  2059. if ( MibPtr->Access != MIB_ACCESS_READ &&
  2060. MibPtr->Access != MIB_ACCESS_READWRITE )
  2061. {
  2062. nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
  2063. goto Exit;
  2064. }
  2065. // Call the LM call to get data
  2066. MibVal = (*MibPtr->LMFunc)( MIB_ACTION_GET, MibPtr->LMData, NULL );
  2067. if ( MibVal == NULL )
  2068. {
  2069. nResult = SNMP_ERRORSTATUS_GENERR;
  2070. goto Exit;
  2071. }
  2072. // Setup varbind's return value
  2073. VarBind->value.asnType = MibPtr->Type;
  2074. switch ( MibPtr->Type )
  2075. {
  2076. case ASN_RFC1155_COUNTER:
  2077. case ASN_RFC1155_GAUGE:
  2078. case ASN_RFC1155_TIMETICKS:
  2079. case ASN_INTEGER:
  2080. VarBind->value.asnValue.number = MibVal->d.intval;
  2081. break;
  2082. case ASN_RFC1155_IPADDRESS:
  2083. case ASN_RFC1155_OPAQUE:
  2084. case ASN_OCTETSTRING:
  2085. // This is non-standard copy of structure
  2086. VarBind->value.asnValue.string = MibVal->d.octstrval;
  2087. break;
  2088. default:
  2089. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: Internal Error Processing LAN Manager LEAF Variable\n" ));
  2090. nResult = SNMP_ERRORSTATUS_GENERR;
  2091. SnmpUtilMemFree( MibVal );
  2092. goto Exit;
  2093. } // type switch
  2094. // Free memory alloc'ed by LM API call
  2095. SnmpUtilMemFree( MibVal );
  2096. nResult = SNMP_ERRORSTATUS_NOERROR;
  2097. break;
  2098. case MIB_ACTION_SET:
  2099. // Check for writable attribute
  2100. if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
  2101. MibPtr->Access != MIB_ACCESS_WRITE )
  2102. {
  2103. nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
  2104. goto Exit;
  2105. }
  2106. // Check for proper type before setting
  2107. if ( MibPtr->Type != VarBind->value.asnType )
  2108. {
  2109. nResult = SNMP_ERRORSTATUS_BADVALUE;
  2110. goto Exit;
  2111. }
  2112. // Call LM routine to set variable
  2113. switch ( VarBind->value.asnType )
  2114. {
  2115. case ASN_RFC1155_COUNTER:
  2116. case ASN_INTEGER:
  2117. if ( SNMPAPI_ERROR ==
  2118. (*MibPtr->LMFunc)(MIB_ACTION_SET, MibPtr->LMData,
  2119. (void *)&VarBind->value.asnValue.number) )
  2120. {
  2121. nResult = SNMP_ERRORSTATUS_GENERR;
  2122. goto Exit;
  2123. }
  2124. break;
  2125. case ASN_OCTETSTRING: // This entails ASN_RFC1213_DISPSTRING also
  2126. if ( SNMPAPI_ERROR ==
  2127. (*MibPtr->LMFunc)(MIB_ACTION_SET, MibPtr->LMData,
  2128. (void *)&VarBind->value.asnValue.string) )
  2129. {
  2130. nResult = SNMP_ERRORSTATUS_GENERR;
  2131. goto Exit;
  2132. }
  2133. break;
  2134. default:
  2135. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: Internal Error Processing LAN Manager LEAF Variable\n" ));
  2136. nResult = SNMP_ERRORSTATUS_GENERR;
  2137. goto Exit;
  2138. }
  2139. nResult = SNMP_ERRORSTATUS_NOERROR;
  2140. break;
  2141. default:
  2142. SNMPDBG(( SNMP_LOG_TRACE, "LMMIB2: Internal Error Processing LAN Manager LEAF Variable\n" ));
  2143. nResult = SNMP_ERRORSTATUS_GENERR;
  2144. } // switch
  2145. Exit:
  2146. return nResult;
  2147. } // MIB_leaf_func
  2148. //-------------------------------- END --------------------------------------