Current File : //usr/lib/llib-lsldap
/*
 *Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
 */

/* LINTLIBRARY */
/* PROTOLIB1 */

#include <stdio.h>
#include <sys/types.h>
#include <lber.h>
#include <ldap.h>
#include "ns_sldap.h"
#include "ns_internal.h"


/*
 * Simplified LDAP Naming APIs
 */
int __ns_ldap_list(
	const char *service,
	const char *filter,
	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
			      char **realfilter, const void *userdata),
	const char * const *attribute,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_result_t ** result,
	ns_ldap_error_t ** errorp,
	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
	const void *userdata);

int __ns_ldap_list_sort(
	const char *service,
	const char *filter,
	const char *sortattr,
	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
			      char **realfilter, const void *userdata),
	const char * const *attribute,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_result_t ** result,
	ns_ldap_error_t ** errorp,
	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
	const void *userdata);

int  __ns_ldap_addAttr(
	const char *service,
	const char *dn,
	const ns_ldap_attr_t * const *attr,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_error_t **errorp);

int __ns_ldap_delAttr(
	const char *service,
	const char *dn,
	const ns_ldap_attr_t * const *attr,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_error_t **errorp);

int  __ns_ldap_repAttr(
	const char *service,
	const char *dn,
	const ns_ldap_attr_t * const *attr,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_error_t **errorp);

int  __ns_ldap_addEntry(
	const char *service,
	const char *dn,
	const ns_ldap_entry_t *entry,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_error_t **errorp);

int  __ns_ldap_addTypedEntry(
	const char *servicetype,
	const char *basedn,
	const void *data,
	const int  create,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_error_t **errorp);

int __ns_ldap_delEntry(
	const char *service,
	const char *dn,
	const ns_cred_t *cred,
	const int flags,
	ns_ldap_error_t **errorp);

int __ns_ldap_firstEntry(
	const char *service,
	const char *filter,
	const char *sortattr,
	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
			      char **realfilter, const void *userdata),
	const char * const *attribute,
	const ns_cred_t *cred,
	const int flags,
	void **cookie,
	ns_ldap_result_t ** result,
	ns_ldap_error_t **errorp,
	const void *userdata);

int  __ns_ldap_nextEntry(
	void *cookie,
	ns_ldap_result_t ** result,
	ns_ldap_error_t **errorp);

int  __ns_ldap_endEntry(
	void **cookie,
	ns_ldap_error_t **errorp);

int __ns_ldap_freeResult(
	ns_ldap_result_t **result);

int __ns_ldap_freeError(
	ns_ldap_error_t **errorp);

int __ns_ldap_freeCookie(
	void **cookie);

int  __ns_ldap_uid2dn(
	const char *uid,
	char **userDN,
	const ns_cred_t *cred,
	ns_ldap_error_t ** errorp);

int  __ns_ldap_host2dn(
	const char *host,
	const char *domain,
	char **hostDN,
	const ns_cred_t *cred,
	ns_ldap_error_t ** errorp);

int  __ns_ldap_dn2domain(
	const char *dn,
	char **domain,
	const ns_cred_t *cred,
	ns_ldap_error_t **errorp);

int __ns_ldap_auth(
	const ns_cred_t *cred,
	const int flag,
	ns_ldap_error_t **errorp,
	LDAPControl **serverctrls,
	LDAPControl **clientctrls);

int __ns_ldap_err2str(
	int err,
	char **strmsg);

int __ns_ldap_setParam(
	const ParamIndexType type,
	const void *data,
	ns_ldap_error_t **errorp);

int __ns_ldap_getParam(
	const ParamIndexType type,
	void ***data,
	ns_ldap_error_t **errorp);

int __ns_ldap_freeParam(
	void ***data);

char **__ns_ldap_getAttr(
	const ns_ldap_entry_t *entry,
	const char *attrname);

int __s_api_prepend_automountmapname_to_dn(
	const char *service,
	char **basedn,
	ns_ldap_error_t ** errorp);

char *__s_api_get_canonical_name(
	ns_ldap_entry_t *entry,
	ns_ldap_attr_t *attrptr,
	int case_ignore);

void __ns_ldap_setServer(
	int set);

ns_ldap_error_t *__ns_ldap_LoadConfiguration(
	void);

ns_ldap_error_t *__ns_ldap_DumpConfiguration(
	char *file);

ns_ldap_error_t *__ns_ldap_DumpLdif(
	char *filename);

ns_ldap_error_t *__ns_ldap_print_config(
	int verbose);

void __ns_ldap_default_config(
	void);

int __ns_ldap_download(
	const char *profile,
	char *addr,
	char *baseDN,
	ns_ldap_error_t **errorp);

int __ns_ldap_check_dns_preq(
	int foreground,
	int mode_verbose,
	int mode_quiet,
	const char *fname,
	ns_ldap_self_gssapi_config_t config,
	ns_ldap_error_t **errpp);

int __ns_ldap_check_gssapi_preq(
	int foreground,
	int mode_verbose,
	int mode_quiet,
	ns_ldap_self_gssapi_config_t config,
	ns_ldap_error_t **errpp);

int __ns_ldap_check_all_preq(
	int foreground,
	int mode_verbose,
	int mode_quiet,
	ns_ldap_self_gssapi_config_t config,
	ns_ldap_error_t **errpp);