smb_idmap.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.
*/
#include <strings.h>
#include <synch.h>
#define SMB_IDMAP_STATE_INIT 1
#define SMB_IDMAP_STATE_FINI 2
typedef struct smb_idmap_handle {
int sih_state;
static smb_idmap_handle_t smb_idmaph;
/*
* smb_idmap_start
*
* This function initializes the idmap client handle. It should be called
* at startup.
*/
int
smb_idmap_start(void)
{
return (0);
}
if (stat < 0) {
return (-1);
}
return (0);
}
/*
* smb_idmap_stop
*
* This function destroys the idmap client handle. It should be called
* prior to exiting the SMB daemon.
*/
void
smb_idmap_stop(void)
{
}
}
/*
* smb_idmap_restart
*
* This function should be called when the idmap client handle
* becomes invalid.
*/
int
smb_idmap_restart(void)
{
int rc = 0;
return (-1);
}
if (stat < 0) {
rc = -1;
}
return (rc);
}
/*
* smb_idmap_getsid
*
*/
{
if (stat != IDMAP_SUCCESS)
return (stat);
if (stat != IDMAP_SUCCESS) {
return (stat);
}
if (stat != IDMAP_SUCCESS) {
return (stat);
}
return (IDMAP_SUCCESS);
}
/*
* smb_idmap_getid
*
* Tries to get a mapping for the given SID
*/
{
if (stat != IDMAP_SUCCESS)
return (stat);
if (stat != IDMAP_SUCCESS) {
return (stat);
}
if (stat != IDMAP_SUCCESS) {
return (stat);
}
return (IDMAP_SUCCESS);
}
/*
* smb_idmap_batch_create
*
* Creates and initializes the context for batch ID mapping.
*/
{
if (!sib)
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_OTHER);
}
if (stat != IDMAP_SUCCESS)
return (stat);
return (IDMAP_ERR_MEMORY);
return (IDMAP_SUCCESS);
}
/*
* smb_idmap_batch_destroy
*
* Frees the batch ID mapping context.
*/
void
{
int i;
return;
if (sib->sib_idmaph) {
}
return;
/*
* SIDs are allocated only when mapping
*/
}
}
}
/*
* smb_idmap_batch_getid
*
* Queue a request to map the given SID to a UID or GID.
*
* sim->sim_id should point to variable that's supposed to
* of this function.
* If requested ID type is known, it's passed as 'idtype',
* if it's unknown it'll be returned in sim->sim_idtype.
*/
{
char sidstr[SMB_SID_STRSZ];
int flag = 0;
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_MEMORY);
switch (idtype) {
case SMB_IDMAP_USER:
break;
case SMB_IDMAP_GROUP:
break;
case SMB_IDMAP_UNKNOWN:
break;
default:
return (IDMAP_ERR_ARG);
}
return (stat);
}
/*
* smb_idmap_batch_getsid
*
*
* sim->sim_domsid and sim->sim_rid will contain the mapping
* result upon successful process of the batched request.
*/
{
int flag = 0;
return (IDMAP_ERR_ARG);
switch (idtype) {
case SMB_IDMAP_USER:
break;
case SMB_IDMAP_GROUP:
break;
case SMB_IDMAP_EVERYONE:
/* Everyone S-1-1-0 */
break;
default:
return (IDMAP_ERR_ARG);
}
return (stat);
}
/*
* smb_idmap_batch_getmappings
*
* trigger ID mapping service to get the mappings for queued
* requests.
*
* Checks the result of all the queued requests.
*/
{
int i;
return (stat);
/*
* Check the status for all the queued requests
*/
}
}
}
if (smb_idmap_batch_binsid(sib) != 0)
return (stat);
}
/*
* smb_idmap_batch_binsid
*
* Convert sidrids to binary sids
*
* Returns 0 if successful and non-zero upon failure.
*/
static int
{
int i;
/* This operation is not required */
return (0);
return (-1);
return (-1);
}
return (0);
}