2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _AD_COMMON_H
2N/A#define _AD_COMMON_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <ctype.h>
2N/A#include <nss_dbdefs.h>
2N/A#include <stdlib.h>
2N/A#include <stdio.h>
2N/A#include <string.h>
2N/A#include <strings.h>
2N/A#include <signal.h>
2N/A#include <idmap.h>
2N/A#include <sys/idmap.h>
2N/A#include <rpcsvc/idmap_prot.h>
2N/A#include <idmap_priv.h>
2N/A#include "addisc.h"
2N/A#include "libadutils.h"
2N/A
2N/A#define _GROUP "group"
2N/A#define _PASSWD "passwd"
2N/A#define _SHADOW "shadow"
2N/A
2N/A#define WK_DOMAIN "BUILTIN"
2N/A#define CFG_QUEUE_MAX_SIZE 15
2N/A
2N/A#define SEARCHFILTERLEN 256
2N/A#define RESET_ERRNO()\
2N/A if (errno == EINVAL)\
2N/A errno = 0;
2N/A
2N/A/*
2N/A * Superset the nss_backend_t abstract data type. This ADT has
2N/A * been extended to include AD associated data structures.
2N/A */
2N/A
2N/Atypedef struct ad_backend *ad_backend_ptr;
2N/Atypedef nss_status_t (*ad_backend_op_t)(ad_backend_ptr, void *);
2N/Atypedef int (*fnf)(ad_backend_ptr be, nss_XbyY_args_t *argp);
2N/A
2N/Atypedef enum {
2N/A NSS_AD_DB_NONE = 0,
2N/A NSS_AD_DB_PASSWD_BYNAME = 1,
2N/A NSS_AD_DB_PASSWD_BYUID = 2,
2N/A NSS_AD_DB_GROUP_BYNAME = 3,
2N/A NSS_AD_DB_GROUP_BYGID = 4,
2N/A NSS_AD_DB_SHADOW_BYNAME = 5
2N/A} nss_ad_db_type_t;
2N/A
2N/Astruct ad_backend {
2N/A ad_backend_op_t *ops;
2N/A nss_dbop_t nops;
2N/A char *tablename;
2N/A const char **attrs;
2N/A fnf adobj2str;
2N/A char *buffer;
2N/A int buflen;
2N/A uid_t uid;
2N/A adutils_result_t *result;
2N/A nss_ad_db_type_t db_type;
2N/A};
2N/A
2N/Atypedef struct nssad_prop {
2N/A char *domain_name;
2N/A idmap_ad_disc_ds_t *domain_controller;
2N/A} nssad_prop_t;
2N/A
2N/Atypedef struct nssad_cfg {
2N/A pthread_rwlock_t lock;
2N/A nssad_prop_t props;
2N/A ad_disc_t ad_ctx;
2N/A adutils_ad_t *ad;
2N/A struct nssad_cfg *qnext;
2N/A} nssad_cfg_t;
2N/A
2N/Atypedef struct nssad_state {
2N/A nssad_cfg_t *qhead;
2N/A nssad_cfg_t *qtail;
2N/A uint32_t qcount;
2N/A} nssad_state_t;
2N/A
2N/Aextern nss_status_t _nss_ad_destr(ad_backend_ptr be, void *a);
2N/Aextern nss_status_t _nss_ad_endent(ad_backend_ptr be, void *a);
2N/Aextern nss_status_t _nss_ad_setent(ad_backend_ptr be, void *a);
2N/Aextern nss_status_t _nss_ad_getent(ad_backend_ptr be, void *a);
2N/Anss_backend_t *_nss_ad_constr(ad_backend_op_t ops[], int nops,
2N/A char *tablename, const char **attrs, fnf ldapobj2str);
2N/Aextern nss_status_t _nss_ad_lookup(ad_backend_ptr be,
2N/A nss_XbyY_args_t *argp, const char *database,
2N/A const char *searchfilter, const char *dname,
2N/A int *try_idmap);
2N/Aextern nss_status_t _nss_ad_marshall_data(ad_backend_ptr be,
2N/A nss_XbyY_args_t *argp);
2N/Aextern nss_status_t _nss_ad_sanitize_status(ad_backend_ptr be,
2N/A nss_XbyY_args_t *argp, nss_status_t stat);
2N/Aextern int _ldap_filter_name(char *filter_name, const char *name,
2N/A int filter_name_size);
2N/A
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _AD_COMMON_H */