613 TInt64 seedValue = currentTime.Int64(); |
613 TInt64 seedValue = currentTime.Int64(); |
614 |
614 |
615 TUint8 challenge[KGenericNifChallengeSize] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
615 TUint8 challenge[KGenericNifChallengeSize] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
616 |
616 |
617 TUint8 i=0; |
617 TUint8 i=0; |
618 while(i < KGenericNifChallengeSize) |
618 while((i < KGenericNifChallengeSize) && (aProtocolConfigOption.iChallenge.Length() < aProtocolConfigOption.iChallenge.MaxLength())) |
619 { |
619 { |
620 challenge[i] = (TUint8)(Math::Rand(seedValue)%256); |
620 challenge[i] = (TUint8)(Math::Rand(seedValue)%256); |
621 aProtocolConfigOption.iChallenge.Append(challenge[i++]); |
621 aProtocolConfigOption.iChallenge.Append(challenge[i++]); |
622 } |
622 } |
623 |
623 |
624 //Response |
624 //Response |
625 TBuf8<KGenericNifIdLength+KCommsDbSvrMaxColumnNameLength+KGenericNifChallengeSize> message; |
625 TInt length = 1 /*iId length */ + aProtocolConfigOption.iAuthInfo.iPassword.Length() + aProtocolConfigOption.iChallenge.Length(); |
626 message.Append(aProtocolConfigOption.iId); |
|
627 message.Append(aProtocolConfigOption.iAuthInfo.iPassword); |
|
628 message.Append(aProtocolConfigOption.iChallenge); |
|
629 |
|
630 TInt length = 1 /*iId length */ + aProtocolConfigOption.iAuthInfo.iPassword.Length() + KGenericNifChallengeSize; |
|
631 |
|
632 HBufC8* buf = HBufC8::NewL(length); |
626 HBufC8* buf = HBufC8::NewL(length); |
633 |
|
634 CleanupStack::PushL(buf); |
627 CleanupStack::PushL(buf); |
635 |
628 |
636 TPtr8 ptr((TUint8*)buf->Des().Ptr(),length); |
629 TPtr8 ptr((TUint8*)buf->Des().Ptr(),length); |
637 |
630 ptr.Append(aProtocolConfigOption.iId); |
638 ptr.Copy(message); |
631 ptr.Append(aProtocolConfigOption.iAuthInfo.iPassword); |
|
632 ptr.Append(aProtocolConfigOption.iChallenge); |
639 |
633 |
640 CMD5* md5=0; |
634 CMD5* md5=0; |
641 md5 = CMD5::NewL(); |
635 md5 = CMD5::NewL(); |
642 |
|
643 CleanupStack::PushL(md5); |
636 CleanupStack::PushL(md5); |
644 |
|
645 TPtrC8 Response = md5->Hash(ptr); |
637 TPtrC8 Response = md5->Hash(ptr); |
646 |
638 |
647 aProtocolConfigOption.iResponse.Copy(Response); |
639 if (Response.Length() < aProtocolConfigOption.iResponse.MaxLength()) |
648 |
640 { |
649 CleanupStack::PopAndDestroy(2); //buf, md5 |
641 aProtocolConfigOption.iResponse.Copy(Response); |
|
642 } |
|
643 else |
|
644 { |
|
645 // Just a defensive measure - this should not happen. |
|
646 User::Leave(KErrCorrupt); |
|
647 } |
|
648 |
|
649 CleanupStack::PopAndDestroy(2); //buf, md5 |
650 } |
650 } |
651 |
651 |
652 void TCreatePrimaryPDPCtx::DoL() |
652 void TCreatePrimaryPDPCtx::DoL() |
653 { |
653 { |
654 // if the provisionconfig failed, there is no way to inform the CPR of the failure |
654 // if the provisionconfig failed, there is no way to inform the CPR of the failure |
1154 } |
1154 } |
1155 |
1155 |
1156 DEFINE_SMELEMENT(TAwaitingContextBlockedOrUnblocked, NetStateMachine::MState, PDPSCprStates::TContext) |
1156 DEFINE_SMELEMENT(TAwaitingContextBlockedOrUnblocked, NetStateMachine::MState, PDPSCprStates::TContext) |
1157 TBool TAwaitingContextBlockedOrUnblocked::Accept() |
1157 TBool TAwaitingContextBlockedOrUnblocked::Accept() |
1158 { |
1158 { |
1159 return TAwaitingPDPFSMMessage::Accept(KContextBlockedEvent) || TAwaitingPDPFSMMessage::Accept(KContextUnblockedEvent); |
1159 |
|
1160 if (TAwaitingPDPFSMMessage::Accept(KContextBlockedEvent) || TAwaitingPDPFSMMessage::Accept(KContextUnblockedEvent)) |
|
1161 { |
|
1162 //check if there is a data flow as well. Incase we are getting the notification and the Data Client has already |
|
1163 //been destroyed, we will just ignore the notification. (ou1cimx1#466386) |
|
1164 RNodeInterface* theOnlyDataClient = iContext.iNode.GetFirstClient<TDefaultClientMatchPolicy>(TCFClientType::EData); |
|
1165 if (theOnlyDataClient == NULL) |
|
1166 { |
|
1167 // clear the message and return EFalse. |
|
1168 iContext.iMessage.ClearMessageId(); |
|
1169 return EFalse; |
|
1170 } |
|
1171 else |
|
1172 { |
|
1173 return ETrue; |
|
1174 } |
|
1175 } |
|
1176 else |
|
1177 { |
|
1178 return EFalse; |
|
1179 } |
1160 } |
1180 } |
1161 |
1181 |
1162 DEFINE_SMELEMENT(TForwardContextBlockedOrUnblockedToDC, NetStateMachine::MStateTransition, PDPSCprStates::TContext) |
1182 DEFINE_SMELEMENT(TForwardContextBlockedOrUnblockedToDC, NetStateMachine::MStateTransition, PDPSCprStates::TContext) |
1163 void TForwardContextBlockedOrUnblockedToDC::DoL() |
1183 void TForwardContextBlockedOrUnblockedToDC::DoL() |
1164 { |
1184 { |