From 88203cb111cd9605edcdedb402f8f2a96f8f01e1 Mon Sep 17 00:00:00 2001 From: Hung-ying Tyan Date: Wed, 15 Sep 2010 03:00:19 +0800 Subject: SipService: send SERVER_ERROR if server doesn't provide nonce in authentication response. Change-Id: I93e8c0d6754399ca2f382033085e40fc4c6ccb19 --- services/java/com/android/server/sip/SipSessionGroup.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/sip/SipSessionGroup.java b/services/java/com/android/server/sip/SipSessionGroup.java index 06b6ec9397a5..3d002aaeaf72 100644 --- a/services/java/com/android/server/sip/SipSessionGroup.java +++ b/services/java/com/android/server/sip/SipSessionGroup.java @@ -712,9 +712,15 @@ class SipSessionGroup implements SipListener { case Response.UNAUTHORIZED: case Response.PROXY_AUTHENTICATION_REQUIRED: if (!handleAuthentication(event)) { - Log.v(TAG, "Incorrect username/password"); - onRegistrationFailed(SipErrorCode.INVALID_CREDENTIALS, - "incorrect username or password"); + if (mLastNonce == null) { + onRegistrationFailed(SipErrorCode.SERVER_ERROR, + "server does not provide challenge"); + } else { + Log.v(TAG, "Incorrect username/password"); + onRegistrationFailed( + SipErrorCode.INVALID_CREDENTIALS, + "incorrect username or password"); + } } return true; default: @@ -869,6 +875,9 @@ class SipSessionGroup implements SipListener { case Response.PROXY_AUTHENTICATION_REQUIRED: if (handleAuthentication(event)) { addSipSession(this); + } else if (mLastNonce == null) { + endCallOnError(SipErrorCode.SERVER_ERROR, + "server does not provide challenge"); } else { endCallOnError(SipErrorCode.INVALID_CREDENTIALS, "incorrect username or password"); -- cgit v1.2.3-59-g8ed1b