Messages in this thread Patch in this message | | | From | Roberto Sassu <> | Subject | [PATCH-v2 1/6] ima: connect defined IMA templates through a linked list | Date | Tue, 19 Nov 2013 13:33:40 +0100 |
| |
This patch connects defined templates through a linked list so that it will be possible to append new descriptors when the functionality of specifying a custom template in the policy will be introduced. Template search by name is still performed by iterating over 'defined_templates' array items.
Signed-off-by: Roberto Sassu <roberto.sassu@polito.it> --- security/integrity/ima/ima.h | 1 + security/integrity/ima/ima_template.c | 5 +++++ 2 files changed, 6 insertions(+)
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h index 9636e17..8b4a4f3 100644 --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h @@ -68,6 +68,7 @@ struct ima_template_field { /* IMA template descriptor definition */ struct ima_template_desc { + struct list_head list; char *name; char *fmt; int num_fields; diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c index 5a95d06..33c911a 100644 --- a/security/integrity/ima/ima_template.c +++ b/security/integrity/ima/ima_template.c @@ -204,6 +204,7 @@ static int init_defined_templates(void) int result = 0; /* Init defined templates. */ + INIT_LIST_HEAD(&defined_templates[0].list); for (i = 0; i < ARRAY_SIZE(defined_templates); i++) { struct ima_template_desc *template = &defined_templates[i]; @@ -219,6 +220,10 @@ static int init_defined_templates(void) template->name : template->fmt), result); return result; } + + if (i > 0) + list_add_tail(&defined_templates[i].list, + &defined_templates[0].list); } return result; } -- 1.8.1.4 [unhandled content-type:application/x-pkcs7-signature] | |