Exemplo n.º 1
0
/*ARGSUSED*/
static void
event_handler(void *cookie, char *argp, size_t asize,
    door_desc_t *dp, uint_t n_desc)
{
	door_cred_t		cred;
	nvlist_t		*nvlp;
	char			*dtype;

	if (piclevent_debug)
		syslog(LOG_INFO,
		    "piclevent: got SLM event cookie:%p evarg:%p size:0x%x\n",
		    cookie, argp, asize);
	if ((door_id < 0) || (argp == NULL) || (door_cred(&cred) < 0) ||
	    (cred.dc_euid != 0))
		(void) door_return(argp, 0, NULL, 0);

	if (nvlist_unpack(argp, asize, &nvlp, NULL))
		(void) door_return(argp, 0, NULL, 0);

	if (nvlist_lookup_string(nvlp, PICLEVENTARG_DATA_TYPE, &dtype)) {
		nvlist_free(nvlp);
		(void) door_return(argp, 0, NULL, 0);
	}

	if (strcmp(dtype, PICLEVENTARG_PICLEVENT_DATA) == 0)
		parse_piclevent(nvlp);
	/*
	 * ignore other event data types
	 */
	nvlist_free(nvlp);
	(void) door_return(argp, 0, NULL, 0);
}
Exemplo n.º 2
0
/*ARGSUSED*/
void
fps_door_handler(void *cookie, char *argp, size_t asize,
	door_desc_t  *dp, uint_t  n_desc)
{
	fps_event_t	*evtp = NULL;
	fps_event_reply_t	reply;

	reply.result = -1;  /* -1 failure. 0 success */

	if (argp == NULL)
		(void) door_return((char *)&reply, sizeof (reply), NULL, 0);

	/*LINTED*/
	evtp  = (fps_event_t *)argp;

	if (cookie != FPS_DOOR_COOKIE)
		(void) door_return((char *)&reply, sizeof (reply), NULL, 0);

	fpsd_message(FPSD_NO_EXIT, FPS_INFO,
	    DOOR_HNDLR_MSG,
	    evtp->version, evtp->type, evtp->length);

	reply.result = 0;
	(void) door_return((char *)&reply, sizeof (reply), NULL, 0);

}
Exemplo n.º 3
0
/* ARGSUSED */
static void
vs_stats_door_call(void *cookie, char *ptr, size_t size, door_desc_t *dp,
		uint_t n_desc)
{
	/* LINTED E_BAD_PTR_CAST_ALIGN */
	vs_stats_req_t *req = (vs_stats_req_t *)ptr;
	vs_stats_rsp_t rsp;

	if ((cookie != &vs_stats_door_cookie) ||
	    (ptr == NULL) ||
	    (size != sizeof (vs_stats_req_t)) ||
	    (req->vsr_magic != VS_STATS_DOOR_MAGIC)) {
		return;
	}

	rsp.vsr_magic = VS_STATS_DOOR_MAGIC;

	switch (req->vsr_id) {
	case VS_STATS_GET:
		(void) pthread_mutex_lock(&vs_stats_mutex);
		rsp.vsr_stats = vscan_stats;
		(void) pthread_mutex_unlock(&vs_stats_mutex);
		(void) door_return((char *)&rsp, sizeof (vs_stats_rsp_t),
		    NULL, 0);
		break;

	case VS_STATS_RESET:
		vs_stats_reset();
		(void) door_return(NULL, 0, NULL, 0);
		break;

	default:
		return;
	}
}
Exemplo n.º 4
0
static void server_proc (void *cookie, char *argp, size_t arg_size,
	door_desc_t *dp, uint_t n_desc)
{
	long arg;
	long res;

	if (argp == DOOR_UNREF_DATA) {
		printf ("Door unreferenced\n");
		if (fattach (door_fd, door_path) == -1)
			 err_msg ("fattach failed");
		if (door_return (NULL, 0, NULL, 0) == -1)
			err_msg ("door_return failed");
	}

	if (fdetach (door_path) == -1)
		err_msg("fdetach failed");

	arg = *((long *) argp);
	res = arg * arg;

	printf ("Server proc returning, res = %ld\n", res);

	if (door_return ((char *) &res, sizeof (long), NULL, 0) == -1)
		err_msg ("door_return failed");
}
Exemplo n.º 5
0
/*
 * Handles the door command IPMGMT_CMD_GETIF. It retrieves the name of all the
 * persisted interfaces and the IP protocols (IPv4 or IPv6) they support.
 */
