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.

1535 lines
43 KiB

  1. /*******************************************************************/
  2. /* Copyright(c) 1992 Microsoft Corporation */
  3. /*******************************************************************/
  4. //***
  5. //
  6. // Filename: ppphand.c
  7. //
  8. // Description: This module contains the procedures for the
  9. // supervisor's procedure-driven state machine
  10. // that handle PPP events.
  11. //
  12. // Author: Stefan Solomon (stefans) May 26, 1992.
  13. //
  14. //***
  15. #include "ddm.h"
  16. #include "timer.h"
  17. #include "handlers.h"
  18. #include "objects.h"
  19. #include "util.h"
  20. #include "routerif.h"
  21. #include <raserror.h>
  22. #include <rasppp.h>
  23. #include <ddmif.h>
  24. #include <serial.h>
  25. #include "rasmanif.h"
  26. #include <string.h>
  27. #include <stdlib.h>
  28. #include <memory.h>
  29. //
  30. // This lives in rasapi32.dll
  31. //
  32. DWORD
  33. DDMGetPppParameters(
  34. LPWSTR lpwsPhonebookName,
  35. LPWSTR lpwsPhonebookEntry,
  36. CHAR * szzPppParameters
  37. );
  38. //***
  39. //
  40. // Function: SvPppSendInterfaceInfo
  41. //
  42. // Description: Ppp engine wants to get the interface handles for this
  43. // connection.
  44. //
  45. VOID
  46. SvPppSendInterfaceInfo(
  47. IN PDEVICE_OBJECT pDeviceObj
  48. )
  49. {
  50. ROUTER_INTERFACE_OBJECT * pIfObject;
  51. PPP_INTERFACE_INFO PppInterfaceInfo;
  52. DWORD dwXportIndex;
  53. PCONNECTION_OBJECT pConnObj;
  54. DDM_PRINT(gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  55. "SvPppSendInterfaceHandles: Entered, hPort=%d",pDeviceObj->hPort);
  56. ZeroMemory( &PppInterfaceInfo, sizeof( PppInterfaceInfo ) );
  57. if ( ( pConnObj = ConnObjGetPointer( pDeviceObj->hConnection ) ) == NULL )
  58. {
  59. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM, "No ConnObj" );
  60. return;
  61. }
  62. EnterCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  63. if ( ( pIfObject = IfObjectGetPointer( pConnObj->hDIMInterface ) ) == NULL )
  64. {
  65. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM, "No IfObject" );
  66. LeaveCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  67. return;
  68. }
  69. //
  70. // Get handles to this interface for each transport and notify PPP.
  71. //
  72. for ( dwXportIndex = 0;
  73. dwXportIndex < gblDDMConfigInfo.dwNumRouterManagers;
  74. dwXportIndex++ )
  75. {
  76. switch( gblRouterManagers[dwXportIndex].DdmRouterIf.dwProtocolId )
  77. {
  78. case PID_IPX:
  79. if (pIfObject->Transport[dwXportIndex].fState & RITRANSPORT_ENABLED)
  80. {
  81. PppInterfaceInfo.hIPXInterface =
  82. pIfObject->Transport[dwXportIndex].hInterface;
  83. }
  84. else
  85. {
  86. PppInterfaceInfo.hIPXInterface = INVALID_HANDLE_VALUE;
  87. }
  88. break;
  89. case PID_IP:
  90. if (pIfObject->Transport[dwXportIndex].fState & RITRANSPORT_ENABLED)
  91. {
  92. PppInterfaceInfo.hIPInterface =
  93. pIfObject->Transport[dwXportIndex].hInterface;
  94. CopyMemory( PppInterfaceInfo.szzParameters,
  95. pIfObject->PppInterfaceInfo.szzParameters,
  96. sizeof( PppInterfaceInfo.szzParameters ) );
  97. }
  98. else
  99. {
  100. PppInterfaceInfo.hIPInterface = INVALID_HANDLE_VALUE;
  101. }
  102. break;
  103. default:
  104. break;
  105. }
  106. }
  107. PppInterfaceInfo.IfType = pIfObject->IfType;
  108. LeaveCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  109. PppDdmSendInterfaceInfo( pDeviceObj->hConnection, &PppInterfaceInfo );
  110. }
  111. //***
  112. //
  113. // Function: SvPppUserOK
  114. //
  115. // Description: User has passed security verification and entered the
  116. // configuration conversation phase. Stops auth timer and
  117. // logs the user.
  118. //
  119. //***
  120. VOID
  121. SvPppUserOK(
  122. IN PDEVICE_OBJECT pDeviceObj,
  123. IN PPPDDM_AUTH_RESULT * pAuthResult
  124. )
  125. {
  126. LPWSTR lpstrAudit[2];
  127. ROUTER_INTERFACE_OBJECT * pIfObject;
  128. PCONNECTION_OBJECT pConnObj;
  129. DWORD dwRetCode = NO_ERROR;
  130. WCHAR wchUserName[UNLEN+1];
  131. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  132. "SvPppUserOK: Entered, hPort=%d", pDeviceObj->hPort);
  133. if ( pDeviceObj->DeviceState != DEV_OBJ_AUTH_IS_ACTIVE )
  134. {
  135. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM, "Auth not started" );
  136. return;
  137. }
  138. //
  139. // Stop authentication timer
  140. //
  141. TimerQRemove( (HANDLE)pDeviceObj->hPort, SvAuthTimeout );
  142. if ( strlen( pAuthResult->szUserName ) > 0 )
  143. {
  144. MultiByteToWideChar( CP_ACP,
  145. 0,
  146. pAuthResult->szUserName,
  147. -1,
  148. wchUserName,
  149. UNLEN+1 );
  150. }
  151. else
  152. {
  153. wcscpy( wchUserName, gblpszUnknown );
  154. }
  155. //
  156. // Check to see if the username and domain are the same if the 3rd party
  157. // security DLL is installed..
  158. //
  159. if ( ( gblDDMConfigInfo.lpfnRasBeginSecurityDialog != NULL ) &&
  160. ( gblDDMConfigInfo.lpfnRasEndSecurityDialog != NULL ) &&
  161. ( pDeviceObj->fFlags & DEV_OBJ_SECURITY_DLL_USED ) )
  162. {
  163. //
  164. // If there is no match then hangup the line
  165. //
  166. if ( _wcsicmp( pDeviceObj->wchUserName, wchUserName ) != 0 )
  167. {
  168. lpstrAudit[0] = pDeviceObj->wchUserName;
  169. lpstrAudit[1] = wchUserName;
  170. DDMLogWarning( ROUTERLOG_AUTH_DIFFUSER_FAILURE, 2, lpstrAudit );
  171. PppDdmStop( pDeviceObj->hPort, ERROR_ACCESS_DENIED );
  172. return;
  173. }
  174. }
  175. //
  176. // copy the user name
  177. //
  178. wcscpy( pDeviceObj->wchUserName, wchUserName );
  179. //
  180. // copy the domain name
  181. //
  182. MultiByteToWideChar( CP_ACP,
  183. 0,
  184. pAuthResult->szLogonDomain,
  185. -1,
  186. pDeviceObj->wchDomainName,
  187. DNLEN+1 );
  188. //
  189. // copy the advanced server flag
  190. //
  191. if ( pAuthResult->fAdvancedServer )
  192. {
  193. pDeviceObj->fFlags |= DEV_OBJ_IS_ADVANCED_SERVER;
  194. }
  195. EnterCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  196. do
  197. {
  198. //
  199. // Check to see if there are any non-client intefaces with this
  200. // name.
  201. //
  202. pIfObject = IfObjectGetPointerByName( pDeviceObj->wchUserName, FALSE );
  203. if ( pIfObject == (ROUTER_INTERFACE_OBJECT *)NULL )
  204. {
  205. //
  206. // If this is a client dialing in and clients are not allowed
  207. // to dialin to this port, then disconnect them.
  208. //
  209. if ( !( pDeviceObj->fFlags & DEV_OBJ_ALLOW_CLIENTS ) )
  210. {
  211. dwRetCode = ERROR_NOT_CLIENT_PORT;
  212. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  213. "A client tried to connect on a router only port=%d",
  214. pDeviceObj->hPort);
  215. break;
  216. }
  217. }
  218. else
  219. {
  220. //
  221. // If a call came in for an interface that is not dynamic
  222. // then do not accept the line
  223. //
  224. if ( ( pIfObject->IfType == ROUTER_IF_TYPE_DEDICATED ) ||
  225. ( pIfObject->IfType == ROUTER_IF_TYPE_INTERNAL ) )
  226. {
  227. //
  228. // Notify PPP not to accept the connection
  229. //
  230. dwRetCode = ERROR_ALREADY_CONNECTED;
  231. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  232. "The interface %ws is already connected port=%d",
  233. pIfObject->lpwsInterfaceName, pDeviceObj->hPort );
  234. break;
  235. }
  236. //
  237. // Allow the connection only if the interface is enabled
  238. //
  239. if ( !( pIfObject->fFlags & IFFLAG_ENABLED ) )
  240. {
  241. dwRetCode = ERROR_INTERFACE_DISABLED;
  242. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  243. "The interface %ws is disabled",
  244. pIfObject->lpwsInterfaceName );
  245. break;
  246. }
  247. if ( !( pDeviceObj->fFlags & DEV_OBJ_ALLOW_ROUTERS ) )
  248. {
  249. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  250. "A router tried to connect on a client only port=%d",
  251. pDeviceObj->hPort);
  252. dwRetCode = ERROR_NOT_ROUTER_PORT;
  253. break;
  254. }
  255. //
  256. // Set current usage in rasman to ROUTER
  257. //
  258. RasSetRouterUsage( pDeviceObj->hPort, TRUE );
  259. }
  260. } while( FALSE );
  261. LeaveCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  262. if ( dwRetCode != NO_ERROR )
  263. {
  264. lpstrAudit[0] = pDeviceObj->wchUserName;
  265. lpstrAudit[1] = pDeviceObj->wchPortName;
  266. DDMLogWarningString( ROUTERLOG_CONNECTION_ATTEMPT_FAILURE,
  267. 2,
  268. lpstrAudit,
  269. dwRetCode,
  270. 2 );
  271. PppDdmStop( pDeviceObj->hPort, dwRetCode );
  272. }
  273. return;
  274. }
  275. //***
  276. //
  277. // Function: SvPppNewLinkOrBundle
  278. //
  279. // Description: User has passed security verification and entered the
  280. // configuration conversation phase. Stops auth timer and
  281. // logs the user.
  282. //
  283. //***
  284. VOID
  285. SvPppNewLinkOrBundle(
  286. IN PDEVICE_OBJECT pDeviceObj,
  287. IN BOOL fNewBundle,
  288. IN PBYTE pClientInterface,
  289. IN PBYTE pQuarantineIPFilter,
  290. IN PBYTE pFilter,
  291. IN BOOL fQuarantinePresent
  292. )
  293. {
  294. LPWSTR lpstrAudit[2];
  295. ROUTER_INTERFACE_OBJECT * pIfObject;
  296. PCONNECTION_OBJECT pConnObj;
  297. DWORD dwRetCode = NO_ERROR;
  298. WCHAR wchUserName[UNLEN+1];
  299. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  300. "SvPppNewLinkOrBundle: Entered, hPort=%d", pDeviceObj->hPort);
  301. if ( pDeviceObj->DeviceState != DEV_OBJ_AUTH_IS_ACTIVE )
  302. {
  303. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM, "Auth not started" );
  304. return;
  305. }
  306. //
  307. // Get handle to the connection or bundle for this link
  308. //
  309. if ( ( dwRetCode = RasPortGetBundle( NULL, pDeviceObj->hPort,
  310. &(pDeviceObj->hConnection) ) ) != NO_ERROR )
  311. {
  312. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  313. "RasPortGetBundle failed: %d", dwRetCode );
  314. PppDdmStop( pDeviceObj->hPort, dwRetCode );
  315. return;
  316. }
  317. //
  318. // Allocate a connection object if it does not exist yet
  319. //
  320. pConnObj = ConnObjGetPointer( pDeviceObj->hConnection );
  321. if ( pConnObj == (CONNECTION_OBJECT *)NULL )
  322. {
  323. pConnObj = ConnObjAllocateAndInit( INVALID_HANDLE_VALUE,
  324. pDeviceObj->hConnection );
  325. if ( pConnObj == (CONNECTION_OBJECT *)NULL )
  326. {
  327. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  328. "ConnObjAllocateAndInit failed" );
  329. PppDdmStop( pDeviceObj->hPort, ERROR_NOT_ENOUGH_MEMORY );
  330. return;
  331. }
  332. pConnObj->fFlags = CONN_OBJ_IS_PPP;
  333. pConnObj->hPort = pDeviceObj->hPort;
  334. pConnObj->pQuarantineFilter = pQuarantineIPFilter;
  335. pConnObj->pFilter = pFilter;
  336. wcscpy( pConnObj->wchInterfaceName, pDeviceObj->wchUserName );
  337. //
  338. // copy the user name
  339. //
  340. wcscpy( pConnObj->wchUserName, pDeviceObj->wchUserName );
  341. //
  342. // copy the domain name
  343. //
  344. wcscpy( pConnObj->wchDomainName, pDeviceObj->wchDomainName );
  345. //
  346. // If it is a router, check to see if we have an interface for this
  347. // router, otherwise reject this connection.
  348. //
  349. EnterCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  350. do
  351. {
  352. //
  353. // Check to see if there are any non-client intefaces with this
  354. // name.
  355. //
  356. pIfObject = IfObjectGetPointerByName( pConnObj->wchInterfaceName,
  357. FALSE );
  358. //
  359. // We do not have this interface in our database so assume that
  360. // this is a client so we need to create and interface and add it
  361. // to all the router managers. Also if this interface exists but
  362. // is for a client we need to add this interface again.
  363. //
  364. if ( pIfObject == (ROUTER_INTERFACE_OBJECT *)NULL )
  365. {
  366. pIfObject = IfObjectAllocateAndInit(
  367. pConnObj->wchUserName,
  368. RISTATE_CONNECTING,
  369. ROUTER_IF_TYPE_CLIENT,
  370. pConnObj->hConnection,
  371. TRUE,
  372. 0,
  373. 0,
  374. NULL,
  375. NULL);
  376. if ( pIfObject == (ROUTER_INTERFACE_OBJECT *)NULL )
  377. {
  378. //
  379. // Error log this and stop the connection.
  380. //
  381. dwRetCode = GetLastError();
  382. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  383. "IfObjectAllocateAndInit failed: %d", dwRetCode);
  384. break;
  385. }
  386. //
  387. // Add interfaces to router managers, insert in table now
  388. // because of the table lookup within the InterfaceEnabled
  389. // call made in the context of AddInterface.
  390. //
  391. dwRetCode = IfObjectInsertInTable( pIfObject );
  392. if ( dwRetCode != NO_ERROR )
  393. {
  394. LOCAL_FREE( pIfObject );
  395. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  396. "IfObjectInsertInTable failed: %d", dwRetCode );
  397. break;
  398. }
  399. dwRetCode = IfObjectAddClientInterface( pIfObject,
  400. pClientInterface );
  401. if ( dwRetCode != NO_ERROR )
  402. {
  403. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  404. "IfObjectAddClientInterface failed: %d",
  405. dwRetCode );
  406. IfObjectRemove( pIfObject->hDIMInterface );
  407. break;
  408. }
  409. if(fQuarantinePresent)
  410. {
  411. pConnObj->fFlags |= CONN_OBJ_QUARANTINE_PRESENT;
  412. }
  413. }
  414. else
  415. {
  416. //
  417. // If the interface is already connecting or connected
  418. // and this is a new bundle then we need to reject this
  419. // connection.
  420. //
  421. if ( pIfObject->State != RISTATE_DISCONNECTED )
  422. {
  423. //
  424. // Notify PPP not to accept the connection
  425. //
  426. dwRetCode = ERROR_ALREADY_CONNECTED;
  427. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  428. "The interface %ws is already connected port=%d",
  429. pIfObject->lpwsInterfaceName, pDeviceObj->hPort );
  430. break;
  431. }
  432. }
  433. ConnObjInsertInTable( pConnObj );
  434. pIfObject->State = RISTATE_CONNECTING;
  435. pConnObj->hDIMInterface = pIfObject->hDIMInterface;
  436. pConnObj->InterfaceType = pIfObject->IfType;
  437. } while( FALSE );
  438. LeaveCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  439. if ( dwRetCode != NO_ERROR )
  440. {
  441. PppDdmStop( pDeviceObj->hPort, dwRetCode );
  442. LOCAL_FREE( pConnObj );
  443. return;
  444. }
  445. }
  446. //
  447. // Since this is a new bundle also send the interface handles
  448. //
  449. if ( fNewBundle )
  450. {
  451. SvPppSendInterfaceInfo( pDeviceObj );
  452. }
  453. //
  454. // Add this link to the connection block.
  455. //
  456. if ( ( dwRetCode = ConnObjAddLink( pConnObj, pDeviceObj ) ) != NO_ERROR )
  457. {
  458. PppDdmStop( pDeviceObj->hPort, ERROR_NOT_ENOUGH_MEMORY );
  459. DDMLogError( ROUTERLOG_NOT_ENOUGH_MEMORY, 0, NULL, dwRetCode );
  460. return;
  461. }
  462. }
  463. //***
  464. //
  465. // Function: SvPppFailure
  466. //
  467. // Descr: Ppp will let us know of any failure while active on a port.
  468. // An error message is sent to us and we merely log it and
  469. // disconnect the port.
  470. //
  471. //***
  472. VOID
  473. SvPppFailure(
  474. IN PDEVICE_OBJECT pDeviceObj,
  475. IN PPPDDM_FAILURE *afp
  476. )
  477. {
  478. LPWSTR auditstrp[3];
  479. WCHAR wchErrorString[256+1];
  480. WCHAR wchUserName[UNLEN+DNLEN+1];
  481. WCHAR wchDomainName[DNLEN+1];
  482. DWORD dwRetCode;
  483. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  484. "SvPppFailure: Entered, hPort=%d, Error=%d",
  485. pDeviceObj->hPort, afp->dwError );
  486. //
  487. // Was this a failure for a BAP callback?
  488. //
  489. if ( pDeviceObj->fFlags & DEV_OBJ_BAP_CALLBACK )
  490. {
  491. PppDdmBapCallbackResult( pDeviceObj->hBapConnection, afp->dwError );
  492. pDeviceObj->fFlags &= ~DEV_OBJ_BAP_CALLBACK;
  493. }
  494. if ( afp->szUserName[0] != (CHAR)NULL )
  495. {
  496. MultiByteToWideChar( CP_ACP, 0, afp->szUserName, -1, wchUserName, UNLEN+1 );
  497. }
  498. else
  499. {
  500. wcscpy( wchUserName, gblpszUnknown );
  501. }
  502. //
  503. // We ignore the DeviceState here because a Ppp failure can occur at
  504. // any time during the connection.
  505. //
  506. switch( afp->dwError )
  507. {
  508. case ERROR_AUTHENTICATION_FAILURE:
  509. auditstrp[0] = wchUserName;
  510. auditstrp[1] = pDeviceObj->wchPortName;
  511. DDMLogWarning( ROUTERLOG_AUTH_FAILURE,2,auditstrp );
  512. break;
  513. case ERROR_PASSWD_EXPIRED:
  514. MultiByteToWideChar( CP_ACP, 0, afp->szLogonDomain, -1, wchDomainName, DNLEN+1 );
  515. auditstrp[0] = wchDomainName;
  516. auditstrp[1] = wchUserName;
  517. auditstrp[2] = pDeviceObj->wchPortName;
  518. DDMLogWarning( ROUTERLOG_PASSWORD_EXPIRED, 3, auditstrp );
  519. break;
  520. case ERROR_ACCT_EXPIRED:
  521. case ERROR_ACCOUNT_EXPIRED:
  522. MultiByteToWideChar( CP_ACP, 0, afp->szLogonDomain, -1, wchDomainName, DNLEN+1 );
  523. auditstrp[0] = wchDomainName;
  524. auditstrp[1] = wchUserName;
  525. auditstrp[2] = pDeviceObj->wchPortName;
  526. DDMLogWarning( ROUTERLOG_ACCT_EXPIRED, 3, auditstrp );
  527. break;
  528. case ERROR_NO_DIALIN_PERMISSION:
  529. MultiByteToWideChar( CP_ACP, 0, afp->szLogonDomain, -1, wchDomainName, DNLEN+1 );
  530. auditstrp[0] = wchDomainName;
  531. auditstrp[1] = wchUserName;
  532. auditstrp[2] = pDeviceObj->wchPortName;
  533. DDMLogWarning( ROUTERLOG_NO_DIALIN_PRIVILEGE, 3, auditstrp );
  534. break;
  535. case ERROR_REQ_NOT_ACCEP:
  536. auditstrp[0] = pDeviceObj->wchPortName;
  537. DDMLogWarning( ROUTERLOG_LICENSE_LIMIT_EXCEEDED, 1, auditstrp );
  538. break;
  539. case ERROR_BAP_DISCONNECTED:
  540. case ERROR_BAP_REQUIRED:
  541. auditstrp[0] = wchUserName;
  542. auditstrp[1] = pDeviceObj->wchPortName;
  543. DDMLogWarningString( ROUTERLOG_BAP_DISCONNECT, 2, auditstrp,
  544. afp->dwError, 2 );
  545. break;
  546. case ERROR_PORT_NOT_CONNECTED:
  547. case ERROR_PPP_TIMEOUT:
  548. case ERROR_PPP_LCP_TERMINATED:
  549. case ERROR_NOT_CONNECTED:
  550. //
  551. // Ignore this error
  552. //
  553. break;
  554. case ERROR_PPP_NOT_CONVERGING:
  555. default:
  556. if ( afp->szUserName[0] != (CHAR)NULL )
  557. {
  558. if ( afp->szLogonDomain[0] != (CHAR)NULL )
  559. {
  560. MultiByteToWideChar(CP_ACP,0,afp->szLogonDomain,-1,wchUserName,UNLEN+1);
  561. wcscat( wchUserName, L"\\" );
  562. MultiByteToWideChar(CP_ACP,0,afp->szUserName,-1,wchDomainName,DNLEN+1);
  563. wcscat( wchUserName, wchDomainName );
  564. }
  565. else
  566. {
  567. MultiByteToWideChar(CP_ACP,0,afp->szUserName,-1,wchUserName,UNLEN+1);
  568. }
  569. }
  570. else if ( pDeviceObj->wchUserName[0] != (WCHAR)NULL )
  571. {
  572. if ( pDeviceObj->wchDomainName[0] != (WCHAR)NULL )
  573. {
  574. wcscpy( wchUserName, pDeviceObj->wchDomainName );
  575. wcscat( wchUserName, L"\\" );
  576. wcscat( wchUserName, pDeviceObj->wchUserName );
  577. }
  578. else
  579. {
  580. wcscpy( wchUserName, pDeviceObj->wchUserName );
  581. }
  582. }
  583. else
  584. {
  585. wcscpy( wchUserName, gblpszUnknown );
  586. }
  587. auditstrp[0] = pDeviceObj->wchPortName;
  588. auditstrp[1] = wchUserName;
  589. DDMLogErrorString(ROUTERLOG_PPP_FAILURE, 2, auditstrp, afp->dwError, 2);
  590. break;
  591. }
  592. }
  593. //***
  594. //
  595. // Function: SvPppCallbackRequest
  596. //
  597. // Description:
  598. //
  599. //***
  600. VOID
  601. SvPppCallbackRequest(
  602. IN PDEVICE_OBJECT pDeviceObj,
  603. IN PPPDDM_CALLBACK_REQUEST *cbrp
  604. )
  605. {
  606. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  607. "SvPppCallbackRequest: Entered, hPort = %d\n",pDeviceObj->hPort);
  608. //
  609. // check the state
  610. //
  611. if (pDeviceObj->DeviceState != DEV_OBJ_AUTH_IS_ACTIVE)
  612. {
  613. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM, "Auth not started" );
  614. return;
  615. }
  616. TimerQRemove( (HANDLE)pDeviceObj->hPort, SvAuthTimeout );
  617. //
  618. // copy relevant fields in our dcb
  619. //
  620. if (cbrp->fUseCallbackDelay)
  621. {
  622. pDeviceObj->dwCallbackDelay = cbrp->dwCallbackDelay;
  623. }
  624. else
  625. {
  626. pDeviceObj->dwCallbackDelay = gblDDMConfigInfo.dwCallbackTime;
  627. }
  628. MultiByteToWideChar( CP_ACP,
  629. 0,
  630. cbrp->szCallbackNumber,
  631. -1,
  632. pDeviceObj->wchCallbackNumber,
  633. MAX_PHONE_NUMBER_LEN + 1 );
  634. //
  635. // Disconnect the line and change the state
  636. //
  637. pDeviceObj->DeviceState = DEV_OBJ_CALLBACK_DISCONNECTING;
  638. //
  639. // Wait to enable the client to get the message
  640. //
  641. TimerQRemove( (HANDLE)pDeviceObj->hPort, SvDiscTimeout );
  642. TimerQInsert( (HANDLE)pDeviceObj->hPort,
  643. DISC_TIMEOUT_CALLBACK, SvDiscTimeout );
  644. }
  645. //***
  646. //
  647. // Function: SvPppDone
  648. //
  649. // Description: Activates all allocated bindings.
  650. //
  651. //***
  652. VOID
  653. SvPppDone(
  654. IN PDEVICE_OBJECT pDeviceObj,
  655. IN PPP_PROJECTION_RESULT *pProjectionResult
  656. )
  657. {
  658. LPWSTR lpstrAudit[3];
  659. DWORD dwRetCode;
  660. DWORD dwNumActivatedProjections = 0;
  661. ROUTER_INTERFACE_OBJECT * pIfObject;
  662. CONNECTION_OBJECT * pConnObj;
  663. WCHAR wchFullUserName[UNLEN+DNLEN+2];
  664. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  665. "SvPppDone: Entered, hPort=%d", pDeviceObj->hPort);
  666. //
  667. // If we are not authenicating and not been authenticated then we ignore
  668. // this message.
  669. //
  670. if ( ( pDeviceObj->DeviceState != DEV_OBJ_AUTH_IS_ACTIVE ) &&
  671. ( pDeviceObj->DeviceState != DEV_OBJ_ACTIVE ) )
  672. {
  673. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  674. "We are not authenicating and not been authenticated" );
  675. return;
  676. }
  677. //
  678. // Get pointer to connection object. If we cannot find it that means we
  679. // have gotten a PPP message for a device who's connection does not exist.
  680. // Simply ignore it.
  681. //
  682. if ( ( pConnObj = ConnObjGetPointer( pDeviceObj->hConnection ) ) == NULL )
  683. {
  684. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM, "No ConnObj" );
  685. return;
  686. }
  687. //
  688. // If we are getting a projection info structure again, we just update it
  689. // and return.
  690. //
  691. if ( pDeviceObj->DeviceState == DEV_OBJ_ACTIVE )
  692. {
  693. pConnObj->PppProjectionResult = *pProjectionResult;
  694. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  695. "Updated projection info structure" );
  696. return;
  697. }
  698. if ( pConnObj->wchDomainName[0] != TEXT('\0') )
  699. {
  700. wcscpy( wchFullUserName, pConnObj->wchDomainName );
  701. wcscat( wchFullUserName, TEXT("\\") );
  702. wcscat( wchFullUserName, pConnObj->wchUserName );
  703. }
  704. else
  705. {
  706. wcscpy( wchFullUserName, pConnObj->wchUserName );
  707. }
  708. lpstrAudit[0] = wchFullUserName;
  709. lpstrAudit[1] = pDeviceObj->wchPortName;
  710. //
  711. // If we have not yet been notifyied of projections for this connection.
  712. //
  713. if ( !(pConnObj->fFlags & CONN_OBJ_PROJECTIONS_NOTIFIED) )
  714. {
  715. if ( pProjectionResult->ip.dwError == NO_ERROR )
  716. {
  717. dwNumActivatedProjections++;
  718. }
  719. if ( pProjectionResult->ipx.dwError == NO_ERROR )
  720. {
  721. dwNumActivatedProjections++;
  722. }
  723. if ( pProjectionResult->at.dwError == NO_ERROR )
  724. {
  725. dwNumActivatedProjections++;
  726. }
  727. //
  728. // We couldn't activate any projection due to some error error log
  729. // and bring the link down
  730. //
  731. if ( dwNumActivatedProjections == 0 )
  732. {
  733. DDMLogError(ROUTERLOG_AUTH_NO_PROJECTIONS, 2, lpstrAudit, NO_ERROR);
  734. PppDdmStop( pDeviceObj->hPort, NO_ERROR );
  735. return;
  736. }
  737. else
  738. {
  739. //
  740. // Even though NBF was removed from the product, we can
  741. // still get the computer namefrom the nbf projection result
  742. // (PPP Engine dummied it in there).
  743. //
  744. // If the computer name ends with 0x03, that tells us
  745. // the messenger service is running on the remote computer.
  746. //
  747. pConnObj->fFlags &= ~CONN_OBJ_MESSENGER_PRESENT;
  748. pConnObj->bComputerName[0] = (CHAR)NULL;
  749. if ( pProjectionResult->nbf.wszWksta[0] != (WCHAR)NULL )
  750. {
  751. WideCharToMultiByte(
  752. CP_ACP,
  753. 0,
  754. pProjectionResult->nbf.wszWksta,
  755. -1,
  756. pConnObj->bComputerName,
  757. sizeof( pConnObj->bComputerName ),
  758. NULL,
  759. NULL );
  760. if (pConnObj->bComputerName[NCBNAMSZ-1] == (WCHAR) 0x03)
  761. {
  762. pConnObj->fFlags |= CONN_OBJ_MESSENGER_PRESENT;
  763. }
  764. pConnObj->bComputerName[NCBNAMSZ-1] = (WCHAR)NULL;
  765. }
  766. }
  767. //
  768. // Projections Activated OK
  769. //
  770. pConnObj->PppProjectionResult = *pProjectionResult;
  771. pConnObj->fFlags |= CONN_OBJ_PROJECTIONS_NOTIFIED;
  772. //
  773. // Set this interface to connected if it is not already connected
  774. //
  775. dwRetCode = IfObjectConnected(
  776. pConnObj->hDIMInterface,
  777. pConnObj->hConnection,
  778. &(pConnObj->PppProjectionResult) );
  779. //
  780. // If the interface does not exist anymore bring down this connection
  781. //
  782. if ( dwRetCode != NO_ERROR )
  783. {
  784. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  785. "Interface does not exist anymore" );
  786. PppDdmStop( pDeviceObj->hPort, NO_ERROR );
  787. ConnObjDisconnect( pConnObj );
  788. return;
  789. }
  790. GetSystemTimeAsFileTime( (FILETIME*)&(pConnObj->qwActiveTime) );
  791. if ( !AcceptNewConnection( pDeviceObj, pConnObj ) )
  792. {
  793. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  794. "ERROR_ACCESS_DENIED" );
  795. PppDdmStop( pDeviceObj->hPort, ERROR_ACCESS_DENIED );
  796. ConnObjDisconnect( pConnObj );
  797. return;
  798. }
  799. }
  800. if ( !AcceptNewLink( pDeviceObj, pConnObj ) )
  801. {
  802. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  803. "ERROR_ACCESS_DENIED" );
  804. PppDdmStop( pDeviceObj->hPort, ERROR_ACCESS_DENIED );
  805. return;
  806. }
  807. //
  808. // Reduce the media count for this device
  809. //
  810. if ( !(pDeviceObj->fFlags & DEV_OBJ_MARKED_AS_INUSE) )
  811. {
  812. if ( pDeviceObj->fFlags & DEV_OBJ_ALLOW_ROUTERS )
  813. {
  814. MediaObjRemoveFromTable( pDeviceObj->wchDeviceType );
  815. }
  816. pDeviceObj->fFlags |= DEV_OBJ_MARKED_AS_INUSE;
  817. gblDeviceTable.NumDevicesInUse++;
  818. //
  819. // Possibly need to notify the router managers of unreachability
  820. //
  821. EnterCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  822. IfObjectNotifyAllOfReachabilityChange( FALSE,
  823. INTERFACE_OUT_OF_RESOURCES );
  824. LeaveCriticalSection( &(gblpInterfaceTable->CriticalSection) );
  825. }
  826. //
  827. // log authentication success, 18 is MSPPC
  828. //
  829. if ( ( pConnObj->PppProjectionResult.ccp.dwSendProtocol == 18 ) &&
  830. ( pConnObj->PppProjectionResult.ccp.dwReceiveProtocol == 18 ) )
  831. {
  832. if ( ( pConnObj->PppProjectionResult.ccp.dwReceiveProtocolData &
  833. ( MSTYPE_ENCRYPTION_40 |
  834. MSTYPE_ENCRYPTION_40F |
  835. MSTYPE_ENCRYPTION_56 |
  836. MSTYPE_ENCRYPTION_128 ) ) &&
  837. ( pConnObj->PppProjectionResult.ccp.dwSendProtocolData &
  838. ( MSTYPE_ENCRYPTION_40 |
  839. MSTYPE_ENCRYPTION_40F |
  840. MSTYPE_ENCRYPTION_56 |
  841. MSTYPE_ENCRYPTION_128 ) ) )
  842. {
  843. if ( ( pConnObj->PppProjectionResult.ccp.dwSendProtocolData &
  844. MSTYPE_ENCRYPTION_128 ) &&
  845. ( pConnObj->PppProjectionResult.ccp.dwReceiveProtocolData &
  846. MSTYPE_ENCRYPTION_128 ) )
  847. {
  848. DDMLogInformation(ROUTERLOG_AUTH_SUCCESS_STRONG_ENCRYPTION,2,
  849. lpstrAudit);
  850. }
  851. else
  852. {
  853. DDMLogInformation(ROUTERLOG_AUTH_SUCCESS_ENCRYPTION,2,
  854. lpstrAudit);
  855. }
  856. }
  857. else
  858. {
  859. DDMLogInformation( ROUTERLOG_AUTH_SUCCESS, 2, lpstrAudit );
  860. }
  861. if(pProjectionResult->ip.dwError == ERROR_SUCCESS)
  862. {
  863. WCHAR *pszIpAddress =
  864. GetIpAddress(pProjectionResult->ip.dwRemoteAddress);
  865. if(NULL != pszIpAddress)
  866. {
  867. lpstrAudit[2] = pszIpAddress;
  868. DDMLogInformation(ROUTERLOG_IP_USER_CONNECTED, 3, lpstrAudit);
  869. LocalFree(pszIpAddress);
  870. }
  871. }
  872. }
  873. else
  874. {
  875. DDMLogInformation( ROUTERLOG_AUTH_SUCCESS, 2, lpstrAudit );
  876. if(pProjectionResult->ip.dwError == ERROR_SUCCESS)
  877. {
  878. WCHAR *pszIpAddress = GetIpAddress(
  879. pProjectionResult->ip.dwRemoteAddress);
  880. if(NULL != pszIpAddress)
  881. {
  882. lpstrAudit[2] = pszIpAddress;
  883. DDMLogInformation(ROUTERLOG_IP_USER_CONNECTED, 3, lpstrAudit);
  884. LocalFree(pszIpAddress);
  885. }
  886. }
  887. }
  888. //
  889. // and finaly go to ACTIVE state
  890. //
  891. pDeviceObj->DeviceState = DEV_OBJ_ACTIVE;
  892. pDeviceObj->dwTotalNumberOfCalls++;
  893. pDeviceObj->fFlags |= DEV_OBJ_PPP_IS_ACTIVE;
  894. //
  895. // and initialize the active time
  896. //
  897. GetSystemTimeAsFileTime( (FILETIME*)&(pDeviceObj->qwActiveTime) );
  898. //
  899. // Was this a connection for a BAP callback?
  900. //
  901. if ( pDeviceObj->fFlags & DEV_OBJ_BAP_CALLBACK )
  902. {
  903. PppDdmBapCallbackResult( pDeviceObj->hBapConnection, NO_ERROR );
  904. pDeviceObj->fFlags &= ~DEV_OBJ_BAP_CALLBACK;
  905. }
  906. return;
  907. }
  908. //**
  909. //
  910. // Call: SvAddLinkToConnection
  911. //
  912. // Returns: NO_ERROR - Success
  913. // Non-zero returns - Failure
  914. //
  915. // Description: Called to actually add a new link that BAP has brought up.
  916. //
  917. VOID
  918. SvAddLinkToConnection(
  919. IN PDEVICE_OBJECT pDeviceObj,
  920. IN HRASCONN hRasConn
  921. )
  922. {
  923. CONNECTION_OBJECT * pConnObj;
  924. DWORD dwRetCode;
  925. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  926. "SvAddLinkToConnection: Entered, hPort=%d", pDeviceObj->hPort );
  927. //
  928. // Set this port to be notified by rasapi32 on disconnect.
  929. //
  930. dwRetCode = RasConnectionNotification(
  931. hRasConn,
  932. gblSupervisorEvents[NUM_DDM_EVENTS
  933. + (gblDeviceTable.NumDeviceBuckets*2)
  934. + DeviceObjHashPortToBucket(pDeviceObj->hPort)],
  935. RASCN_Disconnection );
  936. if ( dwRetCode != NO_ERROR )
  937. {
  938. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  939. "RasConnectionNotification failed: %d", dwRetCode );
  940. return;
  941. }
  942. //
  943. // Get the HCONN bundle handle for this port
  944. //
  945. if ( RasPortGetBundle( NULL,
  946. pDeviceObj->hPort,
  947. &(pDeviceObj->hConnection) ) )
  948. {
  949. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  950. "RasPortGetBundle failed" );
  951. return;
  952. }
  953. if ( ( pConnObj = ConnObjGetPointer( pDeviceObj->hConnection ) ) == NULL )
  954. {
  955. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM, "No ConnObj" );
  956. return;
  957. }
  958. if ( ( dwRetCode = ConnObjAddLink( pConnObj, pDeviceObj ) ) != NO_ERROR )
  959. {
  960. DDMLogError( ROUTERLOG_NOT_ENOUGH_MEMORY, 0, NULL, dwRetCode );
  961. return;
  962. }
  963. //
  964. // Reduce the media count for this device
  965. //
  966. if ( !(pDeviceObj->fFlags & DEV_OBJ_MARKED_AS_INUSE) )
  967. {
  968. if ( pDeviceObj->fFlags & DEV_OBJ_ALLOW_ROUTERS )
  969. {
  970. MediaObjRemoveFromTable( pDeviceObj->wchDeviceType );
  971. }
  972. pDeviceObj->fFlags |= DEV_OBJ_MARKED_AS_INUSE;
  973. gblDeviceTable.NumDevicesInUse++;
  974. //
  975. // Possibly need to notify the router managers of unreachability
  976. //
  977. IfObjectNotifyAllOfReachabilityChange(FALSE,INTERFACE_OUT_OF_RESOURCES);
  978. }
  979. pDeviceObj->fFlags |= DEV_OBJ_OPENED_FOR_DIALOUT;
  980. pDeviceObj->hRasConn = hRasConn;
  981. if ( pConnObj->InterfaceType == ROUTER_IF_TYPE_FULL_ROUTER )
  982. {
  983. RasSetRouterUsage( pDeviceObj->hPort, TRUE );
  984. }
  985. }
  986. //**
  987. //
  988. // Call: SvDoBapCallbackRequest
  989. //
  990. // Returns: NO_ERROR - Success
  991. // Non-zero returns - Failure
  992. //
  993. // Description: Called by BAP to initiate a callback to the remote peer
  994. //
  995. VOID
  996. SvDoBapCallbackRequest(
  997. IN PDEVICE_OBJECT pDevObj,
  998. IN HCONN hConnection,
  999. IN CHAR * szCallbackNumber
  1000. )
  1001. {
  1002. DWORD dwRetCode;
  1003. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  1004. "SvDoBapCallbackRequest: Entered, hPort=%d", pDevObj->hPort );
  1005. //
  1006. // Check to see if the device is available
  1007. //
  1008. if ( ( pDevObj->DeviceState != DEV_OBJ_LISTENING ) ||
  1009. ( pDevObj->fFlags & DEV_OBJ_OPENED_FOR_DIALOUT ) )
  1010. {
  1011. DDM_PRINT( gblDDMConfigInfo.dwTraceId, TRACE_FSM,
  1012. "Device not available" );
  1013. PppDdmBapCallbackResult( hConnection, ERROR_PORT_NOT_AVAILABLE );
  1014. return;
  1015. }
  1016. pDevObj->fFlags |= DEV_OBJ_IS_PPP;
  1017. pDevObj->DeviceState = DEV_OBJ_CALLBACK_DISCONNECTING;
  1018. MultiByteToWideChar( CP_ACP,
  1019. 0,
  1020. szCallbackNumber,
  1021. -1,
  1022. pDevObj->wchCallbackNumber,
  1023. MAX_PHONE_NUMBER_LEN + 1 );
  1024. pDevObj->dwCallbackDelay = 10;
  1025. pDevObj->hBapConnection = hConnection;
  1026. pDevObj->fFlags |= DEV_OBJ_BAP_CALLBACK;
  1027. RmDisconnect( pDevObj );
  1028. }
  1029. //***
  1030. //
  1031. // Function: PppEventHandler
  1032. //
  1033. // Description: receives the ppp messages and invokes the apropriate
  1034. // procedures in fsm.
  1035. //
  1036. //***
  1037. VOID
  1038. PppEventHandler(
  1039. VOID
  1040. )
  1041. {
  1042. PPP_MESSAGE PppMsg;
  1043. PDEVICE_OBJECT pDevObj;
  1044. PCONNECTION_OBJECT pConnObj;
  1045. //
  1046. // loop to get all messages
  1047. //
  1048. while( ServerReceiveMessage( MESSAGEQ_ID_PPP, (BYTE *)&PppMsg) )
  1049. {
  1050. EnterCriticalSection( &(gblDeviceTable.CriticalSection) );
  1051. if ( PppMsg.dwMsgId == PPPDDMMSG_PnPNotification )
  1052. {
  1053. //
  1054. // Port add/removal/change usage or protocol addition/removal
  1055. // notifications.
  1056. //
  1057. DWORD dwPnPEvent =
  1058. PppMsg.ExtraInfo.DdmPnPNotification.PnPNotification.dwEvent;
  1059. RASMAN_PORT * pRasmanPort =
  1060. &(PppMsg.ExtraInfo.DdmPnPNotification.PnPNotification.RasPort);
  1061. switch( dwPnPEvent )
  1062. {
  1063. case PNPNOTIFEVENT_CREATE:
  1064. if(pRasmanPort->P_ConfiguredUsage &
  1065. (CALL_IN | CALL_ROUTER | CALL_OUTBOUND_ROUTER))
  1066. {
  1067. DeviceObjAdd( pRasmanPort );
  1068. }
  1069. break;
  1070. case PNPNOTIFEVENT_REMOVE:
  1071. DeviceObjRemove( pRasmanPort );
  1072. break;
  1073. case PNPNOTIFEVENT_USAGE:
  1074. DeviceObjUsageChange( pRasmanPort );
  1075. break;
  1076. }
  1077. LeaveCriticalSection( &(gblDeviceTable.CriticalSection) );
  1078. continue;
  1079. }
  1080. else
  1081. {
  1082. //
  1083. // Otherwise identify the port for which this event is received.
  1084. //
  1085. if ( ( pDevObj = DeviceObjGetPointer( PppMsg.hPort ) ) == NULL )
  1086. {
  1087. RTASSERT( pDevObj != NULL );
  1088. LeaveCriticalSection( &(gblDeviceTable.CriticalSection) );
  1089. continue;
  1090. }
  1091. }
  1092. //
  1093. // action on the message type
  1094. //
  1095. switch( PppMsg.dwMsgId )
  1096. {
  1097. case PPPDDMMSG_BapCallbackRequest:
  1098. SvDoBapCallbackRequest(
  1099. pDevObj,
  1100. PppMsg.ExtraInfo.BapCallbackRequest.hConnection,
  1101. PppMsg.ExtraInfo.BapCallbackRequest.szCallbackNumber );
  1102. break;
  1103. case PPPDDMMSG_PppDone:
  1104. pDevObj->fFlags &= (~DEV_OBJ_AUTH_ACTIVE);
  1105. SvPppDone(pDevObj, &PppMsg.ExtraInfo.ProjectionResult);
  1106. break;
  1107. case PPPDDMMSG_CallbackRequest:
  1108. SvPppCallbackRequest(pDevObj,&PppMsg.ExtraInfo.CallbackRequest);
  1109. break;
  1110. case PPPDDMMSG_Authenticated:
  1111. SvPppUserOK(pDevObj, &PppMsg.ExtraInfo.AuthResult);
  1112. break;
  1113. case PPPDDMMSG_NewLink:
  1114. SvPppNewLinkOrBundle( pDevObj, FALSE, NULL, NULL, NULL, FALSE );
  1115. break;
  1116. case PPPDDMMSG_NewBundle:
  1117. if(NULL != IfObjectGetPointerByName(
  1118. pDevObj->wchUserName, FALSE))
  1119. {
  1120. MprInfoDelete(PppMsg.ExtraInfo.DdmNewBundle.pClientInterface);
  1121. PppMsg.ExtraInfo.DdmNewBundle.pClientInterface = NULL;
  1122. MprInfoDelete(PppMsg.ExtraInfo.DdmNewBundle.pQuarantineIPFilter);
  1123. PppMsg.ExtraInfo.DdmNewBundle.pQuarantineIPFilter = NULL;
  1124. MprInfoDelete(PppMsg.ExtraInfo.DdmNewBundle.pFilter);
  1125. PppMsg.ExtraInfo.DdmNewBundle.pFilter = NULL;
  1126. PppMsg.ExtraInfo.DdmNewBundle.fQuarantinePresent = FALSE;
  1127. }
  1128. SvPppNewLinkOrBundle(
  1129. pDevObj,
  1130. TRUE,
  1131. PppMsg.ExtraInfo.DdmNewBundle.pClientInterface,
  1132. PppMsg.ExtraInfo.DdmNewBundle.pQuarantineIPFilter,
  1133. PppMsg.ExtraInfo.DdmNewBundle.pFilter,
  1134. PppMsg.ExtraInfo.DdmNewBundle.fQuarantinePresent);
  1135. if ( PppMsg.ExtraInfo.DdmNewBundle.pClientInterface != NULL )
  1136. {
  1137. MprInfoDelete( PppMsg.ExtraInfo.DdmNewBundle.pClientInterface );
  1138. }
  1139. break;
  1140. case PPPDDMMSG_PppFailure:
  1141. pDevObj->fFlags &= (~DEV_OBJ_AUTH_ACTIVE);
  1142. switch( PppMsg.ExtraInfo.DdmFailure.dwError )
  1143. {
  1144. case NO_ERROR:
  1145. case ERROR_IDLE_DISCONNECTED:
  1146. pDevObj->dwDisconnectReason = DDM_IDLE_DISCONNECT;
  1147. break;
  1148. case ERROR_PPP_SESSION_TIMEOUT:
  1149. pDevObj->dwDisconnectReason = DDM_SESSION_TIMEOUT;
  1150. break;
  1151. default:
  1152. pDevObj->dwDisconnectReason = 0;
  1153. SvPppFailure( pDevObj, &PppMsg.ExtraInfo.DdmFailure );
  1154. }
  1155. PppDdmStop( pDevObj->hPort, PppMsg.ExtraInfo.DdmFailure.dwError );
  1156. break;
  1157. case PPPDDMMSG_Stopped:
  1158. if ( ( pDevObj->DeviceState != DEV_OBJ_CLOSING ) &&
  1159. ( pDevObj->DeviceState != DEV_OBJ_LISTENING ) )
  1160. {
  1161. DevStartClosing( pDevObj );
  1162. }
  1163. break;
  1164. case PPPDDMMSG_PortCleanedUp:
  1165. if ( pDevObj->DeviceState != DEV_OBJ_LISTENING )
  1166. {
  1167. pDevObj->fFlags &= (~DEV_OBJ_PPP_IS_ACTIVE);
  1168. if ( pDevObj->DeviceState != DEV_OBJ_CLOSING )
  1169. {
  1170. DevStartClosing( pDevObj );
  1171. }
  1172. else
  1173. {
  1174. DevCloseComplete( pDevObj );
  1175. }
  1176. }
  1177. break;
  1178. case PPPDDMMSG_NewBapLinkUp:
  1179. SvAddLinkToConnection( pDevObj,
  1180. PppMsg.ExtraInfo.BapNewLinkUp.hRasConn );
  1181. break;
  1182. default:
  1183. RTASSERT(FALSE);
  1184. break;
  1185. }
  1186. LeaveCriticalSection( &(gblDeviceTable.CriticalSection) );
  1187. }
  1188. }