/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <string.h>
#include <strings.h>
#include <syslog.h>
#include <errno.h>
#include <libshare.h>
#include <smbsrv/smb_share.h>
static struct {
char *value;
} cscopt[] = {
{ "disabled", SMB_SHRF_CSC_DISABLED },
{ "manual", SMB_SHRF_CSC_MANUAL },
{ "auto", SMB_SHRF_CSC_AUTO },
{ "vdo", SMB_SHRF_CSC_VDO }
};
nvlist_t **);
/*
* Sends the given share definition to libshare
* to be exported.
*/
{
int status;
int rc;
return (status);
return (ERROR_NOT_ENOUGH_MEMORY);
return (status);
}
return (smb_share_lmerr(rc));
}
/*
* Asks smbsrv to remove the specified share
*/
{
int rc;
if (share_name == NULL)
return (NERR_NetNameNotFound);
return (ERROR_NOT_ENOUGH_MEMORY);
return (ERROR_NOT_ENOUGH_MEMORY);
}
return (status);
}
return (smb_share_lmerr(rc));
}
smb_share_count(void)
{
return (smb_kmod_share_count(SMB_SHARENUM_FLAG_ALL));
}
/*
* Return B_TRUE if the share exists. Otherwise return B_FALSE.
*/
{
}
/*
* Lookup a share by path. The path can be the empty string.
*
* If the share-info pointer is non-null, the share data is returned in si.
*
* If the share-info is null, the share is still looked up and the result
* indicates whether or not the path is shared.
*/
{
return (NERR_NetNameNotFound);
}
/*
* Lookup a share by name.
*
* If the share-info pointer is non-null, the share data is returned in si.
*
* If the share-info is null, the share is still looked up and the result
* indicates whether or not a share with the specified name exists.
*/
{
return (NERR_NetNameNotFound);
return (NERR_NetNameNotFound);
}
void
{
return;
}
/*
* Return the option name for the first CSC flag (there should be only
* one) encountered in the share flags.
*/
char *
{
int i;
}
return (NULL);
}
/*
* Map a client-side caching (CSC) option to the appropriate share
* flag. Only one option is allowed; an error will be logged if
* multiple options have been specified. We don't need to do anything
* about multiple values here because the SRVSVC will not recognize
* a value containing multiple flags and will return the default value.
*
* If the option value is not recognized, it will be ignored: invalid
* values will typically be caught and rejected by sharemgr.
*/
void
{
int i;
break;
}
}
case 0:
case SMB_SHRF_CSC_DISABLED:
case SMB_SHRF_CSC_MANUAL:
case SMB_SHRF_CSC_AUTO:
case SMB_SHRF_CSC_VDO:
break;
default:
break;
}
}
/*
* Check that the client-side caching (CSC) option value is valid.
*/
{
int i;
return (B_TRUE);
}
return (B_FALSE);
}
/*
* Converts libshare error codes to Win32 error codes.
*/
{
switch (sa_err) {
case SA_OK:
return (NERR_Success);
case SA_SHARE_NOT_FOUND:
return (NERR_NetNameNotFound);
case SA_NO_MEMORY:
return (ERROR_NOT_ENOUGH_MEMORY);
case SA_DUPLICATE_NAME:
return (NERR_DuplicateShare);
default:
break;
}
return (NERR_InternalError);
}
/*
* This function converts the given smb_share_t
* structure to the nvlist share format.
*/
static uint32_t
{
char *csc;
int rc = 0;
char *mntpnt;
return (ERROR_NOT_ENOUGH_MEMORY);
/*
* add global share properties to share nvlist
* start with share description
*/
!= SA_OK) {
return (smb_share_lmerr(rc));
}
}
/*
* Now add the mount point, derived from path
*/
return (ERROR_NOT_ENOUGH_MEMORY);
}
/* could not resolve mntpnt use "" */
return (ERROR_NOT_ENOUGH_MEMORY);
}
}
return (ERROR_NOT_ENOUGH_MEMORY);
}
/*
* Now add protocol specific properties
* These are stored in an embedded nvlist
*/
!= SA_OK) {
return (smb_share_lmerr(rc));
}
return (NERR_InternalError);
}
if (si->shr_container)
si->shr_container);
if (si->shr_access_none)
if (si->shr_access_ro)
si->shr_access_ro);
if (si->shr_access_rw)
si->shr_access_rw);
}
if (rc != 0) {
return (ERROR_NOT_ENOUGH_MEMORY);
}
}
return (ERROR_SUCCESS);
}