diff options
author | Kentaro Takeda <takedakn@nttdata.co.jp> | 2008-12-16 23:24:15 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-12-31 18:07:37 -0500 |
commit | be6d3e56a6b9b3a4ee44a0685e39e595073c6f0d (patch) | |
tree | 3a770f4cc676efeba443b28caa1ad195eeff49bc /security/security.c | |
parent | 6a94cb73064c952255336cc57731904174b2c58f (diff) |
introduce new LSM hooks where vfsmount is available.
Add new LSM hooks for path-based checks. Call them on directory-modifying
operations at the points where we still know the vfsmount involved.
Signed-off-by: Kentaro Takeda <takedakn@nttdata.co.jp>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Toshiharu Harada <haradats@nttdata.co.jp>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c index d85dbb37c972..678d4d07b852 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -355,6 +355,72 @@ int security_inode_init_security(struct inode *inode, struct inode *dir, | |||
355 | } | 355 | } |
356 | EXPORT_SYMBOL(security_inode_init_security); | 356 | EXPORT_SYMBOL(security_inode_init_security); |
357 | 357 | ||
358 | #ifdef CONFIG_SECURITY_PATH | ||
359 | int security_path_mknod(struct path *path, struct dentry *dentry, int mode, | ||
360 | unsigned int dev) | ||
361 | { | ||
362 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | ||
363 | return 0; | ||
364 | return security_ops->path_mknod(path, dentry, mode, dev); | ||
365 | } | ||
366 | EXPORT_SYMBOL(security_path_mknod); | ||
367 | |||
368 | int security_path_mkdir(struct path *path, struct dentry *dentry, int mode) | ||
369 | { | ||
370 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | ||
371 | return 0; | ||
372 | return security_ops->path_mkdir(path, dentry, mode); | ||
373 | } | ||
374 | |||
375 | int security_path_rmdir(struct path *path, struct dentry *dentry) | ||
376 | { | ||
377 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | ||
378 | return 0; | ||
379 | return security_ops->path_rmdir(path, dentry); | ||
380 | } | ||
381 | |||
382 | int security_path_unlink(struct path *path, struct dentry *dentry) | ||
383 | { | ||
384 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | ||
385 | return 0; | ||
386 | return security_ops->path_unlink(path, dentry); | ||
387 | } | ||
388 | |||
389 | int security_path_symlink(struct path *path, struct dentry *dentry, | ||
390 | const char *old_name) | ||
391 | { | ||
392 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | ||
393 | return 0; | ||
394 | return security_ops->path_symlink(path, dentry, old_name); | ||
395 | } | ||
396 | |||
397 | int security_path_link(struct dentry *old_dentry, struct path *new_dir, | ||
398 | struct dentry *new_dentry) | ||
399 | { | ||
400 | if (unlikely(IS_PRIVATE(old_dentry->d_inode))) | ||
401 | return 0; | ||
402 | return security_ops->path_link(old_dentry, new_dir, new_dentry); | ||
403 | } | ||
404 | |||
405 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | ||
406 | struct path *new_dir, struct dentry *new_dentry) | ||
407 | { | ||
408 | if (unlikely(IS_PRIVATE(old_dentry->d_inode) || | ||
409 | (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) | ||
410 | return 0; | ||
411 | return security_ops->path_rename(old_dir, old_dentry, new_dir, | ||
412 | new_dentry); | ||
413 | } | ||
414 | |||
415 | int security_path_truncate(struct path *path, loff_t length, | ||
416 | unsigned int time_attrs) | ||
417 | { | ||
418 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | ||
419 | return 0; | ||
420 | return security_ops->path_truncate(path, length, time_attrs); | ||
421 | } | ||
422 | #endif | ||
423 | |||
358 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode) | 424 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode) |
359 | { | 425 | { |
360 | if (unlikely(IS_PRIVATE(dir))) | 426 | if (unlikely(IS_PRIVATE(dir))) |