aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-06-20 11:11:05 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-06-20 11:11:05 -0400
commitae7b961b1c943367dfe179411f120d7bf8eaba89 (patch)
treed40171c26b22295e45ad7b67923442bfb513752a /kernel
parentf7056d64ae101d910f965a2e39831f635ef7891b (diff)
AUDIT: Report lookup flags with path/inode records.
When LOOKUP_PARENT is used, the inode which results is not the inode found at the pathname. Report the flags so that this doesn't generate misleading audit records. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/auditsc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 48a39579c45c..031f979019d1 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -95,6 +95,7 @@ struct audit_names {
95 uid_t uid; 95 uid_t uid;
96 gid_t gid; 96 gid_t gid;
97 dev_t rdev; 97 dev_t rdev;
98 unsigned flags;
98}; 99};
99 100
100struct audit_aux_data { 101struct audit_aux_data {
@@ -792,6 +793,8 @@ static void audit_log_exit(struct audit_context *context)
792 audit_log_format(ab, " name="); 793 audit_log_format(ab, " name=");
793 audit_log_untrustedstring(ab, context->names[i].name); 794 audit_log_untrustedstring(ab, context->names[i].name);
794 } 795 }
796 audit_log_format(ab, " flags=%x\n", context->names[i].flags);
797
795 if (context->names[i].ino != (unsigned long)-1) 798 if (context->names[i].ino != (unsigned long)-1)
796 audit_log_format(ab, " inode=%lu dev=%02x:%02x mode=%#o" 799 audit_log_format(ab, " inode=%lu dev=%02x:%02x mode=%#o"
797 " ouid=%u ogid=%u rdev=%02x:%02x", 800 " ouid=%u ogid=%u rdev=%02x:%02x",
@@ -1018,7 +1021,7 @@ void audit_putname(const char *name)
1018 1021
1019/* Store the inode and device from a lookup. Called from 1022/* Store the inode and device from a lookup. Called from
1020 * fs/namei.c:path_lookup(). */ 1023 * fs/namei.c:path_lookup(). */
1021void audit_inode(const char *name, const struct inode *inode) 1024void audit_inode(const char *name, const struct inode *inode, unsigned flags)
1022{ 1025{
1023 int idx; 1026 int idx;
1024 struct audit_context *context = current->audit_context; 1027 struct audit_context *context = current->audit_context;
@@ -1044,12 +1047,13 @@ void audit_inode(const char *name, const struct inode *inode)
1044 ++context->ino_count; 1047 ++context->ino_count;
1045#endif 1048#endif
1046 } 1049 }
1047 context->names[idx].ino = inode->i_ino; 1050 context->names[idx].flags = flags;
1048 context->names[idx].dev = inode->i_sb->s_dev; 1051 context->names[idx].ino = inode->i_ino;
1049 context->names[idx].mode = inode->i_mode; 1052 context->names[idx].dev = inode->i_sb->s_dev;
1050 context->names[idx].uid = inode->i_uid; 1053 context->names[idx].mode = inode->i_mode;
1051 context->names[idx].gid = inode->i_gid; 1054 context->names[idx].uid = inode->i_uid;
1052 context->names[idx].rdev = inode->i_rdev; 1055 context->names[idx].gid = inode->i_gid;
1056 context->names[idx].rdev = inode->i_rdev;
1053} 1057}
1054 1058
1055void auditsc_get_stamp(struct audit_context *ctx, 1059void auditsc_get_stamp(struct audit_context *ctx,