static void
ipmgmt_getif_handler(void *argp)
{
	ipmgmt_getif_arg_t	*getif = argp;
	ipmgmt_getif_rval_t	*rvalp;
	ipmgmt_retval_t		rval;
	ipmgmt_getif_cbarg_t	cbarg;
	ipadm_if_info_t		*ifp, *rifp, *curifp;
	int			i, err = 0, count = 0;
	size_t			rbufsize;

	assert(getif->ia_cmd == IPMGMT_CMD_GETIF);

	bzero(&cbarg, sizeof (cbarg));
	cbarg.cb_ifname = getif->ia_ifname;
	err = ipmgmt_db_walk(ipmgmt_db_getif, &cbarg, IPADM_DB_READ);
	if (err == ENOENT && cbarg.cb_ifinfo) {
		/*
		 * If there is atleast one entry in the nvlist,
		 * do not return error.
		 */
		err = 0;
	}
	if (err != 0) {
		rval.ir_err = err;
		(void) door_return((char *)&rval, sizeof (rval), NULL, 0);
		return;
	}

	/* allocate sufficient buffer to return the interface info */
	for (ifp = cbarg.cb_ifinfo; ifp != NULL; ifp = ifp->ifi_next)
		++count;
	rbufsize = sizeof (*rvalp) + count * sizeof (*ifp);
	rvalp = alloca(rbufsize);
	bzero(rvalp, rbufsize);

	rvalp->ir_ifcnt = count;
	rifp = rvalp->ir_ifinfo;
	ifp = cbarg.cb_ifinfo;

	/*
	 * copy the interface info to buffer allocated on stack. The reason
	 * we do this is to avoid memory leak, as door_return() would never
	 * return
	 */
	for (i = 0; i < count; i++) {
		rifp = rvalp->ir_ifinfo + i;
		(void) bcopy(ifp, rifp, sizeof (*rifp));
		rifp->ifi_next = NULL;
		curifp = ifp->ifi_next;
		free(ifp);
		ifp = curifp;
	}
	rvalp->ir_err = err;
	(void) door_return((char *)rvalp, rbufsize, NULL, 0);
}
Exemplo n.º 6
0
static void
if_selfcred_return_per_user_door(char *argp, size_t arg_size,
	door_desc_t *dp, int whoami)
{
	nss_pheader_t	*phdr = (nss_pheader_t *)((void *)argp);
	char		*dblist;
	int		door = -1;
	int		rc = 0;
	door_desc_t	desc;
	char		*space;
	int		len;

	/*
	 * check to see if self-cred is configured and
	 * need to return an alternate PUN door
	 */
	if (per_user_is_on == 1) {
		rc = need_per_user_door(argp, whoami,
		    _nscd_get_client_euid(), &dblist);
		if (rc == -1)
			per_user_is_on = 0;
	}
	if (rc <= 0) {
		/*
		 * self-cred not configured, and no error detected,
		 * return to continue the door call processing
		 */
		if (NSCD_STATUS_IS_OK(phdr))
			return;
		else
			/*
			 * configured but error detected,
			 * stop the door call processing
			 */
			(void) door_return(argp, phdr->data_off, NULL, 0);
	}

	/* get the alternate PUN door */
	_nscd_proc_alt_get(argp, &door);
	if (NSCD_GET_STATUS(phdr) != NSS_ALTRETRY) {
		(void) door_return(argp, phdr->data_off, NULL, 0);
	}

	/* return the alternate door descriptor */
	len = strlen(dblist) + 1;
	space = alloca(arg_size + len);
	phdr->data_len = len;
	(void) memcpy(space, phdr, arg_size);
	(void) strncpy((char *)space + arg_size, dblist, len);
	dp = &desc;
	dp->d_attributes = DOOR_DESCRIPTOR;
	dp->d_data.d_desc.d_descriptor = door;
	arg_size += len;
	(void) door_return(space, arg_size, dp, 1);
}
Exemplo n.º 7
0
/*
 * Handles the door command IPMGMT_CMD_GETADDR. It retrieves the persisted
 * address for a given `gargp->ia_aobjname'. If it is not defined then it
 * retrieves all the addresses configured on `gargp->ia_ifname'. The
 * "ipadm show-addr addrobj" or "ipadm show-addr <ifname>/\*" will call this
 * handler through library.
 */
