[PATCH] direct-io bio_add_page fix
[linux-2.6/history.git] / security / dummy.c
blob0b3ca57db95b323e074231d792fa3db6dfcdcb28
1 /*
2 * Stub functions for the default security function pointers in case no
3 * security model is loaded.
5 * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com>
6 * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
7 * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
15 #include <linux/config.h>
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/security.h>
19 #include <linux/skbuff.h>
20 #include <linux/netlink.h>
22 static int dummy_ptrace (struct task_struct *parent, struct task_struct *child)
24 return 0;
27 static int dummy_capget (struct task_struct *target, kernel_cap_t * effective,
28 kernel_cap_t * inheritable, kernel_cap_t * permitted)
30 return 0;
33 static int dummy_capset_check (struct task_struct *target,
34 kernel_cap_t * effective,
35 kernel_cap_t * inheritable,
36 kernel_cap_t * permitted)
38 return 0;
41 static void dummy_capset_set (struct task_struct *target,
42 kernel_cap_t * effective,
43 kernel_cap_t * inheritable,
44 kernel_cap_t * permitted)
46 return;
49 static int dummy_acct (struct file *file)
51 return 0;
54 static int dummy_capable (struct task_struct *tsk, int cap)
56 if (cap_is_fs_cap (cap) ? tsk->fsuid == 0 : tsk->euid == 0)
57 /* capability granted */
58 return 0;
60 /* capability denied */
61 return -EPERM;
64 static int dummy_sys_security (unsigned int id, unsigned int call,
65 unsigned long *args)
67 return -ENOSYS;
70 static int dummy_quotactl (int cmds, int type, int id, struct super_block *sb)
72 return 0;
75 static int dummy_quota_on (struct file *f)
77 return 0;
80 static int dummy_bprm_alloc_security (struct linux_binprm *bprm)
82 return 0;
85 static void dummy_bprm_free_security (struct linux_binprm *bprm)
87 return;
90 static void dummy_bprm_compute_creds (struct linux_binprm *bprm)
92 return;
95 static int dummy_bprm_set_security (struct linux_binprm *bprm)
97 return 0;
100 static int dummy_bprm_check_security (struct linux_binprm *bprm)
102 return 0;
105 static int dummy_sb_alloc_security (struct super_block *sb)
107 return 0;
110 static void dummy_sb_free_security (struct super_block *sb)
112 return;
115 static int dummy_sb_statfs (struct super_block *sb)
117 return 0;
120 static int dummy_mount (char *dev_name, struct nameidata *nd, char *type,
121 unsigned long flags, void *data)
123 return 0;
126 static int dummy_check_sb (struct vfsmount *mnt, struct nameidata *nd)
128 return 0;
131 static int dummy_umount (struct vfsmount *mnt, int flags)
133 return 0;
136 static void dummy_umount_close (struct vfsmount *mnt)
138 return;
141 static void dummy_umount_busy (struct vfsmount *mnt)
143 return;
146 static void dummy_post_remount (struct vfsmount *mnt, unsigned long flags,
147 void *data)
149 return;
153 static void dummy_post_mountroot (void)
155 return;
158 static void dummy_post_addmount (struct vfsmount *mnt, struct nameidata *nd)
160 return;
163 static int dummy_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd)
165 return 0;
168 static void dummy_post_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd)
170 return;
173 static int dummy_inode_alloc_security (struct inode *inode)
175 return 0;
178 static void dummy_inode_free_security (struct inode *inode)
180 return;
183 static int dummy_inode_create (struct inode *inode, struct dentry *dentry,
184 int mask)
186 return 0;
189 static void dummy_inode_post_create (struct inode *inode, struct dentry *dentry,
190 int mask)
192 return;
195 static int dummy_inode_link (struct dentry *old_dentry, struct inode *inode,
196 struct dentry *new_dentry)
198 return 0;
201 static void dummy_inode_post_link (struct dentry *old_dentry,
202 struct inode *inode,
203 struct dentry *new_dentry)
205 return;
208 static int dummy_inode_unlink (struct inode *inode, struct dentry *dentry)
210 return 0;
213 static int dummy_inode_symlink (struct inode *inode, struct dentry *dentry,
214 const char *name)
216 return 0;
219 static void dummy_inode_post_symlink (struct inode *inode,
220 struct dentry *dentry, const char *name)
222 return;
225 static int dummy_inode_mkdir (struct inode *inode, struct dentry *dentry,
226 int mask)
228 return 0;
231 static void dummy_inode_post_mkdir (struct inode *inode, struct dentry *dentry,
232 int mask)
234 return;
237 static int dummy_inode_rmdir (struct inode *inode, struct dentry *dentry)
239 return 0;
242 static int dummy_inode_mknod (struct inode *inode, struct dentry *dentry,
243 int major, dev_t minor)
245 return 0;
248 static void dummy_inode_post_mknod (struct inode *inode, struct dentry *dentry,
249 int major, dev_t minor)
251 return;
254 static int dummy_inode_rename (struct inode *old_inode,
255 struct dentry *old_dentry,
256 struct inode *new_inode,
257 struct dentry *new_dentry)
259 return 0;
262 static void dummy_inode_post_rename (struct inode *old_inode,
263 struct dentry *old_dentry,
264 struct inode *new_inode,
265 struct dentry *new_dentry)
267 return;
270 static int dummy_inode_readlink (struct dentry *dentry)
272 return 0;
275 static int dummy_inode_follow_link (struct dentry *dentry,
276 struct nameidata *nameidata)
278 return 0;
281 static int dummy_inode_permission (struct inode *inode, int mask)
283 return 0;
286 static int dummy_inode_permission_lite (struct inode *inode, int mask)
288 return 0;
291 static int dummy_inode_setattr (struct dentry *dentry, struct iattr *iattr)
293 return 0;
296 static int dummy_inode_getattr (struct vfsmount *mnt, struct dentry *dentry)
298 return 0;
301 static void dummy_post_lookup (struct inode *ino, struct dentry *d)
303 return;
306 static void dummy_delete (struct inode *ino)
308 return;
311 static int dummy_inode_setxattr (struct dentry *dentry, char *name, void *value,
312 size_t size, int flags)
314 return 0;
317 static int dummy_inode_getxattr (struct dentry *dentry, char *name)
319 return 0;
322 static int dummy_inode_listxattr (struct dentry *dentry)
324 return 0;
327 static int dummy_inode_removexattr (struct dentry *dentry, char *name)
329 return 0;
332 static int dummy_file_permission (struct file *file, int mask)
334 return 0;
337 static int dummy_file_alloc_security (struct file *file)
339 return 0;
342 static void dummy_file_free_security (struct file *file)
344 return;
347 static int dummy_file_llseek (struct file *file)
349 return 0;
352 static int dummy_file_ioctl (struct file *file, unsigned int command,
353 unsigned long arg)
355 return 0;
358 static int dummy_file_mmap (struct file *file, unsigned long prot,
359 unsigned long flags)
361 return 0;
364 static int dummy_file_mprotect (struct vm_area_struct *vma, unsigned long prot)
366 return 0;
369 static int dummy_file_lock (struct file *file, unsigned int cmd)
371 return 0;
374 static int dummy_file_fcntl (struct file *file, unsigned int cmd,
375 unsigned long arg)
377 return 0;
380 static int dummy_file_set_fowner (struct file *file)
382 return 0;
385 static int dummy_file_send_sigiotask (struct task_struct *tsk,
386 struct fown_struct *fown, int fd,
387 int reason)
389 return 0;
392 static int dummy_file_receive (struct file *file)
394 return 0;
397 static int dummy_task_create (unsigned long clone_flags)
399 return 0;
402 static int dummy_task_alloc_security (struct task_struct *p)
404 return 0;
407 static void dummy_task_free_security (struct task_struct *p)
409 return;
412 static int dummy_task_setuid (uid_t id0, uid_t id1, uid_t id2, int flags)
414 return 0;
417 static int dummy_task_post_setuid (uid_t id0, uid_t id1, uid_t id2, int flags)
419 return 0;
422 static int dummy_task_setgid (gid_t id0, gid_t id1, gid_t id2, int flags)
424 return 0;
427 static int dummy_task_setpgid (struct task_struct *p, pid_t pgid)
429 return 0;
432 static int dummy_task_getpgid (struct task_struct *p)
434 return 0;
437 static int dummy_task_getsid (struct task_struct *p)
439 return 0;
442 static int dummy_task_setgroups (int gidsetsize, gid_t * grouplist)
444 return 0;
447 static int dummy_task_setnice (struct task_struct *p, int nice)
449 return 0;
452 static int dummy_task_setrlimit (unsigned int resource, struct rlimit *new_rlim)
454 return 0;
457 static int dummy_task_setscheduler (struct task_struct *p, int policy,
458 struct sched_param *lp)
460 return 0;
463 static int dummy_task_getscheduler (struct task_struct *p)
465 return 0;
468 static int dummy_task_wait (struct task_struct *p)
470 return 0;
473 static int dummy_task_kill (struct task_struct *p, struct siginfo *info,
474 int sig)
476 return 0;
479 static int dummy_task_prctl (int option, unsigned long arg2, unsigned long arg3,
480 unsigned long arg4, unsigned long arg5)
482 return 0;
485 static void dummy_task_kmod_set_label (void)
487 return;
490 static void dummy_task_reparent_to_init (struct task_struct *p)
492 p->euid = p->fsuid = 0;
493 return;
496 static int dummy_ipc_permission (struct kern_ipc_perm *ipcp, short flag)
498 return 0;
502 static int dummy_msg_queue_alloc_security (struct msg_queue *msq)
504 return 0;
507 static void dummy_msg_queue_free_security (struct msg_queue *msq)
509 return;
512 static int dummy_shm_alloc_security (struct shmid_kernel *shp)
514 return 0;
517 static void dummy_shm_free_security (struct shmid_kernel *shp)
519 return;
522 static int dummy_sem_alloc_security (struct sem_array *sma)
524 return 0;
527 static void dummy_sem_free_security (struct sem_array *sma)
529 return;
532 static int dummy_register (const char *name, struct security_operations *ops)
534 return -EINVAL;
537 static int dummy_unregister (const char *name, struct security_operations *ops)
539 return -EINVAL;
542 struct security_operations dummy_security_ops = {
543 .ptrace = dummy_ptrace,
544 .capget = dummy_capget,
545 .capset_check = dummy_capset_check,
546 .capset_set = dummy_capset_set,
547 .acct = dummy_acct,
548 .capable = dummy_capable,
549 .sys_security = dummy_sys_security,
550 .quotactl = dummy_quotactl,
551 .quota_on = dummy_quota_on,
553 .bprm_alloc_security = dummy_bprm_alloc_security,
554 .bprm_free_security = dummy_bprm_free_security,
555 .bprm_compute_creds = dummy_bprm_compute_creds,
556 .bprm_set_security = dummy_bprm_set_security,
557 .bprm_check_security = dummy_bprm_check_security,
559 .sb_alloc_security = dummy_sb_alloc_security,
560 .sb_free_security = dummy_sb_free_security,
561 .sb_statfs = dummy_sb_statfs,
562 .sb_mount = dummy_mount,
563 .sb_check_sb = dummy_check_sb,
564 .sb_umount = dummy_umount,
565 .sb_umount_close = dummy_umount_close,
566 .sb_umount_busy = dummy_umount_busy,
567 .sb_post_remount = dummy_post_remount,
568 .sb_post_mountroot = dummy_post_mountroot,
569 .sb_post_addmount = dummy_post_addmount,
570 .sb_pivotroot = dummy_pivotroot,
571 .sb_post_pivotroot = dummy_post_pivotroot,
573 .inode_alloc_security = dummy_inode_alloc_security,
574 .inode_free_security = dummy_inode_free_security,
575 .inode_create = dummy_inode_create,
576 .inode_post_create = dummy_inode_post_create,
577 .inode_link = dummy_inode_link,
578 .inode_post_link = dummy_inode_post_link,
579 .inode_unlink = dummy_inode_unlink,
580 .inode_symlink = dummy_inode_symlink,
581 .inode_post_symlink = dummy_inode_post_symlink,
582 .inode_mkdir = dummy_inode_mkdir,
583 .inode_post_mkdir = dummy_inode_post_mkdir,
584 .inode_rmdir = dummy_inode_rmdir,
585 .inode_mknod = dummy_inode_mknod,
586 .inode_post_mknod = dummy_inode_post_mknod,
587 .inode_rename = dummy_inode_rename,
588 .inode_post_rename = dummy_inode_post_rename,
589 .inode_readlink = dummy_inode_readlink,
590 .inode_follow_link = dummy_inode_follow_link,
591 .inode_permission = dummy_inode_permission,
592 .inode_permission_lite = dummy_inode_permission_lite,
593 .inode_setattr = dummy_inode_setattr,
594 .inode_getattr = dummy_inode_getattr,
595 .inode_post_lookup = dummy_post_lookup,
596 .inode_delete = dummy_delete,
597 .inode_setxattr = dummy_inode_setxattr,
598 .inode_getxattr = dummy_inode_getxattr,
599 .inode_listxattr = dummy_inode_listxattr,
600 .inode_removexattr = dummy_inode_removexattr,
602 .file_permission = dummy_file_permission,
603 .file_alloc_security = dummy_file_alloc_security,
604 .file_free_security = dummy_file_free_security,
605 .file_llseek = dummy_file_llseek,
606 .file_ioctl = dummy_file_ioctl,
607 .file_mmap = dummy_file_mmap,
608 .file_mprotect = dummy_file_mprotect,
609 .file_lock = dummy_file_lock,
610 .file_fcntl = dummy_file_fcntl,
611 .file_set_fowner = dummy_file_set_fowner,
612 .file_send_sigiotask = dummy_file_send_sigiotask,
613 .file_receive = dummy_file_receive,
615 .task_create = dummy_task_create,
616 .task_alloc_security = dummy_task_alloc_security,
617 .task_free_security = dummy_task_free_security,
618 .task_setuid = dummy_task_setuid,
619 .task_post_setuid = dummy_task_post_setuid,
620 .task_setgid = dummy_task_setgid,
621 .task_setpgid = dummy_task_setpgid,
622 .task_getpgid = dummy_task_getpgid,
623 .task_getsid = dummy_task_getsid,
624 .task_setgroups = dummy_task_setgroups,
625 .task_setnice = dummy_task_setnice,
626 .task_setrlimit = dummy_task_setrlimit,
627 .task_setscheduler = dummy_task_setscheduler,
628 .task_getscheduler = dummy_task_getscheduler,
629 .task_wait = dummy_task_wait,
630 .task_kill = dummy_task_kill,
631 .task_prctl = dummy_task_prctl,
632 .task_kmod_set_label = dummy_task_kmod_set_label,
633 .task_reparent_to_init = dummy_task_reparent_to_init,
635 .ipc_permission = dummy_ipc_permission,
637 .msg_queue_alloc_security = dummy_msg_queue_alloc_security,
638 .msg_queue_free_security = dummy_msg_queue_free_security,
640 .shm_alloc_security = dummy_shm_alloc_security,
641 .shm_free_security = dummy_shm_free_security,
643 .sem_alloc_security = dummy_sem_alloc_security,
644 .sem_free_security = dummy_sem_free_security,
646 .register_security = dummy_register,
647 .unregister_security = dummy_unregister,