summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2000-04-19 20:12:41 +0000
committerrwatson <rwatson@FreeBSD.org>2000-04-19 20:12:41 +0000
commit5a7c0dbf091196c9ab6ee1b0aa3747adc1ae6f1a (patch)
treeb58b5ba7806db70693ead22fbdc170da207964c7 /sys/ufs
parent04946447c6df3d01f842b434f0530b7185b572b0 (diff)
downloadFreeBSD-src-5a7c0dbf091196c9ab6ee1b0aa3747adc1ae6f1a.zip
FreeBSD-src-5a7c0dbf091196c9ab6ee1b0aa3747adc1ae6f1a.tar.gz
o Introduce an extended attribute backing file header magic number
o Introduce an extended attribute backing file header version number
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/extattr.h8
-rw-r--r--sys/ufs/ufs/ufs_extattr.c15
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/ufs/ufs/extattr.h b/sys/ufs/ufs/extattr.h
index 6f3132b..c2d1eee 100644
--- a/sys/ufs/ufs/extattr.h
+++ b/sys/ufs/ufs/extattr.h
@@ -32,8 +32,10 @@
#ifndef _UFS_UFS_EXTATTR_H_
#define _UFS_UFS_EXTATTR_H_
-#define UFS_EXTATTR_FSROOTSUBDIR ".attributes"
-#define UFS_EXTATTR_MAXEXTATTRNAME 33 /* including null */
+#define UFS_EXTATTR_MAGIC 0x00b5d5ec
+#define UFS_EXTATTR_VERSION 0x00000002
+#define UFS_EXTATTR_FSROOTSUBDIR ".attribute"
+#define UFS_EXTATTR_MAXEXTATTRNAME 65 /* including null */
#define UFS_EXTATTR_MAXEXTATTRSIZE 1024 /* bytes */
#define UFS_EXTATTR_ATTR_FLAG_INUSE 0x00000001 /* attr has been set */
@@ -51,6 +53,8 @@
#define UFS_EXTATTR_CMD_DISABLE 0x00000004
struct ufs_extattr_fileheader {
+ u_int uef_magic; /* magic number for sanity checking */
+ u_int uef_version; /* version of attribute file */
u_int uef_size; /* size of attributes, w/o header */
u_int uef_read_perm; /* permissions to read attribute */
u_int uef_write_perm; /* permissions to write attribute */
diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c
index b12f062..e5155dd 100644
--- a/sys/ufs/ufs/ufs_extattr.c
+++ b/sys/ufs/ufs/ufs_extattr.c
@@ -222,7 +222,6 @@ ufs_extattr_enable(struct ufsmount *ump, char *attrname,
sizeof(struct ufs_extattr_fileheader));
attribute->uele_backing_vnode = backing_vnode;
- backing_vnode->v_flag |= VSYSTEM;
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
@@ -249,6 +248,20 @@ ufs_extattr_enable(struct ufsmount *ump, char *attrname,
goto free_exit;
}
+ if (attribute->uele_fileheader.uef_magic != UFS_EXTATTR_MAGIC) {
+ printf("ufs_extattr_enable: invalid attribute header magic\n");
+ error = EINVAL;
+ goto free_exit;
+ }
+
+ if (attribute->uele_fileheader.uef_version != UFS_EXTATTR_VERSION) {
+ printf("ufs_extattr_enable: incorrect attribute header "
+ "version\n");
+ error = EINVAL;
+ goto free_exit;
+ }
+
+ backing_vnode->v_flag |= VSYSTEM;
LIST_INSERT_HEAD(&ump->um_extattr.uepm_list, attribute, uele_entries);
return (0);
OpenPOWER on IntegriCloud