gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: 5973.


From: gnunet
Subject: [libeufin] branch master updated: 5973.
Date: Wed, 22 Jan 2020 23:44:17 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new bd6f0b0  5973.
bd6f0b0 is described below

commit bd6f0b03f2df6aa048aedf339673d2abf4105cd4
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jan 22 23:41:50 2020 +0100

    5973.
    
    Report more appropriate error when subscriber
    state is not suitable for the request.
---
 .../tech/libeufin/sandbox/EbicsProtocolBackend.kt  | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 3f74d06..ed13b44 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -53,12 +53,28 @@ import javax.sql.rowset.serial.SerialBlob
 open class EbicsRequestError(val errorText: String, val errorCode: String) :
     Exception("EBICS request management error: $errorText ($errorCode)")
 
-class EbicsInvalidRequestError : EbicsRequestError("[EBICS_INVALID_REQUEST] 
Invalid request", "060102")
+class EbicsInvalidRequestError : EbicsRequestError(
+    "[EBICS_INVALID_REQUEST] Invalid request",
+    "060102"
+)
+
+/**
+ * This error is thrown whenever the Subscriber's state is not suitable
+ * for the requested action.  For example, the subscriber sends a EbicsRequest
+ * message without having first uploaded their keys (#5973).
+ */
+class EbicsSubscriberStateError : EbicsRequestError(
+    "[EBICS_INVALID_USER_OR_USER_STATE] Subscriber unknown or subscriber state 
inadmissible",
+    "091002"
+)
 
 open class EbicsKeyManagementError(val errorText: String, val errorCode: 
String) :
     Exception("EBICS key management error: $errorText ($errorCode)")
 
-private class EbicsInvalidXmlError : 
EbicsKeyManagementError("[EBICS_INVALID_XML]", "091010")
+private class EbicsInvalidXmlError : EbicsKeyManagementError(
+    "[EBICS_INVALID_XML]",
+    "091010"
+)
 
 private class EbicsInvalidOrderType : EbicsRequestError(
     "[EBICS_UNSUPPORTED_ORDER_TYPE] Order type not supported",
@@ -356,7 +372,7 @@ private suspend fun ApplicationCall.handleEbicsHpb(
             throw EbicsInvalidRequestError()
         }
         if (ebicsSubscriber.state != SubscriberState.INITIALIZED) {
-            throw EbicsInvalidRequestError()
+            throw EbicsSubscriberStateError()
         }
         val authPubBlob = ebicsSubscriber.authenticationKey!!.rsaPublicKey
         val encPubBlob = ebicsSubscriber.encryptionKey!!.rsaPublicKey
@@ -694,7 +710,8 @@ suspend fun ApplicationCall.ebicsweb() {
                 }
 
                 if (ebicsHost == null) throw EbicsInvalidRequestError()
-                if (subscriber == null) throw EbicsInvalidRequestError()
+                if (subscriber == null || subscriber.state != 
SubscriberState.INITIALIZED)
+                    throw EbicsSubscriberStateError()
 
                 val hostAuthPriv = CryptoUtil.loadRsaPrivateKey(
                     ebicsHost.authenticationPrivateKey

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]