/*
* 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 <malloc.h>
#include <synch.h>
#include <syslog.h>
#include <pthread.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <assert.h>
#include "ad_common.h"
static void
{
}
}
}
static int
{
return (-1);
NULL);
return (0);
}
static int
{
int i;
return (0);
return (-1);
if (adutils_add_ds(new,
return (-1);
}
}
return (0);
}
static
int
{
return (0);
return (0);
}
if (*value)
return (1);
}
static
int
{
&props) < 0)
return (-1);
&props.domain_controller)) {
}
return (0);
}
static void
{
}
}
static nssad_cfg_t *
{
return (NULL);
return (NULL);
}
goto errout;
goto errout;
goto errout;
goto errout;
return (cp);
return (NULL);
}
int
{
char c;
c = *name;
switch (c) {
case '*':
case '(':
case ')':
case '\\':
return (-1);
*filter_name++ = '\\';
break;
default:
return (-1);
*filter_name++ = c;
break;
}
}
if (end <= filter_name)
return (-1);
*filter_name = '\0';
return (0);
}
static
{
if (adrc == ADUTILS_SUCCESS)
return ((nss_status_t)NSS_SUCCESS);
if (adrc == ADUTILS_ERR_NOTFOUND)
errno = 0;
return ((nss_status_t)NSS_NOTFOUND);
}
/* ARGSUSED */
{
int stat;
/*
* This suggests that the process (e.g. nscd) expects
* nssad to return the data in native file format in
* argp->buf.buffer i.e. no need to marshall the data.
*/
return ((nss_status_t)NSS_STR_PARSE_SUCCESS);
}
return ((nss_status_t)NSS_STR_PARSE_PARSE);
if (stat == NSS_STR_PARSE_SUCCESS) {
}
return ((nss_status_t)stat);
}
{
}
if (stat == NSS_STR_PARSE_SUCCESS) {
return ((nss_status_t)NSS_SUCCESS);
} else if (stat == NSS_STR_PARSE_PARSE) {
return ((nss_status_t)NSS_NOTFOUND);
} else if (stat == NSS_STR_PARSE_ERANGE) {
return ((nss_status_t)NSS_NOTFOUND);
}
return ((nss_status_t)NSS_UNAVAIL);
}
/* ARGSUSED */
static
{
/*
* Note about the queue:
*
* The queue is used to hold our per domain
* configs. The queue is limited to CFG_QUEUE_MAX_SIZE.
* If the queue increases beyond that point we toss
* out the LRU entry. The entries are inserted into
* the queue at state.qtail and the LRU entry is
* removed from state.qhead. state.qnext points
* from the qtail to the qhead. Everytime a config
* is accessed it is moved to qtail.
*/
(void) pthread_mutex_lock(&statelock);
continue;
/* Found config for the given domain. */
/*
* Move the entry to the tail of the queue.
* This way the LRU entry can be found at
* the head of the queue.
*/
}
/*
* If there are expired items in the
* config, grab the write lock and
* refresh the config.
*/
if (nssad_cfg_refresh(cp) < 0) {
(void) pthread_mutex_unlock(&statelock);
return (NULL);
}
}
/* Return the config found */
(void) pthread_mutex_unlock(&statelock);
return (cp);
}
/* Create new config entry for the domain */
(void) pthread_mutex_unlock(&statelock);
return (NULL);
}
/* Add it to the queue */
(void) pthread_mutex_unlock(&statelock);
return (cp);
}
/* If the queue has exceeded its size, remove the LRU entry */
/* Detach the lru entry and destroy */
continue;
break;
}
}
}
(void) pthread_mutex_unlock(&statelock);
return (cp);
}
/* ARGSUSED */
static
{
int retries = 0;
return ((nss_status_t)NSS_NOTFOUND);
if (rc != ADUTILS_SUCCESS)
goto out;
if (rc != ADUTILS_SUCCESS) {
goto out;
}
if (rc != ADUTILS_SUCCESS)
goto out;
out:
if (rc == ADUTILS_ERR_RETRIABLE_NET_ERR &&
goto retry;
return (map_adrc2nssrc(rc));
}
/* ARGSUSED */
const char *database, const char *searchfilter,
{
*try_idmap = 0;
/* Clear up results if any */
/* Lookup AD */
if (stat != NSS_SUCCESS) {
*try_idmap = 1;
return (stat);
}
/* Map AD object(s) to string in native file format */
if (stat == NSS_STR_PARSE_SUCCESS)
}
static
void
{
(void) pthread_mutex_lock(&statelock);
}
(void) pthread_mutex_unlock(&statelock);
}
static
void
{
}
}
/*
* _nss_ad_destr frees allocated memory before exiting this nsswitch shared
* backend library. This function is called before returning control back to
* nsswitch.
*/
/*ARGSUSED*/
{
(void) _clean_ad_backend(be);
clean_state();
return ((nss_status_t)NSS_SUCCESS);
}
/*ARGSUSED*/
{
return ((nss_status_t)NSS_UNAVAIL);
}
/*ARGSUSED*/
{
return ((nss_status_t)NSS_UNAVAIL);
}
/*ARGSUSED*/
{
return ((nss_status_t)NSS_UNAVAIL);
}
{
return (NULL);
return (NULL);
}
return ((nss_backend_t *)be);
}