Changeset 70874 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Feb 5, 2018 6:30:15 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120700
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
r70873 r70874 52 52 #include <linux/miscdevice.h> 53 53 #include <linux/poll.h> 54 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) 55 # include <linux/tty.h> 56 #endif 54 57 #include <VBox/version.h> 55 58 #include "revision-generated.h" … … 57 60 #include <iprt/assert.h> 58 61 #include <iprt/asm.h> 62 #include <iprt/ctype.h> 59 63 #include <iprt/err.h> 60 64 #include <iprt/initterm.h> … … 746 750 747 751 /** 752 * Checks if the given group number is zero or not. 753 * 754 * @returns true / false. 755 * @param gid The group to check for. 756 */ 757 DECLINLINE(bool) vgdrvLinuxIsGroupZero(kgid_t gid) 758 { 759 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) 760 return from_kgid(current_user_ns(), gid); 761 #else 762 return gid == 0; 763 #endif 764 } 765 766 767 /** 748 768 * Searches the effective group and supplementary groups for @a gid. 749 769 * … … 770 790 uint32_t fRet = VMMDEV_REQUESTOR_CON_DONT_KNOW; 771 791 772 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)792 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) /* First with tty_kref_put(). */ 773 793 /* 774 794 * Check for tty0..63, ASSUMING that these are only used for the physical console. … … 791 811 || ( RT_C_IS_DIGIT(pszName[4]) 792 812 && pszName[5] == '\0' 793 && (pszName[3] - '0') * 10 + (pszName[4] - '0') <= 63)) 813 && (pszName[3] - '0') * 10 + (pszName[4] - '0') <= 63)) ) 794 814 fRet = VMMDEV_REQUESTOR_CON_YES; 795 815 tty_kref_put(pTty); … … 825 845 if (MINOR(pInode->i_rdev) == g_MiscDeviceUser.minor) 826 846 { 827 fRequestor |= VMMDEV_REQUESTOR_U NTRUSTED_DEVICE;828 if ( pInode->i_gid&& vgdrvLinuxIsInGroupEff(pInode->i_gid))847 fRequestor |= VMMDEV_REQUESTOR_USER_DEVICE; 848 if (vgdrvLinuxIsGroupZero(pInode->i_gid) && vgdrvLinuxIsInGroupEff(pInode->i_gid)) 829 849 fRequestor |= VMMDEV_REQUESTOR_GRP_VBOX; 830 850 }
Note:
See TracChangeset
for help on using the changeset viewer.