- myNodeID = my_cat_desc.cd_parentcnid; /* move up the hierarchy */
- myPerms = DerivePermissionSummary(my_cat_attr.ca_uid, my_cat_attr.ca_gid,
- my_cat_attr.ca_mode, my_hfsmountPtr->hfs_mp,
- theProcPtr->p_ucred, theProcPtr );
- cat_releasedesc( &my_cat_desc );
-
- if ( (myPerms & X_OK) == 0 )
+ cp = VTOC(vp);
+ finfop = (struct FndrDirInfo *)&cp->c_attr.ca_finderinfo[0];
+
+ if ( searchBits & SRCHFS_SKIPPACKAGES ) {
+ if ( (SWAP_BE16(finfop->frFlags) & kHasBundle)
+ || (cp->c_desc.cd_nameptr != NULL
+ && is_package_name(cp->c_desc.cd_nameptr, cp->c_desc.cd_namelen)) ) {
+ myResult = 0;
+ goto ExitThisRoutine;
+ }
+ }
+
+ if ( searchBits & SRCHFS_SKIPINAPPROPRIATE ) {
+ if ( cp->c_parentcnid == kRootDirID && cp->c_desc.cd_nameptr != NULL &&
+ is_inappropriate_name(cp->c_desc.cd_nameptr, cp->c_desc.cd_namelen) ) {
+ myResult = 0;
+ goto ExitThisRoutine;
+ }
+ }
+
+ if ( (searchBits & SRCHFS_SKIPINVISIBLE) &&
+ (SWAP_BE16(finfop->frFlags) & kIsInvisible) ) {
+ myResult = 0;
+ goto ExitThisRoutine;
+ }
+
+ 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), ctx);
+ } else {
+ myErr = vnode_authorize(vp, NULL, (KAUTH_VNODE_SEARCH), ctx);
+ }
+ vnode_put(vp);
+ vp = NULL;
+ if ( myErr ) {