17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 545916cd2Sjpk * Common Development and Distribution License (the "License"). 645916cd2Sjpk * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 229f2fd570SJulian Pullen * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _NS_SLDAP_H 277c478bd9Sstevel@tonic-gate #define _NS_SLDAP_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <stdio.h> 347c478bd9Sstevel@tonic-gate #include <sys/types.h> 357c478bd9Sstevel@tonic-gate #include <lber.h> 367c478bd9Sstevel@tonic-gate #include <ldap.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * Version 407c478bd9Sstevel@tonic-gate */ 417c478bd9Sstevel@tonic-gate #define NS_LDAP_VERSION NS_LDAP_VERSION_2 427c478bd9Sstevel@tonic-gate #define NS_LDAP_VERSION_1 "1.0" 437c478bd9Sstevel@tonic-gate #define NS_LDAP_VERSION_2 "2.0" 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * Flags 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate #define NS_LDAP_HARD 0x001 497c478bd9Sstevel@tonic-gate #define NS_LDAP_ALL_RES 0x002 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* Search Referral Option */ 527c478bd9Sstevel@tonic-gate typedef enum SearchRef { 537c478bd9Sstevel@tonic-gate NS_LDAP_FOLLOWREF = 0x004, 547c478bd9Sstevel@tonic-gate NS_LDAP_NOREF = 0x008 557c478bd9Sstevel@tonic-gate } SearchRef_t; 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate typedef enum ScopeType { 587c478bd9Sstevel@tonic-gate NS_LDAP_SCOPE_BASE = 0x010, 597c478bd9Sstevel@tonic-gate NS_LDAP_SCOPE_ONELEVEL = 0x020, 607c478bd9Sstevel@tonic-gate NS_LDAP_SCOPE_SUBTREE = 0x040 617c478bd9Sstevel@tonic-gate } ScopeType_t; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * BE VERY CAREFUL. DO NOT USE FLAG NS_LDAP_KEEP_CONN UNLESS YOU MUST 657c478bd9Sstevel@tonic-gate * IN libsldap.so.1 THERE IS NO CONNECTION GARBAGE COLLECTION AND IF 667c478bd9Sstevel@tonic-gate * THIS FLAG GETS USED THERE MIGHT BE A CONNECTION LEAK. CURRENTLY THIS 677c478bd9Sstevel@tonic-gate * IS ONLY SUPPORTED FOR LIST AND INTENDED FOR APPLICATIONS LIKE AUTOMOUNTER 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #define NS_LDAP_KEEP_CONN 0x080 717c478bd9Sstevel@tonic-gate #define NS_LDAP_NEW_CONN 0x400 727c478bd9Sstevel@tonic-gate #define NS_LDAP_NOMAP 0x800 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #define NS_LDAP_PAGE_CTRL 0x1000 757c478bd9Sstevel@tonic-gate #define NS_LDAP_NO_PAGE_CTRL 0x0000 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate /* 78f5c3c7a7Ssdussud * NS_LDAP_NOT_CVT_DN is needed when attribute mapping is used 79f5c3c7a7Ssdussud * to retrieve the DN in LDAP and DN is not to be converted when 80f5c3c7a7Ssdussud * being passed back to the application. See __ns_ldap_uid2dn() 81f5c3c7a7Ssdussud * and __ns_ldap_host2dn() for such usage. 82f5c3c7a7Ssdussud */ 83f5c3c7a7Ssdussud #define NS_LDAP_NOT_CVT_DN 0x2000 84f5c3c7a7Ssdussud 85f5c3c7a7Ssdussud /* 86dd1104fbSMichen Chang * NS_LDAP_UPDATE_SHADOW is for a privileged caller of the 87dd1104fbSMichen Chang * __ns_ldap_repAttr() to update the shadow database on the 88dd1104fbSMichen Chang * LDAP server. 89dd1104fbSMichen Chang */ 90dd1104fbSMichen Chang #define NS_LDAP_UPDATE_SHADOW 0x4000 91dd1104fbSMichen Chang 92dd1104fbSMichen Chang /* 93b57459abSJulian Pullen * NS_LDAP_READ_SHADOW is for a privileged caller of __ns_ldap_list() 94b57459abSJulian Pullen * and __ns_ldap_firstEntry() to read the shadow database on the 95b57459abSJulian Pullen * LDAP server. 96b57459abSJulian Pullen */ 97b57459abSJulian Pullen #define NS_LDAP_READ_SHADOW 0x8000 98b57459abSJulian Pullen 99b57459abSJulian Pullen /* 1007c478bd9Sstevel@tonic-gate * Authentication Information 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate typedef enum CredLevel { 1037c478bd9Sstevel@tonic-gate NS_LDAP_CRED_ANON = 0, 1047c478bd9Sstevel@tonic-gate NS_LDAP_CRED_PROXY = 1, 105cb5caa98Sdjl NS_LDAP_CRED_SELF = 2 1067c478bd9Sstevel@tonic-gate } CredLevel_t; 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate typedef enum AuthType { 1097c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_NONE = 0, 1107c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_SIMPLE = 1, 1117c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_SASL = 2, 1127c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_TLS = 3, /* implied SASL usage */ 1137c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_ATLS = 4 /* implied SASL usage */ 1147c478bd9Sstevel@tonic-gate } AuthType_t; 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate typedef enum TlsType { 1177c478bd9Sstevel@tonic-gate NS_LDAP_TLS_NONE = 0, 1187c478bd9Sstevel@tonic-gate NS_LDAP_TLS_SIMPLE = 1, 1197c478bd9Sstevel@tonic-gate NS_LDAP_TLS_SASL = 2 1207c478bd9Sstevel@tonic-gate } TlsType_t; 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate typedef enum SaslMech { 1237c478bd9Sstevel@tonic-gate NS_LDAP_SASL_NONE = 0, /* No SASL mechanism */ 1247c478bd9Sstevel@tonic-gate NS_LDAP_SASL_CRAM_MD5 = 1, 1257c478bd9Sstevel@tonic-gate NS_LDAP_SASL_DIGEST_MD5 = 2, 1267c478bd9Sstevel@tonic-gate NS_LDAP_SASL_EXTERNAL = 3, /* currently not supported */ 127cb5caa98Sdjl NS_LDAP_SASL_GSSAPI = 4, 1287c478bd9Sstevel@tonic-gate NS_LDAP_SASL_SPNEGO = 5 /* currently not supported */ 1297c478bd9Sstevel@tonic-gate } SaslMech_t; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate typedef enum SaslOpt { 1327c478bd9Sstevel@tonic-gate NS_LDAP_SASLOPT_NONE = 0, 133cb5caa98Sdjl NS_LDAP_SASLOPT_INT = 1, 134cb5caa98Sdjl NS_LDAP_SASLOPT_PRIV = 2 1357c478bd9Sstevel@tonic-gate } SaslOpt_t; 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate typedef enum PrefOnly { 1387c478bd9Sstevel@tonic-gate NS_LDAP_PREF_FALSE = 0, 1397c478bd9Sstevel@tonic-gate NS_LDAP_PREF_TRUE = 1 1407c478bd9Sstevel@tonic-gate } PrefOnly_t; 1417c478bd9Sstevel@tonic-gate 142dd1104fbSMichen Chang typedef enum enableShadowUpdate { 143dd1104fbSMichen Chang NS_LDAP_ENABLE_SHADOW_UPDATE_FALSE = 0, 144dd1104fbSMichen Chang NS_LDAP_ENABLE_SHADOW_UPDATE_TRUE = 1 145dd1104fbSMichen Chang } enableShadowUpdate_t; 146dd1104fbSMichen Chang 1477c478bd9Sstevel@tonic-gate typedef struct UnixCred { 1487c478bd9Sstevel@tonic-gate char *userID; /* Unix ID number */ 1497c478bd9Sstevel@tonic-gate char *passwd; /* password */ 1507c478bd9Sstevel@tonic-gate } UnixCred_t; 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate typedef struct CertCred { 1537c478bd9Sstevel@tonic-gate char *path; /* certificate path */ 1547c478bd9Sstevel@tonic-gate char *passwd; /* password */ 1557c478bd9Sstevel@tonic-gate char *nickname; /* nickname */ 1567c478bd9Sstevel@tonic-gate } CertCred_t; 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate typedef struct ns_auth { 1597c478bd9Sstevel@tonic-gate AuthType_t type; 1607c478bd9Sstevel@tonic-gate TlsType_t tlstype; 1617c478bd9Sstevel@tonic-gate SaslMech_t saslmech; 1627c478bd9Sstevel@tonic-gate SaslOpt_t saslopt; 1637c478bd9Sstevel@tonic-gate } ns_auth_t; 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate typedef struct ns_cred { 1667c478bd9Sstevel@tonic-gate ns_auth_t auth; 1677c478bd9Sstevel@tonic-gate char *hostcertpath; 1687c478bd9Sstevel@tonic-gate union { 1697c478bd9Sstevel@tonic-gate UnixCred_t unix_cred; 1707c478bd9Sstevel@tonic-gate CertCred_t cert_cred; 1717c478bd9Sstevel@tonic-gate } cred; 1727c478bd9Sstevel@tonic-gate } ns_cred_t; 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate typedef struct LineBuf { 1767c478bd9Sstevel@tonic-gate char *str; 1777c478bd9Sstevel@tonic-gate int len; 1787c478bd9Sstevel@tonic-gate int alloc; 1797c478bd9Sstevel@tonic-gate } LineBuf; 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate /* 1827c478bd9Sstevel@tonic-gate * Configuration Information 1837c478bd9Sstevel@tonic-gate */ 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate typedef enum { 1867c478bd9Sstevel@tonic-gate NS_LDAP_FILE_VERSION_P = 0, 1877c478bd9Sstevel@tonic-gate NS_LDAP_BINDDN_P = 1, 1887c478bd9Sstevel@tonic-gate NS_LDAP_BINDPASSWD_P = 2, 1897c478bd9Sstevel@tonic-gate NS_LDAP_SERVERS_P = 3, 1907c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_BASEDN_P = 4, 1917c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_P = 5, 1927c478bd9Sstevel@tonic-gate /* 1937c478bd9Sstevel@tonic-gate * NS_LDAP_TRANSPORT_SEC_P is only left in for backward compatibility 1947c478bd9Sstevel@tonic-gate * with version 1 clients and their configuration files. The only 1957c478bd9Sstevel@tonic-gate * supported value is NS_LDAP_SEC_NONE. No application should be 1967c478bd9Sstevel@tonic-gate * using this parameter type (either through getParam or setParam. 1977c478bd9Sstevel@tonic-gate */ 1987c478bd9Sstevel@tonic-gate NS_LDAP_TRANSPORT_SEC_P = 6, 1997c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_REF_P = 7, 2007c478bd9Sstevel@tonic-gate NS_LDAP_DOMAIN_P = 8, 2017c478bd9Sstevel@tonic-gate NS_LDAP_EXP_P = 9, 2027c478bd9Sstevel@tonic-gate NS_LDAP_CERT_PATH_P = 10, 2037c478bd9Sstevel@tonic-gate NS_LDAP_CERT_PASS_P = 11, 2047c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_DN_P = 12, 2057c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_SCOPE_P = 13, 2067c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_TIME_P = 14, 2077c478bd9Sstevel@tonic-gate NS_LDAP_SERVER_PREF_P = 15, 2087c478bd9Sstevel@tonic-gate NS_LDAP_PREF_ONLY_P = 16, 2097c478bd9Sstevel@tonic-gate NS_LDAP_CACHETTL_P = 17, 2107c478bd9Sstevel@tonic-gate NS_LDAP_PROFILE_P = 18, 2117c478bd9Sstevel@tonic-gate NS_LDAP_CREDENTIAL_LEVEL_P = 19, 2127c478bd9Sstevel@tonic-gate NS_LDAP_SERVICE_SEARCH_DESC_P = 20, 2137c478bd9Sstevel@tonic-gate NS_LDAP_BIND_TIME_P = 21, 2147c478bd9Sstevel@tonic-gate NS_LDAP_ATTRIBUTEMAP_P = 22, 2157c478bd9Sstevel@tonic-gate NS_LDAP_OBJECTCLASSMAP_P = 23, 2167c478bd9Sstevel@tonic-gate NS_LDAP_CERT_NICKNAME_P = 24, 2177c478bd9Sstevel@tonic-gate NS_LDAP_SERVICE_AUTH_METHOD_P = 25, 2187c478bd9Sstevel@tonic-gate NS_LDAP_SERVICE_CRED_LEVEL_P = 26, 2197c478bd9Sstevel@tonic-gate NS_LDAP_HOST_CERTPATH_P = 27, 220dd1104fbSMichen Chang NS_LDAP_ENABLE_SHADOW_UPDATE_P = 28, 221dd1104fbSMichen Chang NS_LDAP_ADMIN_BINDDN_P = 29, 222dd1104fbSMichen Chang NS_LDAP_ADMIN_BINDPASSWD_P = 30, 2237c478bd9Sstevel@tonic-gate /* 2247c478bd9Sstevel@tonic-gate * The following entry (max ParamIndexType) is an internal 2257c478bd9Sstevel@tonic-gate * placeholder. It must be the last (and highest value) 2267c478bd9Sstevel@tonic-gate * entry in this eNum. Please update accordingly. 2277c478bd9Sstevel@tonic-gate */ 228dd1104fbSMichen Chang NS_LDAP_MAX_PIT_P = 31 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate } ParamIndexType; 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate /* 233cb5caa98Sdjl * NONE - No self / SASL/GSSAPI configured 234cb5caa98Sdjl * ONLY - Only self / SASL/GSSAPI configured 235cb5caa98Sdjl * MIXED - self / SASL/GSSAPI is mixed with other types of configuration 236cb5caa98Sdjl */ 237cb5caa98Sdjl typedef enum { 238cb5caa98Sdjl NS_LDAP_SELF_GSSAPI_CONFIG_NONE = 0, 239cb5caa98Sdjl NS_LDAP_SELF_GSSAPI_CONFIG_ONLY = 1, 240cb5caa98Sdjl NS_LDAP_SELF_GSSAPI_CONFIG_MIXED = 2 241cb5caa98Sdjl } ns_ldap_self_gssapi_config_t; 242cb5caa98Sdjl 243cb5caa98Sdjl /* 2447c478bd9Sstevel@tonic-gate * __ns_ldap_*() return codes 2457c478bd9Sstevel@tonic-gate */ 2467c478bd9Sstevel@tonic-gate typedef enum { 2477c478bd9Sstevel@tonic-gate NS_LDAP_SUCCESS = 0, /* success, no info in errorp */ 2487c478bd9Sstevel@tonic-gate NS_LDAP_OP_FAILED = 1, /* failed operation, no info in errorp */ 2497c478bd9Sstevel@tonic-gate NS_LDAP_NOTFOUND = 2, /* entry not found, no info in errorp */ 2507c478bd9Sstevel@tonic-gate NS_LDAP_MEMORY = 3, /* memory failure, no info in errorp */ 2517c478bd9Sstevel@tonic-gate NS_LDAP_CONFIG = 4, /* config problem, detail in errorp */ 2527c478bd9Sstevel@tonic-gate NS_LDAP_PARTIAL = 5, /* partial result, detail in errorp */ 2537c478bd9Sstevel@tonic-gate NS_LDAP_INTERNAL = 7, /* LDAP error, detail in errorp */ 2547c478bd9Sstevel@tonic-gate NS_LDAP_INVALID_PARAM = 8, /* LDAP error, no info in errorp */ 2557c478bd9Sstevel@tonic-gate NS_LDAP_SUCCESS_WITH_INFO 2567c478bd9Sstevel@tonic-gate = 9 /* success, with info in errorp */ 2577c478bd9Sstevel@tonic-gate } ns_ldap_return_code; 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate /* 2607c478bd9Sstevel@tonic-gate * Detailed error code for NS_LDAP_CONFIG 2617c478bd9Sstevel@tonic-gate */ 2627c478bd9Sstevel@tonic-gate typedef enum { 2637c478bd9Sstevel@tonic-gate NS_CONFIG_SYNTAX = 0, /* syntax error */ 2647c478bd9Sstevel@tonic-gate NS_CONFIG_NODEFAULT = 1, /* no default value */ 2657c478bd9Sstevel@tonic-gate NS_CONFIG_NOTLOADED = 2, /* configuration not loaded */ 2667c478bd9Sstevel@tonic-gate NS_CONFIG_NOTALLOW = 3, /* operation requested not allowed */ 2677c478bd9Sstevel@tonic-gate NS_CONFIG_FILE = 4, /* configuration file problem */ 2687c478bd9Sstevel@tonic-gate NS_CONFIG_CACHEMGR = 5 /* error with door to ldap_cachemgr */ 2697c478bd9Sstevel@tonic-gate } ns_ldap_config_return_code; 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gate /* 2727c478bd9Sstevel@tonic-gate * Detailed error code for NS_LDAP_PARTIAL 2737c478bd9Sstevel@tonic-gate */ 2747c478bd9Sstevel@tonic-gate typedef enum { 2757c478bd9Sstevel@tonic-gate NS_PARTIAL_TIMEOUT = 0, /* partial results due to timeout */ 2767c478bd9Sstevel@tonic-gate NS_PARTIAL_OTHER = 1 /* error encountered */ 2777c478bd9Sstevel@tonic-gate } ns_ldap_partial_return_code; 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate /* 2807c478bd9Sstevel@tonic-gate * For use by __ns_ldap_addTypedEntry() for publickey serivicetype 2817c478bd9Sstevel@tonic-gate */ 2827c478bd9Sstevel@tonic-gate typedef enum { 2837c478bd9Sstevel@tonic-gate NS_HOSTCRED_FALSE = 0, 2847c478bd9Sstevel@tonic-gate NS_HOSTCRED_TRUE = 1 2857c478bd9Sstevel@tonic-gate } hostcred_t; 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate /* 2887c478bd9Sstevel@tonic-gate * Detailed password status 2897c478bd9Sstevel@tonic-gate */ 2907c478bd9Sstevel@tonic-gate typedef enum { 2917c478bd9Sstevel@tonic-gate NS_PASSWD_GOOD = 0, /* password is good */ 2927c478bd9Sstevel@tonic-gate NS_PASSWD_ABOUT_TO_EXPIRE = 1, /* password is good but */ 2937c478bd9Sstevel@tonic-gate /* about to expire */ 2947c478bd9Sstevel@tonic-gate NS_PASSWD_CHANGE_NEEDED = 2, /* good but need to be */ 2957c478bd9Sstevel@tonic-gate /* changed immediately */ 2967c478bd9Sstevel@tonic-gate NS_PASSWD_EXPIRED = 3, /* password expired */ 2977c478bd9Sstevel@tonic-gate NS_PASSWD_RETRY_EXCEEDED = 4, /* exceed retry limit; */ 2987c478bd9Sstevel@tonic-gate /* account is locked */ 2997c478bd9Sstevel@tonic-gate NS_PASSWD_CHANGE_NOT_ALLOWED = 5, /* can only be changed */ 3007c478bd9Sstevel@tonic-gate /* by the administrator */ 3017c478bd9Sstevel@tonic-gate NS_PASSWD_INVALID_SYNTAX = 6, /* can not be changed: */ 3027c478bd9Sstevel@tonic-gate /* new password has */ 3037c478bd9Sstevel@tonic-gate /* invalid syntax -- */ 304c31b4830SSerge Dussud /* trivial password: same */ 305c31b4830SSerge Dussud /* value as attr, cn, sn, */ 306c31b4830SSerge Dussud /* uid, etc. */ 307c31b4830SSerge Dussud /* or strong password */ 308c31b4830SSerge Dussud /* policies check */ 3097c478bd9Sstevel@tonic-gate NS_PASSWD_TOO_SHORT = 7, /* can not be changed: */ 3107c478bd9Sstevel@tonic-gate /* new password has */ 3117c478bd9Sstevel@tonic-gate /* less chars than */ 3127c478bd9Sstevel@tonic-gate /* required */ 3137c478bd9Sstevel@tonic-gate NS_PASSWD_IN_HISTORY = 8, /* can not be changed: */ 3147c478bd9Sstevel@tonic-gate /* reuse old password */ 3157c478bd9Sstevel@tonic-gate NS_PASSWD_WITHIN_MIN_AGE = 9 /* can not be changed: */ 3167c478bd9Sstevel@tonic-gate /* within minimum age */ 3177c478bd9Sstevel@tonic-gate } ns_ldap_passwd_status_t; 3187c478bd9Sstevel@tonic-gate 3197c478bd9Sstevel@tonic-gate /* 3207c478bd9Sstevel@tonic-gate * Password management information structure 32147789246Svv149972 * 32247789246Svv149972 * This structure is different from AcctUsableResponse_t structure in 32347789246Svv149972 * that this structure holds result of users account mgmt information when 32447789246Svv149972 * an ldap bind is done with user name and user password. 3257c478bd9Sstevel@tonic-gate */ 3267c478bd9Sstevel@tonic-gate typedef struct ns_ldap_passwd_mgmt { 3277c478bd9Sstevel@tonic-gate ns_ldap_passwd_status_t 3287c478bd9Sstevel@tonic-gate status; /* password status */ 3297c478bd9Sstevel@tonic-gate int sec_until_expired; /* seconds until expired, */ 3307c478bd9Sstevel@tonic-gate /* valid if status is */ 3317c478bd9Sstevel@tonic-gate /* NS_PASSWD_ABOUT_TO_EXPIRE */ 3327c478bd9Sstevel@tonic-gate } ns_ldap_passwd_mgmt_t; 3337c478bd9Sstevel@tonic-gate 33447789246Svv149972 /* 33547789246Svv149972 * LDAP V3 control flag for account management - Used for account management 33647789246Svv149972 * when no password is provided 33747789246Svv149972 */ 33847789246Svv149972 #define NS_LDAP_ACCOUNT_USABLE_CONTROL "1.3.6.1.4.1.42.2.27.9.5.8" 33947789246Svv149972 34047789246Svv149972 /* 34147789246Svv149972 * Structure for holding the response returned by server for 34247789246Svv149972 * NS_LDAP_ACCOUNT_USABLE_CONTROL control when account is not available. 34347789246Svv149972 */ 34447789246Svv149972 typedef struct AcctUsableMoreInfo { 34547789246Svv149972 int inactive; 34647789246Svv149972 int reset; 34747789246Svv149972 int expired; 34847789246Svv149972 int rem_grace; 34947789246Svv149972 int sec_b4_unlock; 35047789246Svv149972 } AcctUsableMoreInfo_t; 35147789246Svv149972 35247789246Svv149972 /* 35347789246Svv149972 * Structure used to hold the response from the server for 35447789246Svv149972 * NS_LDAP_ACCOUNT_USABLE_CONTROL control. The ASN1 notation is as below: 35547789246Svv149972 * 35647789246Svv149972 * ACCOUNT_USABLE_RESPONSE::= CHOICE { 35747789246Svv149972 * is_available [0] INTEGER, seconds before expiration 35847789246Svv149972 * is_not_available [1] More_info 35947789246Svv149972 * } 36047789246Svv149972 * 36147789246Svv149972 * More_info::= SEQUENCE { 36247789246Svv149972 * inactive [0] BOOLEAN DEFAULT FALSE, 36347789246Svv149972 * reset [1] BOOLEAN DEFAULT FALSE, 36447789246Svv149972 * expired [2] BOOLEAN DEFAULT FALSE, 36547789246Svv149972 * remaining_grace [3] INTEGER OPTIONAL, 36647789246Svv149972 * seconds_before_unlock[4] INTEGER OPTIONAL 36747789246Svv149972 * } 36847789246Svv149972 * 36947789246Svv149972 * This structure is different from ns_ldap_passwd_mgmt_t structure in 37047789246Svv149972 * that this structure holds result of users account mgmt information when 37147789246Svv149972 * pam_ldap doesn't have the users password and proxy agent is used for 37247789246Svv149972 * obtaining the account management information. 37347789246Svv149972 */ 37447789246Svv149972 typedef struct AcctUsableResponse { 37547789246Svv149972 int choice; 37647789246Svv149972 union { 37747789246Svv149972 int seconds_before_expiry; 37847789246Svv149972 AcctUsableMoreInfo_t more_info; 37947789246Svv149972 } AcctUsableResp; 38047789246Svv149972 } AcctUsableResponse_t; 3817c478bd9Sstevel@tonic-gate 3827c478bd9Sstevel@tonic-gate /* 3837c478bd9Sstevel@tonic-gate * Simplified LDAP Naming API result structure 3847c478bd9Sstevel@tonic-gate */ 3857c478bd9Sstevel@tonic-gate typedef struct ns_ldap_error { 3867c478bd9Sstevel@tonic-gate int status; /* LDAP error code */ 3877c478bd9Sstevel@tonic-gate char *message; /* LDAP error message */ 3887c478bd9Sstevel@tonic-gate ns_ldap_passwd_mgmt_t pwd_mgmt; /* LDAP password */ 3897c478bd9Sstevel@tonic-gate /* management info */ 3907c478bd9Sstevel@tonic-gate } ns_ldap_error_t; 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate typedef struct ns_ldap_attr { 3937c478bd9Sstevel@tonic-gate char *attrname; /* attribute name */ 3947c478bd9Sstevel@tonic-gate uint_t value_count; 3957c478bd9Sstevel@tonic-gate char **attrvalue; /* attribute values */ 3967c478bd9Sstevel@tonic-gate } ns_ldap_attr_t; 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate typedef struct ns_ldap_entry { 3997c478bd9Sstevel@tonic-gate uint_t attr_count; /* number of attributes */ 4007c478bd9Sstevel@tonic-gate ns_ldap_attr_t **attr_pair; /* attributes pairs */ 4017c478bd9Sstevel@tonic-gate struct ns_ldap_entry *next; /* next entry */ 4027c478bd9Sstevel@tonic-gate } ns_ldap_entry_t; 4037c478bd9Sstevel@tonic-gate 4047c478bd9Sstevel@tonic-gate typedef struct ns_ldap_result { 4057c478bd9Sstevel@tonic-gate uint_t entries_count; /* number of entries */ 4067c478bd9Sstevel@tonic-gate ns_ldap_entry_t *entry; /* data */ 4077c478bd9Sstevel@tonic-gate } ns_ldap_result_t; 4087c478bd9Sstevel@tonic-gate 4097c478bd9Sstevel@tonic-gate /* 4107c478bd9Sstevel@tonic-gate * structures for the conversion routines used by typedAddEntry() 4117c478bd9Sstevel@tonic-gate */ 4127c478bd9Sstevel@tonic-gate 4137c478bd9Sstevel@tonic-gate typedef struct _ns_netgroups { 4147c478bd9Sstevel@tonic-gate char *name; 4157c478bd9Sstevel@tonic-gate char **triplet; 4167c478bd9Sstevel@tonic-gate char **netgroup; 4177c478bd9Sstevel@tonic-gate } _ns_netgroups_t; 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate typedef struct _ns_netmasks { 4207c478bd9Sstevel@tonic-gate char *netnumber; 4217c478bd9Sstevel@tonic-gate char *netmask; 4227c478bd9Sstevel@tonic-gate } _ns_netmasks_t; 4237c478bd9Sstevel@tonic-gate 4247c478bd9Sstevel@tonic-gate typedef struct _ns_bootp { 4257c478bd9Sstevel@tonic-gate char *name; 4267c478bd9Sstevel@tonic-gate char **param; 4277c478bd9Sstevel@tonic-gate } _ns_bootp_t; 4287c478bd9Sstevel@tonic-gate 4297c478bd9Sstevel@tonic-gate typedef struct _ns_ethers { 4307c478bd9Sstevel@tonic-gate char *name; 4317c478bd9Sstevel@tonic-gate char *ether; 4327c478bd9Sstevel@tonic-gate } _ns_ethers_t; 4337c478bd9Sstevel@tonic-gate 4347c478bd9Sstevel@tonic-gate typedef struct _ns_pubkey { 4357c478bd9Sstevel@tonic-gate char *name; 4367c478bd9Sstevel@tonic-gate hostcred_t hostcred; 4377c478bd9Sstevel@tonic-gate char *pubkey; 4387c478bd9Sstevel@tonic-gate char *privkey; 4397c478bd9Sstevel@tonic-gate } _ns_pubkey_t; 4407c478bd9Sstevel@tonic-gate 4417c478bd9Sstevel@tonic-gate typedef struct _ns_alias { 4427c478bd9Sstevel@tonic-gate char *alias; 4437c478bd9Sstevel@tonic-gate char **member; 4447c478bd9Sstevel@tonic-gate } _ns_alias_t; 4457c478bd9Sstevel@tonic-gate 4467c478bd9Sstevel@tonic-gate typedef struct _ns_automount { 4477c478bd9Sstevel@tonic-gate char *mapname; 4487c478bd9Sstevel@tonic-gate char *key; 4497c478bd9Sstevel@tonic-gate char *value; 4507c478bd9Sstevel@tonic-gate } _ns_automount_t; 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gate /* 4537c478bd9Sstevel@tonic-gate * return values for the callback function in __ns_ldap_list() 4547c478bd9Sstevel@tonic-gate */ 4557c478bd9Sstevel@tonic-gate #define NS_LDAP_CB_NEXT 0 /* get the next entry */ 4567c478bd9Sstevel@tonic-gate #define NS_LDAP_CB_DONE 1 /* done */ 4577c478bd9Sstevel@tonic-gate 4587c478bd9Sstevel@tonic-gate /* 4597c478bd9Sstevel@tonic-gate * Input values for the type specified in __ns_ldap_addTypedEntry() 4607c478bd9Sstevel@tonic-gate * and __ns_ldap_delTypedEntry() 4617c478bd9Sstevel@tonic-gate */ 4627c478bd9Sstevel@tonic-gate 4637c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PASSWD "passwd" 4647c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_GROUP "group" 4657c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_HOSTS "hosts" 4667c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_IPNODES "ipnodes" 4677c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PROFILE "prof_attr" 4687c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_RPC "rpc" 4697c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PROTOCOLS "protocols" 4707c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_NETWORKS "networks" 4717c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_NETGROUP "netgroup" 4727c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_ALIASES "aliases" 4737c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_SERVICES "services" 4747c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_ETHERS "ethers" 4757c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_SHADOW "shadow" 4767c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_NETMASKS "netmasks" 4777c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_AUTHATTR "auth_attr" 4787c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_EXECATTR "exec_attr" 4797c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_USERATTR "user_attr" 4807c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PROJECT "project" 4817c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PUBLICKEY "publickey" 4827c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_AUUSER "audit_user" 4837c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_BOOTPARAMS "bootparams" 4847c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_AUTOMOUNT "auto_" 48545916cd2Sjpk #define NS_LDAP_TYPE_TNRHDB "tnrhdb" 48645916cd2Sjpk #define NS_LDAP_TYPE_TNRHTP "tnrhtp" 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate /* 4897c478bd9Sstevel@tonic-gate * service descriptor/attribute mapping structure 4907c478bd9Sstevel@tonic-gate */ 4917c478bd9Sstevel@tonic-gate 4927c478bd9Sstevel@tonic-gate typedef struct ns_ldap_search_desc { 4937c478bd9Sstevel@tonic-gate char *basedn; /* search base dn */ 4947c478bd9Sstevel@tonic-gate ScopeType_t scope; /* search scope */ 4957c478bd9Sstevel@tonic-gate char *filter; /* search filter */ 4967c478bd9Sstevel@tonic-gate } ns_ldap_search_desc_t; 4977c478bd9Sstevel@tonic-gate 4987c478bd9Sstevel@tonic-gate typedef struct ns_ldap_attribute_map { 4997c478bd9Sstevel@tonic-gate char *origAttr; /* original attribute */ 5007c478bd9Sstevel@tonic-gate char **mappedAttr; /* mapped attribute(s) */ 5017c478bd9Sstevel@tonic-gate } ns_ldap_attribute_map_t; 5027c478bd9Sstevel@tonic-gate 5037c478bd9Sstevel@tonic-gate typedef struct ns_ldap_objectclass_map { 5047c478bd9Sstevel@tonic-gate char *origOC; /* original objectclass */ 5057c478bd9Sstevel@tonic-gate char *mappedOC; /* mapped objectclass */ 5067c478bd9Sstevel@tonic-gate } ns_ldap_objectclass_map_t; 5077c478bd9Sstevel@tonic-gate 508dd1104fbSMichen Chang /* 509dd1104fbSMichen Chang * Value of the userPassword attribute representing NO Unix password 510dd1104fbSMichen Chang */ 511dd1104fbSMichen Chang #define NS_LDAP_NO_UNIX_PASSWORD "<NO UNIX PASSWORD>" 512dd1104fbSMichen Chang 513479ac375Sdm199847 /* Opaque handle for batch API */ 514479ac375Sdm199847 typedef struct ns_ldap_list_batch ns_ldap_list_batch_t; 515479ac375Sdm199847 5167c478bd9Sstevel@tonic-gate /* 517e1dd0a2fSth160488 * The type of standalone configuration specified by a client application. 518e1dd0a2fSth160488 * The meaning of the requests is as follows: 519e1dd0a2fSth160488 * 520e1dd0a2fSth160488 * NS_CACHEMGR: libsldap will request all the configuration via door_call(3C) 521e1dd0a2fSth160488 * to ldap_cachemgr. 522e1dd0a2fSth160488 * NS_LDAP_SERVER: the consumer application has specified a directory server 523e1dd0a2fSth160488 * to communicate to. 524e1dd0a2fSth160488 * NS_PREDEFINED: reserved for internal use 525e1dd0a2fSth160488 */ 526e1dd0a2fSth160488 typedef enum { 527e1dd0a2fSth160488 NS_CACHEMGR = 0, 528e1dd0a2fSth160488 NS_LDAP_SERVER 529e1dd0a2fSth160488 } ns_standalone_request_type_t; 530e1dd0a2fSth160488 531e1dd0a2fSth160488 /* 532e1dd0a2fSth160488 * This structure describes an LDAP server specified by a client application. 533e1dd0a2fSth160488 */ 534e1dd0a2fSth160488 typedef struct ns_dir_server { 535e1dd0a2fSth160488 char *server; /* A directory server's IP */ 536e1dd0a2fSth160488 uint16_t port; /* A directory server's port. */ 537e1dd0a2fSth160488 /* Default value is 389 */ 538e1dd0a2fSth160488 char *domainName; /* A domain name being served */ 539e1dd0a2fSth160488 /* by the specified server. */ 540e1dd0a2fSth160488 /* Default value is the local */ 541e1dd0a2fSth160488 /* domain's name */ 542e1dd0a2fSth160488 char *profileName; /* A DUAProfile's name. */ 543e1dd0a2fSth160488 /* Default value is 'default' */ 544e1dd0a2fSth160488 ns_auth_t *auth; /* Authentication information used */ 545e1dd0a2fSth160488 /* during subsequent connections */ 546e1dd0a2fSth160488 char *cred; /* A credential level to be used */ 547e1dd0a2fSth160488 /* along with the authentication info */ 548e1dd0a2fSth160488 char *host_cert_path; /* A path to the certificate database */ 549e1dd0a2fSth160488 /* Default is '/vat/ldap' */ 550e1dd0a2fSth160488 char *bind_dn; /* A bind DN to be used during */ 551e1dd0a2fSth160488 /* subsequent LDAP Bind requests */ 552e1dd0a2fSth160488 char *bind_passwd; /* A bind password to be used during */ 553e1dd0a2fSth160488 /* subsequent LDAP Bind requests */ 554e1dd0a2fSth160488 } ns_dir_server_t; 555e1dd0a2fSth160488 556e1dd0a2fSth160488 /* 557e1dd0a2fSth160488 * This structure contains information describing an LDAP server. 558e1dd0a2fSth160488 */ 559e1dd0a2fSth160488 typedef struct ns_standalone_conf { 560e1dd0a2fSth160488 union { 561e1dd0a2fSth160488 ns_dir_server_t server; 562e1dd0a2fSth160488 void *predefined_conf; /* Reserved for internal use */ 563e1dd0a2fSth160488 } ds_profile; /* A type of the configuration */ 564e1dd0a2fSth160488 565e1dd0a2fSth160488 #define SA_SERVER ds_profile.server.server 566e1dd0a2fSth160488 #define SA_PORT ds_profile.server.port 567e1dd0a2fSth160488 #define SA_DOMAIN ds_profile.server.domainName 568e1dd0a2fSth160488 #define SA_PROFILE_NAME ds_profile.server.profileName 569e1dd0a2fSth160488 #define SA_AUTH ds_profile.server.auth 570e1dd0a2fSth160488 #define SA_CRED ds_profile.server.cred 571e1dd0a2fSth160488 #define SA_CERT_PATH ds_profile.server.host_cert_path 572e1dd0a2fSth160488 #define SA_BIND_DN ds_profile.server.bind_dn 573e1dd0a2fSth160488 #define SA_BIND_PWD ds_profile.server.bind_passwd 574e1dd0a2fSth160488 575e1dd0a2fSth160488 ns_standalone_request_type_t type; 576e1dd0a2fSth160488 } ns_standalone_conf_t; 577e1dd0a2fSth160488 578e1dd0a2fSth160488 /* 579e1dd0a2fSth160488 * This function "informs" libsldap that a client application has specified 580e1dd0a2fSth160488 * a directory to use. The function obtains a DUAProfile, credentials, 581e1dd0a2fSth160488 * and naming context. During all further operations on behalf 582e1dd0a2fSth160488 * of the application requested a standalone schema libsldap will use 583e1dd0a2fSth160488 * the information obtained by __ns_ldap_initStandalone() instead of 584e1dd0a2fSth160488 * door_call(3C)ing ldap_cachemgr(1M). 585e1dd0a2fSth160488 * 586e1dd0a2fSth160488 * conf 587e1dd0a2fSth160488 * A structure describing where and in which way to obtain all the 588e1dd0a2fSth160488 * configuration describing how to communicate to a choosen LDAP directory. 589e1dd0a2fSth160488 * 590e1dd0a2fSth160488 * errorp 591e1dd0a2fSth160488 * An error object describing an error occured. 592e1dd0a2fSth160488 */ 593e1dd0a2fSth160488 ns_ldap_return_code __ns_ldap_initStandalone( 594e1dd0a2fSth160488 const ns_standalone_conf_t *conf, 595e1dd0a2fSth160488 ns_ldap_error_t **errorp); 596e1dd0a2fSth160488 597e1dd0a2fSth160488 /* 598e1dd0a2fSth160488 * This function obtains the directory's base DN and a DUAProfile 599e1dd0a2fSth160488 * from a specified server. 600e1dd0a2fSth160488 * 601e1dd0a2fSth160488 * server 602e1dd0a2fSth160488 * Specifies the selected directory sever. 603e1dd0a2fSth160488 * 604e1dd0a2fSth160488 * cred 605e1dd0a2fSth160488 * Contains an authentication information and credential required to 606e1dd0a2fSth160488 * establish a connection. 607e1dd0a2fSth160488 * 608e1dd0a2fSth160488 * config 609e1dd0a2fSth160488 * If not NULL, a new configuration basing on a DUAProfile specified in the 610e1dd0a2fSth160488 * server parameter will be create and returned. 611e1dd0a2fSth160488 * 612e1dd0a2fSth160488 * baseDN 613e1dd0a2fSth160488 * If not NULL, the directory's base DN will be returned. 614e1dd0a2fSth160488 * 615e1dd0a2fSth160488 * error 616e1dd0a2fSth160488 * Describes an error, if any. 617e1dd0a2fSth160488 */ 618e1dd0a2fSth160488 ns_ldap_return_code __ns_ldap_getConnectionInfoFromDUA( 619e1dd0a2fSth160488 const ns_dir_server_t *server, 620e1dd0a2fSth160488 const ns_cred_t *cred, 621e1dd0a2fSth160488 char **config, char **baseDN, 622e1dd0a2fSth160488 ns_ldap_error_t **error); 623e1dd0a2fSth160488 624e1dd0a2fSth160488 #define SA_PROHIBIT_FALLBACK 0 625e1dd0a2fSth160488 #define SA_ALLOW_FALLBACK 1 626e1dd0a2fSth160488 627e1dd0a2fSth160488 #define DONT_SAVE_NSCONF 0 628e1dd0a2fSth160488 #define SAVE_NSCONF 1 629e1dd0a2fSth160488 630e1dd0a2fSth160488 /* 631e1dd0a2fSth160488 * This function obtains the root DSE from a specified server. 632e1dd0a2fSth160488 * 633e1dd0a2fSth160488 * server_addr 634e1dd0a2fSth160488 * An adress of a server to be connected to. 635e1dd0a2fSth160488 * 636e1dd0a2fSth160488 * rootDSE 637e1dd0a2fSth160488 * A buffer containing the root DSE in the ldap_cachmgr door call format. 638e1dd0a2fSth160488 * 639e1dd0a2fSth160488 * errorp 640e1dd0a2fSth160488 * Describes an error, if any. 641e1dd0a2fSth160488 * 642e1dd0a2fSth160488 * anon_fallback 643e1dd0a2fSth160488 * If set to 1 and establishing a connection fails, __s_api_getRootDSE() 644e1dd0a2fSth160488 * will try once again using anonymous credentials. 645e1dd0a2fSth160488 */ 646e1dd0a2fSth160488 ns_ldap_return_code __ns_ldap_getRootDSE( 647e1dd0a2fSth160488 const char *server_addr, 648e1dd0a2fSth160488 char **rootDSE, 649e1dd0a2fSth160488 ns_ldap_error_t **errorp, 650e1dd0a2fSth160488 int anon_fallback); 651e1dd0a2fSth160488 652e1dd0a2fSth160488 /* 653e1dd0a2fSth160488 * This function iterates through the list of the configured LDAP servers 654e1dd0a2fSth160488 * and "pings" those which are marked as removed or if any error occurred 655e1dd0a2fSth160488 * during the previous receiving of the server's root DSE. If the 656e1dd0a2fSth160488 * function is able to reach such a server and get its root DSE, it 657e1dd0a2fSth160488 * marks the server as on-line. Otherwise, the server's status is set 658e1dd0a2fSth160488 * to "Error". 659e1dd0a2fSth160488 * For each server the function tries to connect to, it fires up 660e1dd0a2fSth160488 * a separate thread and then waits until all the threads finish. 661e1dd0a2fSth160488 * The function returns NS_LDAP_INTERNAL if the Standalone mode was not 662e1dd0a2fSth160488 * initialized or was canceled prior to an invocation of 663e1dd0a2fSth160488 * __ns_ldap_pingOfflineServers(). 664e1dd0a2fSth160488 */ 665e1dd0a2fSth160488 ns_ldap_return_code __ns_ldap_pingOfflineServers(void); 666e1dd0a2fSth160488 667e1dd0a2fSth160488 /* 668e1dd0a2fSth160488 * This function cancels the Standalone mode and destroys the list of root DSEs. 669e1dd0a2fSth160488 */ 670e1dd0a2fSth160488 void __ns_ldap_cancelStandalone(void); 671e1dd0a2fSth160488 /* 672e1dd0a2fSth160488 * This function initializes an ns_auth_t structure provided by a caller 673e1dd0a2fSth160488 * according to a specified authentication mechanism. 674e1dd0a2fSth160488 */ 675e1dd0a2fSth160488 ns_ldap_return_code __ns_ldap_initAuth(const char *auth_mech, 676e1dd0a2fSth160488 ns_auth_t *auth, 677e1dd0a2fSth160488 ns_ldap_error_t **errorp); 678e1dd0a2fSth160488 679e1dd0a2fSth160488 /* 6807c478bd9Sstevel@tonic-gate * Simplified LDAP Naming APIs 6817c478bd9Sstevel@tonic-gate */ 6827c478bd9Sstevel@tonic-gate int __ns_ldap_list( 6837c478bd9Sstevel@tonic-gate const char *service, 6847c478bd9Sstevel@tonic-gate const char *filter, 6857c478bd9Sstevel@tonic-gate int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, 6867c478bd9Sstevel@tonic-gate char **realfilter, const void *userdata), 6877c478bd9Sstevel@tonic-gate const char * const *attribute, 6887c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 6897c478bd9Sstevel@tonic-gate const int flags, 6907c478bd9Sstevel@tonic-gate ns_ldap_result_t ** result, 6917c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp, 6927c478bd9Sstevel@tonic-gate int (*callback)(const ns_ldap_entry_t *entry, const void *userdata), 6937c478bd9Sstevel@tonic-gate const void *userdata); 6947c478bd9Sstevel@tonic-gate 6959f2fd570SJulian Pullen 6969f2fd570SJulian Pullen int __ns_ldap_list_sort( 6979f2fd570SJulian Pullen const char *service, 6989f2fd570SJulian Pullen const char *filter, 6999f2fd570SJulian Pullen const char *sortattr, 7009f2fd570SJulian Pullen int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, 7019f2fd570SJulian Pullen char **realfilter, const void *userdata), 7029f2fd570SJulian Pullen const char * const *attribute, 7039f2fd570SJulian Pullen const ns_cred_t *cred, 7049f2fd570SJulian Pullen const int flags, 7059f2fd570SJulian Pullen ns_ldap_result_t ** result, 7069f2fd570SJulian Pullen ns_ldap_error_t ** errorp, 7079f2fd570SJulian Pullen int (*callback)(const ns_ldap_entry_t *entry, const void *userdata), 7089f2fd570SJulian Pullen const void *userdata); 7099f2fd570SJulian Pullen 710479ac375Sdm199847 int __ns_ldap_list_batch_start( 711479ac375Sdm199847 ns_ldap_list_batch_t **batch); 712479ac375Sdm199847 713479ac375Sdm199847 int __ns_ldap_list_batch_add( 714479ac375Sdm199847 ns_ldap_list_batch_t *batch, 715479ac375Sdm199847 const char *service, 716479ac375Sdm199847 const char *filter, 717479ac375Sdm199847 int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, 718479ac375Sdm199847 char **realfilter, const void *userdata), 719479ac375Sdm199847 const char * const *attribute, 720479ac375Sdm199847 const ns_cred_t *cred, 721479ac375Sdm199847 const int flags, 722479ac375Sdm199847 ns_ldap_result_t ** result, 723479ac375Sdm199847 ns_ldap_error_t ** errorp, 724479ac375Sdm199847 int *rcp, 725479ac375Sdm199847 int (*callback)(const ns_ldap_entry_t *entry, const void *userdata), 726479ac375Sdm199847 const void *userdata); 727479ac375Sdm199847 728479ac375Sdm199847 int __ns_ldap_list_batch_end( 729479ac375Sdm199847 ns_ldap_list_batch_t *batch); 730479ac375Sdm199847 731479ac375Sdm199847 void __ns_ldap_list_batch_release( 732479ac375Sdm199847 ns_ldap_list_batch_t *batch); 733479ac375Sdm199847 7347c478bd9Sstevel@tonic-gate int __ns_ldap_addAttr( 7357c478bd9Sstevel@tonic-gate const char *service, 7367c478bd9Sstevel@tonic-gate const char *dn, 7377c478bd9Sstevel@tonic-gate const ns_ldap_attr_t * const *attr, 7387c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7397c478bd9Sstevel@tonic-gate const int flags, 7407c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7417c478bd9Sstevel@tonic-gate 7427c478bd9Sstevel@tonic-gate int __ns_ldap_delAttr( 7437c478bd9Sstevel@tonic-gate const char *service, 7447c478bd9Sstevel@tonic-gate const char *dn, 7457c478bd9Sstevel@tonic-gate const ns_ldap_attr_t * const *attr, 7467c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7477c478bd9Sstevel@tonic-gate const int flags, 7487c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7497c478bd9Sstevel@tonic-gate 7507c478bd9Sstevel@tonic-gate int __ns_ldap_repAttr( 7517c478bd9Sstevel@tonic-gate const char *service, 7527c478bd9Sstevel@tonic-gate const char *dn, 7537c478bd9Sstevel@tonic-gate const ns_ldap_attr_t * const *attr, 7547c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7557c478bd9Sstevel@tonic-gate const int flags, 7567c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7577c478bd9Sstevel@tonic-gate 7587c478bd9Sstevel@tonic-gate int __ns_ldap_addEntry( 7597c478bd9Sstevel@tonic-gate const char *service, 7607c478bd9Sstevel@tonic-gate const char *dn, 7617c478bd9Sstevel@tonic-gate const ns_ldap_entry_t *entry, 7627c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7637c478bd9Sstevel@tonic-gate const int flags, 7647c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7657c478bd9Sstevel@tonic-gate 7667c478bd9Sstevel@tonic-gate int __ns_ldap_addTypedEntry( 7677c478bd9Sstevel@tonic-gate const char *servicetype, 7687c478bd9Sstevel@tonic-gate const char *basedn, 7697c478bd9Sstevel@tonic-gate const void *data, 7707c478bd9Sstevel@tonic-gate const int create, 7717c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7727c478bd9Sstevel@tonic-gate const int flags, 7737c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7747c478bd9Sstevel@tonic-gate 7757c478bd9Sstevel@tonic-gate int __ns_ldap_delEntry( 7767c478bd9Sstevel@tonic-gate const char *service, 7777c478bd9Sstevel@tonic-gate const char *dn, 7787c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7797c478bd9Sstevel@tonic-gate const int flags, 7807c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7817c478bd9Sstevel@tonic-gate 7827c478bd9Sstevel@tonic-gate int __ns_ldap_firstEntry( 7837c478bd9Sstevel@tonic-gate const char *service, 7847c478bd9Sstevel@tonic-gate const char *filter, 7859f2fd570SJulian Pullen const char *sortattr, 7867c478bd9Sstevel@tonic-gate int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, 7877c478bd9Sstevel@tonic-gate char **realfilter, const void *userdata), 7887c478bd9Sstevel@tonic-gate const char * const *attribute, 7897c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7907c478bd9Sstevel@tonic-gate const int flags, 7917c478bd9Sstevel@tonic-gate void **cookie, 7927c478bd9Sstevel@tonic-gate ns_ldap_result_t ** result, 7937c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp, 7947c478bd9Sstevel@tonic-gate const void *userdata); 7957c478bd9Sstevel@tonic-gate 7967c478bd9Sstevel@tonic-gate int __ns_ldap_nextEntry( 7977c478bd9Sstevel@tonic-gate void *cookie, 7987c478bd9Sstevel@tonic-gate ns_ldap_result_t ** result, 7997c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8007c478bd9Sstevel@tonic-gate 8017c478bd9Sstevel@tonic-gate int __ns_ldap_endEntry( 8027c478bd9Sstevel@tonic-gate void **cookie, 8037c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8047c478bd9Sstevel@tonic-gate 8057c478bd9Sstevel@tonic-gate int __ns_ldap_freeResult( 8067c478bd9Sstevel@tonic-gate ns_ldap_result_t **result); 8077c478bd9Sstevel@tonic-gate 8087c478bd9Sstevel@tonic-gate int __ns_ldap_freeError( 8097c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8107c478bd9Sstevel@tonic-gate 8117c478bd9Sstevel@tonic-gate int __ns_ldap_uid2dn( 8127c478bd9Sstevel@tonic-gate const char *uid, 8137c478bd9Sstevel@tonic-gate char **userDN, 8147c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 8157c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp); 8167c478bd9Sstevel@tonic-gate 8177c478bd9Sstevel@tonic-gate int __ns_ldap_host2dn( 8187c478bd9Sstevel@tonic-gate const char *host, 8197c478bd9Sstevel@tonic-gate const char *domain, 8207c478bd9Sstevel@tonic-gate char **hostDN, 8217c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 8227c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp); 8237c478bd9Sstevel@tonic-gate 8247c478bd9Sstevel@tonic-gate int __ns_ldap_dn2domain( 8257c478bd9Sstevel@tonic-gate const char *dn, 8267c478bd9Sstevel@tonic-gate char **domain, 8277c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 8287c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp); 8297c478bd9Sstevel@tonic-gate 8307c478bd9Sstevel@tonic-gate int __ns_ldap_auth( 8317c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 8327c478bd9Sstevel@tonic-gate const int flag, 8337c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp, 8347c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, 8357c478bd9Sstevel@tonic-gate LDAPControl **clientctrls); 8367c478bd9Sstevel@tonic-gate 8377c478bd9Sstevel@tonic-gate int __ns_ldap_freeCred( 8387c478bd9Sstevel@tonic-gate ns_cred_t **credp); 8397c478bd9Sstevel@tonic-gate 8407c478bd9Sstevel@tonic-gate int __ns_ldap_err2str( 8417c478bd9Sstevel@tonic-gate int err, 8427c478bd9Sstevel@tonic-gate char **strmsg); 8437c478bd9Sstevel@tonic-gate 8447c478bd9Sstevel@tonic-gate int __ns_ldap_setParam( 8457c478bd9Sstevel@tonic-gate const ParamIndexType type, 8467c478bd9Sstevel@tonic-gate const void *data, 8477c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8487c478bd9Sstevel@tonic-gate 8497c478bd9Sstevel@tonic-gate int __ns_ldap_getParam( 8507c478bd9Sstevel@tonic-gate const ParamIndexType type, 8517c478bd9Sstevel@tonic-gate void ***data, 8527c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8537c478bd9Sstevel@tonic-gate 8547c478bd9Sstevel@tonic-gate int __ns_ldap_freeParam( 8557c478bd9Sstevel@tonic-gate void ***data); 8567c478bd9Sstevel@tonic-gate 8577c478bd9Sstevel@tonic-gate char **__ns_ldap_getAttr( 8587c478bd9Sstevel@tonic-gate const ns_ldap_entry_t *entry, 8597c478bd9Sstevel@tonic-gate const char *attrname); 8607c478bd9Sstevel@tonic-gate 861cb5caa98Sdjl ns_ldap_attr_t *__ns_ldap_getAttrStruct( 862cb5caa98Sdjl const ns_ldap_entry_t *entry, 863cb5caa98Sdjl const char *attrname); 864cb5caa98Sdjl 8657c478bd9Sstevel@tonic-gate int __ns_ldap_getServiceAuthMethods( 8667c478bd9Sstevel@tonic-gate const char *service, 8677c478bd9Sstevel@tonic-gate ns_auth_t ***auth, 8687c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8697c478bd9Sstevel@tonic-gate 8707c478bd9Sstevel@tonic-gate int __ns_ldap_getSearchDescriptors( 8717c478bd9Sstevel@tonic-gate const char *service, 8727c478bd9Sstevel@tonic-gate ns_ldap_search_desc_t ***desc, 8737c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8747c478bd9Sstevel@tonic-gate 8757c478bd9Sstevel@tonic-gate int __ns_ldap_freeSearchDescriptors( 8767c478bd9Sstevel@tonic-gate ns_ldap_search_desc_t ***desc); 8777c478bd9Sstevel@tonic-gate 8787c478bd9Sstevel@tonic-gate int __ns_ldap_getAttributeMaps( 8797c478bd9Sstevel@tonic-gate const char *service, 8807c478bd9Sstevel@tonic-gate ns_ldap_attribute_map_t ***maps, 8817c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8827c478bd9Sstevel@tonic-gate 8837c478bd9Sstevel@tonic-gate int __ns_ldap_freeAttributeMaps( 8847c478bd9Sstevel@tonic-gate ns_ldap_attribute_map_t ***maps); 8857c478bd9Sstevel@tonic-gate 8867c478bd9Sstevel@tonic-gate char **__ns_ldap_getMappedAttributes( 8877c478bd9Sstevel@tonic-gate const char *service, 8887c478bd9Sstevel@tonic-gate const char *origAttribute); 8897c478bd9Sstevel@tonic-gate 8907c478bd9Sstevel@tonic-gate char **__ns_ldap_getOrigAttribute( 8917c478bd9Sstevel@tonic-gate const char *service, 8927c478bd9Sstevel@tonic-gate const char *mappedAttribute); 8937c478bd9Sstevel@tonic-gate 8947c478bd9Sstevel@tonic-gate int __ns_ldap_getObjectClassMaps( 8957c478bd9Sstevel@tonic-gate const char *service, 8967c478bd9Sstevel@tonic-gate ns_ldap_objectclass_map_t ***maps, 8977c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8987c478bd9Sstevel@tonic-gate 8997c478bd9Sstevel@tonic-gate int __ns_ldap_freeObjectClassMaps( 9007c478bd9Sstevel@tonic-gate ns_ldap_objectclass_map_t ***maps); 9017c478bd9Sstevel@tonic-gate 9027c478bd9Sstevel@tonic-gate char **__ns_ldap_getMappedObjectClass( 9037c478bd9Sstevel@tonic-gate const char *service, 9047c478bd9Sstevel@tonic-gate const char *origObjectClass); 9057c478bd9Sstevel@tonic-gate 9067c478bd9Sstevel@tonic-gate char **__ns_ldap_getOrigObjectClass( 9077c478bd9Sstevel@tonic-gate const char *service, 9087c478bd9Sstevel@tonic-gate const char *mappedObjectClass); 9097c478bd9Sstevel@tonic-gate 9107c478bd9Sstevel@tonic-gate int __ns_ldap_getParamType( 9117c478bd9Sstevel@tonic-gate const char *value, 9127c478bd9Sstevel@tonic-gate ParamIndexType *type); 91347789246Svv149972 91447789246Svv149972 int __ns_ldap_getAcctMgmt( 91547789246Svv149972 const char *user, 91647789246Svv149972 AcctUsableResponse_t *acctResp); 917dd1104fbSMichen Chang 918*225376fbSJulian Pullen boolean_t __ns_ldap_is_shadow_update_enabled(void); 919dd1104fbSMichen Chang 920cb5caa98Sdjl void 921cb5caa98Sdjl __ns_ldap_self_gssapi_only_set( 922cb5caa98Sdjl int flag); 923cb5caa98Sdjl int 924cb5caa98Sdjl __ns_ldap_self_gssapi_config( 925cb5caa98Sdjl ns_ldap_self_gssapi_config_t *config); 9267c478bd9Sstevel@tonic-gate #ifdef __cplusplus 9277c478bd9Sstevel@tonic-gate } 9287c478bd9Sstevel@tonic-gate #endif 9297c478bd9Sstevel@tonic-gate 9307c478bd9Sstevel@tonic-gate #endif /* _NS_SLDAP_H */ 931