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 /* 22*dd1104fbSMichen Chang * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _NS_SLDAP_H 287c478bd9Sstevel@tonic-gate #define _NS_SLDAP_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <stdio.h> 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #include <lber.h> 377c478bd9Sstevel@tonic-gate #include <ldap.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate /* 407c478bd9Sstevel@tonic-gate * Version 417c478bd9Sstevel@tonic-gate */ 427c478bd9Sstevel@tonic-gate #define NS_LDAP_VERSION NS_LDAP_VERSION_2 437c478bd9Sstevel@tonic-gate #define NS_LDAP_VERSION_1 "1.0" 447c478bd9Sstevel@tonic-gate #define NS_LDAP_VERSION_2 "2.0" 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* 477c478bd9Sstevel@tonic-gate * Flags 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate #define NS_LDAP_HARD 0x001 507c478bd9Sstevel@tonic-gate #define NS_LDAP_ALL_RES 0x002 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* Search Referral Option */ 537c478bd9Sstevel@tonic-gate typedef enum SearchRef { 547c478bd9Sstevel@tonic-gate NS_LDAP_FOLLOWREF = 0x004, 557c478bd9Sstevel@tonic-gate NS_LDAP_NOREF = 0x008 567c478bd9Sstevel@tonic-gate } SearchRef_t; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate typedef enum ScopeType { 597c478bd9Sstevel@tonic-gate NS_LDAP_SCOPE_BASE = 0x010, 607c478bd9Sstevel@tonic-gate NS_LDAP_SCOPE_ONELEVEL = 0x020, 617c478bd9Sstevel@tonic-gate NS_LDAP_SCOPE_SUBTREE = 0x040 627c478bd9Sstevel@tonic-gate } ScopeType_t; 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* 657c478bd9Sstevel@tonic-gate * BE VERY CAREFUL. DO NOT USE FLAG NS_LDAP_KEEP_CONN UNLESS YOU MUST 667c478bd9Sstevel@tonic-gate * IN libsldap.so.1 THERE IS NO CONNECTION GARBAGE COLLECTION AND IF 677c478bd9Sstevel@tonic-gate * THIS FLAG GETS USED THERE MIGHT BE A CONNECTION LEAK. CURRENTLY THIS 687c478bd9Sstevel@tonic-gate * IS ONLY SUPPORTED FOR LIST AND INTENDED FOR APPLICATIONS LIKE AUTOMOUNTER 697c478bd9Sstevel@tonic-gate */ 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #define NS_LDAP_KEEP_CONN 0x080 727c478bd9Sstevel@tonic-gate #define NS_LDAP_NEW_CONN 0x400 737c478bd9Sstevel@tonic-gate #define NS_LDAP_NOMAP 0x800 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate #define NS_LDAP_PAGE_CTRL 0x1000 767c478bd9Sstevel@tonic-gate #define NS_LDAP_NO_PAGE_CTRL 0x0000 777c478bd9Sstevel@tonic-gate 78f5c3c7a7Ssdussud /* 79f5c3c7a7Ssdussud * NS_LDAP_NOT_CVT_DN is needed when attribute mapping is used 80f5c3c7a7Ssdussud * to retrieve the DN in LDAP and DN is not to be converted when 81f5c3c7a7Ssdussud * being passed back to the application. See __ns_ldap_uid2dn() 82f5c3c7a7Ssdussud * and __ns_ldap_host2dn() for such usage. 83f5c3c7a7Ssdussud */ 84f5c3c7a7Ssdussud #define NS_LDAP_NOT_CVT_DN 0x2000 85f5c3c7a7Ssdussud 86*dd1104fbSMichen Chang /* 87*dd1104fbSMichen Chang * NS_LDAP_UPDATE_SHADOW is for a privileged caller of the 88*dd1104fbSMichen Chang * __ns_ldap_repAttr() to update the shadow database on the 89*dd1104fbSMichen Chang * LDAP server. 90*dd1104fbSMichen Chang */ 91*dd1104fbSMichen Chang #define NS_LDAP_UPDATE_SHADOW 0x4000 92*dd1104fbSMichen Chang 937c478bd9Sstevel@tonic-gate /* 947c478bd9Sstevel@tonic-gate * Authentication Information 957c478bd9Sstevel@tonic-gate */ 967c478bd9Sstevel@tonic-gate typedef enum CredLevel { 977c478bd9Sstevel@tonic-gate NS_LDAP_CRED_ANON = 0, 987c478bd9Sstevel@tonic-gate NS_LDAP_CRED_PROXY = 1, 99cb5caa98Sdjl NS_LDAP_CRED_SELF = 2 1007c478bd9Sstevel@tonic-gate } CredLevel_t; 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate typedef enum AuthType { 1037c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_NONE = 0, 1047c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_SIMPLE = 1, 1057c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_SASL = 2, 1067c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_TLS = 3, /* implied SASL usage */ 1077c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_ATLS = 4 /* implied SASL usage */ 1087c478bd9Sstevel@tonic-gate } AuthType_t; 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate typedef enum TlsType { 1117c478bd9Sstevel@tonic-gate NS_LDAP_TLS_NONE = 0, 1127c478bd9Sstevel@tonic-gate NS_LDAP_TLS_SIMPLE = 1, 1137c478bd9Sstevel@tonic-gate NS_LDAP_TLS_SASL = 2 1147c478bd9Sstevel@tonic-gate } TlsType_t; 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate typedef enum SaslMech { 1177c478bd9Sstevel@tonic-gate NS_LDAP_SASL_NONE = 0, /* No SASL mechanism */ 1187c478bd9Sstevel@tonic-gate NS_LDAP_SASL_CRAM_MD5 = 1, 1197c478bd9Sstevel@tonic-gate NS_LDAP_SASL_DIGEST_MD5 = 2, 1207c478bd9Sstevel@tonic-gate NS_LDAP_SASL_EXTERNAL = 3, /* currently not supported */ 121cb5caa98Sdjl NS_LDAP_SASL_GSSAPI = 4, 1227c478bd9Sstevel@tonic-gate NS_LDAP_SASL_SPNEGO = 5 /* currently not supported */ 1237c478bd9Sstevel@tonic-gate } SaslMech_t; 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate typedef enum SaslOpt { 1267c478bd9Sstevel@tonic-gate NS_LDAP_SASLOPT_NONE = 0, 127cb5caa98Sdjl NS_LDAP_SASLOPT_INT = 1, 128cb5caa98Sdjl NS_LDAP_SASLOPT_PRIV = 2 1297c478bd9Sstevel@tonic-gate } SaslOpt_t; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate typedef enum PrefOnly { 1327c478bd9Sstevel@tonic-gate NS_LDAP_PREF_FALSE = 0, 1337c478bd9Sstevel@tonic-gate NS_LDAP_PREF_TRUE = 1 1347c478bd9Sstevel@tonic-gate } PrefOnly_t; 1357c478bd9Sstevel@tonic-gate 136*dd1104fbSMichen Chang typedef enum enableShadowUpdate { 137*dd1104fbSMichen Chang NS_LDAP_ENABLE_SHADOW_UPDATE_FALSE = 0, 138*dd1104fbSMichen Chang NS_LDAP_ENABLE_SHADOW_UPDATE_TRUE = 1 139*dd1104fbSMichen Chang } enableShadowUpdate_t; 140*dd1104fbSMichen Chang 1417c478bd9Sstevel@tonic-gate typedef struct UnixCred { 1427c478bd9Sstevel@tonic-gate char *userID; /* Unix ID number */ 1437c478bd9Sstevel@tonic-gate char *passwd; /* password */ 1447c478bd9Sstevel@tonic-gate } UnixCred_t; 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate typedef struct CertCred { 1477c478bd9Sstevel@tonic-gate char *path; /* certificate path */ 1487c478bd9Sstevel@tonic-gate char *passwd; /* password */ 1497c478bd9Sstevel@tonic-gate char *nickname; /* nickname */ 1507c478bd9Sstevel@tonic-gate } CertCred_t; 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate typedef struct ns_auth { 1537c478bd9Sstevel@tonic-gate AuthType_t type; 1547c478bd9Sstevel@tonic-gate TlsType_t tlstype; 1557c478bd9Sstevel@tonic-gate SaslMech_t saslmech; 1567c478bd9Sstevel@tonic-gate SaslOpt_t saslopt; 1577c478bd9Sstevel@tonic-gate } ns_auth_t; 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate typedef struct ns_cred { 1607c478bd9Sstevel@tonic-gate ns_auth_t auth; 1617c478bd9Sstevel@tonic-gate char *hostcertpath; 1627c478bd9Sstevel@tonic-gate union { 1637c478bd9Sstevel@tonic-gate UnixCred_t unix_cred; 1647c478bd9Sstevel@tonic-gate CertCred_t cert_cred; 1657c478bd9Sstevel@tonic-gate } cred; 1667c478bd9Sstevel@tonic-gate } ns_cred_t; 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate typedef struct LineBuf { 1707c478bd9Sstevel@tonic-gate char *str; 1717c478bd9Sstevel@tonic-gate int len; 1727c478bd9Sstevel@tonic-gate int alloc; 1737c478bd9Sstevel@tonic-gate } LineBuf; 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate /* 1767c478bd9Sstevel@tonic-gate * Configuration Information 1777c478bd9Sstevel@tonic-gate */ 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate typedef enum { 1807c478bd9Sstevel@tonic-gate NS_LDAP_FILE_VERSION_P = 0, 1817c478bd9Sstevel@tonic-gate NS_LDAP_BINDDN_P = 1, 1827c478bd9Sstevel@tonic-gate NS_LDAP_BINDPASSWD_P = 2, 1837c478bd9Sstevel@tonic-gate NS_LDAP_SERVERS_P = 3, 1847c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_BASEDN_P = 4, 1857c478bd9Sstevel@tonic-gate NS_LDAP_AUTH_P = 5, 1867c478bd9Sstevel@tonic-gate /* 1877c478bd9Sstevel@tonic-gate * NS_LDAP_TRANSPORT_SEC_P is only left in for backward compatibility 1887c478bd9Sstevel@tonic-gate * with version 1 clients and their configuration files. The only 1897c478bd9Sstevel@tonic-gate * supported value is NS_LDAP_SEC_NONE. No application should be 1907c478bd9Sstevel@tonic-gate * using this parameter type (either through getParam or setParam. 1917c478bd9Sstevel@tonic-gate */ 1927c478bd9Sstevel@tonic-gate NS_LDAP_TRANSPORT_SEC_P = 6, 1937c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_REF_P = 7, 1947c478bd9Sstevel@tonic-gate NS_LDAP_DOMAIN_P = 8, 1957c478bd9Sstevel@tonic-gate NS_LDAP_EXP_P = 9, 1967c478bd9Sstevel@tonic-gate NS_LDAP_CERT_PATH_P = 10, 1977c478bd9Sstevel@tonic-gate NS_LDAP_CERT_PASS_P = 11, 1987c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_DN_P = 12, 1997c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_SCOPE_P = 13, 2007c478bd9Sstevel@tonic-gate NS_LDAP_SEARCH_TIME_P = 14, 2017c478bd9Sstevel@tonic-gate NS_LDAP_SERVER_PREF_P = 15, 2027c478bd9Sstevel@tonic-gate NS_LDAP_PREF_ONLY_P = 16, 2037c478bd9Sstevel@tonic-gate NS_LDAP_CACHETTL_P = 17, 2047c478bd9Sstevel@tonic-gate NS_LDAP_PROFILE_P = 18, 2057c478bd9Sstevel@tonic-gate NS_LDAP_CREDENTIAL_LEVEL_P = 19, 2067c478bd9Sstevel@tonic-gate NS_LDAP_SERVICE_SEARCH_DESC_P = 20, 2077c478bd9Sstevel@tonic-gate NS_LDAP_BIND_TIME_P = 21, 2087c478bd9Sstevel@tonic-gate NS_LDAP_ATTRIBUTEMAP_P = 22, 2097c478bd9Sstevel@tonic-gate NS_LDAP_OBJECTCLASSMAP_P = 23, 2107c478bd9Sstevel@tonic-gate NS_LDAP_CERT_NICKNAME_P = 24, 2117c478bd9Sstevel@tonic-gate NS_LDAP_SERVICE_AUTH_METHOD_P = 25, 2127c478bd9Sstevel@tonic-gate NS_LDAP_SERVICE_CRED_LEVEL_P = 26, 2137c478bd9Sstevel@tonic-gate NS_LDAP_HOST_CERTPATH_P = 27, 214*dd1104fbSMichen Chang NS_LDAP_ENABLE_SHADOW_UPDATE_P = 28, 215*dd1104fbSMichen Chang NS_LDAP_ADMIN_BINDDN_P = 29, 216*dd1104fbSMichen Chang NS_LDAP_ADMIN_BINDPASSWD_P = 30, 2177c478bd9Sstevel@tonic-gate /* 2187c478bd9Sstevel@tonic-gate * The following entry (max ParamIndexType) is an internal 2197c478bd9Sstevel@tonic-gate * placeholder. It must be the last (and highest value) 2207c478bd9Sstevel@tonic-gate * entry in this eNum. Please update accordingly. 2217c478bd9Sstevel@tonic-gate */ 222*dd1104fbSMichen Chang NS_LDAP_MAX_PIT_P = 31 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate } ParamIndexType; 2257c478bd9Sstevel@tonic-gate 226cb5caa98Sdjl /* 227cb5caa98Sdjl * NONE - No self / SASL/GSSAPI configured 228cb5caa98Sdjl * ONLY - Only self / SASL/GSSAPI configured 229cb5caa98Sdjl * MIXED - self / SASL/GSSAPI is mixed with other types of configuration 230cb5caa98Sdjl */ 231cb5caa98Sdjl typedef enum { 232cb5caa98Sdjl NS_LDAP_SELF_GSSAPI_CONFIG_NONE = 0, 233cb5caa98Sdjl NS_LDAP_SELF_GSSAPI_CONFIG_ONLY = 1, 234cb5caa98Sdjl NS_LDAP_SELF_GSSAPI_CONFIG_MIXED = 2 235cb5caa98Sdjl } ns_ldap_self_gssapi_config_t; 236cb5caa98Sdjl 2377c478bd9Sstevel@tonic-gate /* 2387c478bd9Sstevel@tonic-gate * __ns_ldap_*() return codes 2397c478bd9Sstevel@tonic-gate */ 2407c478bd9Sstevel@tonic-gate typedef enum { 2417c478bd9Sstevel@tonic-gate NS_LDAP_SUCCESS = 0, /* success, no info in errorp */ 2427c478bd9Sstevel@tonic-gate NS_LDAP_OP_FAILED = 1, /* failed operation, no info in errorp */ 2437c478bd9Sstevel@tonic-gate NS_LDAP_NOTFOUND = 2, /* entry not found, no info in errorp */ 2447c478bd9Sstevel@tonic-gate NS_LDAP_MEMORY = 3, /* memory failure, no info in errorp */ 2457c478bd9Sstevel@tonic-gate NS_LDAP_CONFIG = 4, /* config problem, detail in errorp */ 2467c478bd9Sstevel@tonic-gate NS_LDAP_PARTIAL = 5, /* partial result, detail in errorp */ 2477c478bd9Sstevel@tonic-gate NS_LDAP_INTERNAL = 7, /* LDAP error, detail in errorp */ 2487c478bd9Sstevel@tonic-gate NS_LDAP_INVALID_PARAM = 8, /* LDAP error, no info in errorp */ 2497c478bd9Sstevel@tonic-gate NS_LDAP_SUCCESS_WITH_INFO 2507c478bd9Sstevel@tonic-gate = 9 /* success, with info in errorp */ 2517c478bd9Sstevel@tonic-gate } ns_ldap_return_code; 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate /* 2547c478bd9Sstevel@tonic-gate * Detailed error code for NS_LDAP_CONFIG 2557c478bd9Sstevel@tonic-gate */ 2567c478bd9Sstevel@tonic-gate typedef enum { 2577c478bd9Sstevel@tonic-gate NS_CONFIG_SYNTAX = 0, /* syntax error */ 2587c478bd9Sstevel@tonic-gate NS_CONFIG_NODEFAULT = 1, /* no default value */ 2597c478bd9Sstevel@tonic-gate NS_CONFIG_NOTLOADED = 2, /* configuration not loaded */ 2607c478bd9Sstevel@tonic-gate NS_CONFIG_NOTALLOW = 3, /* operation requested not allowed */ 2617c478bd9Sstevel@tonic-gate NS_CONFIG_FILE = 4, /* configuration file problem */ 2627c478bd9Sstevel@tonic-gate NS_CONFIG_CACHEMGR = 5 /* error with door to ldap_cachemgr */ 2637c478bd9Sstevel@tonic-gate } ns_ldap_config_return_code; 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate /* 2667c478bd9Sstevel@tonic-gate * Detailed error code for NS_LDAP_PARTIAL 2677c478bd9Sstevel@tonic-gate */ 2687c478bd9Sstevel@tonic-gate typedef enum { 2697c478bd9Sstevel@tonic-gate NS_PARTIAL_TIMEOUT = 0, /* partial results due to timeout */ 2707c478bd9Sstevel@tonic-gate NS_PARTIAL_OTHER = 1 /* error encountered */ 2717c478bd9Sstevel@tonic-gate } ns_ldap_partial_return_code; 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate /* 2747c478bd9Sstevel@tonic-gate * For use by __ns_ldap_addTypedEntry() for publickey serivicetype 2757c478bd9Sstevel@tonic-gate */ 2767c478bd9Sstevel@tonic-gate typedef enum { 2777c478bd9Sstevel@tonic-gate NS_HOSTCRED_FALSE = 0, 2787c478bd9Sstevel@tonic-gate NS_HOSTCRED_TRUE = 1 2797c478bd9Sstevel@tonic-gate } hostcred_t; 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate /* 2827c478bd9Sstevel@tonic-gate * Detailed password status 2837c478bd9Sstevel@tonic-gate */ 2847c478bd9Sstevel@tonic-gate typedef enum { 2857c478bd9Sstevel@tonic-gate NS_PASSWD_GOOD = 0, /* password is good */ 2867c478bd9Sstevel@tonic-gate NS_PASSWD_ABOUT_TO_EXPIRE = 1, /* password is good but */ 2877c478bd9Sstevel@tonic-gate /* about to expire */ 2887c478bd9Sstevel@tonic-gate NS_PASSWD_CHANGE_NEEDED = 2, /* good but need to be */ 2897c478bd9Sstevel@tonic-gate /* changed immediately */ 2907c478bd9Sstevel@tonic-gate NS_PASSWD_EXPIRED = 3, /* password expired */ 2917c478bd9Sstevel@tonic-gate NS_PASSWD_RETRY_EXCEEDED = 4, /* exceed retry limit; */ 2927c478bd9Sstevel@tonic-gate /* account is locked */ 2937c478bd9Sstevel@tonic-gate NS_PASSWD_CHANGE_NOT_ALLOWED = 5, /* can only be changed */ 2947c478bd9Sstevel@tonic-gate /* by the administrator */ 2957c478bd9Sstevel@tonic-gate NS_PASSWD_INVALID_SYNTAX = 6, /* can not be changed: */ 2967c478bd9Sstevel@tonic-gate /* new password has */ 2977c478bd9Sstevel@tonic-gate /* invalid syntax -- */ 298c31b4830SSerge Dussud /* trivial password: same */ 299c31b4830SSerge Dussud /* value as attr, cn, sn, */ 300c31b4830SSerge Dussud /* uid, etc. */ 301c31b4830SSerge Dussud /* or strong password */ 302c31b4830SSerge Dussud /* policies check */ 3037c478bd9Sstevel@tonic-gate NS_PASSWD_TOO_SHORT = 7, /* can not be changed: */ 3047c478bd9Sstevel@tonic-gate /* new password has */ 3057c478bd9Sstevel@tonic-gate /* less chars than */ 3067c478bd9Sstevel@tonic-gate /* required */ 3077c478bd9Sstevel@tonic-gate NS_PASSWD_IN_HISTORY = 8, /* can not be changed: */ 3087c478bd9Sstevel@tonic-gate /* reuse old password */ 3097c478bd9Sstevel@tonic-gate NS_PASSWD_WITHIN_MIN_AGE = 9 /* can not be changed: */ 3107c478bd9Sstevel@tonic-gate /* within minimum age */ 3117c478bd9Sstevel@tonic-gate } ns_ldap_passwd_status_t; 3127c478bd9Sstevel@tonic-gate 3137c478bd9Sstevel@tonic-gate /* 3147c478bd9Sstevel@tonic-gate * Password management information structure 31547789246Svv * 31647789246Svv * This structure is different from AcctUsableResponse_t structure in 31747789246Svv * that this structure holds result of users account mgmt information when 31847789246Svv * an ldap bind is done with user name and user password. 3197c478bd9Sstevel@tonic-gate */ 3207c478bd9Sstevel@tonic-gate typedef struct ns_ldap_passwd_mgmt { 3217c478bd9Sstevel@tonic-gate ns_ldap_passwd_status_t 3227c478bd9Sstevel@tonic-gate status; /* password status */ 3237c478bd9Sstevel@tonic-gate int sec_until_expired; /* seconds until expired, */ 3247c478bd9Sstevel@tonic-gate /* valid if status is */ 3257c478bd9Sstevel@tonic-gate /* NS_PASSWD_ABOUT_TO_EXPIRE */ 3267c478bd9Sstevel@tonic-gate } ns_ldap_passwd_mgmt_t; 3277c478bd9Sstevel@tonic-gate 32847789246Svv /* 32947789246Svv * LDAP V3 control flag for account management - Used for account management 33047789246Svv * when no password is provided 33147789246Svv */ 33247789246Svv #define NS_LDAP_ACCOUNT_USABLE_CONTROL "1.3.6.1.4.1.42.2.27.9.5.8" 33347789246Svv 33447789246Svv /* 33547789246Svv * Structure for holding the response returned by server for 33647789246Svv * NS_LDAP_ACCOUNT_USABLE_CONTROL control when account is not available. 33747789246Svv */ 33847789246Svv typedef struct AcctUsableMoreInfo { 33947789246Svv int inactive; 34047789246Svv int reset; 34147789246Svv int expired; 34247789246Svv int rem_grace; 34347789246Svv int sec_b4_unlock; 34447789246Svv } AcctUsableMoreInfo_t; 34547789246Svv 34647789246Svv /* 34747789246Svv * Structure used to hold the response from the server for 34847789246Svv * NS_LDAP_ACCOUNT_USABLE_CONTROL control. The ASN1 notation is as below: 34947789246Svv * 35047789246Svv * ACCOUNT_USABLE_RESPONSE::= CHOICE { 35147789246Svv * is_available [0] INTEGER, seconds before expiration 35247789246Svv * is_not_available [1] More_info 35347789246Svv * } 35447789246Svv * 35547789246Svv * More_info::= SEQUENCE { 35647789246Svv * inactive [0] BOOLEAN DEFAULT FALSE, 35747789246Svv * reset [1] BOOLEAN DEFAULT FALSE, 35847789246Svv * expired [2] BOOLEAN DEFAULT FALSE, 35947789246Svv * remaining_grace [3] INTEGER OPTIONAL, 36047789246Svv * seconds_before_unlock[4] INTEGER OPTIONAL 36147789246Svv * } 36247789246Svv * 36347789246Svv * This structure is different from ns_ldap_passwd_mgmt_t structure in 36447789246Svv * that this structure holds result of users account mgmt information when 36547789246Svv * pam_ldap doesn't have the users password and proxy agent is used for 36647789246Svv * obtaining the account management information. 36747789246Svv */ 36847789246Svv typedef struct AcctUsableResponse { 36947789246Svv int choice; 37047789246Svv union { 37147789246Svv int seconds_before_expiry; 37247789246Svv AcctUsableMoreInfo_t more_info; 37347789246Svv } AcctUsableResp; 37447789246Svv } AcctUsableResponse_t; 3757c478bd9Sstevel@tonic-gate 3767c478bd9Sstevel@tonic-gate /* 3777c478bd9Sstevel@tonic-gate * Simplified LDAP Naming API result structure 3787c478bd9Sstevel@tonic-gate */ 3797c478bd9Sstevel@tonic-gate typedef struct ns_ldap_error { 3807c478bd9Sstevel@tonic-gate int status; /* LDAP error code */ 3817c478bd9Sstevel@tonic-gate char *message; /* LDAP error message */ 3827c478bd9Sstevel@tonic-gate ns_ldap_passwd_mgmt_t pwd_mgmt; /* LDAP password */ 3837c478bd9Sstevel@tonic-gate /* management info */ 3847c478bd9Sstevel@tonic-gate } ns_ldap_error_t; 3857c478bd9Sstevel@tonic-gate 3867c478bd9Sstevel@tonic-gate typedef struct ns_ldap_attr { 3877c478bd9Sstevel@tonic-gate char *attrname; /* attribute name */ 3887c478bd9Sstevel@tonic-gate uint_t value_count; 3897c478bd9Sstevel@tonic-gate char **attrvalue; /* attribute values */ 3907c478bd9Sstevel@tonic-gate } ns_ldap_attr_t; 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate typedef struct ns_ldap_entry { 3937c478bd9Sstevel@tonic-gate uint_t attr_count; /* number of attributes */ 3947c478bd9Sstevel@tonic-gate ns_ldap_attr_t **attr_pair; /* attributes pairs */ 3957c478bd9Sstevel@tonic-gate struct ns_ldap_entry *next; /* next entry */ 3967c478bd9Sstevel@tonic-gate } ns_ldap_entry_t; 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate typedef struct ns_ldap_result { 3997c478bd9Sstevel@tonic-gate uint_t entries_count; /* number of entries */ 4007c478bd9Sstevel@tonic-gate ns_ldap_entry_t *entry; /* data */ 4017c478bd9Sstevel@tonic-gate } ns_ldap_result_t; 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate /* 4047c478bd9Sstevel@tonic-gate * structures for the conversion routines used by typedAddEntry() 4057c478bd9Sstevel@tonic-gate */ 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate typedef struct _ns_netgroups { 4087c478bd9Sstevel@tonic-gate char *name; 4097c478bd9Sstevel@tonic-gate char **triplet; 4107c478bd9Sstevel@tonic-gate char **netgroup; 4117c478bd9Sstevel@tonic-gate } _ns_netgroups_t; 4127c478bd9Sstevel@tonic-gate 4137c478bd9Sstevel@tonic-gate typedef struct _ns_netmasks { 4147c478bd9Sstevel@tonic-gate char *netnumber; 4157c478bd9Sstevel@tonic-gate char *netmask; 4167c478bd9Sstevel@tonic-gate } _ns_netmasks_t; 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate typedef struct _ns_bootp { 4197c478bd9Sstevel@tonic-gate char *name; 4207c478bd9Sstevel@tonic-gate char **param; 4217c478bd9Sstevel@tonic-gate } _ns_bootp_t; 4227c478bd9Sstevel@tonic-gate 4237c478bd9Sstevel@tonic-gate typedef struct _ns_ethers { 4247c478bd9Sstevel@tonic-gate char *name; 4257c478bd9Sstevel@tonic-gate char *ether; 4267c478bd9Sstevel@tonic-gate } _ns_ethers_t; 4277c478bd9Sstevel@tonic-gate 4287c478bd9Sstevel@tonic-gate typedef struct _ns_pubkey { 4297c478bd9Sstevel@tonic-gate char *name; 4307c478bd9Sstevel@tonic-gate hostcred_t hostcred; 4317c478bd9Sstevel@tonic-gate char *pubkey; 4327c478bd9Sstevel@tonic-gate char *privkey; 4337c478bd9Sstevel@tonic-gate } _ns_pubkey_t; 4347c478bd9Sstevel@tonic-gate 4357c478bd9Sstevel@tonic-gate typedef struct _ns_alias { 4367c478bd9Sstevel@tonic-gate char *alias; 4377c478bd9Sstevel@tonic-gate char **member; 4387c478bd9Sstevel@tonic-gate } _ns_alias_t; 4397c478bd9Sstevel@tonic-gate 4407c478bd9Sstevel@tonic-gate typedef struct _ns_automount { 4417c478bd9Sstevel@tonic-gate char *mapname; 4427c478bd9Sstevel@tonic-gate char *key; 4437c478bd9Sstevel@tonic-gate char *value; 4447c478bd9Sstevel@tonic-gate } _ns_automount_t; 4457c478bd9Sstevel@tonic-gate 4467c478bd9Sstevel@tonic-gate /* 4477c478bd9Sstevel@tonic-gate * return values for the callback function in __ns_ldap_list() 4487c478bd9Sstevel@tonic-gate */ 4497c478bd9Sstevel@tonic-gate #define NS_LDAP_CB_NEXT 0 /* get the next entry */ 4507c478bd9Sstevel@tonic-gate #define NS_LDAP_CB_DONE 1 /* done */ 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gate /* 4537c478bd9Sstevel@tonic-gate * Input values for the type specified in __ns_ldap_addTypedEntry() 4547c478bd9Sstevel@tonic-gate * and __ns_ldap_delTypedEntry() 4557c478bd9Sstevel@tonic-gate */ 4567c478bd9Sstevel@tonic-gate 4577c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PASSWD "passwd" 4587c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_GROUP "group" 4597c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_HOSTS "hosts" 4607c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_IPNODES "ipnodes" 4617c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PROFILE "prof_attr" 4627c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_RPC "rpc" 4637c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PROTOCOLS "protocols" 4647c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_NETWORKS "networks" 4657c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_NETGROUP "netgroup" 4667c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_ALIASES "aliases" 4677c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_SERVICES "services" 4687c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_ETHERS "ethers" 4697c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_SHADOW "shadow" 4707c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_NETMASKS "netmasks" 4717c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_AUTHATTR "auth_attr" 4727c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_EXECATTR "exec_attr" 4737c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_USERATTR "user_attr" 4747c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PROJECT "project" 4757c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_PUBLICKEY "publickey" 4767c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_AUUSER "audit_user" 4777c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_BOOTPARAMS "bootparams" 4787c478bd9Sstevel@tonic-gate #define NS_LDAP_TYPE_AUTOMOUNT "auto_" 47945916cd2Sjpk #define NS_LDAP_TYPE_TNRHDB "tnrhdb" 48045916cd2Sjpk #define NS_LDAP_TYPE_TNRHTP "tnrhtp" 4817c478bd9Sstevel@tonic-gate 4827c478bd9Sstevel@tonic-gate /* 4837c478bd9Sstevel@tonic-gate * service descriptor/attribute mapping structure 4847c478bd9Sstevel@tonic-gate */ 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate typedef struct ns_ldap_search_desc { 4877c478bd9Sstevel@tonic-gate char *basedn; /* search base dn */ 4887c478bd9Sstevel@tonic-gate ScopeType_t scope; /* search scope */ 4897c478bd9Sstevel@tonic-gate char *filter; /* search filter */ 4907c478bd9Sstevel@tonic-gate } ns_ldap_search_desc_t; 4917c478bd9Sstevel@tonic-gate 4927c478bd9Sstevel@tonic-gate typedef struct ns_ldap_attribute_map { 4937c478bd9Sstevel@tonic-gate char *origAttr; /* original attribute */ 4947c478bd9Sstevel@tonic-gate char **mappedAttr; /* mapped attribute(s) */ 4957c478bd9Sstevel@tonic-gate } ns_ldap_attribute_map_t; 4967c478bd9Sstevel@tonic-gate 4977c478bd9Sstevel@tonic-gate typedef struct ns_ldap_objectclass_map { 4987c478bd9Sstevel@tonic-gate char *origOC; /* original objectclass */ 4997c478bd9Sstevel@tonic-gate char *mappedOC; /* mapped objectclass */ 5007c478bd9Sstevel@tonic-gate } ns_ldap_objectclass_map_t; 5017c478bd9Sstevel@tonic-gate 502*dd1104fbSMichen Chang /* 503*dd1104fbSMichen Chang * Value of the userPassword attribute representing NO Unix password 504*dd1104fbSMichen Chang */ 505*dd1104fbSMichen Chang #define NS_LDAP_NO_UNIX_PASSWORD "<NO UNIX PASSWORD>" 506*dd1104fbSMichen Chang 507479ac375Sdm /* Opaque handle for batch API */ 508479ac375Sdm typedef struct ns_ldap_list_batch ns_ldap_list_batch_t; 509479ac375Sdm 510e1dd0a2fSth /* 511e1dd0a2fSth * The type of standalone configuration specified by a client application. 512e1dd0a2fSth * The meaning of the requests is as follows: 513e1dd0a2fSth * 514e1dd0a2fSth * NS_CACHEMGR: libsldap will request all the configuration via door_call(3C) 515e1dd0a2fSth * to ldap_cachemgr. 516e1dd0a2fSth * NS_LDAP_SERVER: the consumer application has specified a directory server 517e1dd0a2fSth * to communicate to. 518e1dd0a2fSth * NS_PREDEFINED: reserved for internal use 519e1dd0a2fSth */ 520e1dd0a2fSth typedef enum { 521e1dd0a2fSth NS_CACHEMGR = 0, 522e1dd0a2fSth NS_LDAP_SERVER 523e1dd0a2fSth } ns_standalone_request_type_t; 524e1dd0a2fSth 525e1dd0a2fSth /* 526e1dd0a2fSth * This structure describes an LDAP server specified by a client application. 527e1dd0a2fSth */ 528e1dd0a2fSth typedef struct ns_dir_server { 529e1dd0a2fSth char *server; /* A directory server's IP */ 530e1dd0a2fSth uint16_t port; /* A directory server's port. */ 531e1dd0a2fSth /* Default value is 389 */ 532e1dd0a2fSth char *domainName; /* A domain name being served */ 533e1dd0a2fSth /* by the specified server. */ 534e1dd0a2fSth /* Default value is the local */ 535e1dd0a2fSth /* domain's name */ 536e1dd0a2fSth char *profileName; /* A DUAProfile's name. */ 537e1dd0a2fSth /* Default value is 'default' */ 538e1dd0a2fSth ns_auth_t *auth; /* Authentication information used */ 539e1dd0a2fSth /* during subsequent connections */ 540e1dd0a2fSth char *cred; /* A credential level to be used */ 541e1dd0a2fSth /* along with the authentication info */ 542e1dd0a2fSth char *host_cert_path; /* A path to the certificate database */ 543e1dd0a2fSth /* Default is '/vat/ldap' */ 544e1dd0a2fSth char *bind_dn; /* A bind DN to be used during */ 545e1dd0a2fSth /* subsequent LDAP Bind requests */ 546e1dd0a2fSth char *bind_passwd; /* A bind password to be used during */ 547e1dd0a2fSth /* subsequent LDAP Bind requests */ 548e1dd0a2fSth } ns_dir_server_t; 549e1dd0a2fSth 550e1dd0a2fSth /* 551e1dd0a2fSth * This structure contains information describing an LDAP server. 552e1dd0a2fSth */ 553e1dd0a2fSth typedef struct ns_standalone_conf { 554e1dd0a2fSth union { 555e1dd0a2fSth ns_dir_server_t server; 556e1dd0a2fSth void *predefined_conf; /* Reserved for internal use */ 557e1dd0a2fSth } ds_profile; /* A type of the configuration */ 558e1dd0a2fSth 559e1dd0a2fSth #define SA_SERVER ds_profile.server.server 560e1dd0a2fSth #define SA_PORT ds_profile.server.port 561e1dd0a2fSth #define SA_DOMAIN ds_profile.server.domainName 562e1dd0a2fSth #define SA_PROFILE_NAME ds_profile.server.profileName 563e1dd0a2fSth #define SA_AUTH ds_profile.server.auth 564e1dd0a2fSth #define SA_CRED ds_profile.server.cred 565e1dd0a2fSth #define SA_CERT_PATH ds_profile.server.host_cert_path 566e1dd0a2fSth #define SA_BIND_DN ds_profile.server.bind_dn 567e1dd0a2fSth #define SA_BIND_PWD ds_profile.server.bind_passwd 568e1dd0a2fSth 569e1dd0a2fSth ns_standalone_request_type_t type; 570e1dd0a2fSth } ns_standalone_conf_t; 571e1dd0a2fSth 572e1dd0a2fSth /* 573e1dd0a2fSth * This function "informs" libsldap that a client application has specified 574e1dd0a2fSth * a directory to use. The function obtains a DUAProfile, credentials, 575e1dd0a2fSth * and naming context. During all further operations on behalf 576e1dd0a2fSth * of the application requested a standalone schema libsldap will use 577e1dd0a2fSth * the information obtained by __ns_ldap_initStandalone() instead of 578e1dd0a2fSth * door_call(3C)ing ldap_cachemgr(1M). 579e1dd0a2fSth * 580e1dd0a2fSth * conf 581e1dd0a2fSth * A structure describing where and in which way to obtain all the 582e1dd0a2fSth * configuration describing how to communicate to a choosen LDAP directory. 583e1dd0a2fSth * 584e1dd0a2fSth * errorp 585e1dd0a2fSth * An error object describing an error occured. 586e1dd0a2fSth */ 587e1dd0a2fSth ns_ldap_return_code __ns_ldap_initStandalone( 588e1dd0a2fSth const ns_standalone_conf_t *conf, 589e1dd0a2fSth ns_ldap_error_t **errorp); 590e1dd0a2fSth 591e1dd0a2fSth /* 592e1dd0a2fSth * This function obtains the directory's base DN and a DUAProfile 593e1dd0a2fSth * from a specified server. 594e1dd0a2fSth * 595e1dd0a2fSth * server 596e1dd0a2fSth * Specifies the selected directory sever. 597e1dd0a2fSth * 598e1dd0a2fSth * cred 599e1dd0a2fSth * Contains an authentication information and credential required to 600e1dd0a2fSth * establish a connection. 601e1dd0a2fSth * 602e1dd0a2fSth * config 603e1dd0a2fSth * If not NULL, a new configuration basing on a DUAProfile specified in the 604e1dd0a2fSth * server parameter will be create and returned. 605e1dd0a2fSth * 606e1dd0a2fSth * baseDN 607e1dd0a2fSth * If not NULL, the directory's base DN will be returned. 608e1dd0a2fSth * 609e1dd0a2fSth * error 610e1dd0a2fSth * Describes an error, if any. 611e1dd0a2fSth */ 612e1dd0a2fSth ns_ldap_return_code __ns_ldap_getConnectionInfoFromDUA( 613e1dd0a2fSth const ns_dir_server_t *server, 614e1dd0a2fSth const ns_cred_t *cred, 615e1dd0a2fSth char **config, char **baseDN, 616e1dd0a2fSth ns_ldap_error_t **error); 617e1dd0a2fSth 618e1dd0a2fSth #define SA_PROHIBIT_FALLBACK 0 619e1dd0a2fSth #define SA_ALLOW_FALLBACK 1 620e1dd0a2fSth 621e1dd0a2fSth #define DONT_SAVE_NSCONF 0 622e1dd0a2fSth #define SAVE_NSCONF 1 623e1dd0a2fSth 624e1dd0a2fSth /* 625e1dd0a2fSth * This function obtains the root DSE from a specified server. 626e1dd0a2fSth * 627e1dd0a2fSth * server_addr 628e1dd0a2fSth * An adress of a server to be connected to. 629e1dd0a2fSth * 630e1dd0a2fSth * rootDSE 631e1dd0a2fSth * A buffer containing the root DSE in the ldap_cachmgr door call format. 632e1dd0a2fSth * 633e1dd0a2fSth * errorp 634e1dd0a2fSth * Describes an error, if any. 635e1dd0a2fSth * 636e1dd0a2fSth * anon_fallback 637e1dd0a2fSth * If set to 1 and establishing a connection fails, __s_api_getRootDSE() 638e1dd0a2fSth * will try once again using anonymous credentials. 639e1dd0a2fSth */ 640e1dd0a2fSth ns_ldap_return_code __ns_ldap_getRootDSE( 641e1dd0a2fSth const char *server_addr, 642e1dd0a2fSth char **rootDSE, 643e1dd0a2fSth ns_ldap_error_t **errorp, 644e1dd0a2fSth int anon_fallback); 645e1dd0a2fSth 646e1dd0a2fSth /* 647e1dd0a2fSth * This function iterates through the list of the configured LDAP servers 648e1dd0a2fSth * and "pings" those which are marked as removed or if any error occurred 649e1dd0a2fSth * during the previous receiving of the server's root DSE. If the 650e1dd0a2fSth * function is able to reach such a server and get its root DSE, it 651e1dd0a2fSth * marks the server as on-line. Otherwise, the server's status is set 652e1dd0a2fSth * to "Error". 653e1dd0a2fSth * For each server the function tries to connect to, it fires up 654e1dd0a2fSth * a separate thread and then waits until all the threads finish. 655e1dd0a2fSth * The function returns NS_LDAP_INTERNAL if the Standalone mode was not 656e1dd0a2fSth * initialized or was canceled prior to an invocation of 657e1dd0a2fSth * __ns_ldap_pingOfflineServers(). 658e1dd0a2fSth */ 659e1dd0a2fSth ns_ldap_return_code __ns_ldap_pingOfflineServers(void); 660e1dd0a2fSth 661e1dd0a2fSth /* 662e1dd0a2fSth * This function cancels the Standalone mode and destroys the list of root DSEs. 663e1dd0a2fSth */ 664e1dd0a2fSth void __ns_ldap_cancelStandalone(void); 665e1dd0a2fSth /* 666e1dd0a2fSth * This function initializes an ns_auth_t structure provided by a caller 667e1dd0a2fSth * according to a specified authentication mechanism. 668e1dd0a2fSth */ 669e1dd0a2fSth ns_ldap_return_code __ns_ldap_initAuth(const char *auth_mech, 670e1dd0a2fSth ns_auth_t *auth, 671e1dd0a2fSth ns_ldap_error_t **errorp); 672e1dd0a2fSth 6737c478bd9Sstevel@tonic-gate /* 6747c478bd9Sstevel@tonic-gate * Simplified LDAP Naming APIs 6757c478bd9Sstevel@tonic-gate */ 6767c478bd9Sstevel@tonic-gate int __ns_ldap_list( 6777c478bd9Sstevel@tonic-gate const char *service, 6787c478bd9Sstevel@tonic-gate const char *filter, 6797c478bd9Sstevel@tonic-gate int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, 6807c478bd9Sstevel@tonic-gate char **realfilter, const void *userdata), 6817c478bd9Sstevel@tonic-gate const char * const *attribute, 6827c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 6837c478bd9Sstevel@tonic-gate const int flags, 6847c478bd9Sstevel@tonic-gate ns_ldap_result_t ** result, 6857c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp, 6867c478bd9Sstevel@tonic-gate int (*callback)(const ns_ldap_entry_t *entry, const void *userdata), 6877c478bd9Sstevel@tonic-gate const void *userdata); 6887c478bd9Sstevel@tonic-gate 689479ac375Sdm int __ns_ldap_list_batch_start( 690479ac375Sdm ns_ldap_list_batch_t **batch); 691479ac375Sdm 692479ac375Sdm int __ns_ldap_list_batch_add( 693479ac375Sdm ns_ldap_list_batch_t *batch, 694479ac375Sdm const char *service, 695479ac375Sdm const char *filter, 696479ac375Sdm int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, 697479ac375Sdm char **realfilter, const void *userdata), 698479ac375Sdm const char * const *attribute, 699479ac375Sdm const ns_cred_t *cred, 700479ac375Sdm const int flags, 701479ac375Sdm ns_ldap_result_t ** result, 702479ac375Sdm ns_ldap_error_t ** errorp, 703479ac375Sdm int *rcp, 704479ac375Sdm int (*callback)(const ns_ldap_entry_t *entry, const void *userdata), 705479ac375Sdm const void *userdata); 706479ac375Sdm 707479ac375Sdm int __ns_ldap_list_batch_end( 708479ac375Sdm ns_ldap_list_batch_t *batch); 709479ac375Sdm 710479ac375Sdm void __ns_ldap_list_batch_release( 711479ac375Sdm ns_ldap_list_batch_t *batch); 712479ac375Sdm 7137c478bd9Sstevel@tonic-gate int __ns_ldap_addAttr( 7147c478bd9Sstevel@tonic-gate const char *service, 7157c478bd9Sstevel@tonic-gate const char *dn, 7167c478bd9Sstevel@tonic-gate const ns_ldap_attr_t * const *attr, 7177c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7187c478bd9Sstevel@tonic-gate const int flags, 7197c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7207c478bd9Sstevel@tonic-gate 7217c478bd9Sstevel@tonic-gate int __ns_ldap_delAttr( 7227c478bd9Sstevel@tonic-gate const char *service, 7237c478bd9Sstevel@tonic-gate const char *dn, 7247c478bd9Sstevel@tonic-gate const ns_ldap_attr_t * const *attr, 7257c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7267c478bd9Sstevel@tonic-gate const int flags, 7277c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7287c478bd9Sstevel@tonic-gate 7297c478bd9Sstevel@tonic-gate int __ns_ldap_repAttr( 7307c478bd9Sstevel@tonic-gate const char *service, 7317c478bd9Sstevel@tonic-gate const char *dn, 7327c478bd9Sstevel@tonic-gate const ns_ldap_attr_t * const *attr, 7337c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7347c478bd9Sstevel@tonic-gate const int flags, 7357c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7367c478bd9Sstevel@tonic-gate 7377c478bd9Sstevel@tonic-gate int __ns_ldap_addEntry( 7387c478bd9Sstevel@tonic-gate const char *service, 7397c478bd9Sstevel@tonic-gate const char *dn, 7407c478bd9Sstevel@tonic-gate const ns_ldap_entry_t *entry, 7417c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7427c478bd9Sstevel@tonic-gate const int flags, 7437c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7447c478bd9Sstevel@tonic-gate 7457c478bd9Sstevel@tonic-gate int __ns_ldap_addTypedEntry( 7467c478bd9Sstevel@tonic-gate const char *servicetype, 7477c478bd9Sstevel@tonic-gate const char *basedn, 7487c478bd9Sstevel@tonic-gate const void *data, 7497c478bd9Sstevel@tonic-gate const int create, 7507c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7517c478bd9Sstevel@tonic-gate const int flags, 7527c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7537c478bd9Sstevel@tonic-gate 7547c478bd9Sstevel@tonic-gate int __ns_ldap_delEntry( 7557c478bd9Sstevel@tonic-gate const char *service, 7567c478bd9Sstevel@tonic-gate const char *dn, 7577c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7587c478bd9Sstevel@tonic-gate const int flags, 7597c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7607c478bd9Sstevel@tonic-gate 7617c478bd9Sstevel@tonic-gate int __ns_ldap_firstEntry( 7627c478bd9Sstevel@tonic-gate const char *service, 7637c478bd9Sstevel@tonic-gate const char *filter, 7647c478bd9Sstevel@tonic-gate int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, 7657c478bd9Sstevel@tonic-gate char **realfilter, const void *userdata), 7667c478bd9Sstevel@tonic-gate const char * const *attribute, 7677c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7687c478bd9Sstevel@tonic-gate const int flags, 7697c478bd9Sstevel@tonic-gate void **cookie, 7707c478bd9Sstevel@tonic-gate ns_ldap_result_t ** result, 7717c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp, 7727c478bd9Sstevel@tonic-gate const void *userdata); 7737c478bd9Sstevel@tonic-gate 7747c478bd9Sstevel@tonic-gate int __ns_ldap_nextEntry( 7757c478bd9Sstevel@tonic-gate void *cookie, 7767c478bd9Sstevel@tonic-gate ns_ldap_result_t ** result, 7777c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7787c478bd9Sstevel@tonic-gate 7797c478bd9Sstevel@tonic-gate int __ns_ldap_endEntry( 7807c478bd9Sstevel@tonic-gate void **cookie, 7817c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7827c478bd9Sstevel@tonic-gate 7837c478bd9Sstevel@tonic-gate int __ns_ldap_freeResult( 7847c478bd9Sstevel@tonic-gate ns_ldap_result_t **result); 7857c478bd9Sstevel@tonic-gate 7867c478bd9Sstevel@tonic-gate int __ns_ldap_freeError( 7877c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 7887c478bd9Sstevel@tonic-gate 7897c478bd9Sstevel@tonic-gate int __ns_ldap_uid2dn( 7907c478bd9Sstevel@tonic-gate const char *uid, 7917c478bd9Sstevel@tonic-gate char **userDN, 7927c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 7937c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp); 7947c478bd9Sstevel@tonic-gate 7957c478bd9Sstevel@tonic-gate int __ns_ldap_host2dn( 7967c478bd9Sstevel@tonic-gate const char *host, 7977c478bd9Sstevel@tonic-gate const char *domain, 7987c478bd9Sstevel@tonic-gate char **hostDN, 7997c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 8007c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp); 8017c478bd9Sstevel@tonic-gate 8027c478bd9Sstevel@tonic-gate int __ns_ldap_dn2domain( 8037c478bd9Sstevel@tonic-gate const char *dn, 8047c478bd9Sstevel@tonic-gate char **domain, 8057c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 8067c478bd9Sstevel@tonic-gate ns_ldap_error_t ** errorp); 8077c478bd9Sstevel@tonic-gate 8087c478bd9Sstevel@tonic-gate int __ns_ldap_auth( 8097c478bd9Sstevel@tonic-gate const ns_cred_t *cred, 8107c478bd9Sstevel@tonic-gate const int flag, 8117c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp, 8127c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, 8137c478bd9Sstevel@tonic-gate LDAPControl **clientctrls); 8147c478bd9Sstevel@tonic-gate 8157c478bd9Sstevel@tonic-gate int __ns_ldap_freeCred( 8167c478bd9Sstevel@tonic-gate ns_cred_t **credp); 8177c478bd9Sstevel@tonic-gate 8187c478bd9Sstevel@tonic-gate int __ns_ldap_err2str( 8197c478bd9Sstevel@tonic-gate int err, 8207c478bd9Sstevel@tonic-gate char **strmsg); 8217c478bd9Sstevel@tonic-gate 8227c478bd9Sstevel@tonic-gate int __ns_ldap_setParam( 8237c478bd9Sstevel@tonic-gate const ParamIndexType type, 8247c478bd9Sstevel@tonic-gate const void *data, 8257c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8267c478bd9Sstevel@tonic-gate 8277c478bd9Sstevel@tonic-gate int __ns_ldap_getParam( 8287c478bd9Sstevel@tonic-gate const ParamIndexType type, 8297c478bd9Sstevel@tonic-gate void ***data, 8307c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8317c478bd9Sstevel@tonic-gate 8327c478bd9Sstevel@tonic-gate int __ns_ldap_freeParam( 8337c478bd9Sstevel@tonic-gate void ***data); 8347c478bd9Sstevel@tonic-gate 8357c478bd9Sstevel@tonic-gate char **__ns_ldap_getAttr( 8367c478bd9Sstevel@tonic-gate const ns_ldap_entry_t *entry, 8377c478bd9Sstevel@tonic-gate const char *attrname); 8387c478bd9Sstevel@tonic-gate 839cb5caa98Sdjl ns_ldap_attr_t *__ns_ldap_getAttrStruct( 840cb5caa98Sdjl const ns_ldap_entry_t *entry, 841cb5caa98Sdjl const char *attrname); 842cb5caa98Sdjl 8437c478bd9Sstevel@tonic-gate int __ns_ldap_getServiceAuthMethods( 8447c478bd9Sstevel@tonic-gate const char *service, 8457c478bd9Sstevel@tonic-gate ns_auth_t ***auth, 8467c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8477c478bd9Sstevel@tonic-gate 8487c478bd9Sstevel@tonic-gate int __ns_ldap_getSearchDescriptors( 8497c478bd9Sstevel@tonic-gate const char *service, 8507c478bd9Sstevel@tonic-gate ns_ldap_search_desc_t ***desc, 8517c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8527c478bd9Sstevel@tonic-gate 8537c478bd9Sstevel@tonic-gate int __ns_ldap_freeSearchDescriptors( 8547c478bd9Sstevel@tonic-gate ns_ldap_search_desc_t ***desc); 8557c478bd9Sstevel@tonic-gate 8567c478bd9Sstevel@tonic-gate int __ns_ldap_getAttributeMaps( 8577c478bd9Sstevel@tonic-gate const char *service, 8587c478bd9Sstevel@tonic-gate ns_ldap_attribute_map_t ***maps, 8597c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8607c478bd9Sstevel@tonic-gate 8617c478bd9Sstevel@tonic-gate int __ns_ldap_freeAttributeMaps( 8627c478bd9Sstevel@tonic-gate ns_ldap_attribute_map_t ***maps); 8637c478bd9Sstevel@tonic-gate 8647c478bd9Sstevel@tonic-gate char **__ns_ldap_getMappedAttributes( 8657c478bd9Sstevel@tonic-gate const char *service, 8667c478bd9Sstevel@tonic-gate const char *origAttribute); 8677c478bd9Sstevel@tonic-gate 8687c478bd9Sstevel@tonic-gate char **__ns_ldap_getOrigAttribute( 8697c478bd9Sstevel@tonic-gate const char *service, 8707c478bd9Sstevel@tonic-gate const char *mappedAttribute); 8717c478bd9Sstevel@tonic-gate 8727c478bd9Sstevel@tonic-gate int __ns_ldap_getObjectClassMaps( 8737c478bd9Sstevel@tonic-gate const char *service, 8747c478bd9Sstevel@tonic-gate ns_ldap_objectclass_map_t ***maps, 8757c478bd9Sstevel@tonic-gate ns_ldap_error_t **errorp); 8767c478bd9Sstevel@tonic-gate 8777c478bd9Sstevel@tonic-gate int __ns_ldap_freeObjectClassMaps( 8787c478bd9Sstevel@tonic-gate ns_ldap_objectclass_map_t ***maps); 8797c478bd9Sstevel@tonic-gate 8807c478bd9Sstevel@tonic-gate char **__ns_ldap_getMappedObjectClass( 8817c478bd9Sstevel@tonic-gate const char *service, 8827c478bd9Sstevel@tonic-gate const char *origObjectClass); 8837c478bd9Sstevel@tonic-gate 8847c478bd9Sstevel@tonic-gate char **__ns_ldap_getOrigObjectClass( 8857c478bd9Sstevel@tonic-gate const char *service, 8867c478bd9Sstevel@tonic-gate const char *mappedObjectClass); 8877c478bd9Sstevel@tonic-gate 8887c478bd9Sstevel@tonic-gate int __ns_ldap_getParamType( 8897c478bd9Sstevel@tonic-gate const char *value, 8907c478bd9Sstevel@tonic-gate ParamIndexType *type); 89147789246Svv 89247789246Svv int __ns_ldap_getAcctMgmt( 89347789246Svv const char *user, 89447789246Svv AcctUsableResponse_t *acctResp); 895*dd1104fbSMichen Chang 896*dd1104fbSMichen Chang boolean_t __ns_ldap_is_shadow_update_enabled(); 897*dd1104fbSMichen Chang 898cb5caa98Sdjl void 899cb5caa98Sdjl __ns_ldap_self_gssapi_only_set( 900cb5caa98Sdjl int flag); 901cb5caa98Sdjl int 902cb5caa98Sdjl __ns_ldap_self_gssapi_config( 903cb5caa98Sdjl ns_ldap_self_gssapi_config_t *config); 9047c478bd9Sstevel@tonic-gate #ifdef __cplusplus 9057c478bd9Sstevel@tonic-gate } 9067c478bd9Sstevel@tonic-gate #endif 9077c478bd9Sstevel@tonic-gate 9087c478bd9Sstevel@tonic-gate #endif /* _NS_SLDAP_H */ 909