diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2000-04-19 20:12:41 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2000-04-19 20:12:41 +0000 |
| commit | 747b0fa36cb4f4d6085fbc987d87a1294bf2601a (patch) | |
| tree | 4dcdd2c6e4e17540c38162192e72756e0344ce52 /sys | |
| parent | cc7f40abaa87e0e49fc162589d6b74dff4b47ddf (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/ufs/ufs/extattr.h | 8 | ||||
| -rw-r--r-- | sys/ufs/ufs/ufs_extattr.c | 15 |
2 files changed, 20 insertions, 3 deletions
diff --git a/sys/ufs/ufs/extattr.h b/sys/ufs/ufs/extattr.h index 6f3132b28964..c2d1eee4506e 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 b12f0629e639..e5155dd08404 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); |
