shortened fieldnames of pts_file_metadata_t struct
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 26 Oct 2011 20:10:24 +0000 (22:10 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 28 Nov 2011 13:39:52 +0000 (14:39 +0100)
src/libimcv/plugins/imv_attestation/imv_attestation_process.c
src/libpts/pts/pts.c
src/libpts/pts/pts_file_meta.h
src/libpts/tcg/tcg_pts_attr_unix_file_meta.c

index d72ce87..9e373b1 100644 (file)
@@ -420,13 +420,13 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
                                DBG1(DBG_IMV, " '%s' (%d bytes) owner %d, group %d, type %d",
                                         entry->filename,
                                         entry->filesize,
-                                        entry->owner_id,
-                                        entry->group_id,
+                                        entry->owner,
+                                        entry->group,
                                         entry->type);
                                DBG1(DBG_IMV, "    created %T, modified %T, accessed %T",
-                                        &entry->create_time, utc,
-                                        &entry->last_modify_time, utc,
-                                        &entry->last_access_time, utc);
+                                        &entry->created, utc,
+                                        &entry->modified, utc,
+                                        &entry->accessed, utc);
                        }
                        e->destroy(e);
                        break;
index 9d1d670..c827a3b 100644 (file)
@@ -19,8 +19,6 @@
 #include <crypto/hashers/hasher.h>
 #include <bio/bio_writer.h>
 #include <bio/bio_reader.h>
-/* for isdigit()*/
-#include <ctype.h>
 
 #include <trousers/tss.h>
 #include <trousers/trousers.h>