static void
ipmgmt_getaddr_handler(void *argp)
{
	size_t			buflen, onvlsize;
	char			*buf, *onvlbuf;
	ipmgmt_getaddr_arg_t	*gargp = argp;
	ipmgmt_getaddr_cbarg_t	cbarg;
	ipmgmt_get_rval_t 	rval, *rvalp = &rval;
	int			err = 0;

	cbarg.cb_ifname = gargp->ia_ifname;
	cbarg.cb_aobjname = gargp->ia_aobjname;
	cbarg.cb_ocnt = 0;
	if (nvlist_alloc(&cbarg.cb_onvl, NV_UNIQUE_NAME, 0) != 0)
		goto fail;
	err = ipmgmt_db_walk(ipmgmt_db_getaddr, &cbarg, IPADM_DB_READ);
	if (err == ENOENT && cbarg.cb_ocnt > 0) {
		/*
		 * If there is atleast one entry in the nvlist,
		 * do not return error.
		 */
		err = 0;
	}
	if (err != 0)
		goto fail;

	if ((err = nvlist_size(cbarg.cb_onvl, &onvlsize,
	    NV_ENCODE_NATIVE)) != 0) {
		goto fail;
	}
	buflen = onvlsize + sizeof (ipmgmt_get_rval_t);
	/*
	 * We cannot use malloc() here because door_return never returns, and
	 * memory allocated by malloc() would get leaked. Use alloca() instead.
	 */
	buf = alloca(buflen);
	onvlbuf = buf + sizeof (ipmgmt_get_rval_t);
	if ((err = nvlist_pack(cbarg.cb_onvl, &onvlbuf, &onvlsize,
	    NV_ENCODE_NATIVE, 0)) != 0) {
		goto fail;
	}
	nvlist_free(cbarg.cb_onvl);
	rvalp = (ipmgmt_get_rval_t *)(void *)buf;
	rvalp->ir_err = 0;
	rvalp->ir_nvlsize = onvlsize;

	(void) door_return(buf, buflen, NULL, 0);
	return;
fail:
	nvlist_free(cbarg.cb_onvl);
	rvalp->ir_err = err;
	(void) door_return((char *)rvalp, sizeof (*rvalp), NULL, 0);
}
Exemplo n.º 8
0
static void
reparsed_door_call_error(int error, int buflen)
{
	reparsed_door_res_t rpd_res;

	memset(&rpd_res, 0, sizeof (reparsed_door_res_t));
	rpd_res.res_status = error;
	rpd_res.res_len = buflen;
	door_return((char *)&rpd_res, sizeof (reparsed_door_res_t), NULL, 0);

	(void) door_return(NULL, 0, NULL, 0);
	/* NOTREACHED */
}
Exemplo n.º 9
0
static void
nfscmd_err(door_desc_t *dp, nfscmd_arg_t *args, int err)
{
	nfscmd_res_t res;

	res.version = NFSCMD_VERS_1;
	res.cmd = NFSCMD_ERROR;
	res.error = err;
	(void) door_return((char *)&res, sizeof (nfscmd_res_t), NULL, 0);
	(void) door_return(NULL, 0, NULL, 0);
	/* NOTREACHED */

}
Exemplo n.º 10
0
/*
 * picld_wait is called when a picl_wait request is received
 */
static void
picld_wait(picl_service_t *in)
{
	picl_retwait_t	ret;
	int		err;
	ucred_t	*puc = NULL;
	uid_t uid;

	ret.cnum = in->req_wait.cnum;
	if (door_ucred(&puc) != 0)
		ret.retcode = PICL_FAILURE;
	else {
		uid = ucred_geteuid(puc);
		if (enter_picld_wait(uid) == PICL_FAILURE)
			ret.retcode = PICL_FAILURE;
		else {
			err = xptree_refresh_notify(in->req_wait.secs);
			ret.retcode = err;
			exit_picld_wait(uid);
		}
		ucred_free(puc);
	}
	(void) rw_unlock(&init_lk);
	(void) door_return((char *)&ret, sizeof (picl_retwait_t), NULL, 0);
}
Exemplo n.º 11
0
/*
 * Handles the door command IPMGMT_CMD_RESETADDR. For the given addrobj
 * deletes all the persisted addrobj configuration. It also deletes the
 * corresponding node, from `aobjmap'.
 */
