|
26 | 26 | #include <linux/capability.h> |
27 | 27 | #include <linux/slab.h> |
28 | 28 | #include <linux/err.h> |
| 29 | +#include <linux/string.h> |
29 | 30 |
|
30 | 31 | struct linux_binprm; |
31 | 32 | struct cred; |
@@ -306,6 +307,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) |
306 | 307 | * Parse a string of security data filling in the opts structure |
307 | 308 | * @options string containing all mount options known by the LSM |
308 | 309 | * @opts binary data structure usable by the LSM |
| 310 | + * @dentry_init_security: |
| 311 | + * Compute a context for a dentry as the inode is not yet available |
| 312 | + * since NFSv4 has no label backed by an EA anyway. |
| 313 | + * @dentry dentry to use in calculating the context. |
| 314 | + * @mode mode used to determine resource type. |
| 315 | + * @name name of the last path component used to create file |
| 316 | + * @ctx pointer to place the pointer to the resulting context in. |
| 317 | + * @ctxlen point to place the length of the resulting context. |
| 318 | + * |
309 | 319 | * |
310 | 320 | * Security hooks for inode operations. |
311 | 321 | * |
@@ -1443,6 +1453,10 @@ struct security_operations { |
1443 | 1453 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, |
1444 | 1454 | struct super_block *newsb); |
1445 | 1455 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); |
| 1456 | + int (*dentry_init_security) (struct dentry *dentry, int mode, |
| 1457 | + struct qstr *name, void **ctx, |
| 1458 | + u32 *ctxlen); |
| 1459 | + |
1446 | 1460 |
|
1447 | 1461 | #ifdef CONFIG_SECURITY_PATH |
1448 | 1462 | int (*path_unlink) (struct path *dir, struct dentry *dentry); |
@@ -1729,6 +1743,9 @@ int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *o |
1729 | 1743 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, |
1730 | 1744 | struct super_block *newsb); |
1731 | 1745 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); |
| 1746 | +int security_dentry_init_security(struct dentry *dentry, int mode, |
| 1747 | + struct qstr *name, void **ctx, |
| 1748 | + u32 *ctxlen); |
1732 | 1749 |
|
1733 | 1750 | int security_inode_alloc(struct inode *inode); |
1734 | 1751 | void security_inode_free(struct inode *inode); |
@@ -2035,6 +2052,16 @@ static inline int security_inode_alloc(struct inode *inode) |
2035 | 2052 | static inline void security_inode_free(struct inode *inode) |
2036 | 2053 | { } |
2037 | 2054 |
|
| 2055 | +static inline int security_dentry_init_security(struct dentry *dentry, |
| 2056 | + int mode, |
| 2057 | + struct qstr *name, |
| 2058 | + void **ctx, |
| 2059 | + u32 *ctxlen) |
| 2060 | +{ |
| 2061 | + return -EOPNOTSUPP; |
| 2062 | +} |
| 2063 | + |
| 2064 | + |
2038 | 2065 | static inline int security_inode_init_security(struct inode *inode, |
2039 | 2066 | struct inode *dir, |
2040 | 2067 | const struct qstr *qstr, |
|
0 commit comments