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) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A
2N/A#ifndef _NS_SLDAP_H
2N/A#define _NS_SLDAP_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <stdio.h>
2N/A#include <sys/types.h>
2N/A#include <lber.h>
2N/A#include <ldap.h>
2N/A
2N/A/*
2N/A * Version
2N/A */
2N/A#define NS_LDAP_VERSION NS_LDAP_VERSION_2
2N/A#define NS_LDAP_VERSION_1 "1.0"
2N/A#define NS_LDAP_VERSION_2 "2.0"
2N/A
2N/A/*
2N/A * Flags
2N/A */
2N/A#define NS_LDAP_HARD 0x001
2N/A#define NS_LDAP_ALL_RES 0x002
2N/A
2N/A/* Search Referral Option */
2N/Atypedef enum SearchRef {
2N/A NS_LDAP_FOLLOWREF = 0x004,
2N/A NS_LDAP_NOREF = 0x008
2N/A} SearchRef_t;
2N/A
2N/Atypedef enum ScopeType {
2N/A NS_LDAP_SCOPE_BASE = 0x010,
2N/A NS_LDAP_SCOPE_ONELEVEL = 0x020,
2N/A NS_LDAP_SCOPE_SUBTREE = 0x040
2N/A} ScopeType_t;
2N/A
2N/A/*
2N/A * BE VERY CAREFUL. DO NOT USE FLAG NS_LDAP_KEEP_CONN UNLESS YOU MUST
2N/A * IN libsldap.so.1 THERE IS NO CONNECTION GARBAGE COLLECTION AND IF
2N/A * THIS FLAG GETS USED THERE MIGHT BE A CONNECTION LEAK. CURRENTLY THIS
2N/A * IS ONLY SUPPORTED FOR LIST AND INTENDED FOR APPLICATIONS LIKE AUTOMOUNTER
2N/A */
2N/A
2N/A#define NS_LDAP_KEEP_CONN 0x080
2N/A#define NS_LDAP_NEW_CONN 0x400
2N/A#define NS_LDAP_NOMAP 0x800
2N/A
2N/A#define NS_LDAP_PAGE_CTRL 0x1000
2N/A#define NS_LDAP_NO_PAGE_CTRL 0x0200
2N/A
2N/A/*
2N/A * NS_LDAP_NOT_CVT_DN is needed when attribute mapping is used
2N/A * to retrieve the DN in LDAP and DN is not to be converted when
2N/A * being passed back to the application. See __ns_ldap_uid2dn()
2N/A * and __ns_ldap_host2dn() for such usage.
2N/A */
2N/A#define NS_LDAP_NOT_CVT_DN 0x2000
2N/A
2N/A/*
2N/A * NS_LDAP_UPDATE_SHADOW is for a privileged caller of the
2N/A * __ns_ldap_repAttr() to update the shadow database on the
2N/A * LDAP server.
2N/A */
2N/A#define NS_LDAP_UPDATE_SHADOW 0x4000
2N/A
2N/A/*
2N/A * NS_LDAP_READ_SHADOW is for a privileged caller of __ns_ldap_list()
2N/A * and __ns_ldap_firstEntry() to read the shadow database on the
2N/A * LDAP server.
2N/A */
2N/A#define NS_LDAP_READ_SHADOW 0x8000
2N/A/*
2N/A * This flag is used by __ns_ldap_addTypedEntry to distinguish
2N/A * between adding and modifying key-value attr fields.
2N/A */
2N/A#define NS_LDAP_UPDATE_ATTR 0x0200
2N/A
2N/A/*
2N/A * NS_LDAP_BASE64_BINARY_ATTR_VALUE requests any binary attribute values
2N/A * to be base64-encoded and tagged with NS_LDAP_BASE64_TAG, i.e.,
2N/A * \1{base64}NXv+wO0EAA==
2N/A * The first character '\1' is for covering the case where a non-binary
2N/A * value starts with "{base64}".
2N/A */
2N/A#define NS_LDAP_BASE64_BINARY_ATTR_VALUE 0x0100
2N/A#define NS_LDAP_BASE64_TAG "\1{base64}"
2N/A#define NS_LDAP_BASE64_TAG_LEN (sizeof (NS_LDAP_BASE64_TAG) - 1)
2N/A#define NS_LDAP_BASE64_TAG_LDIF "\1{base64}:: "
2N/A#define NS_LDAP_BASE64_TAG_LDIF_LEN (sizeof (NS_LDAP_BASE64_TAG_LDIF) - 1)
2N/A
2N/A/*
2N/A * This flag is used to stop new connection from get directory capabilities
2N/A * from the the root DSE. This is for private use in libsldap.
2N/A */
2N/A#define NS_LDAP_NO_ROOT_DSE_INFO 0x10000
2N/A
2N/A/*
2N/A * Authentication Information
2N/A */
2N/Atypedef enum CredLevel {
2N/A NS_LDAP_CRED_ANON = 0,
2N/A NS_LDAP_CRED_PROXY = 1,
2N/A NS_LDAP_CRED_SELF = 2
2N/A} CredLevel_t;
2N/A
2N/Atypedef enum AuthType {
2N/A NS_LDAP_AUTH_NONE = 0,
2N/A NS_LDAP_AUTH_SIMPLE = 1,
2N/A NS_LDAP_AUTH_SASL = 2,
2N/A NS_LDAP_AUTH_TLS = 3, /* implied SASL usage */
2N/A NS_LDAP_AUTH_ATLS = 4 /* implied SASL usage */
2N/A} AuthType_t;
2N/A
2N/Atypedef enum TlsType {
2N/A NS_LDAP_TLS_NONE = 0,
2N/A NS_LDAP_TLS_SIMPLE = 1,
2N/A NS_LDAP_TLS_SASL = 2
2N/A} TlsType_t;
2N/A
2N/Atypedef enum SaslMech {
2N/A NS_LDAP_SASL_NONE = 0, /* No SASL mechanism */
2N/A NS_LDAP_SASL_CRAM_MD5 = 1,
2N/A NS_LDAP_SASL_DIGEST_MD5 = 2,
2N/A NS_LDAP_SASL_EXTERNAL = 3, /* currently not supported */
2N/A NS_LDAP_SASL_GSSAPI = 4,
2N/A NS_LDAP_SASL_SPNEGO = 5 /* currently not supported */
2N/A} SaslMech_t;
2N/A
2N/Atypedef enum SaslOpt {
2N/A NS_LDAP_SASLOPT_NONE = 0,
2N/A NS_LDAP_SASLOPT_INT = 1,
2N/A NS_LDAP_SASLOPT_PRIV = 2
2N/A} SaslOpt_t;
2N/A
2N/Atypedef enum PrefOnly {
2N/A NS_LDAP_PREF_FALSE = 0,
2N/A NS_LDAP_PREF_TRUE = 1
2N/A} PrefOnly_t;
2N/A
2N/Atypedef enum enableShadowUpdate {
2N/A NS_LDAP_ENABLE_SHADOW_UPDATE_FALSE = 0,
2N/A NS_LDAP_ENABLE_SHADOW_UPDATE_TRUE = 1
2N/A} enableShadowUpdate_t;
2N/A
2N/Atypedef struct UnixCred {
2N/A char *userID; /* Unix ID number */
2N/A char *passwd; /* password */
2N/A} UnixCred_t;
2N/A
2N/Atypedef struct CertCred {
2N/A char *path; /* certificate path */
2N/A char *passwd; /* password */
2N/A char *nickname; /* nickname */
2N/A} CertCred_t;
2N/A
2N/Atypedef struct ns_auth {
2N/A AuthType_t type;
2N/A TlsType_t tlstype;
2N/A SaslMech_t saslmech;
2N/A SaslOpt_t saslopt;
2N/A} ns_auth_t;
2N/A
2N/Atypedef struct ns_cred {
2N/A ns_auth_t auth;
2N/A char *hostcertpath;
2N/A union {
2N/A UnixCred_t unix_cred;
2N/A CertCred_t cert_cred;
2N/A } cred;
2N/A} ns_cred_t;
2N/A
2N/A
2N/Atypedef struct LineBuf {
2N/A char *str;
2N/A int len;
2N/A int alloc;
2N/A} LineBuf;
2N/A
2N/A/*
2N/A * Configuration Information
2N/A */
2N/A
2N/Atypedef enum {
2N/A NS_LDAP_FILE_VERSION_P = 0,
2N/A NS_LDAP_BINDDN_P = 1,
2N/A NS_LDAP_BINDPASSWD_P = 2,
2N/A NS_LDAP_SERVERS_P = 3,
2N/A NS_LDAP_SEARCH_BASEDN_P = 4,
2N/A NS_LDAP_AUTH_P = 5,
2N/A/*
2N/A * NS_LDAP_TRANSPORT_SEC_P is only left in for backward compatibility
2N/A * with version 1 clients and their configuration files. The only
2N/A * supported value is NS_LDAP_SEC_NONE. No application should be
2N/A * using this parameter type (either through getParam or setParam.
2N/A */
2N/A NS_LDAP_TRANSPORT_SEC_P = 6,
2N/A NS_LDAP_SEARCH_REF_P = 7,
2N/A NS_LDAP_DOMAIN_P = 8,
2N/A NS_LDAP_EXP_P = 9,
2N/A NS_LDAP_CERT_PATH_P = 10,
2N/A NS_LDAP_CERT_PASS_P = 11,
2N/A NS_LDAP_SEARCH_DN_P = 12,
2N/A NS_LDAP_SEARCH_SCOPE_P = 13,
2N/A NS_LDAP_SEARCH_TIME_P = 14,
2N/A NS_LDAP_SERVER_PREF_P = 15,
2N/A NS_LDAP_PREF_ONLY_P = 16,
2N/A NS_LDAP_CACHETTL_P = 17,
2N/A NS_LDAP_PROFILE_P = 18,
2N/A NS_LDAP_CREDENTIAL_LEVEL_P = 19,
2N/A NS_LDAP_SERVICE_SEARCH_DESC_P = 20,
2N/A NS_LDAP_BIND_TIME_P = 21,
2N/A NS_LDAP_ATTRIBUTEMAP_P = 22,
2N/A NS_LDAP_OBJECTCLASSMAP_P = 23,
2N/A NS_LDAP_CERT_NICKNAME_P = 24,
2N/A NS_LDAP_SERVICE_AUTH_METHOD_P = 25,
2N/A NS_LDAP_SERVICE_CRED_LEVEL_P = 26,
2N/A NS_LDAP_HOST_CERTPATH_P = 27,
2N/A NS_LDAP_ENABLE_SHADOW_UPDATE_P = 28,
2N/A NS_LDAP_ADMIN_BINDDN_P = 29,
2N/A NS_LDAP_ADMIN_BINDPASSWD_P = 30,
2N/A/*
2N/A * The following entry (max ParamIndexType) is an internal
2N/A * placeholder. It must be the last (and highest value)
2N/A * entry in this eNum. Please update accordingly.
2N/A */
2N/A NS_LDAP_MAX_PIT_P = 31
2N/A
2N/A} ParamIndexType;
2N/A
2N/A/*
2N/A * NONE - No self / SASL/GSSAPI configured
2N/A * ONLY - Only self / SASL/GSSAPI configured
2N/A * MIXED - self / SASL/GSSAPI is mixed with other types of configuration
2N/A */
2N/Atypedef enum {
2N/A NS_LDAP_SELF_GSSAPI_CONFIG_NONE = 0,
2N/A NS_LDAP_SELF_GSSAPI_CONFIG_ONLY = 1,
2N/A NS_LDAP_SELF_GSSAPI_CONFIG_MIXED = 2
2N/A} ns_ldap_self_gssapi_config_t;
2N/A
2N/A/*
2N/A * __ns_ldap_*() return codes
2N/A */
2N/Atypedef enum {
2N/A NS_LDAP_SUCCESS = 0, /* success, no info in errorp */
2N/A NS_LDAP_OP_FAILED = 1, /* failed operation, no info in errorp */
2N/A NS_LDAP_NOTFOUND = 2, /* entry not found, no info in errorp */
2N/A NS_LDAP_MEMORY = 3, /* memory failure, no info in errorp */
2N/A NS_LDAP_CONFIG = 4, /* config problem, detail in errorp */
2N/A NS_LDAP_PARTIAL = 5, /* partial result, detail in errorp */
2N/A NS_LDAP_INTERNAL = 7, /* LDAP error, detail in errorp */
2N/A NS_LDAP_INVALID_PARAM = 8, /* LDAP error, no info in errorp */
2N/A NS_LDAP_SUCCESS_WITH_INFO
2N/A = 9 /* success, with info in errorp */
2N/A} ns_ldap_return_code;
2N/A
2N/A/*
2N/A * Detailed error code for NS_LDAP_CONFIG
2N/A */
2N/Atypedef enum {
2N/A NS_CONFIG_SYNTAX = 0, /* syntax error */
2N/A NS_CONFIG_NODEFAULT = 1, /* no default value */
2N/A NS_CONFIG_NOTLOADED = 2, /* configuration not loaded */
2N/A NS_CONFIG_NOTALLOW = 3, /* operation requested not allowed */
2N/A NS_CONFIG_FILE = 4, /* configuration file problem */
2N/A NS_CONFIG_CACHEMGR = 5 /* error with door to ldap_cachemgr */
2N/A} ns_ldap_config_return_code;
2N/A
2N/A/*
2N/A * Detailed error code for NS_LDAP_PARTIAL
2N/A */
2N/Atypedef enum {
2N/A NS_PARTIAL_TIMEOUT = 0, /* partial results due to timeout */
2N/A NS_PARTIAL_OTHER = 1 /* error encountered */
2N/A} ns_ldap_partial_return_code;
2N/A
2N/A/*
2N/A * For use by __ns_ldap_addTypedEntry() for publickey serivicetype
2N/A */
2N/Atypedef enum {
2N/A NS_HOSTCRED_FALSE = 0,
2N/A NS_HOSTCRED_TRUE = 1
2N/A} hostcred_t;
2N/A
2N/A/*
2N/A * Detailed password status
2N/A */
2N/Atypedef enum {
2N/A NS_PASSWD_GOOD = 0, /* password is good */
2N/A NS_PASSWD_ABOUT_TO_EXPIRE = 1, /* password is good but */
2N/A /* about to expire */
2N/A NS_PASSWD_CHANGE_NEEDED = 2, /* good but need to be */
2N/A /* changed immediately */
2N/A NS_PASSWD_EXPIRED = 3, /* password expired */
2N/A NS_PASSWD_RETRY_EXCEEDED = 4, /* exceed retry limit; */
2N/A /* account is locked */
2N/A NS_PASSWD_CHANGE_NOT_ALLOWED = 5, /* can only be changed */
2N/A /* by the administrator */
2N/A NS_PASSWD_INVALID_SYNTAX = 6, /* can not be changed: */
2N/A /* new password has */
2N/A /* invalid syntax -- */
2N/A /* trivial password: same */
2N/A /* value as attr, cn, sn, */
2N/A /* uid, etc. */
2N/A /* or strong password */
2N/A /* policies check */
2N/A NS_PASSWD_TOO_SHORT = 7, /* can not be changed: */
2N/A /* new password has */
2N/A /* less chars than */
2N/A /* required */
2N/A NS_PASSWD_IN_HISTORY = 8, /* can not be changed: */
2N/A /* reuse old password */
2N/A NS_PASSWD_WITHIN_MIN_AGE = 9 /* can not be changed: */
2N/A /* within minimum age */
2N/A} ns_ldap_passwd_status_t;
2N/A
2N/A/*
2N/A * Password management information structure
2N/A *
2N/A * This structure is different from AcctUsableResponse_t structure in
2N/A * that this structure holds result of users account mgmt information when
2N/A * an ldap bind is done with user name and user password.
2N/A */
2N/Atypedef struct ns_ldap_passwd_mgmt {
2N/A ns_ldap_passwd_status_t
2N/A status; /* password status */
2N/A int sec_until_expired; /* seconds until expired, */
2N/A /* valid if status is */
2N/A /* NS_PASSWD_ABOUT_TO_EXPIRE */
2N/A} ns_ldap_passwd_mgmt_t;
2N/A
2N/A/*
2N/A * LDAP V3 control flag for account management - Used for account management
2N/A * when no password is provided
2N/A */
2N/A#define NS_LDAP_ACCOUNT_USABLE_CONTROL "1.3.6.1.4.1.42.2.27.9.5.8"
2N/A
2N/A/*
2N/A * Structure for holding the response returned by server for
2N/A * NS_LDAP_ACCOUNT_USABLE_CONTROL control when account is not available.
2N/A */
2N/Atypedef struct AcctUsableMoreInfo {
2N/A int inactive;
2N/A int reset;
2N/A int expired;
2N/A int rem_grace;
2N/A int sec_b4_unlock;
2N/A} AcctUsableMoreInfo_t;
2N/A
2N/A/*
2N/A * Structure used to hold the response from the server for
2N/A * NS_LDAP_ACCOUNT_USABLE_CONTROL control. The ASN1 notation is as below:
2N/A *
2N/A * ACCOUNT_USABLE_RESPONSE::= CHOICE {
2N/A * is_available [0] INTEGER, seconds before expiration
2N/A * is_not_available [1] More_info
2N/A * }
2N/A *
2N/A * More_info::= SEQUENCE {
2N/A * inactive [0] BOOLEAN DEFAULT FALSE,
2N/A * reset [1] BOOLEAN DEFAULT FALSE,
2N/A * expired [2] BOOLEAN DEFAULT FALSE,
2N/A * remaining_grace [3] INTEGER OPTIONAL,
2N/A * seconds_before_unlock[4] INTEGER OPTIONAL
2N/A * }
2N/A *
2N/A * This structure is different from ns_ldap_passwd_mgmt_t structure in
2N/A * that this structure holds result of users account mgmt information when
2N/A * pam_ldap doesn't have the users password and proxy agent is used for
2N/A * obtaining the account management information.
2N/A */
2N/Atypedef struct AcctUsableResponse {
2N/A int choice;
2N/A union {
2N/A int seconds_before_expiry;
2N/A AcctUsableMoreInfo_t more_info;
2N/A } AcctUsableResp;
2N/A} AcctUsableResponse_t;
2N/A
2N/A/*
2N/A * Simplified LDAP Naming API result structure
2N/A */
2N/Atypedef struct ns_ldap_error {
2N/A int status; /* LDAP error code */
2N/A char *message; /* LDAP error message */
2N/A ns_ldap_passwd_mgmt_t pwd_mgmt; /* LDAP password */
2N/A /* management info */
2N/A} ns_ldap_error_t;
2N/A
2N/Atypedef struct ns_ldap_attr {
2N/A char *attrname; /* attribute name */
2N/A uint_t value_count;
2N/A char **attrvalue; /* attribute values */
2N/A} ns_ldap_attr_t;
2N/A
2N/Atypedef struct ns_ldap_entry {
2N/A uint_t attr_count; /* number of attributes */
2N/A ns_ldap_attr_t **attr_pair; /* attributes pairs */
2N/A struct ns_ldap_entry *next; /* next entry */
2N/A} ns_ldap_entry_t;
2N/A
2N/Atypedef struct ns_ldap_result {
2N/A uint_t entries_count; /* number of entries */
2N/A ns_ldap_entry_t *entry; /* data */
2N/A} ns_ldap_result_t;
2N/A
2N/A/*
2N/A * structures for the conversion routines used by typedAddEntry()
2N/A */
2N/A
2N/Atypedef struct _ns_netgroups {
2N/A char *name;
2N/A char **triplet;
2N/A char **netgroup;
2N/A} _ns_netgroups_t;
2N/A
2N/Atypedef struct _ns_netmasks {
2N/A char *netnumber;
2N/A char *netmask;
2N/A} _ns_netmasks_t;
2N/A
2N/Atypedef struct _ns_bootp {
2N/A char *name;
2N/A char **param;
2N/A} _ns_bootp_t;
2N/A
2N/Atypedef struct _ns_ethers {
2N/A char *name;
2N/A char *ether;
2N/A} _ns_ethers_t;
2N/A
2N/Atypedef struct _ns_pubkey {
2N/A char *name;
2N/A hostcred_t hostcred;
2N/A char *pubkey;
2N/A char *privkey;
2N/A} _ns_pubkey_t;
2N/A
2N/Atypedef struct _ns_alias {
2N/A char *alias;
2N/A char **member;
2N/A} _ns_alias_t;
2N/A
2N/Atypedef struct _ns_automount {
2N/A char *mapname;
2N/A char *key;
2N/A char *value;
2N/A} _ns_automount_t;
2N/A
2N/A/*
2N/A * return values for the callback function in __ns_ldap_list()
2N/A */
2N/A#define NS_LDAP_CB_NEXT 0 /* get the next entry */
2N/A#define NS_LDAP_CB_DONE 1 /* done */
2N/A
2N/A/*
2N/A * Input values for the type specified in __ns_ldap_addTypedEntry()
2N/A * and __ns_ldap_delTypedEntry()
2N/A */
2N/A
2N/A#define NS_LDAP_TYPE_PASSWD "passwd"
2N/A#define NS_LDAP_TYPE_GROUP "group"
2N/A#define NS_LDAP_TYPE_HOSTS "hosts"
2N/A#define NS_LDAP_TYPE_IPNODES "ipnodes"
2N/A#define NS_LDAP_TYPE_PROFILE "prof_attr"
2N/A#define NS_LDAP_TYPE_RPC "rpc"
2N/A#define NS_LDAP_TYPE_PROTOCOLS "protocols"
2N/A#define NS_LDAP_TYPE_NETWORKS "networks"
2N/A#define NS_LDAP_TYPE_NETGROUP "netgroup"
2N/A#define NS_LDAP_TYPE_ALIASES "aliases"
2N/A#define NS_LDAP_TYPE_SERVICES "services"
2N/A#define NS_LDAP_TYPE_ETHERS "ethers"
2N/A#define NS_LDAP_TYPE_SHADOW "shadow"
2N/A#define NS_LDAP_TYPE_NETMASKS "netmasks"
2N/A#define NS_LDAP_TYPE_AUTHATTR "auth_attr"
2N/A#define NS_LDAP_TYPE_EXECATTR "exec_attr"
2N/A#define NS_LDAP_TYPE_USERATTR "user_attr"
2N/A#define NS_LDAP_TYPE_PROJECT "project"
2N/A#define NS_LDAP_TYPE_PUBLICKEY "publickey"
2N/A#define NS_LDAP_TYPE_AUUSER "audit_user"
2N/A#define NS_LDAP_TYPE_BOOTPARAMS "bootparams"
2N/A#define NS_LDAP_TYPE_AUTOMOUNT "auto_"
2N/A#define NS_LDAP_TYPE_TNRHDB "tnrhdb"
2N/A#define NS_LDAP_TYPE_TNRHTP "tnrhtp"
2N/A
2N/A/*
2N/A * Internal operational attribute maintained by libsldap,
2N/A * only one for now, __ns_ldap_op_attr_server_type. This
2N/A * attribute is returned in the extra_info ns_ldap_entry_t
2N/A * entry by the APIs that support it. Similar to the
2N/A * operational attributes returned by LDAP servers, they
2N/A * are used to provided extra information about the search
2N/A * results. __ns_ldap_op_attr_server_type is used to
2N/A * requested the type of the LDAP server where the search
2N/A * result is from.
2N/A */
2N/A#define NS_LDAP_OP_ATTR_SERVER_TYPE "__ns_ldap_op_attr_server_type"
2N/A
2N/A#define NS_LDAP_ATTR_VAL_SERVER_ODSEE "ODSEE"
2N/A#define NS_LDAP_ATTR_VAL_SERVER_OID "OID"
2N/A#define NS_LDAP_ATTR_VAL_SERVER_AD "AD"
2N/A#define NS_LDAP_ATTR_VAL_SERVER_OPENLDAP "OPENLDAP"
2N/A#define NS_LDAP_ATTR_VAL_SERVER_UNKNOWN "UNKNOWN"
2N/A
2N/Atypedef enum {
2N/A NS_LDAP_SERVERTYPE_ODSEE = 0,
2N/A NS_LDAP_SERVERTYPE_OID = 1,
2N/A NS_LDAP_SERVERTYPE_AD = 2,
2N/A NS_LDAP_SERVERTYPE_OPENLDAP = 3,
2N/A NS_LDAP_SERVERTYPE_UNKNOWN = 4
2N/A} ns_ldap_server_type_t;
2N/A
2N/A
2N/A/*
2N/A * service descriptor/attribute mapping structure
2N/A */
2N/A
2N/Atypedef struct ns_ldap_search_desc {
2N/A char *basedn; /* search base dn */
2N/A ScopeType_t scope; /* search scope */
2N/A char *filter; /* search filter */
2N/A} ns_ldap_search_desc_t;
2N/A
2N/Atypedef struct ns_ldap_attribute_map {
2N/A char *origAttr; /* original attribute */
2N/A char **mappedAttr; /* mapped attribute(s) */
2N/A} ns_ldap_attribute_map_t;
2N/A
2N/Atypedef struct ns_ldap_objectclass_map {
2N/A char *origOC; /* original objectclass */
2N/A char *mappedOC; /* mapped objectclass */
2N/A} ns_ldap_objectclass_map_t;
2N/A
2N/A/*
2N/A * Value of the userPassword attribute representing NO Unix password
2N/A */
2N/A#define NS_LDAP_NO_UNIX_PASSWORD "<NO UNIX PASSWORD>"
2N/A
2N/A/*
2N/A * A special keyword used to check if schema mapping is configured for
2N/A * a particular database. Callers can call __ns_ldap_getOrigAttribute
2N/A * with this keyword to find out if a database has any objectclass or
2N/A * attribute mapping defined.
2N/A */
2N/A#define NS_HASH_SCHEMA_MAPPING_EXISTED "=MAPPING EXISTED="
2N/A
2N/A/* Opaque handle for batch API */
2N/Atypedef struct ns_ldap_list_batch ns_ldap_list_batch_t;
2N/A
2N/A/*
2N/A * The type of standalone configuration specified by a client application.
2N/A * The meaning of the requests is as follows:
2N/A *
2N/A * NS_CACHEMGR: libsldap will request all the configuration via door_call(3C)
2N/A * to ldap_cachemgr.
2N/A * NS_LDAP_SERVER: the consumer application has specified a directory server
2N/A * to communicate to.
2N/A * NS_PREDEFINED: reserved for internal use
2N/A */
2N/Atypedef enum {
2N/A NS_CACHEMGR = 0,
2N/A NS_LDAP_SERVER
2N/A} ns_standalone_request_type_t;
2N/A
2N/A/*
2N/A * This structure describes an LDAP server specified by a client application.
2N/A */
2N/Atypedef struct ns_dir_server {
2N/A char *server; /* A directory server's IP */
2N/A uint16_t port; /* A directory server's port. */
2N/A /* Default value is 389 */
2N/A char *domainName; /* A domain name being served */
2N/A /* by the specified server. */
2N/A /* Default value is the local */
2N/A /* domain's name */
2N/A char *profileName; /* A DUAProfile's name. */
2N/A /* Default value is 'default' */
2N/A ns_auth_t *auth; /* Authentication information used */
2N/A /* during subsequent connections */
2N/A char *cred; /* A credential level to be used */
2N/A /* along with the authentication info */
2N/A char *host_cert_path; /* A path to the certificate database */
2N/A /* Default is '/vat/ldap' */
2N/A char *bind_dn; /* A bind DN to be used during */
2N/A /* subsequent LDAP Bind requests */
2N/A char *bind_passwd; /* A bind password to be used during */
2N/A /* subsequent LDAP Bind requests */
2N/A} ns_dir_server_t;
2N/A
2N/A/*
2N/A * This structure contains information describing an LDAP server.
2N/A */
2N/Atypedef struct ns_standalone_conf {
2N/A union {
2N/A ns_dir_server_t server;
2N/A void *predefined_conf; /* Reserved for internal use */
2N/A } ds_profile; /* A type of the configuration */
2N/A
2N/A#define SA_SERVER ds_profile.server.server
2N/A#define SA_PORT ds_profile.server.port
2N/A#define SA_DOMAIN ds_profile.server.domainName
2N/A#define SA_PROFILE_NAME ds_profile.server.profileName
2N/A#define SA_AUTH ds_profile.server.auth
2N/A#define SA_CRED ds_profile.server.cred
2N/A#define SA_CERT_PATH ds_profile.server.host_cert_path
2N/A#define SA_BIND_DN ds_profile.server.bind_dn
2N/A#define SA_BIND_PWD ds_profile.server.bind_passwd
2N/A
2N/A ns_standalone_request_type_t type;
2N/A} ns_standalone_conf_t;
2N/A
2N/A/*
2N/A * This function "informs" libsldap that a client application has specified
2N/A * a directory to use. The function obtains a DUAProfile, credentials,
2N/A * and naming context. During all further operations on behalf
2N/A * of the application requested a standalone schema libsldap will use
2N/A * the information obtained by __ns_ldap_initStandalone() instead of
2N/A * door_call(3C)ing ldap_cachemgr(1M).
2N/A *
2N/A * conf
2N/A * A structure describing where and in which way to obtain all the
2N/A * configuration describing how to communicate to a choosen LDAP directory.
2N/A *
2N/A * errorp
2N/A * An error object describing an error occured.
2N/A */
2N/Ans_ldap_return_code __ns_ldap_initStandalone(
2N/A const ns_standalone_conf_t *conf,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/A/*
2N/A * This function obtains the directory's base DN and a DUAProfile
2N/A * from a specified server.
2N/A *
2N/A * server
2N/A * Specifies the selected directory sever.
2N/A *
2N/A * cred
2N/A * Contains an authentication information and credential required to
2N/A * establish a connection.
2N/A *
2N/A * config
2N/A * If not NULL, a new configuration basing on a DUAProfile specified in the
2N/A * server parameter will be create and returned.
2N/A *
2N/A * baseDN
2N/A * If not NULL, the directory's base DN will be returned.
2N/A *
2N/A * error
2N/A * Describes an error, if any.
2N/A */
2N/Ans_ldap_return_code __ns_ldap_getConnectionInfoFromDUA(
2N/A const ns_dir_server_t *server,
2N/A const ns_cred_t *cred,
2N/A char **config, char **baseDN,
2N/A ns_ldap_error_t **error);
2N/A
2N/A#define SA_PROHIBIT_FALLBACK 0
2N/A#define SA_ALLOW_FALLBACK 1
2N/A
2N/A#define DONT_SAVE_NSCONF 0
2N/A#define SAVE_NSCONF 1
2N/A
2N/A/*
2N/A * This function obtains the root DSE from a specified server.
2N/A *
2N/A * server_addr
2N/A * An adress of a server to be connected to.
2N/A *
2N/A * server_type
2N/A * Returns the type of the server returning the root DSE.
2N/A *
2N/A * rootDSE
2N/A * A buffer containing the root DSE in the ldap_cachmgr door call format.
2N/A *
2N/A * errorp
2N/A * Describes an error, if any.
2N/A *
2N/A * anon_fallback
2N/A * If set to 1 and establishing a connection fails, __s_api_getRootDSE()
2N/A * will try once again using anonymous credentials.
2N/A */
2N/Ans_ldap_return_code __ns_ldap_getRootDSE(
2N/A const char *server_addr,
2N/A ns_ldap_server_type_t *server_type,
2N/A char **rootDSE,
2N/A ns_ldap_error_t **errorp,
2N/A int anon_fallback);
2N/A
2N/A/*
2N/A * This function iterates through the list of the configured LDAP servers
2N/A * and "pings" those which are marked as removed or if any error occurred
2N/A * during the previous receiving of the server's root DSE. If the
2N/A * function is able to reach such a server and get its root DSE, it
2N/A * marks the server as on-line. Otherwise, the server's status is set
2N/A * to "Error".
2N/A * For each server the function tries to connect to, it fires up
2N/A * a separate thread and then waits until all the threads finish.
2N/A * The function returns NS_LDAP_INTERNAL if the Standalone mode was not
2N/A * initialized or was canceled prior to an invocation of
2N/A * __ns_ldap_pingOfflineServers().
2N/A */
2N/Ans_ldap_return_code __ns_ldap_pingOfflineServers(void);
2N/A
2N/A/*
2N/A * This function cancels the Standalone mode and destroys the list of root DSEs.
2N/A */
2N/Avoid __ns_ldap_cancelStandalone(void);
2N/A/*
2N/A * This function initializes an ns_auth_t structure provided by a caller
2N/A * according to a specified authentication mechanism.
2N/A */
2N/Ans_ldap_return_code __ns_ldap_initAuth(const char *auth_mech,
2N/A ns_auth_t *auth,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/A/*
2N/A * Simplified LDAP Naming APIs
2N/A */
2N/Aint __ns_ldap_list(
2N/A const char *service,
2N/A const char *filter,
2N/A int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
2N/A char **realfilter, const void *userdata),
2N/A const char * const *attribute,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_result_t ** result,
2N/A ns_ldap_error_t ** errorp,
2N/A int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
2N/A const void *userdata);
2N/A
2N/Aint __ns_ldap_list_ext(
2N/A const char *service,
2N/A const char *filter,
2N/A int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
2N/A char **realfilter, const void *userdata),
2N/A const char * const *attribute,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_result_t ** result,
2N/A ns_ldap_error_t ** errorp,
2N/A int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
2N/A const void *userdata,
2N/A const char * const *extra_info_attr,
2N/A ns_ldap_entry_t **extra_info);
2N/A
2N/A
2N/Aint __ns_ldap_list_sort(
2N/A const char *service,
2N/A const char *filter,
2N/A const char *sortattr,
2N/A int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
2N/A char **realfilter, const void *userdata),
2N/A const char * const *attribute,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_result_t ** result,
2N/A ns_ldap_error_t ** errorp,
2N/A int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
2N/A const void *userdata);
2N/A
2N/Aint __ns_ldap_list_batch_start(
2N/A ns_ldap_list_batch_t **batch);
2N/A
2N/Aint __ns_ldap_list_batch_add(
2N/A ns_ldap_list_batch_t *batch,
2N/A const char *service,
2N/A const char *filter,
2N/A int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
2N/A char **realfilter, const void *userdata),
2N/A const char * const *attribute,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_result_t ** result,
2N/A ns_ldap_error_t ** errorp,
2N/A int *rcp,
2N/A int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
2N/A const void *userdata);
2N/A
2N/Aint __ns_ldap_list_batch_end(
2N/A ns_ldap_list_batch_t *batch);
2N/A
2N/Avoid __ns_ldap_list_batch_release(
2N/A ns_ldap_list_batch_t *batch);
2N/A
2N/Aint __ns_ldap_addAttr(
2N/A const char *service,
2N/A const char *dn,
2N/A const ns_ldap_attr_t * const *attr,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_delAttr(
2N/A const char *service,
2N/A const char *dn,
2N/A const ns_ldap_attr_t * const *attr,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_repAttr(
2N/A const char *service,
2N/A const char *dn,
2N/A const ns_ldap_attr_t * const *attr,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_addEntry(
2N/A const char *service,
2N/A const char *dn,
2N/A const ns_ldap_entry_t *entry,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_addTypedEntry(
2N/A const char *servicetype,
2N/A const char *basedn,
2N/A const void *data,
2N/A const int create,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_delEntry(
2N/A const char *service,
2N/A const char *dn,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_firstEntry(
2N/A const char *service,
2N/A const char *filter,
2N/A const char *sortattr,
2N/A int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
2N/A char **realfilter, const void *userdata),
2N/A const char * const *attribute,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A void **cookie,
2N/A ns_ldap_result_t ** result,
2N/A ns_ldap_error_t **errorp,
2N/A const void *userdata);
2N/A
2N/Aint __ns_ldap_firstEntry_ext(
2N/A const char *service,
2N/A const char *filter,
2N/A const char *sortattr,
2N/A int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
2N/A char **realfilter, const void *userdata),
2N/A const char * const *attribute,
2N/A const ns_cred_t *cred,
2N/A const int flags,
2N/A void **cookie,
2N/A ns_ldap_result_t ** result,
2N/A ns_ldap_error_t **errorp,
2N/A const void *userdata,
2N/A const char * const *extra_info_attr,
2N/A ns_ldap_entry_t **extra_info);
2N/A
2N/Aint __ns_ldap_nextEntry(
2N/A void *cookie,
2N/A ns_ldap_result_t ** result,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_endEntry(
2N/A void **cookie,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_freeResult(
2N/A ns_ldap_result_t **result);
2N/A
2N/Avoid __ns_ldap_freeEntry(
2N/A ns_ldap_entry_t *ep);
2N/A
2N/Aint __ns_ldap_freeError(
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_uid2dn(
2N/A const char *uid,
2N/A char **userDN,
2N/A const ns_cred_t *cred,
2N/A ns_ldap_error_t ** errorp);
2N/A
2N/Aint __ns_ldap_host2dn(
2N/A const char *host,
2N/A const char *domain,
2N/A char **hostDN,
2N/A const ns_cred_t *cred,
2N/A ns_ldap_error_t ** errorp);
2N/A
2N/Aint __ns_ldap_dn2domain(
2N/A const char *dn,
2N/A char **domain,
2N/A const ns_cred_t *cred,
2N/A ns_ldap_error_t ** errorp);
2N/A
2N/Aint __ns_ldap_auth(
2N/A const ns_cred_t *cred,
2N/A const int flag,
2N/A ns_ldap_error_t **errorp,
2N/A LDAPControl **serverctrls,
2N/A LDAPControl **clientctrls);
2N/A
2N/Aint __ns_ldap_freeCred(
2N/A ns_cred_t **credp);
2N/A
2N/Aint __ns_ldap_err2str(
2N/A int err,
2N/A char **strmsg);
2N/A
2N/Aint __ns_ldap_setParam(
2N/A const ParamIndexType type,
2N/A const void *data,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_getParam(
2N/A const ParamIndexType type,
2N/A void ***data,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_freeParam(
2N/A void ***data);
2N/A
2N/Achar **__ns_ldap_getAttr(
2N/A const ns_ldap_entry_t *entry,
2N/A const char *attrname);
2N/A
2N/Ans_ldap_attr_t *__ns_ldap_getAttrStruct(
2N/A const ns_ldap_entry_t *entry,
2N/A const char *attrname);
2N/A
2N/Aint __ns_ldap_getServiceAuthMethods(
2N/A const char *service,
2N/A ns_auth_t ***auth,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_getSearchDescriptors(
2N/A const char *service,
2N/A ns_ldap_search_desc_t ***desc,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_freeSearchDescriptors(
2N/A ns_ldap_search_desc_t ***desc);
2N/A
2N/Aint __ns_ldap_getAttributeMaps(
2N/A const char *service,
2N/A ns_ldap_attribute_map_t ***maps,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_freeAttributeMaps(
2N/A ns_ldap_attribute_map_t ***maps);
2N/A
2N/Achar **__ns_ldap_getMappedAttributes(
2N/A const char *service,
2N/A const char *origAttribute);
2N/A
2N/Achar **__ns_ldap_getOrigAttribute(
2N/A const char *service,
2N/A const char *mappedAttribute);
2N/A
2N/Aint __ns_ldap_getObjectClassMaps(
2N/A const char *service,
2N/A ns_ldap_objectclass_map_t ***maps,
2N/A ns_ldap_error_t **errorp);
2N/A
2N/Aint __ns_ldap_freeObjectClassMaps(
2N/A ns_ldap_objectclass_map_t ***maps);
2N/A
2N/Achar **__ns_ldap_getMappedObjectClass(
2N/A const char *service,
2N/A const char *origObjectClass);
2N/A
2N/Achar **__ns_ldap_getOrigObjectClass(
2N/A const char *service,
2N/A const char *mappedObjectClass);
2N/A
2N/Aint __ns_ldap_getParamType(
2N/A const char *value,
2N/A ParamIndexType *type);
2N/A
2N/Aint __ns_ldap_getAcctMgmt(
2N/A const char *user,
2N/A AcctUsableResponse_t *acctResp);
2N/A
2N/Aboolean_t __ns_ldap_is_shadow_update_enabled(void);
2N/A
2N/Aint __ns_ldap_read_dn(
2N/A const char *dn,
2N/A const char *service,
2N/A int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
2N/A char **realfilter, const void *userdata),
2N/A const char * const *attribute,
2N/A const ns_cred_t *auth,
2N/A const int flags,
2N/A ns_ldap_result_t **rResult,
2N/A ns_ldap_error_t **errorp,
2N/A int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
2N/A const void *userdata,
2N/A const char * const *extra_info_attr,
2N/A ns_ldap_entry_t **extra_info);
2N/A
2N/Avoid
2N/A__ns_ldap_self_gssapi_only_set(
2N/A int flag);
2N/Aint
2N/A__ns_ldap_self_gssapi_config(
2N/A ns_ldap_self_gssapi_config_t *config);
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _NS_SLDAP_H */