/*
* 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 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
* SMB server interface to idmap
* (smb_idmap_get..., smb_idmap_batch_...)
*
* There are three implementations of this interface:
* uts/common/fs/smbsrv/smb_idmap.c (smbsrv kmod)
* lib/smbsrv/libfksmbsrv/common/fksmb_idmap.c (libfksmbsrv)
* lib/smbsrv/libsmb/common/smb_idmap.c (libsmb)
*
* There are enough differences (relative to the code size)
* that it's more trouble than it's worth to merge them.
*
* This one differs from the others in that it:
* calls idmap interfaces (libidmap)
* domain SIDs returned are allocated
*/
#include <syslog.h>
#include <strings.h>
/*
* Report an idmap error.
*/
void
{
if (stat != IDMAP_SUCCESS) {
if (s == NULL)
s = "smb_idmap_check";
}
}
/*
* smb_idmap_getsid
*
* Allocates ->sim_domsid
*/
{
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);
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.
*/
{
int flag = 0;
return (IDMAP_ERR_ARG);
return (IDMAP_ERR_SID);
switch (idtype) {
case SMB_IDMAP_USER:
break;
case SMB_IDMAP_GROUP:
break;
case SMB_IDMAP_UNKNOWN:
break;
default:
break;
}
/* This was copied by idmap_get_Xbysid. */
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.
* NB: sim_domsid allocated by strdup, here or in libidmap
*/
{
int flag = 0;
return (IDMAP_ERR_ARG);
switch (idtype) {
case SMB_IDMAP_USER:
break;
case SMB_IDMAP_GROUP:
break;
case SMB_IDMAP_OWNERAT:
/* Current Owner S-1-5-32-766 */
break;
case SMB_IDMAP_GROUPAT:
/* Current Group S-1-5-32-767 */
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);
}