#include <vm/vm_pageout.h>
-#include <architecture/byte_order.h>
#include <libkern/OSAtomic.h>
if (mp->mnt_flag & MNT_ROOTFS)
return (EBUSY); /* the root is always busy */
- return (dounmount(mp, flags, p));
+ return (dounmount(mp, flags, NULL, p));
}
/*
* Do the actual file system unmount.
*/
int
-dounmount(mp, flags, p)
+dounmount(mp, flags, skiplistrmp, p)
register struct mount *mp;
int flags;
+ int * skiplistrmp;
struct proc *p;
{
struct vnode *coveredvp = (vnode_t)0;
* The prior unmount attempt has probably succeeded.
* Do not dereference mp here - returning EBUSY is safest.
*/
+ if (skiplistrmp != NULL)
+ *skiplistrmp = 1;
return (EBUSY);
}
mp->mnt_kern_flag |= MNTK_UNMOUNT;
}
+/*
+ * An open system call using an extended argument list compared to the regular
+ * system call 'open'.
+ *
+ * Parameters: p Process requesting the open
+ * uap User argument descriptor (see below)
+ * retval Pointer to an area to receive the
+ * return calue from the system call
+ *
+ * Indirect: uap->path Path to open (same as 'open')
+ * uap->flags Flags to open (same as 'open'
+ * uap->uid UID to set, if creating
+ * uap->gid GID to set, if creating
+ * uap->mode File mode, if creating (same as 'open')
+ * uap->xsecurity ACL to set, if creating
+ *
+ * Returns: 0 Success
+ * !0 errno value
+ *
+ * Notes: The kauth_filesec_t in 'va', if any, is in host byte order.
+ *
+ * XXX: We should enummerate the possible errno values here, and where
+ * in the code they originated.
+ */
int
open_extended(struct proc *p, struct open_extended_args *uap, register_t *retval)
{
return error;
}
+
+/*
+ * A mkfifo system call using an extended argument list compared to the regular
+ * system call 'mkfifo'.
+ *
+ * Parameters: p Process requesting the open
+ * uap User argument descriptor (see below)
+ * retval (Ignored)
+ *
+ * Indirect: uap->path Path to fifo (same as 'mkfifo')
+ * uap->uid UID to set
+ * uap->gid GID to set
+ * uap->mode File mode to set (same as 'mkfifo')
+ * uap->xsecurity ACL to set, if creating
+ *
+ * Returns: 0 Success
+ * !0 errno value
+ *
+ * Notes: The kauth_filesec_t in 'va', if any, is in host byte order.
+ *
+ * XXX: We should enummerate the possible errno values here, and where
+ * in the code they originated.
+ */
int
mkfifo_extended(struct proc *p, struct mkfifo_extended_args *uap, __unused register_t *retval)
{
vnode_put(vp);
if (dvp)
vnode_put(dvp);
- if (context.vc_ucred)
- kauth_cred_rele(context.vc_ucred);
+ if (IS_VALID_CRED(context.vc_ucred))
+ kauth_cred_unref(&context.vc_ucred);
return(error);
}
nameidone(&nd);
out:
- kauth_cred_rele(context.vc_ucred);
+ kauth_cred_unref(&context.vc_ucred);
return(error);
}
return(error);
}
+/*
+ * A chmod system call using an extended argument list compared to the regular
+ * system call 'mkfifo'.
+ *
+ * Parameters: p Process requesting the open
+ * uap User argument descriptor (see below)
+ * retval (ignored)
+ *
+ * Indirect: uap->path Path to object (same as 'chmod')
+ * uap->uid UID to set
+ * uap->gid GID to set
+ * uap->mode File mode to set (same as 'chmod')
+ * uap->xsecurity ACL to set (or delete)
+ *
+ * Returns: 0 Success
+ * !0 errno value
+ *
+ * Notes: The kauth_filesec_t in 'va', if any, is in host byte order.
+ *
+ * XXX: We should enummerate the possible errno values here, and where
+ * in the code they originated.
+ */
int
chmod_extended(struct proc *p, struct chmod_extended_args *uap, __unused register_t *retval)
{
register struct vnode *vp;
int error;
struct nameidata nd;
- struct ucred cred; /* XXX ILLEGAL */
+ struct ucred template_cred;
int flags; /*what will actually get passed to access*/
u_long nameiflags;
struct vfs_context context;
+ kauth_cred_t my_cred;
/* Make sure that the number of groups is correct before we do anything */
if ((error = suser(kauth_cred_get(), &p->p_acflag)))
return(error);
- /* Fill in the credential structure */
-
- cred.cr_ref = 0;
- cred.cr_uid = uap->userid;
- cred.cr_ngroups = uap->ngroups;
- if ((error = copyin(CAST_USER_ADDR_T(uap->groups), (caddr_t) &(cred.cr_groups), (sizeof(gid_t))*uap->ngroups)))
+ /*
+ * Fill in the template credential structure; we use a template because
+ * lookup can attempt to take a persistent reference.
+ */
+ template_cred.cr_uid = uap->userid;
+ template_cred.cr_ngroups = uap->ngroups;
+ if ((error = copyin(CAST_USER_ADDR_T(uap->groups), (caddr_t) &(template_cred.cr_groups), (sizeof(gid_t))*uap->ngroups)))
return (error);
+ my_cred = kauth_cred_create(&template_cred);
context.vc_proc = p;
- context.vc_ucred = &cred;
+ context.vc_ucred = my_cred;
/* Get our hands on the file */
nameiflags = 0;
NDINIT(&nd, LOOKUP, nameiflags | AUDITVNPATH1,
UIO_USERSPACE, CAST_USER_ADDR_T(uap->path), &context);
- if ((error = namei(&nd)))
+ if ((error = namei(&nd))) {
+ kauth_cred_unref(&context.vc_ucred);
return (error);
+ }
nameidone(&nd);
vp = nd.ni_vp;
vnode_put(vp);
- if (error)
- return (error);
-
- return (0);
-
+ kauth_cred_unref(&context.vc_ucred);
+ return (error);
} /* end of checkuseraccess system call */
/************************************************/
searchblock.returnbuffer = CAST_USER_ADDR_T(tmp_searchblock.returnbuffer);
searchblock.returnbuffersize = tmp_searchblock.returnbuffersize;
searchblock.maxmatches = tmp_searchblock.maxmatches;
- searchblock.timelimit = tmp_searchblock.timelimit;
+ searchblock.timelimit.tv_sec = tmp_searchblock.timelimit.tv_sec;
+ searchblock.timelimit.tv_usec = tmp_searchblock.timelimit.tv_usec;
searchblock.searchparams1 = CAST_USER_ADDR_T(tmp_searchblock.searchparams1);
searchblock.sizeofsearchparams1 = tmp_searchblock.sizeofsearchparams1;
searchblock.searchparams2 = CAST_USER_ADDR_T(tmp_searchblock.searchparams2);
*/
void munge_stat(struct stat *sbp, struct user_stat *usbp)
{
+ bzero(usbp, sizeof(struct user_stat));
+
usbp->st_dev = sbp->st_dev;
usbp->st_ino = sbp->st_ino;
usbp->st_mode = sbp->st_mode;