Fixed passphrase authentication as responder.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 19 May 2007 12:02:30 +0000 (12:02 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 19 May 2007 12:02:30 +0000 (12:02 +0000)
lib/silcske/silcconnauth.c

index dba6ace132ac46de1b641f105a3335f9345b4d18..97fdd1668b47d4452e5e8a86d95223f2defb8f11 100644 (file)
@@ -565,7 +565,8 @@ SILC_FSM_STATE(silc_connauth_st_responder_authenticate)
   /* Passphrase authentication */
   if (passphrase && passphrase_len) {
     SILC_LOG_DEBUG(("Passphrase authentication"));
-    if (!memcmp(auth_data, passphrase, passphrase_len)) {
+    if (!auth_data || payload_len != passphrase_len ||
+       memcmp(auth_data, passphrase, passphrase_len)) {
       /** Authentication failed */
       silc_fsm_next(fsm, silc_connauth_st_responder_failure);
       return SILC_FSM_CONTINUE;
@@ -576,6 +577,12 @@ SILC_FSM_STATE(silc_connauth_st_responder_authenticate)
 
     SILC_LOG_DEBUG(("Digital signature authentication"));
 
+    if (!auth_data) {
+      /** Authentication failed */
+      silc_fsm_next(fsm, silc_connauth_st_responder_failure);
+      return SILC_FSM_CONTINUE;
+    }
+
     connauth->auth_data = silc_memdup(auth_data, payload_len);
     connauth->auth_data_len = payload_len;