smb_api_door_calls.c revision fe1c642d06e14b412cd83ae2179303186ab08972
/*
* 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>
/*
* Given a SID, make a door call to get the associated name.
*
* Returns 0 if the door call is successful, otherwise -1.
*
* If 0 is returned, the lookup result will be available in a_status.
* NT_STATUS_SUCCESS The SID was mapped to a name.
* NT_STATUS_NONE_MAPPED The SID could not be mapped to a name.
*/
int
{
char *buf;
int opcode = SMB_DR_LOOKUP_SID;
int fd;
int rc;
return (-1);
return (-1);
}
}
return (rc);
}
/*
* Given a name, make a door call to get the associated SID.
*
* Returns 0 if the door call is successful, otherwise -1.
*
* If 0 is returned, the lookup result will be available in a_status.
* NT_STATUS_SUCCESS The name was mapped to a SID.
* NT_STATUS_NONE_MAPPED The name could not be mapped to a SID.
*/
int
{
char tmp[MAXNAMELEN];
char *buf;
int opcode = SMB_DR_LOOKUP_NAME;
int fd;
int rc;
} else {
}
return (-1);
return (-1);
}
}
return (rc);
}
{
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);
}