- minor fixes
authorAdnan H <acednan@gmail.com>
Tue, 6 Dec 2016 09:51:58 +0000 (10:51 +0100)
committerAdnan H <acednan@gmail.com>
Tue, 6 Dec 2016 09:51:58 +0000 (10:51 +0100)
src/credential/gnunet-service-credential.c

index 792d8741e4cb2dac0d37ae29c197c21fd1a78236..a4686e63582bb47ef5b976dc060ff06c3be1d95e 100644 (file)
@@ -265,45 +265,46 @@ start_backward_resolution (void* cls,
   struct CredentialRecordEntry *cred_pointer;  
   const char *attribute;
   const char *cred_attribute;
-  char *issuer_key;
-  char *cred_issuer_key;
-  const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key_ecdsa; 
-  const struct GNUNET_CRYPTO_EcdsaPublicKey *cred_issuer_key_ecdsa; 
 
   for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL; 
       cred_pointer = cred_pointer->next){
     cred = &cred_pointer->record_data;
-    issuer_key_ecdsa =  &vrh->attr_pointer->record_data.subject_key;
-    cred_issuer_key_ecdsa = &cred_pointer->record_data.issuer_key;
 
-    issuer_key =  GNUNET_CRYPTO_ecdsa_public_key_to_string(issuer_key_ecdsa);
-    cred_issuer_key = GNUNET_CRYPTO_ecdsa_public_key_to_string(cred_issuer_key_ecdsa);
-    if(0 == strcmp(issuer_key,cred_issuer_key))
-    {
+    if(0 == memcmp (&vrh->attr_pointer->record_data.subject_key, 
+                   &cred_pointer->record_data.issuer_key,
+                   sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))){
+
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Found issuer\n");
-    }         
+      
+    }
+    
+
+
 
   }
-  
 
-  
+
+
   //Start from next to head
-  for(vrh->attr_pointer = vrh->attr_queue_head->next ; vrh->attr_pointer->next != NULL ;
-        vrh->attr_pointer = vrh->attr_pointer->next ){
+  vrh->attr_pointer = vrh->attr_pointer->next;
+
 
+
+  if(vrh->attr_pointer->next != NULL){
     //Start with backward resolution
-    GNUNET_GNS_lookup (gns,
-                       vrh->issuer_attribute,
-                       &vrh->issuer_key, //issuer_key,
-                       GNUNET_GNSRECORD_TYPE_ATTRIBUTE,
-                       GNUNET_GNS_LO_DEFAULT,
-                       NULL, //shorten_key, always NULL
-                       &start_backward_resolution,
-                       vrh);
+    vrh->lookup_request = GNUNET_GNS_lookup (gns,
+                                             vrh->issuer_attribute,
+                                             &vrh->issuer_key, //issuer_key,
+                                             GNUNET_GNSRECORD_TYPE_ATTRIBUTE,
+                                             GNUNET_GNS_LO_DEFAULT,
+                                             NULL, //shorten_key, always NULL
+                                             &start_backward_resolution,
+                                             vrh);
   }
 
 
+
 } 
 
 /**
@@ -327,13 +328,14 @@ send_lookup_response (void* cls,
   const struct GNUNET_CREDENTIAL_CredentialRecordData *crd;
   struct GNUNET_CRYPTO_EccSignaturePurpose *purp;
   struct CredentialRecordEntry *cr_entry;
+  uint32_t cred_verified;
 
   cred_record_count = 0;
   struct AttributeRecordEntry *attr_entry;
 
   struct GNUNET_CREDENTIAL_AttributeRecordData *ard = 
     GNUNET_new(struct GNUNET_CREDENTIAL_AttributeRecordData); 
-  
+
   attr_entry->record_data = *ard; 
   ard->subject_key = vrh->issuer_key;
   GNUNET_CONTAINER_DLL_insert_tail (vrh->attr_queue_head,
@@ -386,17 +388,19 @@ send_lookup_response (void* cls,
   if(cred_verified != GNUNET_YES){
 
 
-    vrh->attr_pointer = vrh->attr_queue_head; 
+    vrh->attr_pointer = vrh->attr_pointer->next;
+    if(vrh->attr_pointer != NULL){
 
-    //Start with backward resolution
-    GNUNET_GNS_lookup (gns,
-                       vrh->issuer_attribute,
-                       &vrh->issuer_key, //issuer_key,
-                       GNUNET_GNSRECORD_TYPE_ATTRIBUTE,
-                       GNUNET_GNS_LO_DEFAULT,
-                       NULL, //shorten_key, always NULL
-                       &start_backward_resolution,
-                       vrh);
+      //Start with backward resolution
+      GNUNET_GNS_lookup (gns,
+                         vrh->issuer_attribute,
+                         &vrh->issuer_key, //issuer_key,
+                         GNUNET_GNSRECORD_TYPE_ATTRIBUTE,
+                         GNUNET_GNS_LO_DEFAULT,
+                         NULL, //shorten_key, always NULL
+                         &start_backward_resolution,
+                         vrh);
+    }
   }