예제 #1
0
void
smb_kmod_stop(void)
{
	smb_ioc_header_t ioc;

	(void) smb_kmod_ioctl(SMB_IOC_STOP, &ioc, sizeof (ioc));
}
예제 #2
0
int
smb_kmod_setcfg(smb_kmod_cfg_t *cfg)
{
	smb_ioc_cfg_t ioc;

	ioc.maxworkers = cfg->skc_maxworkers;
	ioc.maxconnections = cfg->skc_maxconnections;
	ioc.keepalive = cfg->skc_keepalive;
	ioc.restrict_anon = cfg->skc_restrict_anon;
	ioc.signing_enable = cfg->skc_signing_enable;
	ioc.signing_required = cfg->skc_signing_required;
	ioc.oplock_enable = cfg->skc_oplock_enable;
	ioc.sync_enable = cfg->skc_sync_enable;
	ioc.secmode = cfg->skc_secmode;
	ioc.ipv6_enable = cfg->skc_ipv6_enable;
	ioc.print_enable = cfg->skc_print_enable;
	ioc.traverse_mounts = cfg->skc_traverse_mounts;
	ioc.exec_flags = cfg->skc_execflags;
	ioc.version = cfg->skc_version;

	(void) strlcpy(ioc.nbdomain, cfg->skc_nbdomain, sizeof (ioc.nbdomain));
	(void) strlcpy(ioc.fqdn, cfg->skc_fqdn, sizeof (ioc.fqdn));
	(void) strlcpy(ioc.hostname, cfg->skc_hostname, sizeof (ioc.hostname));
	(void) strlcpy(ioc.system_comment, cfg->skc_system_comment,
	    sizeof (ioc.system_comment));

	return (smb_kmod_ioctl(SMB_IOC_CONFIG, &ioc.hdr, sizeof (ioc)));
}
예제 #3
0
int
smb_kmod_event_notify(uint32_t txid)
{
	smb_ioc_event_t ioc;

	ioc.txid = txid;
	return (smb_kmod_ioctl(SMB_IOC_EVENT, &ioc.hdr, sizeof (ioc)));
}
예제 #4
0
int
smb_kmod_setgmtoff(int32_t gmtoff)
{
	smb_ioc_gmt_t ioc;

	ioc.offset = gmtoff;
	return (smb_kmod_ioctl(SMB_IOC_GMTOFF, &ioc.hdr,
	    sizeof (ioc)));
}
예제 #5
0
int
smb_kmod_start(int opipe, int lmshr, int udoor)
{
	smb_ioc_start_t ioc;

	ioc.opipe = opipe;
	ioc.lmshrd = lmshr;
	ioc.udoor = udoor;
	return (smb_kmod_ioctl(SMB_IOC_START, &ioc.hdr, sizeof (ioc)));
}
예제 #6
0
int
smb_kmod_file_close(uint32_t uniqid)
{
	smb_ioc_fileid_t ioc;
	int rc;

	bzero(&ioc, sizeof (ioc));
	ioc.uniqid = uniqid;

	rc = smb_kmod_ioctl(SMB_IOC_FILE_CLOSE, &ioc.hdr, sizeof (ioc));
	return (rc);
}
예제 #7
0
/*
 * A NULL pointer is a wildcard indicator, which we pass on
 * as an empty string (by virtue of the bzero).
 */
