smb_api_door_calls.c revision 29bd28862cfb8abbd3a0f0a4b17e08bbc3652836
/*
* 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.
*/
/*
* Door calls invoked by CLIs to obtain various SMB door service provided
* by SMB daemon.
*/
#include <fcntl.h>
#include <syslog.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <smbsrv/wintypes.h>
#include <smbsrv/smb_door_svc.h>
#include <smbsrv/smb_common_door.h>
/*
* smb_lookup_sid
*
* Tries to get the account name associated with the given SID
* The mapping is requested to be performed by smbd via a door
* call. If no account name can be found the string format of
* the SID will be returned as the name.
*
* The passed namebuf should be big enough to hold the string
* format of a SID.
*/
int
{
char *buf;
int opcode = SMB_DR_LOOKUP_SID;
int fd;
if (!smb_sid_isvalid(sid))
return (NT_STATUS_INVALID_SID);
/* returning string SID */
return (NT_STATUS_SUCCESS);
}
/* returning string SID */
return (NT_STATUS_SUCCESS);
}
}
if (name) {
if (*name != '\0')
}
return (NT_STATUS_SUCCESS);
}
/*
* smb_lookup_name
*
* Tries to get the SID associated with the given account name
* The mapping is requested to be performed by smbd via a door
* call. If no SID can be found NT_STATUS_NONE_MAPPED is returned.
*/
int
{
char *buf;
int opcode = SMB_DR_LOOKUP_NAME;
char *p;
int fd;
if (*name == '\0')
return (NT_STATUS_NONE_MAPPED);
return (NT_STATUS_INTERNAL_ERROR);
return (NT_STATUS_INTERNAL_ERROR);
}
}
return (NT_STATUS_INTERNAL_ERROR);
if (p == NULL) {
return (NT_STATUS_NONE_MAPPED);
}
*p++ = '\0';
return (NT_STATUS_SUCCESS);
}
{
char *buf;
int opcode = SMB_DR_JOIN;
return (NT_STATUS_INVALID_PARAMETER);
return (NT_STATUS_INTERNAL_ERROR);
return (NT_STATUS_INTERNAL_ERROR);
}
if (rc != 0)
} else {
}
return (status);
}
/*
* Gets information about the Domain Controller in the joined resource domain.
*
* Returns: NT_STATUS_SUCCESS if the successful in getting
* domain information.
*/
{
char *buf;
int opcode = SMB_DR_GET_DCINFO;
int fd;
struct hostent *h;
int error_num;
*namebuf = '\0';
return (NT_STATUS_INTERNAL_ERROR);
return (NT_STATUS_INTERNAL_ERROR);
}
}
if (srvname) {
} else {
freehostent(h);
}
}
return (NT_STATUS_SUCCESS);
}
{
return (FALSE);
return (FALSE);
return (FALSE);
return (FALSE);
return (TRUE);
}
/*
* Parameters:
* fqdn (input) - fully-qualified domain name
* srvbuf (output) - fully-qualified hostname of the AD server found
* by this function.
* srvbuflen (input) - length of the 'buf'
*
* Return:
* B_TRUE if an AD server is found. Otherwise, returns B_FALSE;
*
* The buffer passed in should be big enough to hold a fully-qualified
* hostname (MAXHOSTNAMELEN); otherwise, a truncated string will be
* returned. On error, an empty string will be returned.
*/
{
char *buf;
int opcode = SMB_DR_ADS_FIND_HOST;
int fd;
if (!srvbuf)
return (B_FALSE);
*srvbuf = '\0';
if (!fqdn)
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
}
if (*server != '\0') {
}
}
}
return (found);
}