aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs/ioctl.c
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-12-29 00:47:18 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-12-29 00:47:18 -0500
commit0a8c5395f90f06d128247844b2515c8bf3f2826b (patch)
treed95382dcdfa303b99d480c01763d6cb6767fdaca /fs/ncpfs/ioctl.c
parent25051158bbed127e8672b43396c71c5eb610e5f1 (diff)
parent3c92ec8ae91ecf59d88c798301833d7cf83f2179 (diff)
[XFS] Fix merge failures
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: fs/xfs/linux-2.6/xfs_cred.h fs/xfs/linux-2.6/xfs_globals.h fs/xfs/linux-2.6/xfs_ioctl.c fs/xfs/xfs_vnodeops.h Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/ncpfs/ioctl.c')
-rw-r--r--fs/ncpfs/ioctl.c91
1 files changed, 44 insertions, 47 deletions
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 3a97c95e1ca2..6d04e050c74e 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -40,10 +40,10 @@ ncp_get_fs_info(struct ncp_server * server, struct file *file,
40 struct inode *inode = file->f_path.dentry->d_inode; 40 struct inode *inode = file->f_path.dentry->d_inode;
41 struct ncp_fs_info info; 41 struct ncp_fs_info info;
42 42
43 if ((file_permission(file, MAY_WRITE) != 0) 43 if (file_permission(file, MAY_WRITE) != 0
44 && (current->uid != server->m.mounted_uid)) { 44 && current_uid() != server->m.mounted_uid)
45 return -EACCES; 45 return -EACCES;
46 } 46
47 if (copy_from_user(&info, arg, sizeof(info))) 47 if (copy_from_user(&info, arg, sizeof(info)))
48 return -EFAULT; 48 return -EFAULT;
49 49
@@ -70,10 +70,10 @@ ncp_get_fs_info_v2(struct ncp_server * server, struct file *file,
70 struct inode *inode = file->f_path.dentry->d_inode; 70 struct inode *inode = file->f_path.dentry->d_inode;
71 struct ncp_fs_info_v2 info2; 71 struct ncp_fs_info_v2 info2;
72 72
73 if ((file_permission(file, MAY_WRITE) != 0) 73 if (file_permission(file, MAY_WRITE) != 0
74 && (current->uid != server->m.mounted_uid)) { 74 && current_uid() != server->m.mounted_uid)
75 return -EACCES; 75 return -EACCES;
76 } 76
77 if (copy_from_user(&info2, arg, sizeof(info2))) 77 if (copy_from_user(&info2, arg, sizeof(info2)))
78 return -EFAULT; 78 return -EFAULT;
79 79
@@ -141,10 +141,10 @@ ncp_get_compat_fs_info_v2(struct ncp_server * server, struct file *file,
141 struct inode *inode = file->f_path.dentry->d_inode; 141 struct inode *inode = file->f_path.dentry->d_inode;
142 struct compat_ncp_fs_info_v2 info2; 142 struct compat_ncp_fs_info_v2 info2;
143 143
144 if ((file_permission(file, MAY_WRITE) != 0) 144 if (file_permission(file, MAY_WRITE) != 0
145 && (current->uid != server->m.mounted_uid)) { 145 && current_uid() != server->m.mounted_uid)
146 return -EACCES; 146 return -EACCES;
147 } 147
148 if (copy_from_user(&info2, arg, sizeof(info2))) 148 if (copy_from_user(&info2, arg, sizeof(info2)))
149 return -EFAULT; 149 return -EFAULT;
150 150
@@ -270,16 +270,17 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
270 struct ncp_ioctl_request request; 270 struct ncp_ioctl_request request;
271 char* bouncebuffer; 271 char* bouncebuffer;
272 void __user *argp = (void __user *)arg; 272 void __user *argp = (void __user *)arg;
273 uid_t uid = current_uid();
273 274
274 switch (cmd) { 275 switch (cmd) {
275#ifdef CONFIG_COMPAT 276#ifdef CONFIG_COMPAT
276 case NCP_IOC_NCPREQUEST_32: 277 case NCP_IOC_NCPREQUEST_32:
277#endif 278#endif
278 case NCP_IOC_NCPREQUEST: 279 case NCP_IOC_NCPREQUEST:
279 if ((file_permission(filp, MAY_WRITE) != 0) 280 if (file_permission(filp, MAY_WRITE) != 0
280 && (current->uid != server->m.mounted_uid)) { 281 && uid != server->m.mounted_uid)
281 return -EACCES; 282 return -EACCES;
282 } 283
283#ifdef CONFIG_COMPAT 284#ifdef CONFIG_COMPAT
284 if (cmd == NCP_IOC_NCPREQUEST_32) { 285 if (cmd == NCP_IOC_NCPREQUEST_32) {
285 struct compat_ncp_ioctl_request request32; 286 struct compat_ncp_ioctl_request request32;
@@ -356,10 +357,10 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
356 case NCP_IOC_GETMOUNTUID16: 357 case NCP_IOC_GETMOUNTUID16:
357 case NCP_IOC_GETMOUNTUID32: 358 case NCP_IOC_GETMOUNTUID32:
358 case NCP_IOC_GETMOUNTUID64: 359 case NCP_IOC_GETMOUNTUID64:
359 if ((file_permission(filp, MAY_READ) != 0) 360 if (file_permission(filp, MAY_READ) != 0
360 && (current->uid != server->m.mounted_uid)) { 361 && uid != server->m.mounted_uid)
361 return -EACCES; 362 return -EACCES;
362 } 363
363 if (cmd == NCP_IOC_GETMOUNTUID16) { 364 if (cmd == NCP_IOC_GETMOUNTUID16) {
364 u16 uid; 365 u16 uid;
365 SET_UID(uid, server->m.mounted_uid); 366 SET_UID(uid, server->m.mounted_uid);
@@ -380,11 +381,10 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
380 { 381 {
381 struct ncp_setroot_ioctl sr; 382 struct ncp_setroot_ioctl sr;
382 383
383 if ((file_permission(filp, MAY_READ) != 0) 384 if (file_permission(filp, MAY_READ) != 0
384 && (current->uid != server->m.mounted_uid)) 385 && uid != server->m.mounted_uid)
385 {
386 return -EACCES; 386 return -EACCES;
387 } 387
388 if (server->m.mounted_vol[0]) { 388 if (server->m.mounted_vol[0]) {
389 struct dentry* dentry = inode->i_sb->s_root; 389 struct dentry* dentry = inode->i_sb->s_root;
390 390
@@ -408,6 +408,7 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
408 return -EFAULT; 408 return -EFAULT;
409 return 0; 409 return 0;
410 } 410 }
411
411 case NCP_IOC_SETROOT: 412 case NCP_IOC_SETROOT:
412 { 413 {
413 struct ncp_setroot_ioctl sr; 414 struct ncp_setroot_ioctl sr;
@@ -455,11 +456,10 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
455 456
456#ifdef CONFIG_NCPFS_PACKET_SIGNING 457#ifdef CONFIG_NCPFS_PACKET_SIGNING
457 case NCP_IOC_SIGN_INIT: 458 case NCP_IOC_SIGN_INIT:
458 if ((file_permission(filp, MAY_WRITE) != 0) 459 if (file_permission(filp, MAY_WRITE) != 0
459 && (current->uid != server->m.mounted_uid)) 460 && uid != server->m.mounted_uid)
460 {
461 return -EACCES; 461 return -EACCES;
462 } 462
463 if (argp) { 463 if (argp) {
464 if (server->sign_wanted) 464 if (server->sign_wanted)
465 { 465 {
@@ -478,24 +478,22 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
478 return 0; 478 return 0;
479 479
480 case NCP_IOC_SIGN_WANTED: 480 case NCP_IOC_SIGN_WANTED:
481 if ((file_permission(filp, MAY_READ) != 0) 481 if (file_permission(filp, MAY_READ) != 0
482 && (current->uid != server->m.mounted_uid)) 482 && uid != server->m.mounted_uid)
483 {
484 return -EACCES; 483 return -EACCES;
485 }
486 484
487 if (put_user(server->sign_wanted, (int __user *)argp)) 485 if (put_user(server->sign_wanted, (int __user *)argp))
488 return -EFAULT; 486 return -EFAULT;
489 return 0; 487 return 0;
488
490 case NCP_IOC_SET_SIGN_WANTED: 489 case NCP_IOC_SET_SIGN_WANTED:
491 { 490 {
492 int newstate; 491 int newstate;
493 492
494 if ((file_permission(filp, MAY_WRITE) != 0) 493 if (file_permission(filp, MAY_WRITE) != 0
495 && (current->uid != server->m.mounted_uid)) 494 && uid != server->m.mounted_uid)
496 {
497 return -EACCES; 495 return -EACCES;
498 } 496
499 /* get only low 8 bits... */ 497 /* get only low 8 bits... */
500 if (get_user(newstate, (unsigned char __user *)argp)) 498 if (get_user(newstate, (unsigned char __user *)argp))
501 return -EFAULT; 499 return -EFAULT;
@@ -512,11 +510,10 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp,
512 510
513#ifdef CONFIG_NCPFS_IOCTL_LOCKING 511#ifdef CONFIG_NCPFS_IOCTL_LOCKING
514 case NCP_IOC_LOCKUNLOCK: 512 case NCP_IOC_LOCKUNLOCK:
515 if ((file_permission(filp, MAY_WRITE) != 0) 513 if (file_permission(filp, MAY_WRITE) != 0
516 && (current->uid != server->m.mounted_uid)) 514 && uid != server->m.mounted_uid)
517 {
518 return -EACCES; 515 return -EACCES;
519 } 516
520 { 517 {
521 struct ncp_lock_ioctl rqdata; 518 struct ncp_lock_ioctl rqdata;
522 519
@@ -585,9 +582,8 @@ outrel:
585 582
586#ifdef CONFIG_COMPAT 583#ifdef CONFIG_COMPAT
587 case NCP_IOC_GETOBJECTNAME_32: 584 case NCP_IOC_GETOBJECTNAME_32:
588 if (current->uid != server->m.mounted_uid) { 585 if (uid != server->m.mounted_uid)
589 return -EACCES; 586 return -EACCES;
590 }
591 { 587 {
592 struct compat_ncp_objectname_ioctl user; 588 struct compat_ncp_objectname_ioctl user;
593 size_t outl; 589 size_t outl;
@@ -609,10 +605,10 @@ outrel:
609 return 0; 605 return 0;
610 } 606 }
611#endif 607#endif
608
612 case NCP_IOC_GETOBJECTNAME: 609 case NCP_IOC_GETOBJECTNAME:
613 if (current->uid != server->m.mounted_uid) { 610 if (uid != server->m.mounted_uid)
614 return -EACCES; 611 return -EACCES;
615 }
616 { 612 {
617 struct ncp_objectname_ioctl user; 613 struct ncp_objectname_ioctl user;
618 size_t outl; 614 size_t outl;
@@ -633,13 +629,13 @@ outrel:
633 return -EFAULT; 629 return -EFAULT;
634 return 0; 630 return 0;
635 } 631 }
632
636#ifdef CONFIG_COMPAT 633#ifdef CONFIG_COMPAT
637 case NCP_IOC_SETOBJECTNAME_32: 634 case NCP_IOC_SETOBJECTNAME_32:
638#endif 635#endif
639 case NCP_IOC_SETOBJECTNAME: 636 case NCP_IOC_SETOBJECTNAME:
640 if (current->uid != server->m.mounted_uid) { 637 if (uid != server->m.mounted_uid)
641 return -EACCES; 638 return -EACCES;
642 }
643 { 639 {
644 struct ncp_objectname_ioctl user; 640 struct ncp_objectname_ioctl user;
645 void* newname; 641 void* newname;
@@ -691,13 +687,13 @@ outrel:
691 kfree(oldname); 687 kfree(oldname);
692 return 0; 688 return 0;
693 } 689 }
690
694#ifdef CONFIG_COMPAT 691#ifdef CONFIG_COMPAT
695 case NCP_IOC_GETPRIVATEDATA_32: 692 case NCP_IOC_GETPRIVATEDATA_32:
696#endif 693#endif
697 case NCP_IOC_GETPRIVATEDATA: 694 case NCP_IOC_GETPRIVATEDATA:
698 if (current->uid != server->m.mounted_uid) { 695 if (uid != server->m.mounted_uid)
699 return -EACCES; 696 return -EACCES;
700 }
701 { 697 {
702 struct ncp_privatedata_ioctl user; 698 struct ncp_privatedata_ioctl user;
703 size_t outl; 699 size_t outl;
@@ -736,13 +732,13 @@ outrel:
736 732
737 return 0; 733 return 0;
738 } 734 }
735
739#ifdef CONFIG_COMPAT 736#ifdef CONFIG_COMPAT
740 case NCP_IOC_SETPRIVATEDATA_32: 737 case NCP_IOC_SETPRIVATEDATA_32:
741#endif 738#endif
742 case NCP_IOC_SETPRIVATEDATA: 739 case NCP_IOC_SETPRIVATEDATA:
743 if (current->uid != server->m.mounted_uid) { 740 if (uid != server->m.mounted_uid)
744 return -EACCES; 741 return -EACCES;
745 }
746 { 742 {
747 struct ncp_privatedata_ioctl user; 743 struct ncp_privatedata_ioctl user;
748 void* new; 744 void* new;
@@ -794,9 +790,10 @@ outrel:
794#endif /* CONFIG_NCPFS_NLS */ 790#endif /* CONFIG_NCPFS_NLS */
795 791
796 case NCP_IOC_SETDENTRYTTL: 792 case NCP_IOC_SETDENTRYTTL:
797 if ((file_permission(filp, MAY_WRITE) != 0) && 793 if (file_permission(filp, MAY_WRITE) != 0 &&
798 (current->uid != server->m.mounted_uid)) 794 uid != server->m.mounted_uid)
799 return -EACCES; 795 return -EACCES;
796
800 { 797 {
801 u_int32_t user; 798 u_int32_t user;
802 799