int
smb_kmod_session_close(const char *client, const char *username)
{
	smb_ioc_session_t ioc;
	int rc;

	bzero(&ioc, sizeof (ioc));

	if (client != NULL)
		(void) strlcpy(ioc.client, client, MAXNAMELEN);
	if (username != NULL)
		(void) strlcpy(ioc.username, username, MAXNAMELEN);

	rc = smb_kmod_ioctl(SMB_IOC_SESSION_CLOSE, &ioc.hdr, sizeof (ioc));
	return (rc);
}
예제 #8
0
int
smb_kmod_get_spool_doc(uint32_t *spool_num, char *username,
    char *path, smb_inaddr_t *ipaddr)
{
	smb_ioc_spooldoc_t ioc;
	int rc;

	bzero(&ioc, sizeof (ioc));
	rc = smb_kmod_ioctl(SMB_IOC_SPOOLDOC, &ioc.hdr, sizeof (ioc));
	if (rc == 0) {
		*spool_num = ioc.spool_num;
		(void) strlcpy(username, ioc.username, MAXNAMELEN);
		(void) strlcpy(path, ioc.path, MAXPATHLEN);
		*ipaddr = ioc.ipaddr;
	}
	return (rc);
}
예제 #9
0
int
smb_kmod_shareinfo(char *shrname, boolean_t *shortnames)
{
	smb_ioc_shareinfo_t ioc;
	int rc;

	bzero(&ioc, sizeof (ioc));
	(void) strlcpy(ioc.shrname, shrname, MAXNAMELEN);

	rc = smb_kmod_ioctl(SMB_IOC_SHAREINFO, &ioc.hdr, sizeof (ioc));
	if (rc == 0)
		*shortnames = ioc.shortnames;
	else
		*shortnames = B_TRUE;

	return (rc);
}
예제 #10
0
int
smb_kmod_get_open_num(smb_opennum_t *opennum)
{
	smb_ioc_opennum_t ioc;
	int rc;

	bzero(&ioc, sizeof (ioc));
	ioc.qualtype = opennum->qualtype;
	(void) strlcpy(ioc.qualifier, opennum->qualifier, MAXNAMELEN);

	rc = smb_kmod_ioctl(SMB_IOC_NUMOPEN, &ioc.hdr, sizeof (ioc));
	if (rc == 0) {
		opennum->open_users = ioc.open_users;
		opennum->open_trees = ioc.open_trees;
		opennum->open_files = ioc.open_files;
	}

	return (rc);
}
예제 #11
0
/* ARGSUSED */
int
smb_kmod_start(int opipe, int lmshr, int udoor)
{
	smb_ioc_start_t ioc;
	int rc;

	bzero(&ioc, sizeof (ioc));

	/* These three are unused */
	ioc.opipe = -1;
	ioc.lmshrd = -1;
	ioc.udoor = -1;

	/* These are the "door" dispatch callbacks */
	ioc.lmshr_func = NULL; /* not used */
	ioc.opipe_func = NULL; /* not used */
	ioc.udoor_func = (void *)fksmbd_door_dispatch;

	rc = smb_kmod_ioctl(SMB_IOC_START, &ioc.hdr, sizeof (ioc));
	return (rc);
}
예제 #12
0
/* See also: smbsrv smb_server_store_cfg */
int
smb_kmod_setcfg(smb_kmod_cfg_t *cfg)
{
	smb_ioc_cfg_t ioc;

	ioc.maxworkers = cfg->skc_maxworkers;
	ioc.maxconnections = cfg->skc_maxconnections;
	ioc.keepalive = cfg->skc_keepalive;
	ioc.restrict_anon = cfg->skc_restrict_anon;
	ioc.signing_enable = cfg->skc_signing_enable;
	ioc.signing_required = cfg->skc_signing_required;
	ioc.oplock_enable = cfg->skc_oplock_enable;
	ioc.sync_enable = cfg->skc_sync_enable;
	ioc.secmode = cfg->skc_secmode;
	ioc.netbios_enable = cfg->skc_netbios_enable;
	ioc.ipv6_enable = cfg->skc_ipv6_enable;
	ioc.print_enable = cfg->skc_print_enable;
	ioc.traverse_mounts = cfg->skc_traverse_mounts;
	ioc.smb2_enable = cfg->skc_smb2_enable;
	ioc.exec_flags = cfg->skc_execflags;
	ioc.negtok_len = cfg->skc_negtok_len;
	ioc.version = cfg->skc_version;
	ioc.initial_credits = cfg->skc_initial_credits;
	ioc.maximum_credits = cfg->skc_maximum_credits;

	(void) memcpy(ioc.machine_uuid, cfg->skc_machine_uuid, sizeof (uuid_t));
	(void) memcpy(ioc.negtok, cfg->skc_negtok, sizeof (ioc.negtok));
	(void) memcpy(ioc.native_os, cfg->skc_native_os,
	    sizeof (ioc.native_os));
	(void) memcpy(ioc.native_lm, cfg->skc_native_lm,
	    sizeof (ioc.native_lm));

	(void) strlcpy(ioc.nbdomain, cfg->skc_nbdomain, sizeof (ioc.nbdomain));
	(void) strlcpy(ioc.fqdn, cfg->skc_fqdn, sizeof (ioc.fqdn));
	(void) strlcpy(ioc.hostname, cfg->skc_hostname, sizeof (ioc.hostname));
	(void) strlcpy(ioc.system_comment, cfg->skc_system_comment,
	    sizeof (ioc.system_comment));

	return (smb_kmod_ioctl(SMB_IOC_CONFIG, &ioc.hdr, sizeof (ioc)));
}
예제 #13
0
int
smb_kmod_unshare(nvlist_t *shrlist)
{
	smb_ioc_share_t *ioc;
	uint32_t ioclen;
	char *shrbuf = NULL;
	size_t bufsz;
	int rc = ENOMEM;

	if ((rc = nvlist_pack(shrlist, &shrbuf, &bufsz, NV_ENCODE_XDR, 0)) != 0)
		return (rc);

	ioclen = sizeof (smb_ioc_share_t) + bufsz;

	if ((ioc = malloc(ioclen)) != NULL) {
		ioc->shrlen = bufsz;
		bcopy(shrbuf, ioc->shr, bufsz);
		rc = smb_kmod_ioctl(SMB_IOC_UNSHARE, &ioc->hdr, ioclen);
		free(ioc);
	}

	free(shrbuf);
	return (rc);
}
예제 #14
0
/*
 * Enumerate users, connections or files.
 */
