Changeset 75781 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Nov 27, 2018 10:52:01 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-netbsd.c
r70873 r75781 612 612 * 613 613 */ 614 static int VBoxGuestNetBSDOpen(dev_t device, int flags, int fmt, struct lwp *process) 615 { 616 int rc; 614 static int VBoxGuestNetBSDOpen(dev_t device, int flags, int fmt, struct lwp *pLwp) 615 { 617 616 vboxguest_softc *sc; 618 617 struct vboxguest_fdata *fdata; … … 635 634 636 635 fdata = kmem_alloc(sizeof(*fdata), KM_SLEEP); 637 if (fdata == NULL) 638 { 639 return (ENOMEM); 640 } 641 642 fdata->sc = sc; 643 644 if ((error = fd_allocfile(&fp, &fd)) != 0) 645 { 636 if (fdata != NULL) 637 { 638 fdata->sc = sc; 639 640 error = fd_allocfile(&fp, &fd); 641 if (error == 0) 642 { 643 /* 644 * Create a new session. 645 */ 646 int rc; 647 struct kauth_cred *pCred = pLwp->l_cred; 648 uint32_t fRequestor = VMMDEV_REQUESTOR_USERMODE | VMMDEV_REQUESTOR_TRUST_NOT_GIVEN; 649 if (pCred && kauth_cred_geteuid(pCred) == 0) 650 fRequestor |= VMMDEV_REQUESTOR_USR_ROOT; 651 else 652 fRequestor |= VMMDEV_REQUESTOR_USR_USER; 653 654 if (pCred && kauth_cred_ismember_gid(pCred, 0)) 655 fRequestor |= VMMDEV_REQUESTOR_GRP_WHEEL; 656 fRequestor |= VMMDEV_REQUESTOR_NO_USER_DEVICE; /** @todo implement /dev/vboxuser 657 if (!fUnrestricted) 658 fRequestor |= VMMDEV_REQUESTOR_USER_DEVICE; */ 659 fRequestor |= VMMDEV_REQUESTOR_CON_DONT_KNOW; /** @todo can we find out if pLwp is on the console? */ 660 rc = VGDrvCommonCreateUserSession(&g_DevExt, fRequestor, &fdata->session); 661 if (RT_SUCCESS(rc)) 662 { 663 ASMAtomicIncU32(&cUsers); 664 return fd_clone(fp, fd, flags, &vboxguest_fileops, fdata); 665 } 666 667 aprint_error_dev(sc->sc_dev, "VBox session creation failed\n"); 668 closef(fp); /* ??? */ 669 error = RTErrConvertToErrno(rc); 670 } 646 671 kmem_free(fdata, sizeof(*fdata)); 647 return error; 648 } 649 650 /* 651 * Create a new session. 652 */ 653 rc = VGDrvCommonCreateUserSession(&g_DevExt, VMMDEV_REQUESTOR_USERMODE, &fdata->session); 654 if (! RT_SUCCESS(rc)) 655 { 656 aprint_error_dev(sc->sc_dev, "VBox session creation failed\n"); 657 closef(fp); /* ??? */ 658 kmem_free(fdata, sizeof(*fdata)); 659 return RTErrConvertToErrno(rc); 660 } 661 ASMAtomicIncU32(&cUsers); 662 return fd_clone(fp, fd, flags, &vboxguest_fileops, fdata); 672 } 673 else 674 error = NOMEM; 675 return error; 663 676 664 677 }
Note:
See TracChangeset
for help on using the changeset viewer.