idmap_lsa.c revision b3700b074e637f8c6991b70754c88a2cfffb246b
/*
* 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.
*/
/*
* LSA lookups
*/
#include <stdio.h>
#include <note.h>
#include <assert.h>
#include "idmapd.h"
#include "libsmb.h"
{
case SidTypeUser:
case SidTypeComputer:
case SidTypeDomain:
case SidTypeDeletedAccount:
case SidTypeUnknown:
case SidTypeLabel:
*ret_type = IDMAP_USID;
return (IDMAP_SUCCESS);
case SidTypeGroup:
case SidTypeAlias:
case SidTypeWellKnownGroup:
*ret_type = IDMAP_GSID;
return (IDMAP_SUCCESS);
case SidTypeNull:
case SidTypeInvalid:
default:
"LSA lookup: bad type %d for %s@%s",
return (IDMAP_ERR_OTHER);
}
}
/* Given SID, look up name and type */
const char *sidprefix,
char **ret_name,
char **ret_domain,
{
int rc;
*ret_domain = NULL;
if (rc != 0) {
"Check connectivity to Active Directory.");
goto out;
}
goto out;
}
"Warning: smb_lookup_sid(%s) failed (0x%x)",
/* Fail soft */
goto out;
}
if (ret != IDMAP_SUCCESS)
goto out;
goto out;
}
if (*ret_domain == NULL) {
goto out;
}
ret = IDMAP_SUCCESS;
out:
if (ret != IDMAP_SUCCESS) {
free(*ret_domain);
*ret_domain = NULL;
}
return (ret);
}
/* Given name and optional domain, look up SID, type, and canonical name */
const char *name,
const char *domain,
char **ret_sidprefix,
char **ret_name,
char **ret_domain,
{
int rc;
*ret_sidprefix = NULL;
if (ret_domain != NULL)
*ret_domain = NULL;
else
goto out;
}
if (rc != 0) {
"Check connectivity to Active Directory.");
goto out;
}
goto out;
}
"Warning: smb_lookup_name(%s) failed (0x%x)",
/* Fail soft */
goto out;
}
if (*ret_sidprefix == NULL) {
goto out;
}
if (ret != IDMAP_SUCCESS)
goto out;
goto out;
}
}
if (ret_domain != NULL) {
if (*ret_domain == NULL) {
goto out;
}
}
ret = IDMAP_SUCCESS;
out:
if (ret != IDMAP_SUCCESS) {
}
if (ret_domain != NULL) {
free(*ret_domain);
*ret_domain = NULL;
}
*ret_sidprefix = NULL;
}
return (ret);
}
/*
* This exists just so we can avoid exposing all of idmapd to libsmb.h.
* Like the above functions, it's a door call over to smbd.
*/
void
notify_dc_changed(void)
{
}