static void
ipmgmt_resetaddr_handler(void *argp)
{
	ipmgmt_addr_arg_t	*rargp = argp;
	ipmgmt_retval_t		rval;
	ipmgmt_aobjmap_t	node;
	uint32_t		flags = rargp->ia_flags;
	int			err = 0;
	ipmgmt_resetaddr_cbarg_t cbarg;

	cbarg.cb_aobjname = rargp->ia_aobjname;

	if (flags & IPMGMT_PERSIST)
		err = ipmgmt_db_walk(ipmgmt_db_resetaddr, &cbarg,
		    IPADM_DB_DELETE);

	if (flags & IPMGMT_ACTIVE) {
		bzero(&node, sizeof (node));
		(void) strlcpy(node.am_aobjname, rargp->ia_aobjname,
		    sizeof (node.am_aobjname));

		/*
		 * am_lnum is used only for IPv6 autoconf case, since there
		 * can be multiple nodes with the same aobjname.
		 */
		node.am_lnum = rargp->ia_lnum;
		node.am_flags = flags;
		(void) ipmgmt_aobjmap_op(&node, ADDROBJ_DELETE);
	}

	rval.ir_err = err;
	(void) door_return((char *)&rval, sizeof (rval), NULL, 0);
}
Exemplo n.º 12
0
/* ARGSUSED */
static void *
doorserv_thread(void *arg)
{
	(void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
	(void) door_return(NULL, 0, NULL, 0);
	return (NULL);
}
Exemplo n.º 13
0
/* ARGSUSED */
static void *
picld_create_server_thread(void *arg)
{
	/*
	 * wait for door descriptor to be initialized
	 */
	(void) pthread_mutex_lock(&door_mutex);
	while (door_id == -1) {
		(void) pthread_cond_wait(&door_cv, &door_mutex);
	}
	(void) pthread_mutex_unlock(&door_mutex);

	/*
	 * Bind this thread to the door's private thread pool
	 */
	if (door_bind(door_id) < 0) {
		perror("door_bind");
	}

	/*
	 * Disable thread cancellation mechanism
	 */
	(void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
	(void) door_return(NULL, 0, NULL, 0); /* wait for door invocation */
	return (NULL);
}
Exemplo n.º 14
0
static void
lookup(char *argp, size_t arg_size)
{
	nsc_lookup_args_t	largs;
	char			space[NSCD_LOOKUP_BUFSIZE];
	nss_pheader_t		*phdr = (nss_pheader_t *)(void *)argp;

	NSCD_ALLOC_LOOKUP_BUFFER(argp, arg_size, phdr, space,
	    sizeof (space));

	/*
	 * make sure the first couple bytes of the data area is null,
	 * so that bad strings in the packed header stop here
	 */
	(void) memset((char *)phdr + phdr->data_off, 0, 16);

	(void) memset(&largs, 0, sizeof (largs));
	largs.buffer = argp;
	largs.bufsize = arg_size;
	nsc_lookup(&largs, 0);

	/*
	 * only the PUN needs to keep track of the
	 * activity count to determine when to
	 * terminate itself
	 */
	if (_whoami == NSCD_CHILD) {
		(void) mutex_lock(&activity_lock);
		++activity;
		(void) mutex_unlock(&activity_lock);
	}

	NSCD_SET_RETURN_ARG(phdr, arg_size);
	(void) door_return(argp, arg_size, NULL, 0);
}
Exemplo n.º 15
0
/*
 * This function returns the property information
 */
static void
picld_get_attrinfo(picl_service_t *in)
{
	picl_retattrinfo_t	ret;
	int			err;
	ptree_propinfo_t	pinfo;
	picl_prophdl_t		ptreeh;

	err = cvt_picl2ptree(in->req_attrinfo.attr, &ptreeh);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);

	ret.cnum = PICL_CNUM_GETATTRINFO;
	ret.attr = in->req_attrinfo.attr;

	err = ptree_get_propinfo(ptreeh, &pinfo);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);

	ret.type = pinfo.piclinfo.type;
	ret.accessmode = pinfo.piclinfo.accessmode;
	ret.size = (uint32_t)pinfo.piclinfo.size;
	(void) strcpy(ret.name, pinfo.piclinfo.name);
	(void) rw_unlock(&init_lk);
	(void) door_return((char *)&ret, sizeof (picl_retattrinfo_t), NULL, 0);
}
Exemplo n.º 16
0
void
fmd_door_server(void *dip)
{
	fmd_dprintf(FMD_DBG_XPRT, "door server starting for %p\n", dip);
	(void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
	(void) door_return(NULL, 0, NULL, 0);
}
Exemplo n.º 17
0
/* ARGSUSED */
void
doorHandler(
	void		*cookie,
	char		*args,
	size_t		alen,
	door_desc_t	*ddp,
	uint_t		ndid)
{
	uint32_t result = 0;

	if (ddp != NULL || ndid != 0) {
		syslog(LOG_DAEMON|LOG_WARNING,
		    "descriptor passed to door %p %d", ddp, ndid);
		result = EINVAL;
	}

	if (args == NULL || alen == 0) {
		syslog(LOG_DAEMON|LOG_WARNING,
		    "empty message passed to door %p %d", args, alen);
		result = EFAULT;
	}

	if (result == 0)
		result = postMsg((uint_t)alen, (uchar_t *)args);
	(void) door_return((char *)&result, sizeof (result), NULL, 0);

	syslog(LOG_DAEMON|LOG_WARNING, "door_return FAILED %d", errno);
	exit(errno);
}
Exemplo n.º 18
0
/*
 * This function returns the value of the PICL property specified by
 * its name.
 */
static void
picld_get_attrval_by_name(picl_service_t *in)
{
	picl_retattrvalbyname_t	*ret;
	int			err;
	size_t			vbufsize;
	size_t			len;
	door_cred_t		cred;
	picl_nodehdl_t		ptreeh;
	ptree_propinfo_t	pinfo;

	if (door_cred(&cred) < 0)
		picld_return_error(in->in.cnum, PICL_FAILURE);

	err = cvt_picl2ptree(in->req_attrvalbyname.nodeh, &ptreeh);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);

	err = xptree_get_propinfo_by_name(ptreeh,
	    in->req_attrvalbyname.propname, &pinfo);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);

	if (!(pinfo.piclinfo.accessmode & PICL_READ))
		picld_return_error(in->in.cnum, PICL_NOTREADABLE);

	/*
	 * allocate the minimum of piclinfo.size and input bufsize
	 */
	vbufsize = pinfo.piclinfo.size;
	vbufsize = MIN((size_t)in->req_attrvalbyname.bufsize, vbufsize);
	len = sizeof (picl_retattrvalbyname_t) + vbufsize;
	ret = alloca(len);
	if (ret == NULL)
		picld_return_error(in->in.cnum, PICL_FAILURE);
	ret->cnum = PICL_CNUM_GETATTRVALBYNAME;
	ret->nodeh = in->req_attrvalbyname.nodeh;
	(void) strcpy(ret->propname, in->req_attrvalbyname.propname);
	ret->nbytes = (uint32_t)vbufsize;

	err = xptree_get_propval_by_name_with_cred(ptreeh,
	    in->req_attrvalbyname.propname, ret->ret_buf, vbufsize,
	    cred);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);
	/*
	 * adjust returned value size for charstrings
	 */
	if (pinfo.piclinfo.type == PICL_PTYPE_CHARSTRING)
		ret->nbytes = (uint32_t)strlen(ret->ret_buf) + 1;

	if ((pinfo.piclinfo.type == PICL_PTYPE_TABLE) ||
	    (pinfo.piclinfo.type == PICL_PTYPE_REFERENCE))
		cvt_ptree2picl(&ret->ret_nodeh);

	(void) rw_unlock(&init_lk);
	(void) door_return((char *)ret, sizeof (picl_retattrvalbyname_t) +
	    (size_t)ret->nbytes, NULL, 0);
}
Exemplo n.º 19
0
/*
 * Handles the door command IPMGMT_CMD_SETIF. It persists the interface
 * information in the DB.
 */
