searchinfospec_t *searchInfo2,
Boolean lookForDup );
-static int CheckAccess(ExtendedVCB *vcb, u_long searchBits, CatalogKey *key, struct proc *p);
+static int CheckAccess(ExtendedVCB *vcb, u_long searchBits, CatalogKey *key, struct vfs_context *ctx);
static int InsertMatch(struct hfsmount *hfsmp, uio_t a_uio, CatalogRecord *rec,
CatalogKey *key, struct attrlist *returnAttrList,
attrs = ap->a_searchattrs->commonattr | ap->a_returnattrs->commonattr;
if (attrs & (ATTR_CMN_NAME | ATTR_CMN_PAROBJID))
return (EINVAL);
- if ((err = suser(kauth_cred_get(), 0)))
+ if ((err = vfs_context_suser(ap->a_context)))
return (err);
}
hfs_systemfile_unlock(hfsmp, lockflags);
if (CheckCriteria(vcb, ap->a_options, ap->a_searchattrs, &rec,
keyp, &searchInfo1, &searchInfo2, false) &&
- CheckAccess(vcb, ap->a_options, keyp, p)) {
+ CheckAccess(vcb, ap->a_options, keyp, ap->a_context)) {
result = InsertMatch(hfsmp, ap->a_uio, &rec,
keyp, ap->a_returnattrs,
}
if (CheckCriteria( vcb, ap->a_options, ap->a_searchattrs, myCurrentDataPtr,
myCurrentKeyPtr, &searchInfo1, &searchInfo2, true )
- && CheckAccess(vcb, ap->a_options, myCurrentKeyPtr, p)) {
+ && CheckAccess(vcb, ap->a_options, myCurrentKeyPtr, ap->a_context)) {
err = InsertMatch(hfsmp, ap->a_uio, myCurrentDataPtr,
myCurrentKeyPtr, ap->a_returnattrs,
attributesBuffer, variableBuffer, ap->a_nummatches);
*/
static int
-CheckAccess(ExtendedVCB *theVCBPtr, u_long searchBits, CatalogKey *theKeyPtr, struct proc *theProcPtr)
+CheckAccess(ExtendedVCB *theVCBPtr, u_long searchBits, CatalogKey *theKeyPtr, struct vfs_context *ctx)
{
Boolean isHFSPlus;
int myErr;
hfsmount_t * hfsmp;
struct FndrDirInfo *finfop;
struct vnode * vp = NULL;
- struct vfs_context my_context;
myResult = 0; /* default to "no access" */
- my_context.vc_proc = theProcPtr;
- my_context.vc_ucred = kauth_cred_get();
- if (!proc_suser(theProcPtr)) {
+ if (!vfs_context_suser(ctx)) {
myResult = 1; /* allow access */
goto ExitThisRoutine; /* root always has access */
}
myNodeID = cp->c_parentcnid; /* move up the hierarchy */
hfs_unlock(VTOC(vp));
if (vp->v_type == VDIR) {
- myErr = vnode_authorize(vp, NULL, (KAUTH_VNODE_SEARCH | KAUTH_VNODE_LIST_DIRECTORY), &my_context);
+ myErr = vnode_authorize(vp, NULL, (KAUTH_VNODE_SEARCH | KAUTH_VNODE_LIST_DIRECTORY), ctx);
} else {
- myErr = vnode_authorize(vp, NULL, (KAUTH_VNODE_SEARCH), &my_context);
+ myErr = vnode_authorize(vp, NULL, (KAUTH_VNODE_SEARCH), ctx);
}
vnode_put(vp);
vp = NULL;