fix wrong record type
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
Mon, 23 Jul 2018 20:58:20 +0000 (22:58 +0200)
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
Mon, 23 Jul 2018 20:58:20 +0000 (22:58 +0200)
src/reclaim/plugin_gnsrecord_reclaim.c
src/reclaim/plugin_rest_openid_connect.c

index 181a4bbc2a7758ad4a0d275855c5f57ee7de1efc..ecd1d6e77d4ee5ccc2e17866f9cbb7811172c4dd 100644 (file)
@@ -54,11 +54,11 @@ value_to_string (void *cls,
     case GNUNET_GNSRECORD_TYPE_ID_ATTR:
       return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
     case GNUNET_GNSRECORD_TYPE_ID_TOKEN: //DEPRECATED
+    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
+    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
       return GNUNET_strndup (data, data_size);
     case GNUNET_GNSRECORD_TYPE_ABE_KEY:
     case GNUNET_GNSRECORD_TYPE_ABE_MASTER:
-    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
-    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
       return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 
     case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA: //DEPRECATED
         ecdhe_privkey = data;
@@ -115,13 +115,13 @@ string_to_value (void *cls,
                                             *data,
                                             *data_size);
     case GNUNET_GNSRECORD_TYPE_ID_TOKEN:
+    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
+    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
       *data = GNUNET_strdup (s);
       *data_size = strlen (s);
       return GNUNET_OK;
     case GNUNET_GNSRECORD_TYPE_ABE_KEY:
     case GNUNET_GNSRECORD_TYPE_ABE_MASTER:
-    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
-    case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
       return GNUNET_STRINGS_string_to_data (s,
                                             strlen (s),
                                             *data,
index 99459427c875d6a632cf639e98cf9d7f797a03ff..24673c692bd1ae5c0e7307878341fb6044ee6e9c 100644 (file)
@@ -895,10 +895,12 @@ lookup_redirect_uri_result (void *cls,
   }
   for (int i = 0; i < rd_count; i++)
   {
-    if (0 != strcmp (rd[0].data,
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT != rd[i].record_type)
+      continue;
+    if (0 != strcmp (rd[i].data,
                      handle->oidc->redirect_uri))
       continue;
-    tmp = GNUNET_strdup (rd[0].data);
+    tmp = GNUNET_strdup (rd[i].data);
     pos = strrchr (tmp,
                    (unsigned char) '.');
     *pos = '\0';