version 1.13, 2008/12/17 20:51:35 |
version 1.13.2.1, 2009/07/23 23:32:32 |
Line 517 hfs_vop_close(void *v) |
|
Line 517 hfs_vop_close(void *v) |
|
return 0; |
return 0; |
} |
} |
|
|
int |
static int |
hfs_vop_access(void *v) |
hfs_check_possible(struct vnode *vp, mode_t mode) |
{ |
{ |
struct vop_access_args /* { |
|
struct vnode *a_vp; |
|
int a_mode; |
|
kauth_cred_t a_cred; |
|
} */ *ap = v; |
|
struct vattr va; |
|
int error; |
|
|
|
#ifdef HFS_DEBUG |
|
printf("VOP = hfs_vop_access()\n"); |
|
#endif /* HFS_DEBUG */ |
|
|
|
/* |
/* |
* Disallow writes on files, directories, and symlinks |
* Disallow writes on files, directories, and symlinks |
* since we have no write support yet. |
* since we have no write support yet. |
*/ |
*/ |
|
|
if (ap->a_mode & VWRITE) { |
if (mode & VWRITE) { |
switch (ap->a_vp->v_type) { |
switch (vp->v_type) { |
case VDIR: |
case VDIR: |
case VLNK: |
case VLNK: |
case VREG: |
case VREG: |
Line 548 hfs_vop_access(void *v) |
|
Line 537 hfs_vop_access(void *v) |
|
} |
} |
} |
} |
|
|
|
return 0; |
|
} |
|
|
|
static int |
|
hfs_check_permitted(struct vattr *va, mode_t mode, kauth_cred_t cred) |
|
{ |
|
|
|
return genfs_can_access(va->va_type, va->va_mode, va->va_uid, |
|
va->va_gid, mode, cred); |
|
} |
|
|
|
int |
|
hfs_vop_access(void *v) |
|
{ |
|
struct vop_access_args /* { |
|
struct vnode *a_vp; |
|
int a_mode; |
|
kauth_cred_t a_cred; |
|
} */ *ap = v; |
|
struct vattr va; |
|
int error; |
|
|
|
#ifdef HFS_DEBUG |
|
printf("VOP = hfs_vop_access()\n"); |
|
#endif /* HFS_DEBUG */ |
|
|
|
error = hfs_check_possible(ap->a_vp, ap->a_mode); |
|
if (error) |
|
return error; |
|
|
if ((error = VOP_GETATTR(ap->a_vp, &va, ap->a_cred)) != 0) |
if ((error = VOP_GETATTR(ap->a_vp, &va, ap->a_cred)) != 0) |
return error; |
return error; |
|
|
return vaccess(va.va_type, va.va_mode, va.va_uid, va.va_gid, |
error = hfs_check_permitted(&va, ap->a_mode, ap->a_cred); |
ap->a_mode, ap->a_cred); |
|
|
return error; |
} |
} |
|
|
int |
int |