Added Check_Measurement function to pts_database instead of returning enumerator...
authorSansar Choinyambuu <schoinya@hsr.ch>
Wed, 7 Sep 2011 14:45:37 +0000 (16:45 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 8 Sep 2011 10:17:08 +0000 (12:17 +0200)
List of requested files/directories are kept within imv state now
Allocated memory for entries in files_in_dir_with_meas list

src/libimcv/plugins/imv_attestation/imv_attestation.c

index 12ce274..eb958f9 100644 (file)
@@ -275,7 +275,6 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
                        {
                                break;
                        }
-                       
                        while (enumerator->enumerate(enumerator, &id, &type, &pathname))
                        {
                                is_directory = (type != 0);
@@ -285,8 +284,7 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
                                                                                                        delimiter, pathname);
                                attr->set_noskip_flag(attr, TRUE);
                                msg->add_attribute(msg, attr);
-
-                               attestation_state->add_requested_file(attestation_state, id, type);
+                               attestation_state->add_requested_file(attestation_state, id , type);
                        }
                        enumerator->destroy(enumerator);
 
@@ -314,15 +312,6 @@ static TNC_Result send_message(TNC_ConnectionID connection_id)
 }
 
 /**
- * String matching function with boolean return value
- * Used to remove an item from linked list of strings
- */
-static bool string_cmp(char *a, char *b)
-{
-       return (strcmp(a,b) == 0) ? TRUE : FALSE;
-}
-
-/**
  * see section 3.7.3 of TCG TNC IF-IMV Specification 1.2
  */
 TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
@@ -578,7 +567,6 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
 
                                        files_in_dir_with_meas->destroy_function(files_in_dir_with_meas, free);
                                        e_meas->destroy(e_meas);
-                                       
                                        break;
                                }
        
@@ -632,13 +620,15 @@ TNC_Result TNC_IMV_ReceiveMessage(TNC_IMVID imv_id,
        {       
                if (measurement_error || attestation_state->get_requests_count(attestation_state))
                {
+                       file_request_t *entry;
                        enumerator_t *e;
                        int request;
                        
                        e = attestation_state->create_requests_enumerator(attestation_state);
                        while (e->enumerate(e, &request))
                        {
-                               DBG1(DBG_IMV, "measurement/s not received for requests: %d", request);
+                               DBG1(DBG_IMV, "%s measurement not received for request: %d",
+                                        (entry->is_dir) ? "Directory" : "File", entry->request_id);
                        }
                        e->destroy(e);