static void
ipmgmt_setif_handler(void *argp)
{
	ipmgmt_retval_t		rval;

	rval.ir_err = ipmgmt_persist_if(argp);
	(void) door_return((char *)&rval, sizeof (rval), NULL, 0);
}
Exemplo n.º 20
0
/*
 * This function returns the value of the PICL property
 */
static void
picld_get_attrval(picl_service_t *in)
{
	picl_retattrval_t	*ret;
	int			err;
	size_t			vbufsize;
	size_t			len;
	door_cred_t		cred;
	picl_prophdl_t		ptreeh;
	ptree_propinfo_t	pinfo;

	if (door_cred(&cred) < 0)
		picld_return_error(in->in.cnum, PICL_FAILURE);

	err = cvt_picl2ptree(in->req_attrval.attr, &ptreeh);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);

	err = ptree_get_propinfo(ptreeh, &pinfo);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);

	if (!(pinfo.piclinfo.accessmode & PICL_READ))
		picld_return_error(in->in.cnum, PICL_NOTREADABLE);

	vbufsize = pinfo.piclinfo.size;
	vbufsize = MIN((size_t)in->req_attrval.bufsize, vbufsize);

	len = sizeof (picl_retattrval_t) + vbufsize;
	ret = alloca(len);
	if (ret == NULL)
		picld_return_error(in->in.cnum, PICL_FAILURE);
	ret->cnum = PICL_CNUM_GETATTRVAL;
	ret->attr = in->req_attrval.attr;
	ret->nbytes = (uint32_t)vbufsize;
	err = xptree_get_propval_with_cred(ptreeh, ret->ret_buf, vbufsize,
	    cred);
	if (err != PICL_SUCCESS)
		picld_return_error(in->in.cnum, err);

	/*
	 * adjust returned bytes for charstrings
	 */
	if (pinfo.piclinfo.type == PICL_PTYPE_CHARSTRING)
		ret->nbytes = (uint32_t)strlen(ret->ret_buf) + 1;

	/*
	 * convert handle values to picl handles
	 */
	if ((pinfo.piclinfo.type == PICL_PTYPE_TABLE) ||
	    (pinfo.piclinfo.type == PICL_PTYPE_REFERENCE))
		cvt_ptree2picl(&ret->ret_nodeh);
	(void) rw_unlock(&init_lk);
	(void) door_return((char *)ret, sizeof (picl_retattrval_t) +
	    (size_t)ret->nbytes, NULL, 0);
}
Exemplo n.º 21
0
static void
picld_ping(picl_service_t *in)
{
	picl_retping_t	ret;

	ret.cnum = in->req_ping.cnum;

	(void) rw_unlock(&init_lk);
	(void) door_return((char *)&ret, sizeof (picl_retping_t), NULL, 0);
}
Exemplo n.º 22
0
/* ARGSUSED */
static void
event_handler(void *cookie, char *argp, size_t asize,
    door_desc_t *dp, uint_t n_desc)
{
	wpa_event_type event;

	event = ((wl_events_t *)argp)->event;
	wpa_event_handler(cookie, event);

	(void) door_return(NULL, 0, NULL, 0);
}
Exemplo n.º 23
0
static void
nfscmd_charmap_lookup(door_desc_t *dp, nfscmd_arg_t *args)
{
	nfscmd_res_t res;
	struct netbuf nb;
	struct sockaddr sa;
	struct share *sh = NULL;
	char *opts;
	char *name;

	memset(&res, '\0', sizeof (res));
	res.version = NFSCMD_VERS_1;
	res.cmd = NFSCMD_CHARMAP_LOOKUP;

	sh = findentry(args->arg.charmap.path);

	if (sh != NULL) {
		nb.len = nb.maxlen = sizeof (struct sockaddr);
		nb.buf = (char *)&sa;

		sa = args->arg.charmap.addr;

		name = charmap_search(&nb, sh->sh_opts);
		if (name != NULL) {
			strcpy(res.result.charmap.codeset, name);
			res.result.charmap.apply = B_TRUE;
			res.error = NFSCMD_ERR_SUCCESS;
			free(name);
		} else {
			res.result.charmap.apply = B_FALSE;
			res.error = NFSCMD_ERR_NOTFOUND;
		}
		sharefree(sh);
	} else {
		res.error = NFSCMD_ERR_NOTFOUND;
	}

	(void) door_return((char *)&res, sizeof (nfscmd_res_t), NULL, 0);
	(void) door_return(NULL, 0, NULL, 0);
	/* NOTREACHED */
}
Exemplo n.º 24
0
/*
 * Handles the door command IPMGMT_CMD_RESETPROP. It deletes the property line
 * from the DB.
 */