int
smb_kmod_enum(smb_netsvc_t *ns)
{
	smb_ioc_svcenum_t	*ioc;
	uint32_t		ioclen;
	smb_svcenum_t		*svcenum;
	smb_netsvcitem_t	*items;
	smb_netuserinfo_t	*user;
	smb_netconnectinfo_t	*tree;
	smb_netfileinfo_t	*ofile;
	uint8_t			*data;
	uint32_t		len;
	uint32_t		se_type;
	uint_t			nbytes;
	int			i;
	int			rc;

	ioc = ns->ns_ioc;
	ioclen = ns->ns_ioclen;
	rc = smb_kmod_ioctl(SMB_IOC_SVCENUM, &ioc->hdr, ioclen);
	if (rc != 0)
		return (rc);

	svcenum = &ioc->svcenum;
	items = calloc(svcenum->se_nitems, sizeof (smb_netsvcitem_t));
	if (items == NULL)
		return (ENOMEM);

	ns->ns_items = items;
	se_type = ns->ns_ioc->svcenum.se_type;
	data = svcenum->se_buf;
	len = svcenum->se_bused;

	for (i = 0; i < svcenum->se_nitems; ++i) {
		switch (se_type) {
		case SMB_SVCENUM_TYPE_USER:
			user = &items->nsi_un.nsi_user;
			rc = smb_netuserinfo_decode(user, data, len, &nbytes);
			break;
		case SMB_SVCENUM_TYPE_TREE:
			tree = &items->nsi_un.nsi_tree;
			rc = smb_netconnectinfo_decode(tree, data, len,
			    &nbytes);
			break;
		case SMB_SVCENUM_TYPE_FILE:
			ofile = &items->nsi_un.nsi_ofile;
			rc = smb_netfileinfo_decode(ofile, data, len, &nbytes);
			break;
		default:
			rc = -1;
			break;
		}

		if (rc != 0)
			return (EINVAL);

		list_insert_tail(&ns->ns_list, items);

		++items;
		data += nbytes;
		len -= nbytes;
	}

	return (0);
}