17c478bd9Sstevel@tonic-gate /* 2*80ac04ddSGordon Ross * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 37c478bd9Sstevel@tonic-gate * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. 47c478bd9Sstevel@tonic-gate * Use is subject to license terms. 57c478bd9Sstevel@tonic-gate */ 67c478bd9Sstevel@tonic-gate 77c478bd9Sstevel@tonic-gate /* 87c478bd9Sstevel@tonic-gate * The contents of this file are subject to the Netscape Public 97c478bd9Sstevel@tonic-gate * License Version 1.1 (the "License"); you may not use this file 107c478bd9Sstevel@tonic-gate * except in compliance with the License. You may obtain a copy of 117c478bd9Sstevel@tonic-gate * the License at http://www.mozilla.org/NPL/ 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * Software distributed under the License is distributed on an "AS 147c478bd9Sstevel@tonic-gate * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 157c478bd9Sstevel@tonic-gate * implied. See the License for the specific language governing 167c478bd9Sstevel@tonic-gate * rights and limitations under the License. 177c478bd9Sstevel@tonic-gate * 187c478bd9Sstevel@tonic-gate * The Original Code is Mozilla Communicator client code, released 197c478bd9Sstevel@tonic-gate * March 31, 1998. 207c478bd9Sstevel@tonic-gate * 217c478bd9Sstevel@tonic-gate * The Initial Developer of the Original Code is Netscape 227c478bd9Sstevel@tonic-gate * Communications Corporation. Portions created by Netscape are 237c478bd9Sstevel@tonic-gate * Copyright (C) 1998-1999 Netscape Communications Corporation. All 247c478bd9Sstevel@tonic-gate * Rights Reserved. 257c478bd9Sstevel@tonic-gate * 267c478bd9Sstevel@tonic-gate * Contributor(s): 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifndef _LDAP_H 307c478bd9Sstevel@tonic-gate #define _LDAP_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifndef _SOLARIS_SDK 377c478bd9Sstevel@tonic-gate #define _SOLARIS_SDK 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #ifndef LDAP_TYPE_TIMEVAL_DEFINED 417c478bd9Sstevel@tonic-gate #include <sys/time.h> 427c478bd9Sstevel@tonic-gate #endif 437c478bd9Sstevel@tonic-gate #ifndef LDAP_TYPE_SOCKET_DEFINED /* API extension */ 447c478bd9Sstevel@tonic-gate #include <sys/types.h> 457c478bd9Sstevel@tonic-gate #include <sys/socket.h> 467c478bd9Sstevel@tonic-gate #endif 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #include <lber.h> 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate #define LDAP_PORT 389 517c478bd9Sstevel@tonic-gate #define LDAPS_PORT 636 527c478bd9Sstevel@tonic-gate #define LDAP_PORT_MAX 65535 /* API extension */ 537c478bd9Sstevel@tonic-gate #define LDAP_VERSION1 1 /* API extension */ 547c478bd9Sstevel@tonic-gate #define LDAP_VERSION2 2 557c478bd9Sstevel@tonic-gate #define LDAP_VERSION3 3 567c478bd9Sstevel@tonic-gate #define LDAP_VERSION LDAP_VERSION2 /* API extension */ 577c478bd9Sstevel@tonic-gate #define LDAP_VERSION_MIN LDAP_VERSION3 587c478bd9Sstevel@tonic-gate #define LDAP_VERSION_MAX LDAP_VERSION3 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define LDAP_VENDOR_VERSION 500 /* version # * 100 */ 617c478bd9Sstevel@tonic-gate #define LDAP_VENDOR_NAME "Sun Microsystems Inc." 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * The following will be an RFC number once the LDAP C API Internet Draft 647c478bd9Sstevel@tonic-gate * is published as a Proposed Standard RFC. For now we use 2000 + the 657c478bd9Sstevel@tonic-gate * draft revision number (currently 5) since we are close to compliance 667c478bd9Sstevel@tonic-gate * with revision 5 of the draft. 677c478bd9Sstevel@tonic-gate */ 687c478bd9Sstevel@tonic-gate #define LDAP_API_VERSION 2005 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate /* 717c478bd9Sstevel@tonic-gate * C LDAP features we support that are not (yet) part of the LDAP C API 727c478bd9Sstevel@tonic-gate * Internet Draft. Use the ldap_get_option() call with an option value of 737c478bd9Sstevel@tonic-gate * LDAP_OPT_API_FEATURE_INFO to retrieve information about a feature. 747c478bd9Sstevel@tonic-gate * 757c478bd9Sstevel@tonic-gate * Note that this list is incomplete; it includes only the most widely 767c478bd9Sstevel@tonic-gate * used extensions. Also, the version is 1 for all of these for now. 777c478bd9Sstevel@tonic-gate */ 787c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_SERVER_SIDE_SORT 1 797c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 1 807c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_PERSISTENT_SEARCH 1 817c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_PROXY_AUTHORIZATION 1 827c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_LDERRNO 1 837c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_MEMCACHE 1 847c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_IO_FUNCTIONS 1 857c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_EXTIO_FUNCTIONS 1 867c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_DNS_FUNCTIONS 1 877c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS 1 887c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_THREAD_FUNCTIONS 1 897c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS 1 907c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_GETLANGVALUES 1 917c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_CLIENT_SIDE_SORT 1 927c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_URL_FUNCTIONS 1 937c478bd9Sstevel@tonic-gate #define LDAP_API_FEATURE_X_FILTER_FUNCTIONS 1 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate #define LDAP_ROOT_DSE "" /* API extension */ 967c478bd9Sstevel@tonic-gate #define LDAP_NO_ATTRS "1.1" 977c478bd9Sstevel@tonic-gate #define LDAP_ALL_USER_ATTRS "*" 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * Standard options (used with ldap_set_option() and ldap_get_option): 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate #define LDAP_OPT_API_INFO 0x00 /* 0 */ 1037c478bd9Sstevel@tonic-gate #define LDAP_OPT_DESC 0x01 /* 1 */ 1047c478bd9Sstevel@tonic-gate #define LDAP_OPT_DEREF 0x02 /* 2 */ 1057c478bd9Sstevel@tonic-gate #define LDAP_OPT_SIZELIMIT 0x03 /* 3 */ 1067c478bd9Sstevel@tonic-gate #define LDAP_OPT_TIMELIMIT 0x04 /* 4 */ 1077c478bd9Sstevel@tonic-gate #define LDAP_OPT_REFERRALS 0x08 /* 8 */ 1087c478bd9Sstevel@tonic-gate #define LDAP_OPT_RESTART 0x09 /* 9 */ 1097c478bd9Sstevel@tonic-gate #define LDAP_OPT_PROTOCOL_VERSION 0x11 /* 17 */ 1107c478bd9Sstevel@tonic-gate #define LDAP_OPT_SERVER_CONTROLS 0x12 /* 18 */ 1117c478bd9Sstevel@tonic-gate #define LDAP_OPT_CLIENT_CONTROLS 0x13 /* 19 */ 1127c478bd9Sstevel@tonic-gate #define LDAP_OPT_API_FEATURE_INFO 0x15 /* 21 */ 1137c478bd9Sstevel@tonic-gate #define LDAP_OPT_HOST_NAME 0x30 /* 48 */ 1147c478bd9Sstevel@tonic-gate #define LDAP_OPT_ERROR_NUMBER 0x31 /* 49 */ 1157c478bd9Sstevel@tonic-gate #define LDAP_OPT_ERROR_STRING 0x32 /* 50 */ 1167c478bd9Sstevel@tonic-gate #define LDAP_OPT_MATCHED_DN 0x33 /* 51 */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * Well-behaved private and experimental extensions will use option values 1207c478bd9Sstevel@tonic-gate * between 0x4000 (16384) and 0x7FFF (32767) inclusive. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000 /* to 0x7FFF inclusive */ 1237c478bd9Sstevel@tonic-gate /* 1247c478bd9Sstevel@tonic-gate * Special timeout values for poll and connect: 1257c478bd9Sstevel@tonic-gate */ 1267c478bd9Sstevel@tonic-gate #define LDAP_X_IO_TIMEOUT_NO_WAIT 0 /* return immediately */ 1277c478bd9Sstevel@tonic-gate #define LDAP_X_IO_TIMEOUT_NO_TIMEOUT (-1) /* block indefinitely */ 1287c478bd9Sstevel@tonic-gate /* 1297c478bd9Sstevel@tonic-gate * Timeout value for nonblocking connect call 1307c478bd9Sstevel@tonic-gate */ 1317c478bd9Sstevel@tonic-gate #define LDAP_X_OPT_CONNECT_TIMEOUT (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F01) 1327c478bd9Sstevel@tonic-gate /* 0x4000 + 0x0F01 = 0x4F01 = 20225 - API extension */ 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate /* for on/off options */ 1357c478bd9Sstevel@tonic-gate #define LDAP_OPT_ON ((void *)1) 1367c478bd9Sstevel@tonic-gate #define LDAP_OPT_OFF ((void *)0) 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate typedef struct ldap LDAP; /* opaque connection handle */ 1397c478bd9Sstevel@tonic-gate typedef struct ldapmsg LDAPMessage; /* opaque result/entry handle */ 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #define NULLMSG ((LDAPMessage *)0) 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate /* structure representing an LDAP modification */ 1447c478bd9Sstevel@tonic-gate typedef struct ldapmod { 1457c478bd9Sstevel@tonic-gate int mod_op; /* kind of mod + form of values */ 1467c478bd9Sstevel@tonic-gate #define LDAP_MOD_ADD 0x00 1477c478bd9Sstevel@tonic-gate #define LDAP_MOD_DELETE 0x01 1487c478bd9Sstevel@tonic-gate #define LDAP_MOD_REPLACE 0x02 1497c478bd9Sstevel@tonic-gate #define LDAP_MOD_BVALUES 0x80 1507c478bd9Sstevel@tonic-gate char *mod_type; /* attribute name to modify */ 1517c478bd9Sstevel@tonic-gate union mod_vals_u { 1527c478bd9Sstevel@tonic-gate char **modv_strvals; 1537c478bd9Sstevel@tonic-gate struct berval **modv_bvals; 1547c478bd9Sstevel@tonic-gate } mod_vals; /* values to add/delete/replace */ 1557c478bd9Sstevel@tonic-gate #define mod_values mod_vals.modv_strvals 1567c478bd9Sstevel@tonic-gate #define mod_bvalues mod_vals.modv_bvals 1577c478bd9Sstevel@tonic-gate } LDAPMod; 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate /* 1617c478bd9Sstevel@tonic-gate * structure for holding ldapv3 controls 1627c478bd9Sstevel@tonic-gate */ 1637c478bd9Sstevel@tonic-gate typedef struct ldapcontrol { 1647c478bd9Sstevel@tonic-gate char *ldctl_oid; 1657c478bd9Sstevel@tonic-gate struct berval ldctl_value; 1667c478bd9Sstevel@tonic-gate char ldctl_iscritical; 1677c478bd9Sstevel@tonic-gate } LDAPControl; 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate /* 1717c478bd9Sstevel@tonic-gate * LDAP API information. Can be retrieved by using a sequence like: 1727c478bd9Sstevel@tonic-gate * 1737c478bd9Sstevel@tonic-gate * LDAPAPIInfo ldai; 1747c478bd9Sstevel@tonic-gate * ldai.ldapai_info_version = LDAP_API_INFO_VERSION; 1757c478bd9Sstevel@tonic-gate * if ( ldap_get_option( NULL, LDAP_OPT_API_INFO, &ldia ) == 0 ) ... 1767c478bd9Sstevel@tonic-gate */ 1777c478bd9Sstevel@tonic-gate #define LDAP_API_INFO_VERSION 1 1787c478bd9Sstevel@tonic-gate typedef struct ldapapiinfo { 1797c478bd9Sstevel@tonic-gate int ldapai_info_version; /* version of this struct (1) */ 1807c478bd9Sstevel@tonic-gate int ldapai_api_version; /* revision of API supported */ 1817c478bd9Sstevel@tonic-gate int ldapai_protocol_version; /* highest LDAP version supported */ 1827c478bd9Sstevel@tonic-gate char **ldapai_extensions; /* names of API extensions */ 1837c478bd9Sstevel@tonic-gate char *ldapai_vendor_name; /* name of supplier */ 1847c478bd9Sstevel@tonic-gate int ldapai_vendor_version; /* supplier-specific version times 100 */ 1857c478bd9Sstevel@tonic-gate } LDAPAPIInfo; 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate /* 1897c478bd9Sstevel@tonic-gate * LDAP API extended features info. Can be retrieved by using a sequence like: 1907c478bd9Sstevel@tonic-gate * 1917c478bd9Sstevel@tonic-gate * LDAPAPIFeatureInfo ldfi; 1927c478bd9Sstevel@tonic-gate * ldfi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION; 1937c478bd9Sstevel@tonic-gate * ldfi.ldapaif_name = "VIRTUAL_LIST_VIEW"; 1947c478bd9Sstevel@tonic-gate * if ( ldap_get_option( NULL, LDAP_OPT_API_FEATURE_INFO, &ldfi ) == 0 ) ... 1957c478bd9Sstevel@tonic-gate */ 1967c478bd9Sstevel@tonic-gate #define LDAP_FEATURE_INFO_VERSION 1 1977c478bd9Sstevel@tonic-gate typedef struct ldap_apifeature_info { 1987c478bd9Sstevel@tonic-gate int ldapaif_info_version; /* version of this struct (1) */ 1997c478bd9Sstevel@tonic-gate char *ldapaif_name; /* name of supported feature */ 2007c478bd9Sstevel@tonic-gate int ldapaif_version; /* revision of supported feature */ 2017c478bd9Sstevel@tonic-gate } LDAPAPIFeatureInfo; 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate /* possible result types a server can return */ 2057c478bd9Sstevel@tonic-gate #define LDAP_RES_BIND 0x61 /* 97 */ 2067c478bd9Sstevel@tonic-gate #define LDAP_RES_SEARCH_ENTRY 0x64 /* 100 */ 2077c478bd9Sstevel@tonic-gate #define LDAP_RES_SEARCH_RESULT 0x65 /* 101 */ 2087c478bd9Sstevel@tonic-gate #define LDAP_RES_MODIFY 0x67 /* 103 */ 2097c478bd9Sstevel@tonic-gate #define LDAP_RES_ADD 0x69 /* 105 */ 2107c478bd9Sstevel@tonic-gate #define LDAP_RES_DELETE 0x6b /* 107 */ 2117c478bd9Sstevel@tonic-gate #define LDAP_RES_MODDN 0x6d /* 109 */ 2127c478bd9Sstevel@tonic-gate #define LDAP_RES_COMPARE 0x6f /* 111 */ 2137c478bd9Sstevel@tonic-gate #define LDAP_RES_SEARCH_REFERENCE 0x73 /* 115 */ 2147c478bd9Sstevel@tonic-gate #define LDAP_RES_EXTENDED 0x78 /* 120 */ 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate /* Special values for ldap_result() "msgid" parameter */ 2177c478bd9Sstevel@tonic-gate #define LDAP_RES_ANY (-1) 2187c478bd9Sstevel@tonic-gate #define LDAP_RES_UNSOLICITED 0 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate /* built-in SASL methods */ 2217c478bd9Sstevel@tonic-gate #define LDAP_SASL_SIMPLE 0 /* special value used for simple bind */ 2227c478bd9Sstevel@tonic-gate #define LDAP_SASL_EXTERNAL "EXTERNAL" /* TLS/SSL extension */ 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 2257c478bd9Sstevel@tonic-gate #define LDAP_SASL_CRAM_MD5 "CRAM-MD5" 2267c478bd9Sstevel@tonic-gate #define LDAP_SASL_DIGEST_MD5 "DIGEST-MD5" 2277c478bd9Sstevel@tonic-gate #define LDAP_SASL_BIND_INPROGRESS 0x0e /* for backward compatibility */ 2287c478bd9Sstevel@tonic-gate #endif 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate /* search scopes */ 2317c478bd9Sstevel@tonic-gate #define LDAP_SCOPE_BASE 0x00 2327c478bd9Sstevel@tonic-gate #define LDAP_SCOPE_ONELEVEL 0x01 2337c478bd9Sstevel@tonic-gate #define LDAP_SCOPE_SUBTREE 0x02 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gate /* alias dereferencing */ 2367c478bd9Sstevel@tonic-gate #define LDAP_DEREF_NEVER 0 2377c478bd9Sstevel@tonic-gate #define LDAP_DEREF_SEARCHING 1 2387c478bd9Sstevel@tonic-gate #define LDAP_DEREF_FINDING 2 2397c478bd9Sstevel@tonic-gate #define LDAP_DEREF_ALWAYS 3 2407c478bd9Sstevel@tonic-gate 2417c478bd9Sstevel@tonic-gate /* predefined size/time limits */ 2427c478bd9Sstevel@tonic-gate #define LDAP_NO_LIMIT 0 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate /* allowed values for "all" ldap_result() parameter */ 2457c478bd9Sstevel@tonic-gate #define LDAP_MSG_ONE 0 2467c478bd9Sstevel@tonic-gate #define LDAP_MSG_ALL 1 2477c478bd9Sstevel@tonic-gate #define LDAP_MSG_RECEIVED 2 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate /* possible error codes we can be returned */ 2507c478bd9Sstevel@tonic-gate #define LDAP_SUCCESS 0x00 /* 0 */ 2517c478bd9Sstevel@tonic-gate #define LDAP_OPERATIONS_ERROR 0x01 /* 1 */ 2527c478bd9Sstevel@tonic-gate #define LDAP_PROTOCOL_ERROR 0x02 /* 2 */ 2537c478bd9Sstevel@tonic-gate #define LDAP_TIMELIMIT_EXCEEDED 0x03 /* 3 */ 2547c478bd9Sstevel@tonic-gate #define LDAP_SIZELIMIT_EXCEEDED 0x04 /* 4 */ 2557c478bd9Sstevel@tonic-gate #define LDAP_COMPARE_FALSE 0x05 /* 5 */ 2567c478bd9Sstevel@tonic-gate #define LDAP_COMPARE_TRUE 0x06 /* 6 */ 2577c478bd9Sstevel@tonic-gate #define LDAP_STRONG_AUTH_NOT_SUPPORTED 0x07 /* 7 */ 2587c478bd9Sstevel@tonic-gate #define LDAP_STRONG_AUTH_REQUIRED 0x08 /* 8 */ 2597c478bd9Sstevel@tonic-gate #define LDAP_PARTIAL_RESULTS 0x09 /* 9 (UMich LDAPv2 extn) */ 2607c478bd9Sstevel@tonic-gate #define LDAP_REFERRAL 0x0a /* 10 - LDAPv3 */ 2617c478bd9Sstevel@tonic-gate #define LDAP_ADMINLIMIT_EXCEEDED 0x0b /* 11 - LDAPv3 */ 2627c478bd9Sstevel@tonic-gate #define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* 12 - LDAPv3 */ 2637c478bd9Sstevel@tonic-gate #define LDAP_CONFIDENTIALITY_REQUIRED 0x0d /* 13 */ 2647c478bd9Sstevel@tonic-gate #define LDAP_SASL_BIND_IN_PROGRESS 0x0e /* 14 - LDAPv3 */ 2657c478bd9Sstevel@tonic-gate 2667c478bd9Sstevel@tonic-gate #define LDAP_NO_SUCH_ATTRIBUTE 0x10 /* 16 */ 2677c478bd9Sstevel@tonic-gate #define LDAP_UNDEFINED_TYPE 0x11 /* 17 */ 2687c478bd9Sstevel@tonic-gate #define LDAP_INAPPROPRIATE_MATCHING 0x12 /* 18 */ 2697c478bd9Sstevel@tonic-gate #define LDAP_CONSTRAINT_VIOLATION 0x13 /* 19 */ 2707c478bd9Sstevel@tonic-gate #define LDAP_TYPE_OR_VALUE_EXISTS 0x14 /* 20 */ 2717c478bd9Sstevel@tonic-gate #define LDAP_INVALID_SYNTAX 0x15 /* 21 */ 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate #define LDAP_NO_SUCH_OBJECT 0x20 /* 32 */ 2747c478bd9Sstevel@tonic-gate #define LDAP_ALIAS_PROBLEM 0x21 /* 33 */ 2757c478bd9Sstevel@tonic-gate #define LDAP_INVALID_DN_SYNTAX 0x22 /* 34 */ 2767c478bd9Sstevel@tonic-gate #define LDAP_IS_LEAF 0x23 /* 35 (not used in LDAPv3) */ 2777c478bd9Sstevel@tonic-gate #define LDAP_ALIAS_DEREF_PROBLEM 0x24 /* 36 */ 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate #define NAME_ERROR(n) ((n & 0xf0) == 0x20) 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate #define LDAP_INAPPROPRIATE_AUTH 0x30 /* 48 */ 2827c478bd9Sstevel@tonic-gate #define LDAP_INVALID_CREDENTIALS 0x31 /* 49 */ 2837c478bd9Sstevel@tonic-gate #define LDAP_INSUFFICIENT_ACCESS 0x32 /* 50 */ 2847c478bd9Sstevel@tonic-gate #define LDAP_BUSY 0x33 /* 51 */ 2857c478bd9Sstevel@tonic-gate #define LDAP_UNAVAILABLE 0x34 /* 52 */ 2867c478bd9Sstevel@tonic-gate #define LDAP_UNWILLING_TO_PERFORM 0x35 /* 53 */ 2877c478bd9Sstevel@tonic-gate #define LDAP_LOOP_DETECT 0x36 /* 54 */ 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate #define LDAP_SORT_CONTROL_MISSING 0x3C /* 60 (server side sort extn) */ 2907c478bd9Sstevel@tonic-gate #define LDAP_INDEX_RANGE_ERROR 0x3D /* 61 (VLV extn) */ 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate #define LDAP_NAMING_VIOLATION 0x40 /* 64 */ 2937c478bd9Sstevel@tonic-gate #define LDAP_OBJECT_CLASS_VIOLATION 0x41 /* 65 */ 2947c478bd9Sstevel@tonic-gate #define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42 /* 66 */ 2957c478bd9Sstevel@tonic-gate #define LDAP_NOT_ALLOWED_ON_RDN 0x43 /* 67 */ 2967c478bd9Sstevel@tonic-gate #define LDAP_ALREADY_EXISTS 0x44 /* 68 */ 2977c478bd9Sstevel@tonic-gate #define LDAP_NO_OBJECT_CLASS_MODS 0x45 /* 69 */ 2987c478bd9Sstevel@tonic-gate #define LDAP_RESULTS_TOO_LARGE 0x46 /* 70 - CLDAP */ 2997c478bd9Sstevel@tonic-gate #define LDAP_AFFECTS_MULTIPLE_DSAS 0x47 /* 71 */ 3007c478bd9Sstevel@tonic-gate 3017c478bd9Sstevel@tonic-gate #define LDAP_OTHER 0x50 /* 80 */ 3027c478bd9Sstevel@tonic-gate #define LDAP_SERVER_DOWN 0x51 /* 81 */ 3037c478bd9Sstevel@tonic-gate #define LDAP_LOCAL_ERROR 0x52 /* 82 */ 3047c478bd9Sstevel@tonic-gate #define LDAP_ENCODING_ERROR 0x53 /* 83 */ 3057c478bd9Sstevel@tonic-gate #define LDAP_DECODING_ERROR 0x54 /* 84 */ 3067c478bd9Sstevel@tonic-gate #define LDAP_TIMEOUT 0x55 /* 85 */ 3077c478bd9Sstevel@tonic-gate #define LDAP_AUTH_UNKNOWN 0x56 /* 86 */ 3087c478bd9Sstevel@tonic-gate #define LDAP_FILTER_ERROR 0x57 /* 87 */ 3097c478bd9Sstevel@tonic-gate #define LDAP_USER_CANCELLED 0x58 /* 88 */ 3107c478bd9Sstevel@tonic-gate #define LDAP_PARAM_ERROR 0x59 /* 89 */ 3117c478bd9Sstevel@tonic-gate #define LDAP_NO_MEMORY 0x5a /* 90 */ 3127c478bd9Sstevel@tonic-gate #define LDAP_CONNECT_ERROR 0x5b /* 91 */ 3137c478bd9Sstevel@tonic-gate #define LDAP_NOT_SUPPORTED 0x5c /* 92 - LDAPv3 */ 3147c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_NOT_FOUND 0x5d /* 93 - LDAPv3 */ 3157c478bd9Sstevel@tonic-gate #define LDAP_NO_RESULTS_RETURNED 0x5e /* 94 - LDAPv3 */ 3167c478bd9Sstevel@tonic-gate #define LDAP_MORE_RESULTS_TO_RETURN 0x5f /* 95 - LDAPv3 */ 3177c478bd9Sstevel@tonic-gate #define LDAP_CLIENT_LOOP 0x60 /* 96 - LDAPv3 */ 3187c478bd9Sstevel@tonic-gate #define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* 97 - LDAPv3 */ 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate /* 3217c478bd9Sstevel@tonic-gate * LDAPv3 unsolicited notification messages we know about 3227c478bd9Sstevel@tonic-gate */ 3237c478bd9Sstevel@tonic-gate #define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036" 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* 3267c478bd9Sstevel@tonic-gate * LDAPv3 server controls we know about 3277c478bd9Sstevel@tonic-gate */ 3287c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2" 3297c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_SORTREQUEST "1.2.840.113556.1.4.473" 3307c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_SORTRESPONSE "1.2.840.113556.1.4.474" 3317c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_PERSISTENTSEARCH "2.16.840.1.113730.3.4.3" 3327c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_ENTRYCHANGE "2.16.840.1.113730.3.4.7" 3337c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9" 3347c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10" 3357c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_PROXYAUTH "2.16.840.1.113730.3.4.12" 3367c478bd9Sstevel@tonic-gate /* version 1 */ 3377c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_PROXIEDAUTH "2.16.840.1.113730.3.4.18" 3387c478bd9Sstevel@tonic-gate /* version 2 */ 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 3417c478bd9Sstevel@tonic-gate /* 3427c478bd9Sstevel@tonic-gate * Simple Page control OID 3437c478bd9Sstevel@tonic-gate */ 3447c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_SIMPLE_PAGE "1.2.840.113556.1.4.319" 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate /* 3477c478bd9Sstevel@tonic-gate * Begin LDAP Display Template Definitions 3487c478bd9Sstevel@tonic-gate */ 3497c478bd9Sstevel@tonic-gate #define LDAP_TEMPLATE_VERSION 1 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate /* 3527c478bd9Sstevel@tonic-gate * general types of items (confined to most significant byte) 3537c478bd9Sstevel@tonic-gate */ 3547c478bd9Sstevel@tonic-gate #define LDAP_SYN_TYPE_TEXT 0x01000000L 3557c478bd9Sstevel@tonic-gate #define LDAP_SYN_TYPE_IMAGE 0x02000000L 3567c478bd9Sstevel@tonic-gate #define LDAP_SYN_TYPE_BOOLEAN 0x04000000L 3577c478bd9Sstevel@tonic-gate #define LDAP_SYN_TYPE_BUTTON 0x08000000L 3587c478bd9Sstevel@tonic-gate #define LDAP_SYN_TYPE_ACTION 0x10000000L 3597c478bd9Sstevel@tonic-gate 3607c478bd9Sstevel@tonic-gate /* 3617c478bd9Sstevel@tonic-gate * syntax options (confined to second most significant byte) 3627c478bd9Sstevel@tonic-gate */ 3637c478bd9Sstevel@tonic-gate #define LDAP_SYN_OPT_DEFER 0x00010000L 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate /* 3667c478bd9Sstevel@tonic-gate * display template item syntax ids (defined by common agreement) 3677c478bd9Sstevel@tonic-gate * these are the valid values for the ti_syntaxid of the tmplitem 3687c478bd9Sstevel@tonic-gate * struct (defined below). A general type is encoded in the 3697c478bd9Sstevel@tonic-gate * most-significant 8 bits, and some options are encoded in the next 3707c478bd9Sstevel@tonic-gate * 8 bits. The lower 16 bits are reserved for the distinct types. 3717c478bd9Sstevel@tonic-gate */ 3727c478bd9Sstevel@tonic-gate #define LDAP_SYN_CASEIGNORESTR (1 | LDAP_SYN_TYPE_TEXT) 3737c478bd9Sstevel@tonic-gate #define LDAP_SYN_MULTILINESTR (2 | LDAP_SYN_TYPE_TEXT) 3747c478bd9Sstevel@tonic-gate #define LDAP_SYN_DN (3 | LDAP_SYN_TYPE_TEXT) 3757c478bd9Sstevel@tonic-gate #define LDAP_SYN_BOOLEAN (4 | LDAP_SYN_TYPE_BOOLEAN) 3767c478bd9Sstevel@tonic-gate #define LDAP_SYN_JPEGIMAGE (5 | LDAP_SYN_TYPE_IMAGE) 3777c478bd9Sstevel@tonic-gate #define LDAP_SYN_JPEGBUTTON (6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER) 3787c478bd9Sstevel@tonic-gate #define LDAP_SYN_FAXIMAGE (7 | LDAP_SYN_TYPE_IMAGE) 3797c478bd9Sstevel@tonic-gate #define LDAP_SYN_FAXBUTTON (8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER) 3807c478bd9Sstevel@tonic-gate #define LDAP_SYN_AUDIOBUTTON (9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER) 3817c478bd9Sstevel@tonic-gate #define LDAP_SYN_TIME (10 | LDAP_SYN_TYPE_TEXT) 3827c478bd9Sstevel@tonic-gate #define LDAP_SYN_DATE (11 | LDAP_SYN_TYPE_TEXT) 3837c478bd9Sstevel@tonic-gate #define LDAP_SYN_LABELEDURL (12 | LDAP_SYN_TYPE_TEXT) 3847c478bd9Sstevel@tonic-gate #define LDAP_SYN_SEARCHACTION (13 | LDAP_SYN_TYPE_ACTION) 3857c478bd9Sstevel@tonic-gate #define LDAP_SYN_LINKACTION (14 | LDAP_SYN_TYPE_ACTION) 3867c478bd9Sstevel@tonic-gate #define LDAP_SYN_ADDDNACTION (15 | LDAP_SYN_TYPE_ACTION) 3877c478bd9Sstevel@tonic-gate #define LDAP_SYN_VERIFYDNACTION (16 | LDAP_SYN_TYPE_ACTION) 3887c478bd9Sstevel@tonic-gate #define LDAP_SYN_RFC822ADDR (17 | LDAP_SYN_TYPE_TEXT) 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate /* 3917c478bd9Sstevel@tonic-gate * handy macros 3927c478bd9Sstevel@tonic-gate */ 3937c478bd9Sstevel@tonic-gate #define LDAP_GET_SYN_TYPE(syid) ((syid) & 0xFF000000UL) 3947c478bd9Sstevel@tonic-gate #define LDAP_GET_SYN_OPTIONS(syid) ((syid) & 0x00FF0000UL) 3957c478bd9Sstevel@tonic-gate 3967c478bd9Sstevel@tonic-gate 3977c478bd9Sstevel@tonic-gate /* 3987c478bd9Sstevel@tonic-gate * display options for output routines (used by entry2text and friends) 3997c478bd9Sstevel@tonic-gate */ 4007c478bd9Sstevel@tonic-gate /* 4017c478bd9Sstevel@tonic-gate * use calculated label width (based on length of longest label in 4027c478bd9Sstevel@tonic-gate * template) instead of contant width 4037c478bd9Sstevel@tonic-gate */ 4047c478bd9Sstevel@tonic-gate #define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L 4057c478bd9Sstevel@tonic-gate #define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002L 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate /* 4087c478bd9Sstevel@tonic-gate * perform search actions (applies to ldap_entry2text_search only) 4097c478bd9Sstevel@tonic-gate */ 4107c478bd9Sstevel@tonic-gate #define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L 4117c478bd9Sstevel@tonic-gate 4127c478bd9Sstevel@tonic-gate /* 4137c478bd9Sstevel@tonic-gate * include additional info. relevant to "non leaf" entries only 4147c478bd9Sstevel@tonic-gate * used by ldap_entry2html and ldap_entry2html_search to include "Browse" 4157c478bd9Sstevel@tonic-gate * and "Move Up" HREFs 4167c478bd9Sstevel@tonic-gate */ 4177c478bd9Sstevel@tonic-gate #define LDAP_DISP_OPT_NONLEAF 0x00000004L 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate /* 4207c478bd9Sstevel@tonic-gate * display template item options (may not apply to all types) 4217c478bd9Sstevel@tonic-gate * if this bit is set in ti_options, it applies. 4227c478bd9Sstevel@tonic-gate */ 4237c478bd9Sstevel@tonic-gate #define LDAP_DITEM_OPT_READONLY 0x00000001L 4247c478bd9Sstevel@tonic-gate #define LDAP_DITEM_OPT_SORTVALUES 0x00000002L 4257c478bd9Sstevel@tonic-gate #define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004L 4267c478bd9Sstevel@tonic-gate #define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008L 4277c478bd9Sstevel@tonic-gate #define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L 4287c478bd9Sstevel@tonic-gate #define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020L /* booleans only */ 4297c478bd9Sstevel@tonic-gate 4307c478bd9Sstevel@tonic-gate #endif /* _SOLARIS_SDK */ 4317c478bd9Sstevel@tonic-gate 4327c478bd9Sstevel@tonic-gate /* Authentication request and response controls */ 4337c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_AUTH_REQUEST "2.16.840.1.113730.3.4.16" 4347c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_AUTH_RESPONSE "2.16.840.1.113730.3.4.15" 4357c478bd9Sstevel@tonic-gate 4367c478bd9Sstevel@tonic-gate /* Password information sent back to client */ 4377c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_PWEXPIRED "2.16.840.1.113730.3.4.4" 4387c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_PWEXPIRING "2.16.840.1.113730.3.4.5" 4397c478bd9Sstevel@tonic-gate 4407c478bd9Sstevel@tonic-gate 4417c478bd9Sstevel@tonic-gate /* 4427c478bd9Sstevel@tonic-gate * Client controls we know about 4437c478bd9Sstevel@tonic-gate */ 4447c478bd9Sstevel@tonic-gate #define LDAP_CONTROL_REFERRALS "1.2.840.113556.1.4.616" 4457c478bd9Sstevel@tonic-gate 4467c478bd9Sstevel@tonic-gate 4477c478bd9Sstevel@tonic-gate /* 4487c478bd9Sstevel@tonic-gate * LDAP_API macro definition: 4497c478bd9Sstevel@tonic-gate */ 4507c478bd9Sstevel@tonic-gate #ifndef LDAP_API 4517c478bd9Sstevel@tonic-gate #define LDAP_API(rt) rt 4527c478bd9Sstevel@tonic-gate #endif /* LDAP_API */ 4537c478bd9Sstevel@tonic-gate 4547c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 4557c478bd9Sstevel@tonic-gate /* Simple Page Control functions for Solaris SDK */ 4567c478bd9Sstevel@tonic-gate int ldap_create_page_control(LDAP *ld, unsigned int pagesize, 4577c478bd9Sstevel@tonic-gate struct berval *cookie, char isCritical, LDAPControl **output); 4587c478bd9Sstevel@tonic-gate int ldap_parse_page_control(LDAP *ld, LDAPControl **controls, 4597c478bd9Sstevel@tonic-gate unsigned int *totalcount, struct berval **cookie); 4607c478bd9Sstevel@tonic-gate 4617c478bd9Sstevel@tonic-gate /* CRAM-MD5 functions */ 4627c478bd9Sstevel@tonic-gate int ldap_sasl_cram_md5_bind_s(LDAP *ld, char *dn, 4637c478bd9Sstevel@tonic-gate struct berval *cred, LDAPControl **serverctrls, 4647c478bd9Sstevel@tonic-gate LDAPControl **clientctrls); 4657c478bd9Sstevel@tonic-gate /* DIGEST-MD5 Function */ 4667c478bd9Sstevel@tonic-gate int ldap_x_sasl_digest_md5_bind_s(LDAP *ld, char *dn, 4677c478bd9Sstevel@tonic-gate struct berval *cred, LDAPControl **serverctrls, 4687c478bd9Sstevel@tonic-gate LDAPControl **clientctrls); 4697c478bd9Sstevel@tonic-gate int ldap_x_sasl_digest_md5_bind(LDAP *ld, char *dn, 4707c478bd9Sstevel@tonic-gate struct berval *cred, LDAPControl **serverctrls, 4717c478bd9Sstevel@tonic-gate LDAPControl **clientctrls, struct timeval *timeout, 4727c478bd9Sstevel@tonic-gate LDAPMessage **result); 4737c478bd9Sstevel@tonic-gate 4747c478bd9Sstevel@tonic-gate #endif /* _SOLARIS_SDK */ 4757c478bd9Sstevel@tonic-gate 4767c478bd9Sstevel@tonic-gate LDAP_API(LDAP *) LDAP_CALL ldap_open(const char *host, int port); 4777c478bd9Sstevel@tonic-gate LDAP_API(LDAP *) LDAP_CALL ldap_init(const char *defhost, int defport); 4787c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_set_option(LDAP *ld, int option, 4797c478bd9Sstevel@tonic-gate const void *optdata); 4807c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_get_option(LDAP *ld, int option, void *optdata); 4817c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_unbind(LDAP *ld); 4827c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_unbind_s(LDAP *ld); 4837c478bd9Sstevel@tonic-gate 4847c478bd9Sstevel@tonic-gate /* 4857c478bd9Sstevel@tonic-gate * perform ldap operations and obtain results 4867c478bd9Sstevel@tonic-gate */ 4877c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_abandon(LDAP *ld, int msgid); 4887c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_add(LDAP *ld, const char *dn, LDAPMod **attrs); 4897c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_add_s(LDAP *ld, const char *dn, LDAPMod **attrs); 4907c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_simple_bind(LDAP *ld, const char *who, 4917c478bd9Sstevel@tonic-gate const char *passwd); 4927c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_simple_bind_s(LDAP *ld, const char *who, 4937c478bd9Sstevel@tonic-gate const char *passwd); 4947c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modify(LDAP *ld, const char *dn, LDAPMod **mods); 4957c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modify_s(LDAP *ld, const char *dn, 4967c478bd9Sstevel@tonic-gate LDAPMod **mods); 4977c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modrdn(LDAP *ld, const char *dn, 4987c478bd9Sstevel@tonic-gate const char *newrdn); 4997c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modrdn_s(LDAP *ld, const char *dn, 5007c478bd9Sstevel@tonic-gate const char *newrdn); 5017c478bd9Sstevel@tonic-gate 5027c478bd9Sstevel@tonic-gate /* The following 2 functions are deprecated */ 5037c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modrdn2(LDAP *ld, const char *dn, 5047c478bd9Sstevel@tonic-gate const char *newrdn, int deleteoldrdn); 5057c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modrdn2_s(LDAP *ld, const char *dn, 5067c478bd9Sstevel@tonic-gate const char *newrdn, int deleteoldrdn); 5077c478bd9Sstevel@tonic-gate 5087c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_compare(LDAP *ld, const char *dn, 5097c478bd9Sstevel@tonic-gate const char *attr, const char *value); 5107c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_compare_s(LDAP *ld, const char *dn, 5117c478bd9Sstevel@tonic-gate const char *attr, const char *value); 5127c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_delete(LDAP *ld, const char *dn); 5137c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_delete_s(LDAP *ld, const char *dn); 5147c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_search(LDAP *ld, const char *base, int scope, 5157c478bd9Sstevel@tonic-gate const char *filter, char **attrs, int attrsonly); 5167c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_search_s(LDAP *ld, const char *base, int scope, 5177c478bd9Sstevel@tonic-gate const char *filter, char **attrs, int attrsonly, LDAPMessage **res); 5187c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_search_st(LDAP *ld, const char *base, int scope, 5197c478bd9Sstevel@tonic-gate const char *filter, char **attrs, int attrsonly, 5207c478bd9Sstevel@tonic-gate struct timeval *timeout, LDAPMessage **res); 5217c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_result(LDAP *ld, int msgid, int all, 5227c478bd9Sstevel@tonic-gate struct timeval *timeout, LDAPMessage **result); 5237c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_msgfree(LDAPMessage *lm); 5247c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_msgid(LDAPMessage *lm); 5257c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_msgtype(LDAPMessage *lm); 5267c478bd9Sstevel@tonic-gate 5277c478bd9Sstevel@tonic-gate 5287c478bd9Sstevel@tonic-gate /* 5297c478bd9Sstevel@tonic-gate * Routines to parse/deal with results and errors returned 5307c478bd9Sstevel@tonic-gate */ 5317c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_result2error(LDAP *ld, LDAPMessage *r, 5327c478bd9Sstevel@tonic-gate int freeit); 5337c478bd9Sstevel@tonic-gate char *LDAP_CALL ldap_err2string(int err); 5347c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_perror(LDAP *ld, const char *s); 5357c478bd9Sstevel@tonic-gate LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_entry(LDAP *ld, 5367c478bd9Sstevel@tonic-gate LDAPMessage *chain); 5377c478bd9Sstevel@tonic-gate LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_entry(LDAP *ld, 5387c478bd9Sstevel@tonic-gate LDAPMessage *entry); 5397c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_count_entries(LDAP *ld, LDAPMessage *chain); 5407c478bd9Sstevel@tonic-gate char *LDAP_CALL ldap_get_dn(LDAP *ld, LDAPMessage *entry); 5417c478bd9Sstevel@tonic-gate char *LDAP_CALL ldap_dn2ufn(const char *dn); 5427c478bd9Sstevel@tonic-gate char **LDAP_CALL ldap_explode_dn(const char *dn, 5437c478bd9Sstevel@tonic-gate const int notypes); 5447c478bd9Sstevel@tonic-gate char **LDAP_CALL ldap_explode_rdn(const char *rdn, 5457c478bd9Sstevel@tonic-gate const int notypes); 5467c478bd9Sstevel@tonic-gate char *LDAP_CALL ldap_first_attribute(LDAP *ld, LDAPMessage *entry, 5477c478bd9Sstevel@tonic-gate BerElement **ber); 5487c478bd9Sstevel@tonic-gate char *LDAP_CALL ldap_next_attribute(LDAP *ld, LDAPMessage *entry, 5497c478bd9Sstevel@tonic-gate BerElement *ber); 5507c478bd9Sstevel@tonic-gate 5517c478bd9Sstevel@tonic-gate /* The following function is deprecated */ 5527c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_ber_free(BerElement *ber, int freebuf); 5537c478bd9Sstevel@tonic-gate 5547c478bd9Sstevel@tonic-gate char **LDAP_CALL ldap_get_values(LDAP *ld, LDAPMessage *entry, 5557c478bd9Sstevel@tonic-gate const char *target); 5567c478bd9Sstevel@tonic-gate struct berval **LDAP_CALL ldap_get_values_len(LDAP *ld, 5577c478bd9Sstevel@tonic-gate LDAPMessage *entry, const char *target); 5587c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_count_values(char **vals); 5597c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_count_values_len(struct berval **vals); 5607c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_value_free(char **vals); 5617c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_value_free_len(struct berval **vals); 5627c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_memfree(void *p); 5637c478bd9Sstevel@tonic-gate 5647c478bd9Sstevel@tonic-gate 5657c478bd9Sstevel@tonic-gate /* 5667c478bd9Sstevel@tonic-gate * LDAPv3 extended operation calls 5677c478bd9Sstevel@tonic-gate */ 5687c478bd9Sstevel@tonic-gate /* 5697c478bd9Sstevel@tonic-gate * Note: all of the new asynchronous calls return an LDAP error code, 5707c478bd9Sstevel@tonic-gate * not a message id. A message id is returned via the int *msgidp 5717c478bd9Sstevel@tonic-gate * parameter (usually the last parameter) if appropriate. 5727c478bd9Sstevel@tonic-gate */ 5737c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_abandon_ext(LDAP *ld, int msgid, 5747c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls); 5757c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_add_ext(LDAP *ld, const char *dn, LDAPMod **attrs, 5767c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 5777c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_add_ext_s(LDAP *ld, const char *dn, 5787c478bd9Sstevel@tonic-gate LDAPMod **attrs, LDAPControl **serverctrls, LDAPControl **clientctrls); 5797c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_sasl_bind(LDAP *ld, const char *dn, 5807c478bd9Sstevel@tonic-gate const char *mechanism, const struct berval *cred, 5817c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 5827c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_sasl_bind_s(LDAP *ld, const char *dn, 5837c478bd9Sstevel@tonic-gate const char *mechanism, const struct berval *cred, 5847c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, 5857c478bd9Sstevel@tonic-gate struct berval **servercredp); 5867c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modify_ext(LDAP *ld, const char *dn, 5877c478bd9Sstevel@tonic-gate LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, 5887c478bd9Sstevel@tonic-gate int *msgidp); 5897c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_modify_ext_s(LDAP *ld, const char *dn, 5907c478bd9Sstevel@tonic-gate LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls); 5917c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_rename(LDAP *ld, const char *dn, 5927c478bd9Sstevel@tonic-gate const char *newrdn, const char *newparent, int deleteoldrdn, 5937c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 5947c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_rename_s(LDAP *ld, const char *dn, 5957c478bd9Sstevel@tonic-gate const char *newrdn, const char *newparent, int deleteoldrdn, 5967c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls); 5977c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_compare_ext(LDAP *ld, const char *dn, 5987c478bd9Sstevel@tonic-gate const char *attr, const struct berval *bvalue, 5997c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 6007c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_compare_ext_s(LDAP *ld, const char *dn, 6017c478bd9Sstevel@tonic-gate const char *attr, const struct berval *bvalue, 6027c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls); 6037c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_delete_ext(LDAP *ld, const char *dn, 6047c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 6057c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_delete_ext_s(LDAP *ld, const char *dn, 6067c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls); 6077c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_search_ext(LDAP *ld, const char *base, 6087c478bd9Sstevel@tonic-gate int scope, const char *filter, char **attrs, int attrsonly, 6097c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, 6107c478bd9Sstevel@tonic-gate struct timeval *timeoutp, int sizelimit, int *msgidp); 6117c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_search_ext_s(LDAP *ld, const char *base, 6127c478bd9Sstevel@tonic-gate int scope, const char *filter, char **attrs, int attrsonly, 6137c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, 6147c478bd9Sstevel@tonic-gate struct timeval *timeoutp, int sizelimit, LDAPMessage **res); 6157c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_extended_operation(LDAP *ld, 6167c478bd9Sstevel@tonic-gate const char *requestoid, const struct berval *requestdata, 6177c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 6187c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_extended_operation_s(LDAP *ld, 6197c478bd9Sstevel@tonic-gate const char *requestoid, const struct berval *requestdata, 6207c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, 6217c478bd9Sstevel@tonic-gate char **retoidp, struct berval **retdatap); 6227c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_unbind_ext(LDAP *ld, LDAPControl **serverctrls, 6237c478bd9Sstevel@tonic-gate LDAPControl **clientctrls); 6247c478bd9Sstevel@tonic-gate 6257c478bd9Sstevel@tonic-gate 6267c478bd9Sstevel@tonic-gate /* 6277c478bd9Sstevel@tonic-gate * LDAPv3 extended parsing / result handling calls 6287c478bd9Sstevel@tonic-gate */ 6297c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_parse_sasl_bind_result(LDAP *ld, 6307c478bd9Sstevel@tonic-gate LDAPMessage *res, struct berval **servercredp, int freeit); 6317c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_parse_result(LDAP *ld, LDAPMessage *res, 6327c478bd9Sstevel@tonic-gate int *errcodep, char **matcheddnp, char **errmsgp, char ***referralsp, 6337c478bd9Sstevel@tonic-gate LDAPControl ***serverctrlsp, int freeit); 6347c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_parse_extended_result(LDAP *ld, LDAPMessage *res, 6357c478bd9Sstevel@tonic-gate char **retoidp, struct berval **retdatap, int freeit); 6367c478bd9Sstevel@tonic-gate LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_message(LDAP *ld, 6377c478bd9Sstevel@tonic-gate LDAPMessage *res); 6387c478bd9Sstevel@tonic-gate LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_message(LDAP *ld, 6397c478bd9Sstevel@tonic-gate LDAPMessage *msg); 6407c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_count_messages(LDAP *ld, LDAPMessage *res); 6417c478bd9Sstevel@tonic-gate LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_reference(LDAP *ld, 6427c478bd9Sstevel@tonic-gate LDAPMessage *res); 6437c478bd9Sstevel@tonic-gate LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_reference(LDAP *ld, 6447c478bd9Sstevel@tonic-gate LDAPMessage *ref); 6457c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_count_references(LDAP *ld, LDAPMessage *res); 6467c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_parse_reference(LDAP *ld, LDAPMessage *ref, 6477c478bd9Sstevel@tonic-gate char ***referralsp, LDAPControl ***serverctrlsp, int freeit); 6487c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_get_entry_controls(LDAP *ld, LDAPMessage *entry, 6497c478bd9Sstevel@tonic-gate LDAPControl ***serverctrlsp); 6507c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_control_free(LDAPControl *ctrl); 6517c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_controls_free(LDAPControl **ctrls); 6527c478bd9Sstevel@tonic-gate 6537c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 6547c478bd9Sstevel@tonic-gate char ** ldap_get_reference_urls(LDAP *ld, LDAPMessage *res); 6557c478bd9Sstevel@tonic-gate #endif 6567c478bd9Sstevel@tonic-gate 657*80ac04ddSGordon Ross LDAP_API(void) LDAP_CALL ldap_add_result_entry( 658*80ac04ddSGordon Ross LDAPMessage **list, LDAPMessage *e); 659*80ac04ddSGordon Ross LDAP_API(LDAPMessage *) LDAP_CALL ldap_delete_result_entry( 660*80ac04ddSGordon Ross LDAPMessage **list, LDAPMessage *e); 661*80ac04ddSGordon Ross 6627c478bd9Sstevel@tonic-gate 6637c478bd9Sstevel@tonic-gate /* End of core standard C LDAP API definitions */ 6647c478bd9Sstevel@tonic-gate 6657c478bd9Sstevel@tonic-gate /* 6667c478bd9Sstevel@tonic-gate * Server side sorting of search results (an LDAPv3 extension -- 6677c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_SERVER_SIDE_SORT) 6687c478bd9Sstevel@tonic-gate */ 6697c478bd9Sstevel@tonic-gate typedef struct LDAPsortkey { /* structure for a sort-key */ 6707c478bd9Sstevel@tonic-gate char *sk_attrtype; 6717c478bd9Sstevel@tonic-gate char *sk_matchruleoid; 6727c478bd9Sstevel@tonic-gate int sk_reverseorder; 6737c478bd9Sstevel@tonic-gate } LDAPsortkey; 6747c478bd9Sstevel@tonic-gate 6757c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_create_sort_control(LDAP *ld, 6767c478bd9Sstevel@tonic-gate LDAPsortkey **sortKeyList, const char ctl_iscritical, 6777c478bd9Sstevel@tonic-gate LDAPControl **ctrlp); 6787c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_parse_sort_control(LDAP *ld, 6797c478bd9Sstevel@tonic-gate LDAPControl **ctrls, unsigned long *result, char **attribute); 6807c478bd9Sstevel@tonic-gate 6817c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_free_sort_keylist(LDAPsortkey **sortKeyList); 6827c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_create_sort_keylist(LDAPsortkey ***sortKeyList, 6837c478bd9Sstevel@tonic-gate const char *string_rep); 6847c478bd9Sstevel@tonic-gate 6857c478bd9Sstevel@tonic-gate 6867c478bd9Sstevel@tonic-gate /* 6877c478bd9Sstevel@tonic-gate * Virtual list view (an LDAPv3 extension -- LDAP_API_FEATURE_VIRTUAL_LIST_VIEW) 6887c478bd9Sstevel@tonic-gate */ 6897c478bd9Sstevel@tonic-gate /* 6907c478bd9Sstevel@tonic-gate * structure that describes a VirtualListViewRequest control. 6917c478bd9Sstevel@tonic-gate * note that ldvlist_index and ldvlist_size are only relevant to 6927c478bd9Sstevel@tonic-gate * ldap_create_virtuallist_control() if ldvlist_attrvalue is NULL. 6937c478bd9Sstevel@tonic-gate */ 6947c478bd9Sstevel@tonic-gate typedef struct ldapvirtuallist { 6957c478bd9Sstevel@tonic-gate unsigned long ldvlist_before_count; /* # entries before target */ 6967c478bd9Sstevel@tonic-gate unsigned long ldvlist_after_count; /* # entries after target */ 6977c478bd9Sstevel@tonic-gate char *ldvlist_attrvalue; /* jump to this value */ 6987c478bd9Sstevel@tonic-gate unsigned long ldvlist_index; /* list offset */ 6997c478bd9Sstevel@tonic-gate unsigned long ldvlist_size; /* number of items in vlist */ 7007c478bd9Sstevel@tonic-gate void *ldvlist_extradata; /* for use by application */ 7017c478bd9Sstevel@tonic-gate } LDAPVirtualList; 7027c478bd9Sstevel@tonic-gate 7037c478bd9Sstevel@tonic-gate /* 7047c478bd9Sstevel@tonic-gate * VLV functions: 7057c478bd9Sstevel@tonic-gate */ 7067c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_create_virtuallist_control(LDAP *ld, 7077c478bd9Sstevel@tonic-gate LDAPVirtualList *ldvlistp, LDAPControl **ctrlp); 7087c478bd9Sstevel@tonic-gate 7097c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_parse_virtuallist_control(LDAP *ld, 7107c478bd9Sstevel@tonic-gate LDAPControl **ctrls, unsigned long *target_posp, 7117c478bd9Sstevel@tonic-gate unsigned long *list_sizep, int *errcodep); 7127c478bd9Sstevel@tonic-gate 7137c478bd9Sstevel@tonic-gate 7147c478bd9Sstevel@tonic-gate /* 7157c478bd9Sstevel@tonic-gate * Routines for creating persistent search controls and for handling 7167c478bd9Sstevel@tonic-gate * "entry changed notification" controls (an LDAPv3 extension -- 7177c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_PERSISTENT_SEARCH) 7187c478bd9Sstevel@tonic-gate */ 7197c478bd9Sstevel@tonic-gate #define LDAP_CHANGETYPE_ADD 1 7207c478bd9Sstevel@tonic-gate #define LDAP_CHANGETYPE_DELETE 2 7217c478bd9Sstevel@tonic-gate #define LDAP_CHANGETYPE_MODIFY 4 7227c478bd9Sstevel@tonic-gate #define LDAP_CHANGETYPE_MODDN 8 7237c478bd9Sstevel@tonic-gate #define LDAP_CHANGETYPE_ANY (1|2|4|8) 7247c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_create_persistentsearch_control(LDAP *ld, 7257c478bd9Sstevel@tonic-gate int changetypes, int changesonly, int return_echg_ctls, 7267c478bd9Sstevel@tonic-gate char ctl_iscritical, LDAPControl **ctrlp); 7277c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_parse_entrychange_control(LDAP *ld, 7287c478bd9Sstevel@tonic-gate LDAPControl **ctrls, int *chgtypep, char **prevdnp, 7297c478bd9Sstevel@tonic-gate int *chgnumpresentp, ber_int_t *chgnump); 7307c478bd9Sstevel@tonic-gate 7317c478bd9Sstevel@tonic-gate 7327c478bd9Sstevel@tonic-gate /* 7337c478bd9Sstevel@tonic-gate * Routines for creating Proxied Authorization controls (an LDAPv3 7347c478bd9Sstevel@tonic-gate * extension -- LDAP_API_FEATURE_PROXY_AUTHORIZATION) 7357c478bd9Sstevel@tonic-gate * ldap_create_proxyauth_control() is for the old (version 1) control. 7367c478bd9Sstevel@tonic-gate * ldap_create_proxiedauth_control() is for the newer (version 2) control. 7377c478bd9Sstevel@tonic-gate * Version 1 is supported by iPlanet Directory Server 4.1 and later. 7387c478bd9Sstevel@tonic-gate * Version 2 is supported by iPlanet Directory Server 5.0 and later. 7397c478bd9Sstevel@tonic-gate */ 7407c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_create_proxyauth_control(LDAP *ld, 7417c478bd9Sstevel@tonic-gate const char *dn, const char ctl_iscritical, LDAPControl **ctrlp); 7427c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_create_proxiedauth_control(LDAP *ld, 7437c478bd9Sstevel@tonic-gate const char *authzid, LDAPControl **ctrlp); 7447c478bd9Sstevel@tonic-gate 7457c478bd9Sstevel@tonic-gate 7467c478bd9Sstevel@tonic-gate /* 7477c478bd9Sstevel@tonic-gate * Functions to get and set LDAP error information (API extension -- 7487c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_LDERRNO ) 7497c478bd9Sstevel@tonic-gate */ 7507c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_get_lderrno(LDAP *ld, char **m, char **s); 7517c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_set_lderrno(LDAP *ld, int e, char *m, char *s); 7527c478bd9Sstevel@tonic-gate 7537c478bd9Sstevel@tonic-gate 7547c478bd9Sstevel@tonic-gate /* 7557c478bd9Sstevel@tonic-gate * LDAP URL functions and definitions (an API extension -- 7567c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_URL_FUNCTIONS) 7577c478bd9Sstevel@tonic-gate */ 7587c478bd9Sstevel@tonic-gate /* 7597c478bd9Sstevel@tonic-gate * types for ldap URL handling 7607c478bd9Sstevel@tonic-gate */ 7617c478bd9Sstevel@tonic-gate typedef struct ldap_url_desc { 7627c478bd9Sstevel@tonic-gate char *lud_host; 7637c478bd9Sstevel@tonic-gate int lud_port; 7647c478bd9Sstevel@tonic-gate char *lud_dn; 7657c478bd9Sstevel@tonic-gate char **lud_attrs; 7667c478bd9Sstevel@tonic-gate int lud_scope; 7677c478bd9Sstevel@tonic-gate char *lud_filter; 7687c478bd9Sstevel@tonic-gate unsigned long lud_options; 7697c478bd9Sstevel@tonic-gate #define LDAP_URL_OPT_SECURE 0x01 7707c478bd9Sstevel@tonic-gate char *lud_string; /* for internal use only */ 7717c478bd9Sstevel@tonic-gate } LDAPURLDesc; 7727c478bd9Sstevel@tonic-gate 7737c478bd9Sstevel@tonic-gate #define NULLLDAPURLDESC ((LDAPURLDesc *)NULL) 7747c478bd9Sstevel@tonic-gate 7757c478bd9Sstevel@tonic-gate /* 7767c478bd9Sstevel@tonic-gate * possible errors returned by ldap_url_parse() 7777c478bd9Sstevel@tonic-gate */ 7787c478bd9Sstevel@tonic-gate #define LDAP_URL_ERR_NOTLDAP 1 /* URL doesn't begin with "ldap://" */ 7797c478bd9Sstevel@tonic-gate #define LDAP_URL_ERR_NODN 2 /* URL has no DN (required) */ 7807c478bd9Sstevel@tonic-gate #define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */ 7817c478bd9Sstevel@tonic-gate #define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */ 7827c478bd9Sstevel@tonic-gate #define LDAP_URL_ERR_PARAM 5 /* bad parameter to an URL function */ 7837c478bd9Sstevel@tonic-gate #define LDAP_URL_ERR_HOSTPORT 6 /* URL hostcode is invalid */ 7847c478bd9Sstevel@tonic-gate 7857c478bd9Sstevel@tonic-gate /* 7867c478bd9Sstevel@tonic-gate * URL functions: 7877c478bd9Sstevel@tonic-gate */ 7887c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_is_ldap_url(const char *url); 7897c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_url_parse(const char *url, LDAPURLDesc **ludpp); 7907c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_url_parse_nodn(const char *url, LDAPURLDesc **ludpp); 7917c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_free_urldesc(LDAPURLDesc *ludp); 7927c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_url_search(LDAP *ld, const char *url, 7937c478bd9Sstevel@tonic-gate int attrsonly); 7947c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_url_search_s(LDAP *ld, const char *url, 7957c478bd9Sstevel@tonic-gate int attrsonly, LDAPMessage **res); 7967c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_url_search_st(LDAP *ld, const char *url, 7977c478bd9Sstevel@tonic-gate int attrsonly, struct timeval *timeout, LDAPMessage **res); 7987c478bd9Sstevel@tonic-gate 7997c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 8007c478bd9Sstevel@tonic-gate /* 8017c478bd9Sstevel@tonic-gate * Additional URL functions plus Character set, Search Preference 8027c478bd9Sstevel@tonic-gate * and Display Template functions moved from internal header files 8037c478bd9Sstevel@tonic-gate */ 8047c478bd9Sstevel@tonic-gate 8057c478bd9Sstevel@tonic-gate /* 8067c478bd9Sstevel@tonic-gate * URL functions 8077c478bd9Sstevel@tonic-gate */ 8087c478bd9Sstevel@tonic-gate char *ldap_dns_to_url(LDAP *ld, char *dns_name, char *attrs, 8097c478bd9Sstevel@tonic-gate char *scope, char *filter); 8107c478bd9Sstevel@tonic-gate char *ldap_dn_to_url(LDAP *ld, char *dn, int nameparts); 8117c478bd9Sstevel@tonic-gate 8127c478bd9Sstevel@tonic-gate /* 8137c478bd9Sstevel@tonic-gate * Character set functions 8147c478bd9Sstevel@tonic-gate */ 8157c478bd9Sstevel@tonic-gate #ifdef STR_TRANSLATION 8167c478bd9Sstevel@tonic-gate void ldap_set_string_translators(LDAP *ld, 8177c478bd9Sstevel@tonic-gate BERTranslateProc encode_proc, BERTranslateProc decode_proc); 8187c478bd9Sstevel@tonic-gate int ldap_translate_from_t61(LDAP *ld, char **bufp, 8197c478bd9Sstevel@tonic-gate unsigned long *lenp, int free_input); 8207c478bd9Sstevel@tonic-gate int ldap_translate_to_t61(LDAP *ld, char **bufp, 8217c478bd9Sstevel@tonic-gate unsigned long *lenp, int free_input); 8227c478bd9Sstevel@tonic-gate void ldap_enable_translation(LDAP *ld, LDAPMessage *entry, 8237c478bd9Sstevel@tonic-gate int enable); 8247c478bd9Sstevel@tonic-gate #ifdef LDAP_CHARSET_8859 8257c478bd9Sstevel@tonic-gate int ldap_t61_to_8859(char **bufp, unsigned long *buflenp, 8267c478bd9Sstevel@tonic-gate int free_input); 8277c478bd9Sstevel@tonic-gate int ldap_8859_to_t61(char **bufp, unsigned long *buflenp, 8287c478bd9Sstevel@tonic-gate int free_input); 8297c478bd9Sstevel@tonic-gate #endif /* LDAP_CHARSET_8859 */ 8307c478bd9Sstevel@tonic-gate #endif /* STR_TRANSLATION */ 8317c478bd9Sstevel@tonic-gate 8327c478bd9Sstevel@tonic-gate /* 8337c478bd9Sstevel@tonic-gate * Display Temple functions/structures 8347c478bd9Sstevel@tonic-gate */ 8357c478bd9Sstevel@tonic-gate /* 8367c478bd9Sstevel@tonic-gate * display template item structure 8377c478bd9Sstevel@tonic-gate */ 8387c478bd9Sstevel@tonic-gate struct ldap_tmplitem { 8397c478bd9Sstevel@tonic-gate unsigned long ti_syntaxid; 8407c478bd9Sstevel@tonic-gate unsigned long ti_options; 8417c478bd9Sstevel@tonic-gate char *ti_attrname; 8427c478bd9Sstevel@tonic-gate char *ti_label; 8437c478bd9Sstevel@tonic-gate char **ti_args; 8447c478bd9Sstevel@tonic-gate struct ldap_tmplitem *ti_next_in_row; 8457c478bd9Sstevel@tonic-gate struct ldap_tmplitem *ti_next_in_col; 8467c478bd9Sstevel@tonic-gate void *ti_appdata; 8477c478bd9Sstevel@tonic-gate }; 8487c478bd9Sstevel@tonic-gate 8497c478bd9Sstevel@tonic-gate #define NULLTMPLITEM ((struct ldap_tmplitem *)0) 8507c478bd9Sstevel@tonic-gate 8517c478bd9Sstevel@tonic-gate #define LDAP_SET_TMPLITEM_APPDATA(ti, datap) \ 8527c478bd9Sstevel@tonic-gate (ti)->ti_appdata = (void *)(datap) 8537c478bd9Sstevel@tonic-gate 8547c478bd9Sstevel@tonic-gate #define LDAP_GET_TMPLITEM_APPDATA(ti, type) \ 8557c478bd9Sstevel@tonic-gate (type)((ti)->ti_appdata) 8567c478bd9Sstevel@tonic-gate 8577c478bd9Sstevel@tonic-gate #define LDAP_IS_TMPLITEM_OPTION_SET(ti, option) \ 8587c478bd9Sstevel@tonic-gate (((ti)->ti_options & option) != 0) 8597c478bd9Sstevel@tonic-gate 8607c478bd9Sstevel@tonic-gate /* 8617c478bd9Sstevel@tonic-gate * object class array structure 8627c478bd9Sstevel@tonic-gate */ 8637c478bd9Sstevel@tonic-gate struct ldap_oclist { 8647c478bd9Sstevel@tonic-gate char **oc_objclasses; 8657c478bd9Sstevel@tonic-gate struct ldap_oclist *oc_next; 8667c478bd9Sstevel@tonic-gate }; 8677c478bd9Sstevel@tonic-gate 8687c478bd9Sstevel@tonic-gate #define NULLOCLIST ((struct ldap_oclist *)0) 8697c478bd9Sstevel@tonic-gate 8707c478bd9Sstevel@tonic-gate 8717c478bd9Sstevel@tonic-gate /* 8727c478bd9Sstevel@tonic-gate * add defaults list 8737c478bd9Sstevel@tonic-gate */ 8747c478bd9Sstevel@tonic-gate struct ldap_adddeflist { 8757c478bd9Sstevel@tonic-gate int ad_source; 8767c478bd9Sstevel@tonic-gate #define LDAP_ADSRC_CONSTANTVALUE 1 8777c478bd9Sstevel@tonic-gate #define LDAP_ADSRC_ADDERSDN 2 8787c478bd9Sstevel@tonic-gate char *ad_attrname; 8797c478bd9Sstevel@tonic-gate char *ad_value; 8807c478bd9Sstevel@tonic-gate struct ldap_adddeflist *ad_next; 8817c478bd9Sstevel@tonic-gate }; 8827c478bd9Sstevel@tonic-gate 8837c478bd9Sstevel@tonic-gate #define NULLADLIST ((struct ldap_adddeflist *)0) 8847c478bd9Sstevel@tonic-gate 8857c478bd9Sstevel@tonic-gate 8867c478bd9Sstevel@tonic-gate /* 8877c478bd9Sstevel@tonic-gate * display template global options 8887c478bd9Sstevel@tonic-gate * if this bit is set in dt_options, it applies. 8897c478bd9Sstevel@tonic-gate */ 8907c478bd9Sstevel@tonic-gate /* 8917c478bd9Sstevel@tonic-gate * users should be allowed to try to add objects of these entries 8927c478bd9Sstevel@tonic-gate */ 8937c478bd9Sstevel@tonic-gate #define LDAP_DTMPL_OPT_ADDABLE 0x00000001L 8947c478bd9Sstevel@tonic-gate 8957c478bd9Sstevel@tonic-gate /* 8967c478bd9Sstevel@tonic-gate * users should be allowed to do "modify RDN" operation of these entries 8977c478bd9Sstevel@tonic-gate */ 8987c478bd9Sstevel@tonic-gate #define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L 8997c478bd9Sstevel@tonic-gate 9007c478bd9Sstevel@tonic-gate /* 9017c478bd9Sstevel@tonic-gate * this template is an alternate view, not a primary view 9027c478bd9Sstevel@tonic-gate */ 9037c478bd9Sstevel@tonic-gate #define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L 9047c478bd9Sstevel@tonic-gate 9057c478bd9Sstevel@tonic-gate 9067c478bd9Sstevel@tonic-gate /* 9077c478bd9Sstevel@tonic-gate * display template structure 9087c478bd9Sstevel@tonic-gate */ 9097c478bd9Sstevel@tonic-gate struct ldap_disptmpl { 9107c478bd9Sstevel@tonic-gate char *dt_name; 9117c478bd9Sstevel@tonic-gate char *dt_pluralname; 9127c478bd9Sstevel@tonic-gate char *dt_iconname; 9137c478bd9Sstevel@tonic-gate unsigned long dt_options; 9147c478bd9Sstevel@tonic-gate char *dt_authattrname; 9157c478bd9Sstevel@tonic-gate char *dt_defrdnattrname; 9167c478bd9Sstevel@tonic-gate char *dt_defaddlocation; 9177c478bd9Sstevel@tonic-gate struct ldap_oclist *dt_oclist; 9187c478bd9Sstevel@tonic-gate struct ldap_adddeflist *dt_adddeflist; 9197c478bd9Sstevel@tonic-gate struct ldap_tmplitem *dt_items; 9207c478bd9Sstevel@tonic-gate void *dt_appdata; 9217c478bd9Sstevel@tonic-gate struct ldap_disptmpl *dt_next; 9227c478bd9Sstevel@tonic-gate }; 9237c478bd9Sstevel@tonic-gate 9247c478bd9Sstevel@tonic-gate #define NULLDISPTMPL ((struct ldap_disptmpl *)0) 9257c478bd9Sstevel@tonic-gate 9267c478bd9Sstevel@tonic-gate #define LDAP_SET_DISPTMPL_APPDATA(dt, datap) \ 9277c478bd9Sstevel@tonic-gate (dt)->dt_appdata = (void *)(datap) 9287c478bd9Sstevel@tonic-gate 9297c478bd9Sstevel@tonic-gate #define LDAP_GET_DISPTMPL_APPDATA(dt, type) \ 9307c478bd9Sstevel@tonic-gate (type)((dt)->dt_appdata) 9317c478bd9Sstevel@tonic-gate 9327c478bd9Sstevel@tonic-gate #define LDAP_IS_DISPTMPL_OPTION_SET(dt, option) \ 9337c478bd9Sstevel@tonic-gate (((dt)->dt_options & option) != 0) 9347c478bd9Sstevel@tonic-gate 9357c478bd9Sstevel@tonic-gate #define LDAP_TMPL_ERR_VERSION 1 9367c478bd9Sstevel@tonic-gate #define LDAP_TMPL_ERR_MEM 2 9377c478bd9Sstevel@tonic-gate #define LDAP_TMPL_ERR_SYNTAX 3 9387c478bd9Sstevel@tonic-gate #define LDAP_TMPL_ERR_FILE 4 9397c478bd9Sstevel@tonic-gate 9407c478bd9Sstevel@tonic-gate /* 9417c478bd9Sstevel@tonic-gate * buffer size needed for entry2text and vals2text 9427c478bd9Sstevel@tonic-gate */ 9437c478bd9Sstevel@tonic-gate #define LDAP_DTMPL_BUFSIZ 8192 9447c478bd9Sstevel@tonic-gate 9457c478bd9Sstevel@tonic-gate typedef int (*writeptype)(void *writeparm, char *p, int len); 9467c478bd9Sstevel@tonic-gate 9477c478bd9Sstevel@tonic-gate LDAP_API(int) 9487c478bd9Sstevel@tonic-gate LDAP_CALL 9497c478bd9Sstevel@tonic-gate ldap_init_templates(char *file, struct ldap_disptmpl **tmpllistp); 9507c478bd9Sstevel@tonic-gate 9517c478bd9Sstevel@tonic-gate LDAP_API(int) 9527c478bd9Sstevel@tonic-gate LDAP_CALL 9537c478bd9Sstevel@tonic-gate ldap_init_templates_buf(char *buf, long buflen, 9547c478bd9Sstevel@tonic-gate struct ldap_disptmpl **tmpllistp); 9557c478bd9Sstevel@tonic-gate 9567c478bd9Sstevel@tonic-gate LDAP_API(void) 9577c478bd9Sstevel@tonic-gate LDAP_CALL 9587c478bd9Sstevel@tonic-gate ldap_free_templates(struct ldap_disptmpl *tmpllist); 9597c478bd9Sstevel@tonic-gate 9607c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_disptmpl *) 9617c478bd9Sstevel@tonic-gate LDAP_CALL 9627c478bd9Sstevel@tonic-gate ldap_first_disptmpl(struct ldap_disptmpl *tmpllist); 9637c478bd9Sstevel@tonic-gate 9647c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_disptmpl *) 9657c478bd9Sstevel@tonic-gate LDAP_CALL 9667c478bd9Sstevel@tonic-gate ldap_next_disptmpl(struct ldap_disptmpl *tmpllist, 9677c478bd9Sstevel@tonic-gate struct ldap_disptmpl *tmpl); 9687c478bd9Sstevel@tonic-gate 9697c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_disptmpl *) 9707c478bd9Sstevel@tonic-gate LDAP_CALL 9717c478bd9Sstevel@tonic-gate ldap_name2template(char *name, struct ldap_disptmpl *tmpllist); 9727c478bd9Sstevel@tonic-gate 9737c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_disptmpl *) 9747c478bd9Sstevel@tonic-gate LDAP_CALL 9757c478bd9Sstevel@tonic-gate ldap_oc2template(char **oclist, struct ldap_disptmpl *tmpllist); 9767c478bd9Sstevel@tonic-gate 9777c478bd9Sstevel@tonic-gate LDAP_API(char **) 9787c478bd9Sstevel@tonic-gate LDAP_CALL 9797c478bd9Sstevel@tonic-gate ldap_tmplattrs(struct ldap_disptmpl *tmpl, char **includeattrs, int exclude, 9807c478bd9Sstevel@tonic-gate unsigned long syntaxmask); 9817c478bd9Sstevel@tonic-gate 9827c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_tmplitem *) 9837c478bd9Sstevel@tonic-gate LDAP_CALL 9847c478bd9Sstevel@tonic-gate ldap_first_tmplrow(struct ldap_disptmpl *tmpl); 9857c478bd9Sstevel@tonic-gate 9867c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_tmplitem *) 9877c478bd9Sstevel@tonic-gate LDAP_CALL 9887c478bd9Sstevel@tonic-gate ldap_next_tmplrow(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row); 9897c478bd9Sstevel@tonic-gate 9907c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_tmplitem *) 9917c478bd9Sstevel@tonic-gate LDAP_CALL 9927c478bd9Sstevel@tonic-gate ldap_first_tmplcol(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row); 9937c478bd9Sstevel@tonic-gate 9947c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_tmplitem *) 9957c478bd9Sstevel@tonic-gate LDAP_CALL 9967c478bd9Sstevel@tonic-gate ldap_next_tmplcol(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, 9977c478bd9Sstevel@tonic-gate struct ldap_tmplitem *col); 9987c478bd9Sstevel@tonic-gate 9997c478bd9Sstevel@tonic-gate LDAP_API(int) 10007c478bd9Sstevel@tonic-gate LDAP_CALL 10017c478bd9Sstevel@tonic-gate ldap_entry2text(LDAP *ld, char *buf, LDAPMessage *entry, 10027c478bd9Sstevel@tonic-gate struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, 10037c478bd9Sstevel@tonic-gate writeptype writeproc, void *writeparm, char *eol, int rdncount, 10047c478bd9Sstevel@tonic-gate unsigned long opts); 10057c478bd9Sstevel@tonic-gate 10067c478bd9Sstevel@tonic-gate LDAP_API(int) 10077c478bd9Sstevel@tonic-gate LDAP_CALL 10087c478bd9Sstevel@tonic-gate ldap_vals2text(LDAP *ld, char *buf, char **vals, char *label, int labelwidth, 10097c478bd9Sstevel@tonic-gate unsigned long syntaxid, writeptype writeproc, void *writeparm, 10107c478bd9Sstevel@tonic-gate char *eol, int rdncount); 10117c478bd9Sstevel@tonic-gate 10127c478bd9Sstevel@tonic-gate LDAP_API(int) 10137c478bd9Sstevel@tonic-gate LDAP_CALL 10147c478bd9Sstevel@tonic-gate ldap_entry2text_search(LDAP *ld, char *dn, char *base, LDAPMessage *entry, 10157c478bd9Sstevel@tonic-gate struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, 10167c478bd9Sstevel@tonic-gate writeptype writeproc, void *writeparm, char *eol, int rdncount, 10177c478bd9Sstevel@tonic-gate unsigned long opts); 10187c478bd9Sstevel@tonic-gate 10197c478bd9Sstevel@tonic-gate LDAP_API(int) 10207c478bd9Sstevel@tonic-gate LDAP_CALL 10217c478bd9Sstevel@tonic-gate ldap_entry2html(LDAP *ld, char *buf, LDAPMessage *entry, 10227c478bd9Sstevel@tonic-gate struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, 10237c478bd9Sstevel@tonic-gate writeptype writeproc, void *writeparm, char *eol, int rdncount, 10247c478bd9Sstevel@tonic-gate unsigned long opts, char *urlprefix, char *base); 10257c478bd9Sstevel@tonic-gate 10267c478bd9Sstevel@tonic-gate LDAP_API(int) 10277c478bd9Sstevel@tonic-gate LDAP_CALL 10287c478bd9Sstevel@tonic-gate ldap_vals2html(LDAP *ld, char *buf, char **vals, char *label, int labelwidth, 10297c478bd9Sstevel@tonic-gate unsigned long syntaxid, writeptype writeproc, void *writeparm, 10307c478bd9Sstevel@tonic-gate char *eol, int rdncount, char *urlprefix); 10317c478bd9Sstevel@tonic-gate 10327c478bd9Sstevel@tonic-gate LDAP_API(int) 10337c478bd9Sstevel@tonic-gate LDAP_CALL 10347c478bd9Sstevel@tonic-gate ldap_entry2html_search(LDAP *ld, char *dn, char *base, LDAPMessage *entry, 10357c478bd9Sstevel@tonic-gate struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, 10367c478bd9Sstevel@tonic-gate writeptype writeproc, void *writeparm, char *eol, int rdncount, 10377c478bd9Sstevel@tonic-gate unsigned long opts, char *urlprefix); 10387c478bd9Sstevel@tonic-gate 10397c478bd9Sstevel@tonic-gate /* 10407c478bd9Sstevel@tonic-gate * Search Preference Definitions 10417c478bd9Sstevel@tonic-gate */ 10427c478bd9Sstevel@tonic-gate 10437c478bd9Sstevel@tonic-gate struct ldap_searchattr { 10447c478bd9Sstevel@tonic-gate char *sa_attrlabel; 10457c478bd9Sstevel@tonic-gate char *sa_attr; 10467c478bd9Sstevel@tonic-gate /* max 32 matchtypes for now */ 10477c478bd9Sstevel@tonic-gate unsigned long sa_matchtypebitmap; 10487c478bd9Sstevel@tonic-gate char *sa_selectattr; 10497c478bd9Sstevel@tonic-gate char *sa_selecttext; 10507c478bd9Sstevel@tonic-gate struct ldap_searchattr *sa_next; 10517c478bd9Sstevel@tonic-gate }; 10527c478bd9Sstevel@tonic-gate 10537c478bd9Sstevel@tonic-gate struct ldap_searchmatch { 10547c478bd9Sstevel@tonic-gate char *sm_matchprompt; 10557c478bd9Sstevel@tonic-gate char *sm_filter; 10567c478bd9Sstevel@tonic-gate struct ldap_searchmatch *sm_next; 10577c478bd9Sstevel@tonic-gate }; 10587c478bd9Sstevel@tonic-gate 10597c478bd9Sstevel@tonic-gate struct ldap_searchobj { 10607c478bd9Sstevel@tonic-gate char *so_objtypeprompt; 10617c478bd9Sstevel@tonic-gate unsigned long so_options; 10627c478bd9Sstevel@tonic-gate char *so_prompt; 10637c478bd9Sstevel@tonic-gate short so_defaultscope; 10647c478bd9Sstevel@tonic-gate char *so_filterprefix; 10657c478bd9Sstevel@tonic-gate char *so_filtertag; 10667c478bd9Sstevel@tonic-gate char *so_defaultselectattr; 10677c478bd9Sstevel@tonic-gate char *so_defaultselecttext; 10687c478bd9Sstevel@tonic-gate struct ldap_searchattr *so_salist; 10697c478bd9Sstevel@tonic-gate struct ldap_searchmatch *so_smlist; 10707c478bd9Sstevel@tonic-gate struct ldap_searchobj *so_next; 10717c478bd9Sstevel@tonic-gate }; 10727c478bd9Sstevel@tonic-gate 10737c478bd9Sstevel@tonic-gate #define NULLSEARCHOBJ ((struct ldap_searchobj *)0) 10747c478bd9Sstevel@tonic-gate 10757c478bd9Sstevel@tonic-gate /* 10767c478bd9Sstevel@tonic-gate * global search object options 10777c478bd9Sstevel@tonic-gate */ 10787c478bd9Sstevel@tonic-gate #define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001 10797c478bd9Sstevel@tonic-gate 10807c478bd9Sstevel@tonic-gate #define LDAP_IS_SEARCHOBJ_OPTION_SET(so, option) \ 10817c478bd9Sstevel@tonic-gate (((so)->so_options & option) != 0) 10827c478bd9Sstevel@tonic-gate 10837c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_VERSION_ZERO 0 10847c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_VERSION 1 10857c478bd9Sstevel@tonic-gate 10867c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_VERSION 1 10877c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_MEM 2 10887c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_SYNTAX 3 10897c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_FILE 4 10907c478bd9Sstevel@tonic-gate 10917c478bd9Sstevel@tonic-gate LDAP_API(int) 10927c478bd9Sstevel@tonic-gate LDAP_CALL 10937c478bd9Sstevel@tonic-gate ldap_init_searchprefs(char *file, struct ldap_searchobj **solistp); 10947c478bd9Sstevel@tonic-gate 10957c478bd9Sstevel@tonic-gate LDAP_API(int) 10967c478bd9Sstevel@tonic-gate LDAP_CALL 10977c478bd9Sstevel@tonic-gate ldap_init_searchprefs_buf(char *buf, long buflen, 10987c478bd9Sstevel@tonic-gate struct ldap_searchobj **solistp); 10997c478bd9Sstevel@tonic-gate 11007c478bd9Sstevel@tonic-gate LDAP_API(void) 11017c478bd9Sstevel@tonic-gate LDAP_CALL 11027c478bd9Sstevel@tonic-gate ldap_free_searchprefs(struct ldap_searchobj *solist); 11037c478bd9Sstevel@tonic-gate 11047c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_searchobj *) 11057c478bd9Sstevel@tonic-gate LDAP_CALL 11067c478bd9Sstevel@tonic-gate ldap_first_searchobj(struct ldap_searchobj *solist); 11077c478bd9Sstevel@tonic-gate 11087c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_searchobj *) 11097c478bd9Sstevel@tonic-gate LDAP_CALL 11107c478bd9Sstevel@tonic-gate ldap_next_searchobj(struct ldap_searchobj *sollist, 11117c478bd9Sstevel@tonic-gate struct ldap_searchobj *so); 11127c478bd9Sstevel@tonic-gate 11137c478bd9Sstevel@tonic-gate /* 11147c478bd9Sstevel@tonic-gate * specific LDAP instantiations of BER types we know about 11157c478bd9Sstevel@tonic-gate */ 11167c478bd9Sstevel@tonic-gate 11177c478bd9Sstevel@tonic-gate /* general stuff */ 11187c478bd9Sstevel@tonic-gate #define LDAP_TAG_MESSAGE 0x30 /* tag is 16 + constructed bit */ 11197c478bd9Sstevel@tonic-gate #define LDAP_TAG_MSGID 0x02 /* INTEGER */ 11207c478bd9Sstevel@tonic-gate #define LDAP_TAG_CONTROLS 0xa0 /* context specific + constructed + 0 */ 11217c478bd9Sstevel@tonic-gate #define LDAP_TAG_REFERRAL 0xa3 /* context specific + constructed + 3 */ 11227c478bd9Sstevel@tonic-gate #define LDAP_TAG_NEWSUPERIOR 0x80 /* context specific + primitive + 0 */ 11237c478bd9Sstevel@tonic-gate #define LDAP_TAG_SASL_RES_CREDS 0x87 /* context specific + primitive + 7 */ 11247c478bd9Sstevel@tonic-gate #define LDAP_TAG_VLV_BY_INDEX 0xa0 /* context specific + constructed + 0 */ 11257c478bd9Sstevel@tonic-gate #define LDAP_TAG_VLV_BY_VALUE 0x81 /* context specific + primitive + 1 */ 11267c478bd9Sstevel@tonic-gate /* tag for sort control */ 11277c478bd9Sstevel@tonic-gate #define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive + 0 */ 11287c478bd9Sstevel@tonic-gate #define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive + 1 */ 11297c478bd9Sstevel@tonic-gate #define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive + 0 */ 11307c478bd9Sstevel@tonic-gate 11317c478bd9Sstevel@tonic-gate /* possible operations a client can invoke */ 11327c478bd9Sstevel@tonic-gate #define LDAP_REQ_BIND 0x60 /* application + constructed + 0 */ 11337c478bd9Sstevel@tonic-gate #define LDAP_REQ_UNBIND 0x42 /* application + primitive + 2 */ 11347c478bd9Sstevel@tonic-gate #define LDAP_REQ_SEARCH 0x63 /* application + constructed + 3 */ 11357c478bd9Sstevel@tonic-gate #define LDAP_REQ_MODIFY 0x66 /* application + constructed + 6 */ 11367c478bd9Sstevel@tonic-gate #define LDAP_REQ_ADD 0x68 /* application + constructed + 8 */ 11377c478bd9Sstevel@tonic-gate #define LDAP_REQ_DELETE 0x4a /* application + primitive + 10 */ 11387c478bd9Sstevel@tonic-gate #define LDAP_REQ_MODRDN 0x6c /* application + constructed + 12 */ 11397c478bd9Sstevel@tonic-gate #define LDAP_REQ_MODDN 0x6c /* application + constructed + 12 */ 11407c478bd9Sstevel@tonic-gate #define LDAP_REQ_RENAME 0x6c /* application + constructed + 12 */ 11417c478bd9Sstevel@tonic-gate #define LDAP_REQ_COMPARE 0x6e /* application + constructed + 14 */ 11427c478bd9Sstevel@tonic-gate #define LDAP_REQ_ABANDON 0x50 /* application + primitive + 16 */ 11437c478bd9Sstevel@tonic-gate #define LDAP_REQ_EXTENDED 0x77 /* application + constructed + 23 */ 11447c478bd9Sstevel@tonic-gate 11457c478bd9Sstevel@tonic-gate /* U-M LDAP release 3.0 compatibility stuff */ 11467c478bd9Sstevel@tonic-gate #define LDAP_REQ_UNBIND_30 0x62 11477c478bd9Sstevel@tonic-gate #define LDAP_REQ_DELETE_30 0x6a 11487c478bd9Sstevel@tonic-gate #define LDAP_REQ_ABANDON_30 0x70 11497c478bd9Sstevel@tonic-gate 11507c478bd9Sstevel@tonic-gate /* U-M LDAP 3.0 compatibility auth methods */ 11517c478bd9Sstevel@tonic-gate #define LDAP_AUTH_SIMPLE_30 0xa0 /* context specific + constructed */ 11527c478bd9Sstevel@tonic-gate #define LDAP_AUTH_KRBV41_30 0xa1 /* context specific + constructed */ 11537c478bd9Sstevel@tonic-gate #define LDAP_AUTH_KRBV42_30 0xa2 /* context specific + constructed */ 11547c478bd9Sstevel@tonic-gate 11557c478bd9Sstevel@tonic-gate /* filter types */ 11567c478bd9Sstevel@tonic-gate #define LDAP_FILTER_AND 0xa0 /* context specific + constructed + 0 */ 11577c478bd9Sstevel@tonic-gate #define LDAP_FILTER_OR 0xa1 /* context specific + constructed + 1 */ 11587c478bd9Sstevel@tonic-gate #define LDAP_FILTER_NOT 0xa2 /* context specific + constructed + 2 */ 11597c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EQUALITY 0xa3 /* context specific + constructed + 3 */ 11607c478bd9Sstevel@tonic-gate #define LDAP_FILTER_SUBSTRINGS 0xa4 /* context specific + constructed + 4 */ 11617c478bd9Sstevel@tonic-gate #define LDAP_FILTER_GE 0xa5 /* context specific + constructed + 5 */ 11627c478bd9Sstevel@tonic-gate #define LDAP_FILTER_LE 0xa6 /* context specific + constructed + 6 */ 11637c478bd9Sstevel@tonic-gate #define LDAP_FILTER_PRESENT 0x87 /* context specific + primitive + 7 */ 11647c478bd9Sstevel@tonic-gate #define LDAP_FILTER_APPROX 0xa8 /* context specific + constructed + 8 */ 11657c478bd9Sstevel@tonic-gate #define LDAP_FILTER_EXTENDED 0xa9 /* context specific + constructed + 0 */ 11667c478bd9Sstevel@tonic-gate 11677c478bd9Sstevel@tonic-gate /* U-M LDAP 3.0 compatibility filter types */ 11687c478bd9Sstevel@tonic-gate #define LDAP_FILTER_PRESENT_30 0xa7 /* context specific + constructed */ 11697c478bd9Sstevel@tonic-gate 11707c478bd9Sstevel@tonic-gate /* substring filter component types */ 11717c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_INITIAL 0x80 /* context specific + primitive + 0 */ 11727c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_ANY 0x81 /* context specific + primitive + 1 */ 11737c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_FINAL 0x82 /* context specific + primitive + 2 */ 11747c478bd9Sstevel@tonic-gate 11757c478bd9Sstevel@tonic-gate /* U-M LDAP 3.0 compatibility substring filter component types */ 11767c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_INITIAL_30 0xa0 /* context specific */ 11777c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_ANY_30 0xa1 /* context specific */ 11787c478bd9Sstevel@tonic-gate #define LDAP_SUBSTRING_FINAL_30 0xa2 /* context specific */ 11797c478bd9Sstevel@tonic-gate 11807c478bd9Sstevel@tonic-gate #endif /* _SOLARIS_SDK */ 11817c478bd9Sstevel@tonic-gate 11827c478bd9Sstevel@tonic-gate /* 11837c478bd9Sstevel@tonic-gate * Function to dispose of an array of LDAPMod structures (an API extension). 11847c478bd9Sstevel@tonic-gate * Warning: don't use this unless the mods array was allocated using the 11857c478bd9Sstevel@tonic-gate * same memory allocator as is being used by libldap. 11867c478bd9Sstevel@tonic-gate */ 11877c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_mods_free(LDAPMod **mods, int freemods); 11887c478bd9Sstevel@tonic-gate 11897c478bd9Sstevel@tonic-gate /* 11907c478bd9Sstevel@tonic-gate * Preferred language and get_lang_values (an API extension -- 11917c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_GETLANGVALUES) 11927c478bd9Sstevel@tonic-gate * 11937c478bd9Sstevel@tonic-gate * The following two APIs are deprecated 11947c478bd9Sstevel@tonic-gate */ 11957c478bd9Sstevel@tonic-gate 11967c478bd9Sstevel@tonic-gate char **LDAP_CALL ldap_get_lang_values(LDAP *ld, LDAPMessage *entry, 11977c478bd9Sstevel@tonic-gate const char *target, char **type); 11987c478bd9Sstevel@tonic-gate struct berval **LDAP_CALL ldap_get_lang_values_len(LDAP *ld, 11997c478bd9Sstevel@tonic-gate LDAPMessage *entry, const char *target, char **type); 12007c478bd9Sstevel@tonic-gate 12017c478bd9Sstevel@tonic-gate 12027c478bd9Sstevel@tonic-gate /* 12037c478bd9Sstevel@tonic-gate * Rebind callback function (an API extension) 12047c478bd9Sstevel@tonic-gate */ 12057c478bd9Sstevel@tonic-gate #define LDAP_OPT_REBIND_FN 0x06 /* 6 - API extension */ 12067c478bd9Sstevel@tonic-gate #define LDAP_OPT_REBIND_ARG 0x07 /* 7 - API extension */ 12077c478bd9Sstevel@tonic-gate typedef int (LDAP_CALL LDAP_CALLBACK LDAP_REBINDPROC_CALLBACK)(LDAP *ld, 12087c478bd9Sstevel@tonic-gate char **dnp, char **passwdp, int *authmethodp, int freeit, void *arg); 12097c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_set_rebind_proc(LDAP *ld, 12107c478bd9Sstevel@tonic-gate LDAP_REBINDPROC_CALLBACK *rebindproc, void *arg); 12117c478bd9Sstevel@tonic-gate 12127c478bd9Sstevel@tonic-gate /* 12137c478bd9Sstevel@tonic-gate * Thread function callbacks (an API extension -- 12147c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_THREAD_FUNCTIONS). 12157c478bd9Sstevel@tonic-gate */ 12167c478bd9Sstevel@tonic-gate #define LDAP_OPT_THREAD_FN_PTRS 0x05 /* 5 - API extension */ 12177c478bd9Sstevel@tonic-gate 12187c478bd9Sstevel@tonic-gate /* 12197c478bd9Sstevel@tonic-gate * Thread callback functions: 12207c478bd9Sstevel@tonic-gate */ 12217c478bd9Sstevel@tonic-gate typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_ALLOC_CALLBACK)(void); 12227c478bd9Sstevel@tonic-gate typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_FREE_CALLBACK)(void *m); 12237c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_LOCK_CALLBACK)(void *m); 12247c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_UNLOCK_CALLBACK)(void *m); 12257c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_ERRNO_CALLBACK)(void); 12267c478bd9Sstevel@tonic-gate typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_ERRNO_CALLBACK)(int e); 12277c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_LDERRNO_CALLBACK)( 12287c478bd9Sstevel@tonic-gate char **matchedp, char **errmsgp, void *arg); 12297c478bd9Sstevel@tonic-gate typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_LDERRNO_CALLBACK)(int err, 12307c478bd9Sstevel@tonic-gate char *matched, char *errmsg, void *arg); 12317c478bd9Sstevel@tonic-gate 12327c478bd9Sstevel@tonic-gate /* 12337c478bd9Sstevel@tonic-gate * Structure to hold thread function pointers: 12347c478bd9Sstevel@tonic-gate */ 12357c478bd9Sstevel@tonic-gate struct ldap_thread_fns { 12367c478bd9Sstevel@tonic-gate LDAP_TF_MUTEX_ALLOC_CALLBACK *ltf_mutex_alloc; 12377c478bd9Sstevel@tonic-gate LDAP_TF_MUTEX_FREE_CALLBACK *ltf_mutex_free; 12387c478bd9Sstevel@tonic-gate LDAP_TF_MUTEX_LOCK_CALLBACK *ltf_mutex_lock; 12397c478bd9Sstevel@tonic-gate LDAP_TF_MUTEX_UNLOCK_CALLBACK *ltf_mutex_unlock; 12407c478bd9Sstevel@tonic-gate LDAP_TF_GET_ERRNO_CALLBACK *ltf_get_errno; 12417c478bd9Sstevel@tonic-gate LDAP_TF_SET_ERRNO_CALLBACK *ltf_set_errno; 12427c478bd9Sstevel@tonic-gate LDAP_TF_GET_LDERRNO_CALLBACK *ltf_get_lderrno; 12437c478bd9Sstevel@tonic-gate LDAP_TF_SET_LDERRNO_CALLBACK *ltf_set_lderrno; 12447c478bd9Sstevel@tonic-gate void *ltf_lderrno_arg; 12457c478bd9Sstevel@tonic-gate }; 12467c478bd9Sstevel@tonic-gate 12477c478bd9Sstevel@tonic-gate /* 12487c478bd9Sstevel@tonic-gate * Client side sorting of entries (an API extension -- 12497c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_CLIENT_SIDE_SORT) 12507c478bd9Sstevel@tonic-gate */ 12517c478bd9Sstevel@tonic-gate /* 12527c478bd9Sstevel@tonic-gate * Client side sorting callback functions: 12537c478bd9Sstevel@tonic-gate */ 12547c478bd9Sstevel@tonic-gate typedef const struct berval *(LDAP_C LDAP_CALLBACK 12557c478bd9Sstevel@tonic-gate LDAP_KEYGEN_CALLBACK)(void *arg, LDAP *ld, LDAPMessage *entry); 12567c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK 12577c478bd9Sstevel@tonic-gate LDAP_KEYCMP_CALLBACK)(void *arg, const struct berval *, 12587c478bd9Sstevel@tonic-gate const struct berval *); 12597c478bd9Sstevel@tonic-gate typedef void (LDAP_C LDAP_CALLBACK 12607c478bd9Sstevel@tonic-gate LDAP_KEYFREE_CALLBACK)(void *arg, const struct berval *); 12617c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK 12627c478bd9Sstevel@tonic-gate LDAP_CMP_CALLBACK)(const char *val1, const char *val2); 12637c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK 12647c478bd9Sstevel@tonic-gate LDAP_VALCMP_CALLBACK)(const char **val1p, const char **val2p); 12657c478bd9Sstevel@tonic-gate 12667c478bd9Sstevel@tonic-gate /* 12677c478bd9Sstevel@tonic-gate * Client side sorting functions: 12687c478bd9Sstevel@tonic-gate */ 12697c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_multisort_entries(LDAP *ld, LDAPMessage **chain, 12707c478bd9Sstevel@tonic-gate char **attr, LDAP_CMP_CALLBACK *cmp); 12717c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_sort_entries(LDAP *ld, LDAPMessage **chain, 12727c478bd9Sstevel@tonic-gate char *attr, LDAP_CMP_CALLBACK *cmp); 12737c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_sort_values(LDAP *ld, char **vals, 12747c478bd9Sstevel@tonic-gate LDAP_VALCMP_CALLBACK *cmp); 12757c478bd9Sstevel@tonic-gate int LDAP_C LDAP_CALLBACK ldap_sort_strcasecmp(const char **a, 12767c478bd9Sstevel@tonic-gate const char **b); 12777c478bd9Sstevel@tonic-gate 12787c478bd9Sstevel@tonic-gate 12797c478bd9Sstevel@tonic-gate /* 12807c478bd9Sstevel@tonic-gate * Filter functions and definitions (an API extension -- 12817c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_FILTER_FUNCTIONS) 12827c478bd9Sstevel@tonic-gate */ 12837c478bd9Sstevel@tonic-gate /* 12847c478bd9Sstevel@tonic-gate * Structures, constants, and types for filter utility routines: 12857c478bd9Sstevel@tonic-gate */ 12867c478bd9Sstevel@tonic-gate typedef struct ldap_filt_info { 12877c478bd9Sstevel@tonic-gate char *lfi_filter; 12887c478bd9Sstevel@tonic-gate char *lfi_desc; 12897c478bd9Sstevel@tonic-gate int lfi_scope; /* LDAP_SCOPE_BASE, etc */ 12907c478bd9Sstevel@tonic-gate int lfi_isexact; /* exact match filter? */ 12917c478bd9Sstevel@tonic-gate struct ldap_filt_info *lfi_next; 12927c478bd9Sstevel@tonic-gate } LDAPFiltInfo; 12937c478bd9Sstevel@tonic-gate 12947c478bd9Sstevel@tonic-gate #define LDAP_FILT_MAXSIZ 1024 12957c478bd9Sstevel@tonic-gate 12967c478bd9Sstevel@tonic-gate typedef struct ldap_filt_list LDAPFiltList; /* opaque filter list handle */ 12977c478bd9Sstevel@tonic-gate typedef struct ldap_filt_desc LDAPFiltDesc; /* opaque filter desc handle */ 12987c478bd9Sstevel@tonic-gate 12997c478bd9Sstevel@tonic-gate /* 13007c478bd9Sstevel@tonic-gate * Filter utility functions: 13017c478bd9Sstevel@tonic-gate */ 13027c478bd9Sstevel@tonic-gate LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter(char *fname); 13037c478bd9Sstevel@tonic-gate LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter_buf(char *buf, 13047c478bd9Sstevel@tonic-gate ssize_t buflen); 13057c478bd9Sstevel@tonic-gate LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getfirstfilter(LDAPFiltDesc *lfdp, 13067c478bd9Sstevel@tonic-gate char *tagpat, char *value); 13077c478bd9Sstevel@tonic-gate LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getnextfilter(LDAPFiltDesc *lfdp); 13087c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_set_filter_additions(LDAPFiltDesc *lfdp, 13097c478bd9Sstevel@tonic-gate char *prefix, char *suffix); 13107c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_create_filter(char *buf, unsigned long buflen, 13117c478bd9Sstevel@tonic-gate char *pattern, char *prefix, char *suffix, char *attr, 13127c478bd9Sstevel@tonic-gate char *value, char **valwords); 13137c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_getfilter_free(LDAPFiltDesc *lfdp); 13147c478bd9Sstevel@tonic-gate 13157c478bd9Sstevel@tonic-gate 13167c478bd9Sstevel@tonic-gate /* 13177c478bd9Sstevel@tonic-gate * Friendly mapping structure and routines (an API extension) 13187c478bd9Sstevel@tonic-gate */ 13197c478bd9Sstevel@tonic-gate typedef struct friendly { 13207c478bd9Sstevel@tonic-gate char *f_unfriendly; 13217c478bd9Sstevel@tonic-gate char *f_friendly; 13227c478bd9Sstevel@tonic-gate } *FriendlyMap; 13237c478bd9Sstevel@tonic-gate char *LDAP_CALL ldap_friendly_name(char *filename, char *name, 13247c478bd9Sstevel@tonic-gate FriendlyMap *map); 13257c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_free_friendlymap(FriendlyMap *map); 13267c478bd9Sstevel@tonic-gate 13277c478bd9Sstevel@tonic-gate 13287c478bd9Sstevel@tonic-gate /* 13297c478bd9Sstevel@tonic-gate * In Memory Cache (an API extension -- LDAP_API_FEATURE_X_MEMCACHE) 13307c478bd9Sstevel@tonic-gate */ 13317c478bd9Sstevel@tonic-gate typedef struct ldapmemcache LDAPMemCache; /* opaque in-memory cache handle */ 13327c478bd9Sstevel@tonic-gate 13337c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_memcache_init(unsigned long ttl, 13347c478bd9Sstevel@tonic-gate unsigned long size, char **baseDNs, struct ldap_thread_fns *thread_fns, 13357c478bd9Sstevel@tonic-gate LDAPMemCache **cachep); 13367c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_memcache_set(LDAP *ld, LDAPMemCache *cache); 13377c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_memcache_get(LDAP *ld, LDAPMemCache **cachep); 13387c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_memcache_flush(LDAPMemCache *cache, char *dn, 13397c478bd9Sstevel@tonic-gate int scope); 13407c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_memcache_destroy(LDAPMemCache *cache); 13417c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_memcache_update(LDAPMemCache *cache); 13427c478bd9Sstevel@tonic-gate 13437c478bd9Sstevel@tonic-gate /* 13447c478bd9Sstevel@tonic-gate * Server reconnect (an API extension). 13457c478bd9Sstevel@tonic-gate */ 13467c478bd9Sstevel@tonic-gate #define LDAP_OPT_RECONNECT 0x62 /* 98 - API extension */ 13477c478bd9Sstevel@tonic-gate 13487c478bd9Sstevel@tonic-gate /* 13497c478bd9Sstevel@tonic-gate * Asynchronous I/O (an API extension). 13507c478bd9Sstevel@tonic-gate */ 13517c478bd9Sstevel@tonic-gate /* 13527c478bd9Sstevel@tonic-gate * This option enables completely asynchronous IO. It works by using ioctl() 13537c478bd9Sstevel@tonic-gate * on the fd, (or tlook()) 13547c478bd9Sstevel@tonic-gate */ 13557c478bd9Sstevel@tonic-gate #define LDAP_OPT_ASYNC_CONNECT 0x63 /* 99 - API extension */ 13567c478bd9Sstevel@tonic-gate 13577c478bd9Sstevel@tonic-gate /* 13587c478bd9Sstevel@tonic-gate * I/O function callbacks option (an API extension -- 13597c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_IO_FUNCTIONS). 13607c478bd9Sstevel@tonic-gate * Use of the extended I/O functions instead is recommended; see above. 13617c478bd9Sstevel@tonic-gate */ 13627c478bd9Sstevel@tonic-gate #define LDAP_OPT_IO_FN_PTRS 0x0B /* 11 - API extension */ 13637c478bd9Sstevel@tonic-gate 13647c478bd9Sstevel@tonic-gate /* 13657c478bd9Sstevel@tonic-gate * Extended I/O function callbacks option (an API extension -- 13667c478bd9Sstevel@tonic-gate * LDAP_API_FEATURE_X_EXTIO_FUNCTIONS). 13677c478bd9Sstevel@tonic-gate */ 13687c478bd9Sstevel@tonic-gate #define LDAP_X_OPT_EXTIO_FN_PTRS (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F00) 13697c478bd9Sstevel@tonic-gate /* 0x4000 + 0x0F00 = 0x4F00 = 20224 - API extension */ 13707c478bd9Sstevel@tonic-gate 13717c478bd9Sstevel@tonic-gate 13727c478bd9Sstevel@tonic-gate 13737c478bd9Sstevel@tonic-gate /* 13747c478bd9Sstevel@tonic-gate * generalized bind 13757c478bd9Sstevel@tonic-gate */ 13767c478bd9Sstevel@tonic-gate /* 13777c478bd9Sstevel@tonic-gate * Authentication methods: 13787c478bd9Sstevel@tonic-gate */ 13797c478bd9Sstevel@tonic-gate #define LDAP_AUTH_NONE 0x00 13807c478bd9Sstevel@tonic-gate #define LDAP_AUTH_SIMPLE 0x80 13817c478bd9Sstevel@tonic-gate #define LDAP_AUTH_SASL 0xa3 13827c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_bind(LDAP *ld, const char *who, 13837c478bd9Sstevel@tonic-gate const char *passwd, int authmethod); 13847c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_bind_s(LDAP *ld, const char *who, 13857c478bd9Sstevel@tonic-gate const char *cred, int method); 13867c478bd9Sstevel@tonic-gate 13877c478bd9Sstevel@tonic-gate /* 13887c478bd9Sstevel@tonic-gate * experimental DN format support 13897c478bd9Sstevel@tonic-gate */ 13907c478bd9Sstevel@tonic-gate char **LDAP_CALL ldap_explode_dns(const char *dn); 13917c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_is_dns_dn(const char *dn); 13927c478bd9Sstevel@tonic-gate 13937c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 13947c478bd9Sstevel@tonic-gate char *ldap_dns_to_dn(char *dns_name, int *nameparts); 13957c478bd9Sstevel@tonic-gate #endif 13967c478bd9Sstevel@tonic-gate 13977c478bd9Sstevel@tonic-gate 13987c478bd9Sstevel@tonic-gate /* 13997c478bd9Sstevel@tonic-gate * user friendly naming/searching routines 14007c478bd9Sstevel@tonic-gate */ 14017c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_CANCELPROC_CALLBACK)(void *cl); 14027c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_ufn_search_c(LDAP *ld, char *ufn, 14037c478bd9Sstevel@tonic-gate char **attrs, int attrsonly, LDAPMessage **res, 14047c478bd9Sstevel@tonic-gate LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm); 14057c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_ufn_search_ct(LDAP *ld, char *ufn, 14067c478bd9Sstevel@tonic-gate char **attrs, int attrsonly, LDAPMessage **res, 14077c478bd9Sstevel@tonic-gate LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm, 14087c478bd9Sstevel@tonic-gate char *tag1, char *tag2, char *tag3); 14097c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_ufn_search_s(LDAP *ld, char *ufn, 14107c478bd9Sstevel@tonic-gate char **attrs, int attrsonly, LDAPMessage **res); 14117c478bd9Sstevel@tonic-gate LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_ufn_setfilter(LDAP *ld, char *fname); 14127c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_ufn_setprefix(LDAP *ld, char *prefix); 14137c478bd9Sstevel@tonic-gate int LDAP_C ldap_ufn_timeout(void *tvparam); 14147c478bd9Sstevel@tonic-gate 14157c478bd9Sstevel@tonic-gate /* 14167c478bd9Sstevel@tonic-gate * functions and definitions that have been replaced by new improved ones 14177c478bd9Sstevel@tonic-gate */ 14187c478bd9Sstevel@tonic-gate /* 14197c478bd9Sstevel@tonic-gate * Use ldap_get_option() with LDAP_OPT_API_INFO and an LDAPAPIInfo structure 14207c478bd9Sstevel@tonic-gate * instead of ldap_version(). The use of this API is deprecated. 14217c478bd9Sstevel@tonic-gate */ 14227c478bd9Sstevel@tonic-gate typedef struct _LDAPVersion { 14237c478bd9Sstevel@tonic-gate int sdk_version; /* Version of the SDK, * 100 */ 14247c478bd9Sstevel@tonic-gate int protocol_version; /* Highest protocol version supported, * 100 */ 14257c478bd9Sstevel@tonic-gate int SSL_version; /* SSL version if this SDK supports it, * 100 */ 14267c478bd9Sstevel@tonic-gate int security_level; /* highest level available */ 14277c478bd9Sstevel@tonic-gate int reserved[4]; 14287c478bd9Sstevel@tonic-gate } LDAPVersion; 14297c478bd9Sstevel@tonic-gate #define LDAP_SECURITY_NONE 0 14307c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_version(LDAPVersion *ver); 14317c478bd9Sstevel@tonic-gate 14327c478bd9Sstevel@tonic-gate /* use ldap_create_filter() instead of ldap_build_filter() */ 14337c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_build_filter(char *buf, size_t buflen, 14347c478bd9Sstevel@tonic-gate char *pattern, char *prefix, char *suffix, char *attr, 14357c478bd9Sstevel@tonic-gate char *value, char **valwords); 14367c478bd9Sstevel@tonic-gate /* use ldap_set_filter_additions() instead of ldap_setfilteraffixes() */ 14377c478bd9Sstevel@tonic-gate LDAP_API(void) LDAP_CALL ldap_setfilteraffixes(LDAPFiltDesc *lfdp, 14387c478bd9Sstevel@tonic-gate char *prefix, char *suffix); 14397c478bd9Sstevel@tonic-gate 14407c478bd9Sstevel@tonic-gate /* older result types a server can return -- use LDAP_RES_MODDN instead */ 14417c478bd9Sstevel@tonic-gate #define LDAP_RES_MODRDN LDAP_RES_MODDN 14427c478bd9Sstevel@tonic-gate #define LDAP_RES_RENAME LDAP_RES_MODDN 14437c478bd9Sstevel@tonic-gate 14447c478bd9Sstevel@tonic-gate /* older error messages */ 14457c478bd9Sstevel@tonic-gate #define LDAP_AUTH_METHOD_NOT_SUPPORTED LDAP_STRONG_AUTH_NOT_SUPPORTED 14467c478bd9Sstevel@tonic-gate 14477c478bd9Sstevel@tonic-gate /* end of unsupported functions */ 14487c478bd9Sstevel@tonic-gate 14497c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 14507c478bd9Sstevel@tonic-gate 14517c478bd9Sstevel@tonic-gate /* SSL Functions */ 14527c478bd9Sstevel@tonic-gate 14537c478bd9Sstevel@tonic-gate /* 14547c478bd9Sstevel@tonic-gate * these three defines resolve the SSL strength 14557c478bd9Sstevel@tonic-gate * setting auth weak, diables all cert checking 14567c478bd9Sstevel@tonic-gate * the CNCHECK tests for the man in the middle hack 14577c478bd9Sstevel@tonic-gate */ 14587c478bd9Sstevel@tonic-gate #define LDAPSSL_AUTH_WEAK 0 14597c478bd9Sstevel@tonic-gate #define LDAPSSL_AUTH_CERT 1 14607c478bd9Sstevel@tonic-gate #define LDAPSSL_AUTH_CNCHECK 2 14617c478bd9Sstevel@tonic-gate 14627c478bd9Sstevel@tonic-gate /* 14637c478bd9Sstevel@tonic-gate * Initialize LDAP library for SSL 14647c478bd9Sstevel@tonic-gate */ 14657c478bd9Sstevel@tonic-gate LDAP * LDAP_CALL ldapssl_init(const char *defhost, int defport, 14667c478bd9Sstevel@tonic-gate int defsecure); 14677c478bd9Sstevel@tonic-gate 14687c478bd9Sstevel@tonic-gate /* 14697c478bd9Sstevel@tonic-gate * Install I/O routines to make SSL over LDAP possible. 14707c478bd9Sstevel@tonic-gate * Use this after ldap_init() or just use ldapssl_init() instead. 14717c478bd9Sstevel@tonic-gate */ 14727c478bd9Sstevel@tonic-gate int LDAP_CALL ldapssl_install_routines(LDAP *ld); 14737c478bd9Sstevel@tonic-gate 14747c478bd9Sstevel@tonic-gate 14757c478bd9Sstevel@tonic-gate /* 14767c478bd9Sstevel@tonic-gate * The next three functions initialize the security code for SSL 14777c478bd9Sstevel@tonic-gate * The first one ldapssl_client_init() does initialization for SSL only 14787c478bd9Sstevel@tonic-gate * The next one supports ldapssl_clientauth_init() intializes security 14797c478bd9Sstevel@tonic-gate * for SSL for client authentication. The third function initializes 14807c478bd9Sstevel@tonic-gate * security for doing SSL with client authentication, and PKCS, that is, 14817c478bd9Sstevel@tonic-gate * the third function initializes the security module database(secmod.db). 14827c478bd9Sstevel@tonic-gate * The parameters are as follows: 14837c478bd9Sstevel@tonic-gate * const char *certdbpath - path to the cert file. This can be a shortcut 14847c478bd9Sstevel@tonic-gate * to the directory name, if so cert7.db will be postfixed to the string. 14857c478bd9Sstevel@tonic-gate * void *certdbhandle - Normally this is NULL. This memory will need 14867c478bd9Sstevel@tonic-gate * to be freed. 14877c478bd9Sstevel@tonic-gate * int needkeydb - boolean. Must be ! = 0 if client Authentification 14887c478bd9Sstevel@tonic-gate * is required 14897c478bd9Sstevel@tonic-gate * char *keydbpath - path to the key database. This can be a shortcut 14907c478bd9Sstevel@tonic-gate * to the directory name, if so key3.db will be postfixed to the string. 14917c478bd9Sstevel@tonic-gate * void *keydbhandle - Normally this is NULL, This memory will need 14927c478bd9Sstevel@tonic-gate * to be freed 14937c478bd9Sstevel@tonic-gate * int needsecmoddb - boolean. Must be ! = 0 to assure that the correct 14947c478bd9Sstevel@tonic-gate * security module is loaded into memory 14957c478bd9Sstevel@tonic-gate * char *secmodpath - path to the secmod. This can be a shortcut to the 14967c478bd9Sstevel@tonic-gate * directory name, if so secmod.db will be postfixed to the string. 14977c478bd9Sstevel@tonic-gate * 14987c478bd9Sstevel@tonic-gate * These three functions are mutually exclusive. You can only call 14997c478bd9Sstevel@tonic-gate * one. This means that, for a given process, you must call the 15007c478bd9Sstevel@tonic-gate * appropriate initialization function for the life of the process. 15017c478bd9Sstevel@tonic-gate */ 15027c478bd9Sstevel@tonic-gate 15037c478bd9Sstevel@tonic-gate 15047c478bd9Sstevel@tonic-gate /* 15057c478bd9Sstevel@tonic-gate * Initialize the secure parts (Security and SSL) of the runtime for use 15067c478bd9Sstevel@tonic-gate * by a client application. This is only called once. 15077c478bd9Sstevel@tonic-gate */ 15087c478bd9Sstevel@tonic-gate int LDAP_CALL ldapssl_client_init( 15097c478bd9Sstevel@tonic-gate const char *certdbpath, void *certdbhandle); 15107c478bd9Sstevel@tonic-gate 15117c478bd9Sstevel@tonic-gate /* 15127c478bd9Sstevel@tonic-gate * Initialize the secure parts (Security and SSL) of the runtime for use 15137c478bd9Sstevel@tonic-gate * by a client application that may want to do SSL client authentication. 15147c478bd9Sstevel@tonic-gate */ 15157c478bd9Sstevel@tonic-gate int LDAP_CALL ldapssl_clientauth_init( 15167c478bd9Sstevel@tonic-gate const char *certdbpath, void *certdbhandle, 15177c478bd9Sstevel@tonic-gate const int needkeydb, const char *keydbpath, void *keydbhandle); 15187c478bd9Sstevel@tonic-gate 15197c478bd9Sstevel@tonic-gate /* 15207c478bd9Sstevel@tonic-gate * Initialize the secure parts (Security and SSL) of the runtime for use 15217c478bd9Sstevel@tonic-gate * by a client application that may want to do SSL client authentication. 15227c478bd9Sstevel@tonic-gate */ 15237c478bd9Sstevel@tonic-gate int LDAP_CALL ldapssl_advclientauth_init( 15247c478bd9Sstevel@tonic-gate const char *certdbpath, void *certdbhandle, 15257c478bd9Sstevel@tonic-gate const int needkeydb, const char *keydbpath, void *keydbhandle, 15267c478bd9Sstevel@tonic-gate const int needsecmoddb, const char *secmoddbpath, 15277c478bd9Sstevel@tonic-gate const int sslstrength); 15287c478bd9Sstevel@tonic-gate 15297c478bd9Sstevel@tonic-gate /* 15307c478bd9Sstevel@tonic-gate * get a meaningful error string back from the security library 15317c478bd9Sstevel@tonic-gate * this function should be called, if ldap_err2string doesn't 15327c478bd9Sstevel@tonic-gate * identify the error code. 15337c478bd9Sstevel@tonic-gate */ 15347c478bd9Sstevel@tonic-gate const char *LDAP_CALL ldapssl_err2string(const int prerrno); 15357c478bd9Sstevel@tonic-gate 15367c478bd9Sstevel@tonic-gate /* 15377c478bd9Sstevel@tonic-gate * Enable SSL client authentication on the given ld. 15387c478bd9Sstevel@tonic-gate */ 15397c478bd9Sstevel@tonic-gate int LDAP_CALL ldapssl_enable_clientauth(LDAP *ld, char *keynickname, 15407c478bd9Sstevel@tonic-gate char *keypasswd, char *certnickname); 15417c478bd9Sstevel@tonic-gate 15427c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_TOKEN_CALLBACK) 15437c478bd9Sstevel@tonic-gate (void *context, char **tokenname); 15447c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_PIN_CALLBACK) 15457c478bd9Sstevel@tonic-gate (void *context, const char *tokenname, char **tokenpin); 15467c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTPATH_CALLBACK) 15477c478bd9Sstevel@tonic-gate (void *context, char **certpath); 15487c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_KEYPATH_CALLBACK) 15497c478bd9Sstevel@tonic-gate (void *context, char **keypath); 15507c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_MODPATH_CALLBACK) 15517c478bd9Sstevel@tonic-gate (void *context, char **modulepath); 15527c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTNAME_CALLBACK) 15537c478bd9Sstevel@tonic-gate (void *context, char **certname); 15547c478bd9Sstevel@tonic-gate typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK) 15557c478bd9Sstevel@tonic-gate (void *context, char **filename); 15567c478bd9Sstevel@tonic-gate 15577c478bd9Sstevel@tonic-gate #define PKCS_STRUCTURE_ID 1 15587c478bd9Sstevel@tonic-gate struct ldapssl_pkcs_fns { 15597c478bd9Sstevel@tonic-gate int local_structure_id; 15607c478bd9Sstevel@tonic-gate void *local_data; 15617c478bd9Sstevel@tonic-gate LDAP_PKCS_GET_CERTPATH_CALLBACK *pkcs_getcertpath; 15627c478bd9Sstevel@tonic-gate LDAP_PKCS_GET_CERTNAME_CALLBACK *pkcs_getcertname; 15637c478bd9Sstevel@tonic-gate LDAP_PKCS_GET_KEYPATH_CALLBACK *pkcs_getkeypath; 15647c478bd9Sstevel@tonic-gate LDAP_PKCS_GET_MODPATH_CALLBACK *pkcs_getmodpath; 15657c478bd9Sstevel@tonic-gate LDAP_PKCS_GET_PIN_CALLBACK *pkcs_getpin; 15667c478bd9Sstevel@tonic-gate LDAP_PKCS_GET_TOKEN_CALLBACK *pkcs_gettokenname; 15677c478bd9Sstevel@tonic-gate LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK *pkcs_getdonglefilename; 15687c478bd9Sstevel@tonic-gate 15697c478bd9Sstevel@tonic-gate }; 15707c478bd9Sstevel@tonic-gate 15717c478bd9Sstevel@tonic-gate 15727c478bd9Sstevel@tonic-gate int LDAP_CALL ldapssl_pkcs_init(const struct ldapssl_pkcs_fns *pfns); 15737c478bd9Sstevel@tonic-gate 15747c478bd9Sstevel@tonic-gate /* end of SSL functions */ 15757c478bd9Sstevel@tonic-gate #endif /* _SOLARIS_SDK */ 15767c478bd9Sstevel@tonic-gate 15777c478bd9Sstevel@tonic-gate /* SASL options */ 15787c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_MECH 0x6100 15797c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_REALM 0x6101 15807c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_AUTHCID 0x6102 15817c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_AUTHZID 0x6103 15827c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_SSF 0x6104 /* read-only */ 15837c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_SSF_EXTERNAL 0x6105 /* write-only */ 15847c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_SECPROPS 0x6106 /* write-only */ 15857c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_SSF_MIN 0x6107 15867c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_SSF_MAX 0x6108 15877c478bd9Sstevel@tonic-gate #define LDAP_OPT_X_SASL_MAXBUFSIZE 0x6109 15887c478bd9Sstevel@tonic-gate 15897c478bd9Sstevel@tonic-gate /* 15907c478bd9Sstevel@tonic-gate * ldap_interactive_bind_s Interaction flags 15917c478bd9Sstevel@tonic-gate * Interactive: prompt always - REQUIRED 15927c478bd9Sstevel@tonic-gate */ 15937c478bd9Sstevel@tonic-gate #define LDAP_SASL_INTERACTIVE 1U 15947c478bd9Sstevel@tonic-gate 15957c478bd9Sstevel@tonic-gate /* 15967c478bd9Sstevel@tonic-gate * V3 SASL Interaction Function Callback Prototype 15977c478bd9Sstevel@tonic-gate * when using SASL, interact is pointer to sasl_interact_t 15987c478bd9Sstevel@tonic-gate * should likely passed in a control (and provided controls) 15997c478bd9Sstevel@tonic-gate */ 16007c478bd9Sstevel@tonic-gate typedef int (LDAP_SASL_INTERACT_PROC) 16017c478bd9Sstevel@tonic-gate (LDAP *ld, unsigned flags, void* defaults, void *interact); 16027c478bd9Sstevel@tonic-gate 16037c478bd9Sstevel@tonic-gate int LDAP_CALL ldap_sasl_interactive_bind_s(LDAP *ld, const char *dn, 16047c478bd9Sstevel@tonic-gate const char *saslMechanism, LDAPControl **serverControls, 16057c478bd9Sstevel@tonic-gate LDAPControl **clientControls, unsigned flags, 16067c478bd9Sstevel@tonic-gate LDAP_SASL_INTERACT_PROC *proc, void *defaults); 16077c478bd9Sstevel@tonic-gate 16087c478bd9Sstevel@tonic-gate #ifdef __cplusplus 16097c478bd9Sstevel@tonic-gate } 16107c478bd9Sstevel@tonic-gate #endif 16117c478bd9Sstevel@tonic-gate 16127c478bd9Sstevel@tonic-gate #endif /* _LDAP_H */ 1613