static void
ipmgmt_resetprop_handler(void *argp)
{
	ipmgmt_prop_arg_t	*pargp = argp;
	ipmgmt_retval_t		rval;

	assert(pargp->ia_cmd == IPMGMT_CMD_RESETPROP);

	rval.ir_err = ipmgmt_db_walk(ipmgmt_db_resetprop, pargp,
	    IPADM_DB_DELETE);
	(void) door_return((char *)&rval, sizeof (rval), NULL, 0);
}
Exemplo n.º 25
0
/*
 * This returns an error message to libpicl
 */
static void
picld_return_error(picl_callnumber_t cnum, picl_errno_t err)
{
	picl_reterror_t	ret_error;

	ret_error.cnum = PICL_CNUM_ERROR;
	ret_error.in_cnum = cnum;
	ret_error.errnum = err;
	(void) rw_unlock(&init_lk);
	(void) door_return((char *)&ret_error, sizeof (picl_reterror_t), NULL,
	    0);
}
Exemplo n.º 26
0
static void server_proc (void *cookie, char *argp, size_t arg_size,
	door_desc_t *dp, uint_t n_desc)
{
	long arg;
	long res;

	arg = *((long *) argp);
	res = arg * arg;

	if (door_return ((char *) &res, sizeof (long), NULL, 0) == -1)
		err_msg ("door_return failed");
}
Exemplo n.º 27
0
/* ARGSUSED */
void
nfsmapid_func(void *cookie, char *argp, size_t arg_size,
						door_desc_t *dp, uint_t n_desc)
{
	struct mapid_arg	*mapargp;
	struct mapid_res	mapres;

	/*
	 * Make sure we have a valid argument
	 */
	if (arg_size < sizeof (struct mapid_arg)) {
		mapres.status = NFSMAPID_INVALID;
		mapres.u_res.len = 0;
		(void) door_return((char *)&mapres, sizeof (struct mapid_res),
		    NULL, 0);
		return;
	}

	/* LINTED pointer cast */
	mapargp = (struct mapid_arg *)argp;
	switch (mapargp->cmd) {
	case NFSMAPID_STR_UID:
		nfsmapid_str_uid(mapargp, arg_size);
		return;
	case NFSMAPID_UID_STR:
		nfsmapid_uid_str(mapargp, arg_size);
		return;
	case NFSMAPID_STR_GID:
		nfsmapid_str_gid(mapargp, arg_size);
		return;
	case NFSMAPID_GID_STR:
		nfsmapid_gid_str(mapargp, arg_size);
		return;
	default:
		break;
	}
	mapres.status = NFSMAPID_INVALID;
	mapres.u_res.len = 0;
	(void) door_return((char *)&mapres, sizeof (struct mapid_res), NULL, 0);
}
Exemplo n.º 28
0
static void
getent(char *argp, size_t arg_size)
{
	char			space[NSCD_LOOKUP_BUFSIZE];
	nss_pheader_t		*phdr = (nss_pheader_t *)(void *)argp;

	NSCD_ALLOC_LOOKUP_BUFFER(argp, arg_size, phdr, space, sizeof (space));

	nss_pgetent(argp, arg_size);

	NSCD_SET_RETURN_ARG(phdr, arg_size);
	(void) door_return(argp, arg_size, NULL, 0);
}
Exemplo n.º 29
0
/*ARGSUSED*/
static void *
server_tsd_bind(void *arg)
{
	static void *value = 0;

	/* disable cancellation to avoid hangs if server threads disappear */
	(void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
	(void) thr_setspecific(server_key, value);
	(void) door_return(NULL, 0, NULL, 0);

	/* make lint happy */
	return (NULL);
}
Exemplo n.º 30
0
void
nfscmd_func(void *cookie, char *dataptr, size_t arg_size,
	door_desc_t *dp, uint_t n_desc)
{
	nfscmd_arg_t	*args;

	args = (nfscmd_arg_t *)dataptr;

	switch (args->version) {
	case NFSCMD_VERS_1:
		nfscmd_vers_1(dp, args, arg_size);
		break;
	default:
		syslog(LOG_ERR, gettext("Invalid nfscmd version"));
		break;
	}

	(void) door_return((caddr_t)args, sizeof (nfscmd_res_t), NULL, 0);
	(void) door_return(NULL, 0, NULL, 0);
	/* NOTREACHED */

}