smb_api_door_calls.c revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Door calls invoked by CLIs to obtain various SMB door service provided
* by SMB daemon.
*/
#include <syslog.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <smbsrv/wintypes.h>
#include <smbsrv/smb_door_svc.h>
#include <smbsrv/smb_common_door.h>
/* indexed via opcode (smb_dr_opcode_t) */
char *smbapi_desc[] = {
"",
"",
"",
"",
"SmbapiUserList",
"SmbGroupAdd",
"SmbGroupDelete",
"SmbGroupAddMember",
"SmbGroupRemoveMember",
"SmbGroupGetCount",
"SmbGroupGetCacheSize",
"SmbGroupModify",
"SmbGroupPresentablePrivNum",
"SmbGroupPresentablePriv",
"SmbGroupGetPriv",
"SmbGroupSetPriv",
"SmbGroupListGroups",
"SmbGroupListMembers",
"SmbGroupMembersCount",
0
};
/*
* This function will return information on the connected users
* starting at the given offset.
*
* At most 50 users (i.e. SMB_DR_MAX_USER) will be returned via this
* function. Multiple calls might be needed to obtain all connected
* users.
*
* smb_dr_ulist_free must be called to free memory allocated for the
* account and workstation fields of each user in the returned list.
*/
int
{
int rc = -1;
int fd;
if (!buf)
return (-1);
return (-1);
if (rbufp) {
}
return (rc);
}
/* Routines for SMB Group Door Client APIs */
{
int opcode = SMB_DR_GROUP_ADD;
int fd;
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
xdr_ntgrp_dr_arg_t, &buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
smb_group_delete(char *gname)
{
int opcode = SMB_DR_GROUP_DELETE;
int fd;
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_MEMBER_ADD;
int fd;
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
&buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_MEMBER_REMOVE;
int fd;
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
&buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
smb_group_count(int *cnt)
{
int fd;
if (cnt == 0) {
return (NT_STATUS_INVALID_PARAMETER);
}
*cnt = 0;
return (NT_STATUS_INTERNAL_ERROR);
return (NT_STATUS_INVALID_PARAMETER);
}
/* Decode Result */
if (rbufp) {
return (NT_STATUS_INVALID_PARAMETER);
}
}
return (rc);
}
smb_group_cachesize(int *sz)
{
int fd;
if (sz == 0) {
return (NT_STATUS_INVALID_PARAMETER);
}
*sz = 0;
return (NT_STATUS_INTERNAL_ERROR);
return (NT_STATUS_INVALID_PARAMETER);
}
/* Decode Result */
if (rbufp) {
return (NT_STATUS_INVALID_PARAMETER);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_MODIFY;
int fd;
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
&buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
smb_group_priv_num(int *num)
{
int opcode = SMB_DR_GROUP_PRIV_NUM;
int fd;
if (num == 0) {
return (NT_STATUS_INVALID_PARAMETER);
}
*num = 0;
return (NT_STATUS_INTERNAL_ERROR);
return (NT_STATUS_INVALID_PARAMETER);
}
/* Decode Result */
if (rbufp) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_PRIV_LIST;
int fd;
return (NT_STATUS_INTERNAL_ERROR);
return (NT_STATUS_INVALID_PARAMETER);
}
/* Decode Result */
if (rbufp) {
if ((*list = smb_dr_decode_grp_privlist(
rbufsize - SMB_DR_DATA_OFFSET)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_PRIV_GET;
int fd;
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
&buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
&retval) != 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_PRIV_SET;
int fd;
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
&buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_LIST;
int fd;
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
&buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
rbufsize - SMB_DR_DATA_OFFSET)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_MEMBER_LIST;
int fd;
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_NO_MEMORY);
}
&buflen)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if (rbufp) {
if ((*members = smb_dr_decode_grp_memberlist(
rbufsize - SMB_DR_DATA_OFFSET)) == 0) {
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (rc);
}
{
int opcode = SMB_DR_GROUP_MEMBER_COUNT;
int fd;
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INTERNAL_ERROR);
/* Encode */
return (NT_STATUS_INTERNAL_ERROR);
}
/* Decode Result. */
if ((dec_args = (ntgrp_dr_arg_t *)
malloc(sizeof (ntgrp_dr_arg_t))) == 0) {
return (NT_STATUS_NO_MEMORY);
}
if (rbufp) {
!= 0) {
}
}
return (rc);
}
/* Helper functions for local group door service to free up data structures */
void
{
int i;
if (!list)
return;
}
}
if (deletelist)
}
}
void
{
int i;
if (!list) {
return;
}
}
if (!entries_only)
}
void
int entries_only)
{
int i;
if (!members) {
return;
}
}
if (!entries_only)
}