netdfs.c revision 8d7e41661dc4633488e93b13363137523ce59977
/*
* 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
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Net DFS server side RPC service.
*/
#include <strings.h>
#include <string.h>
#include <smbsrv/libmlrpc.h>
typedef struct {
char *server;
char *share;
char *path;
char *buf;
} netdfs_unc_t;
static int netdfs_unc_parse(ndr_xa_t *, const char *,
netdfs_unc_t *);
static int netdfs_s_getver(void *, ndr_xa_t *);
static int netdfs_s_add(void *, ndr_xa_t *);
static int netdfs_s_remove(void *, ndr_xa_t *);
static int netdfs_s_setinfo(void *, ndr_xa_t *);
static int netdfs_s_getinfo(void *, ndr_xa_t *);
static int netdfs_s_enum(void *, ndr_xa_t *);
static int netdfs_s_move(void *, ndr_xa_t *);
static int netdfs_s_rename(void *, ndr_xa_t *);
static int netdfs_s_addstdroot(void *, ndr_xa_t *);
static int netdfs_s_remstdroot(void *, ndr_xa_t *);
static int netdfs_s_enumex(void *, ndr_xa_t *);
static ndr_stub_table_t netdfs_stub_table[] = {
{ netdfs_s_add, NETDFS_OPNUM_ADD },
{0}
};
static ndr_service_t netdfs_service = {
"NETDFS", /* name */
"DFS", /* desc */
"\\dfs", /* endpoint */
PIPE_NTSVCS, /* sec_addr_port */
0, /* no bind_instance_size */
0, /* no bind_req() */
0, /* no unbind_and_close() */
0, /* use generic_call_stub() */
netdfs_stub_table /* stub_table */
};
/*
* Register the NETDFS RPC interface with the RPC runtime library.
* The service must be registered in order to use either the client
* side or the server side functions.
*/
void
netdfs_initialize(void)
{
(void) ndr_svc_register(&netdfs_service);
}
/*
* Return the version.
*
* We have to indicate that we emulate a Windows 2003 Server or the
* client will not use the EnumEx RPC and this would limit support
* to a single DFS root.
*/
/*ARGSUSED*/
static int
{
return (NDR_DRC_OK);
}
/*
* Add a new volume or additional storage for an existing volume at
* dfs_path.
*/
static int
{
return (NDR_DRC_OK);
}
} else {
}
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* netdfs_s_remove
*
* Remove a volume or additional storage for volume from the DFS at
* dfs_path. When applied to the last storage in a volume, removes
* the volume from the DFS.
*/
static int
{
return (NDR_DRC_OK);
}
} else {
}
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* Set information about the volume or storage. If the server and share
* are specified, the information set is specific to that server and
* share. Otherwise the information is specific to the volume as a whole.
*
* Valid levels are 100-102.
*/
/*ARGSUSED*/
static int
{
return (NDR_DRC_OK);
}
} else {
}
return (NDR_DRC_OK);
}
case 100:
case 101:
case 102:
break;
default:
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* Get information about the volume or storage. If the server and share
* are specified, the information returned is specific to that server
* and share. Otherwise the information is specific to the volume as a
* whole.
*
* Valid levels are 1-4, 100-104.
*/
/*ARGSUSED*/
static int
{
return (NDR_DRC_OK);
}
} else {
}
return (NDR_DRC_OK);
}
case 1:
case 2:
case 3:
case 4:
case 100:
case 101:
case 102:
case 103:
case 104:
break;
default:
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* Get information about all of the volumes in the DFS. dfs_name is
* the "server" part of the UNC name used to refer to this particular
* DFS.
*
* Valid levels are 1-3.
*/
/*ARGSUSED*/
static int
{
case 1:
case 2:
case 3:
break;
default:
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* Move a DFS volume and all subordinate volumes from one place in the
* DFS to another place in the DFS.
*/
/*ARGSUSED*/
static int
{
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* Rename the current path in a DFS to a new path in the same DFS.
*/
/*ARGSUSED*/
static int
{
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* Add a DFS root share.
*/
/*ARGSUSED*/
static int
{
return (NDR_DRC_OK);
}
/*
* Remove a DFS root share.
*/
/*ARGSUSED*/
static int
{
return (NDR_DRC_OK);
}
/*
* Get information about all of the volumes in the DFS. dfs_path is
* the "server" part of the UNC name used to refer to this particular
* DFS.
*
* Valid levels are 1-3, 300.
*/
static int
{
return (NDR_DRC_OK);
}
if (param->resume_handle)
*(param->resume_handle) = 0;
} else {
}
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* Parse a UNC path (\\server\share\path) into components.
* Path separators are converted to forward slashes.
*
* Returns 0 on success, otherwise -1 to indicate an error.
*/
static int
{
char *p;
return (-1);
return (-1);
*p = '\0';
*p = '\0';
}
}
*p = '\0';
}
}
if (*(--p) == '/')
*p = '\0';
}
}
return (0);
}