@@ -589,62 +587,60 @@ METHOD(pts_t, do_measurements, pts_file_meas_t*,
 static bool file_metadata(char *pathname, pts_file_metadata_t **entry)
 {
        struct stat st;
-       pts_file_metadata_t *tmp;
+       pts_file_metadata_t *this;
 
-       tmp = malloc_thing(pts_file_metadata_t);
+       this = malloc_thing(pts_file_metadata_t);
 
        if (stat(pathname, &st))
        {
-               DBG1(DBG_PTS, "Unable to obtain statistical information about %s",
-                        pathname);
+               DBG1(DBG_PTS, "Unable to obtain statistics about '%s'", pathname);
                return FALSE;
        }
 
-       tmp->filename = strdup(pathname);
-       tmp->meta_length = PTS_FILE_METADATA_SIZE + strlen(tmp->filename);
+       this->filename = strdup(pathname);
+       this->meta_length = PTS_FILE_METADATA_SIZE + strlen(this->filename);
 
        if (S_ISREG(st.st_mode))
        {
-               tmp->type = PTS_FILE_REGULAR;
+               this->type = PTS_FILE_REGULAR;
        }
        else if (S_ISDIR(st.st_mode))
        {
-               tmp->type = PTS_FILE_DIRECTORY;
+               this->type = PTS_FILE_DIRECTORY;
        }
        else if (S_ISCHR(st.st_mode))
        {
-               tmp->type = PTS_FILE_CHAR_SPEC;
+               this->type = PTS_FILE_CHAR_SPEC;
        }
        else if (S_ISBLK(st.st_mode))
        {
-               tmp->type = PTS_FILE_BLOCK_SPEC;
+               this->type = PTS_FILE_BLOCK_SPEC;
        }
        else if (S_ISFIFO(st.st_mode))
        {
-               tmp->type = PTS_FILE_FIFO;
+               this->type = PTS_FILE_FIFO;
        }
        else if (S_ISLNK(st.st_mode))
        {
-               tmp->type = PTS_FILE_SYM_LINK;
+               this->type = PTS_FILE_SYM_LINK;
        }
        else if (S_ISSOCK(st.st_mode))
        {
-               tmp->type = PTS_FILE_SOCKET;
+               this->type = PTS_FILE_SOCKET;
        }
        else
        {
-               tmp->type = PTS_FILE_OTHER;
+               this->type = PTS_FILE_OTHER;
        }
 
-       tmp->filesize = (u_int64_t)st.st_size;
-       tmp->create_time = st.st_ctime;
-       tmp->last_modify_time = st.st_mtime;
-       tmp->last_access_time = st.st_atime;
-       tmp->owner_id = (u_int64_t)st.st_uid;
-       tmp->group_id = (u_int64_t)st.st_gid;
-
-       *entry = tmp;
+       this->filesize = st.st_size;
+       this->created =  st.st_ctime;
+       this->modified = st.st_mtime;
+       this->accessed = st.st_atime;
+       this->owner =    st.st_uid;
+       this->group =    st.st_gid;
 
+       *entry = this;
        return TRUE;
 }
 
index 9c34fed..851f88e 100644 (file)
@@ -36,15 +36,15 @@ typedef struct pts_file_metadata_t pts_file_metadata_t;
  * Structure holding file metadata
  */
 struct pts_file_metadata_t {
-       u_int16_t                       meta_length;
-       pts_file_type_t         type;
-       u_int64_t                       filesize;
-       time_t                          create_time;
-       time_t                          last_modify_time;
-       time_t                          last_access_time;
-       u_int64_t                       owner_id;
-       u_int64_t                       group_id;
-       char                            *filename;
+       u_int16_t        meta_length;
+       pts_file_type_t  type;
+       u_int64_t        filesize;
+       time_t           created;
+       time_t           modified;
+       time_t           accessed;
+       u_int64_t        owner;
+       u_int64_t        group;
+       char             *filename;
 };
 
 /**
@@ -60,7 +60,7 @@ struct pts_file_meta_t {
        int (*get_file_count)(pts_file_meta_t *this);
 
        /**
-        * Add PTS File Metadata
+        * Add PTS File Metadata
         *
         * @param filename              Name of measured file or directory
         * @param metadata              File metadata
index fbc2e9d..7ea49ed 100644 (file)
@@ -160,16 +160,16 @@ METHOD(pa_tnc_attr_t, build, void,
                /* Write the 64 bit integer fields as two 32 bit parts */
                writer->write_uint32(writer, entry->filesize >> 32);
                writer->write_uint32(writer, entry->filesize & 0xffffffff);
-               writer->write_uint32(writer, ((u_int64_t)entry->create_time) >> 32);
-               writer->write_uint32(writer, ((u_int64_t)entry->create_time) & 0xffffffff);
-               writer->write_uint32(writer, ((u_int64_t)entry->last_modify_time) >> 32);
-               writer->write_uint32(writer, ((u_int64_t)entry->last_modify_time) & 0xffffffff);
-               writer->write_uint32(writer, ((u_int64_t)entry->last_access_time) >> 32);
-               writer->write_uint32(writer, ((u_int64_t)entry->last_access_time) & 0xffffffff);
-               writer->write_uint32(writer, entry->owner_id >> 32);
-               writer->write_uint32(writer, entry->owner_id & 0xffffffff);
-               writer->write_uint32(writer, entry->group_id >> 32);
-               writer->write_uint32(writer, entry->group_id & 0xffffffff);
+               writer->write_uint32(writer, ((u_int64_t)entry->created) >> 32);
+               writer->write_uint32(writer, ((u_int64_t)entry->created) & 0xffffffff);
+               writer->write_uint32(writer, ((u_int64_t)entry->modified) >> 32);
+               writer->write_uint32(writer, ((u_int64_t)entry->modified) & 0xffffffff);
+               writer->write_uint32(writer, ((u_int64_t)entry->accessed) >> 32);
+               writer->write_uint32(writer, ((u_int64_t)entry->accessed) & 0xffffffff);
+               writer->write_uint32(writer, entry->owner >> 32);
+               writer->write_uint32(writer, entry->owner & 0xffffffff);
+               writer->write_uint32(writer, entry->group >> 32);
+               writer->write_uint32(writer, entry->group & 0xffffffff);
                
                writer->write_data  (writer, chunk_create(entry->filename, strlen(entry->filename)));
        }
@@ -346,11 +346,11 @@ METHOD(pa_tnc_attr_t, process, status_t,
                entry->meta_length = PTS_FILE_METADATA_SIZE + strlen(entry->filename);
                entry->type = type;
                entry->filesize = filesize;
-               entry->create_time = create_time_t;
-               entry->last_modify_time = modify_time_t;
-               entry->last_access_time = access_time_t;
-               entry->owner_id = owner_id;
-               entry->group_id = group_id;
+               entry->created = create_time_t;
+               entry->modified = modify_time_t;
+               entry->accessed = access_time_t;
+               entry->owner = owner_id;
+               entry->group = group_id;
                
                this->metadata->add(this->metadata, entry);
        }