/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#include <ctype.h>
#include <synch.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <assert.h>
#include <smbsrv/libmlrpc.h>
/*
* Global list of allocated handles. Handles are used in various
* server-side RPC functions: typically, issued when a service is
* opened and obsoleted when it is closed. Clients should treat
* handles as opaque data.
*/
/*
* Table of registered services.
*/
/*
* Register a service.
*
* Returns:
* 0 Success
* -1 Duplicate service
* -2 Duplicate name
* -3 Table overflow
*/
int
{
ndr_service_t *p;
int i;
for (i = 0; i < NDR_MAX_SERVICES; i++) {
if ((p = ndr_services[i]) == NULL) {
if (free_slot < 0)
free_slot = i;
continue;
}
if (p == svc)
return (-1);
return (-2);
}
if (free_slot < 0)
return (-3);
return (0);
}
void
{
int i;
for (i = 0; i < NDR_MAX_SERVICES; i++) {
if (ndr_services[i] == svc)
ndr_services[i] = NULL;
}
}
{
return (ste);
}
return (NULL);
}
{
int i;
for (i = 0; i < NDR_MAX_SERVICES; i++) {
continue;
continue;
return (svc);
}
return (NULL);
}
{
int i;
if (as_uuid)
if (ts_uuid)
for (i = 0; i < NDR_MAX_SERVICES; i++) {
continue;
if (as_uuid) {
if (svc->abstract_syntax_uuid == 0)
continue;
continue;
continue;
}
if (ts_uuid) {
if (svc->transfer_syntax_uuid == 0)
continue;
continue;
continue;
}
return (svc);
}
ndo_printf(0, 0, "ndr_svc_lookup_uuid: unknown service");
ndo_printf(0, 0, "abstract=%s v%d, transfer=%s v%d",
return (NULL);
}
/*
* Allocate a handle for use with the server-side RPC functions.
*
* An arbitrary caller context can be associated with the handle
* via data; it will not be dereferenced by the handle API.
*/
{
return (NULL);
}
(void) mutex_lock(&ndr_handle_lock);
(void) mutex_unlock(&ndr_handle_lock);
}
/*
* Remove a handle from the global list and free it.
*/
void
{
(void) mutex_lock(&ndr_handle_lock);
pphd = &ndr_handle_list;
while (*pphd) {
}
break;
}
}
(void) mutex_unlock(&ndr_handle_lock);
}
/*
* Lookup a handle by id. If the handle is in the list and it matches
* the specified service, a pointer to it is returned. Otherwise a null
* pointer is returned.
*/
{
(void) mutex_lock(&ndr_handle_lock);
while (hd) {
break;
(void) mutex_unlock(&ndr_handle_lock);
return (hd);
}
}
(void) mutex_unlock(&ndr_handle_lock);
return (NULL);
}
/*
* Called when a pipe is closed to release any associated handles.
*/
void
{
(void) mutex_lock(&ndr_handle_lock);
pphd = &ndr_handle_list;
while (*pphd) {
if (hd->nh_data_free)
continue;
}
}
(void) mutex_unlock(&ndr_handle_lock);
}
/*
* Convert a UUID to a string.
*/
void
{
}
/*
* Convert a string to a UUID.
*/
int
{
char *p = in;
char *q;
int i;
return (-1);
if (*p != '-')
return (-1);
p++;
if (*p != '-')
return (-1);
p++;
if (*p != '-')
return (-1);
p++;
for (i = 0; i < 8; i++) {
if (*p == '-')
p++;
if (p[0] == 0 || p[1] == 0)
return (-1);
buf[0] = *p++;
buf[1] = *p++;
buf[2] = 0;
if (*q != 0)
return (-1);
}
if (*p != 0)
return (-1);
return (0);
}
void
int n_pool)
{
int ix;
}
}
{
break;
}
return (mbind);
}
{
break;
}
return (mbind);
}
/*
* Move bytes between a buffer and a uio structure.
* The transfer direction is controlled by rw:
* UIO_READ: transfer from buf to uio
* UIO_WRITE: transfer from uio to buf
*
* Returns the number of bytes moved.
*/
{
uio->uio_iovcnt--;
continue;
}
if (reading)
else
}
return (nxfer);
}