xref: /illumos-gate/usr/src/lib/libnisdb/ldap_map.h (revision 36e852a1)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*36e852a1SRaja Andra  * Common Development and Distribution License (the "License").
6*36e852a1SRaja Andra  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*36e852a1SRaja Andra  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_LDAP_MAP_H
287c478bd9Sstevel@tonic-gate #define	_LDAP_MAP_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <rpcsvc/nis.h>
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include "ldap_parse.h"
337c478bd9Sstevel@tonic-gate #include "ldap_structs.h"
347c478bd9Sstevel@tonic-gate #include "nis_hashitem.h"
357c478bd9Sstevel@tonic-gate #include "db_query_c.h"
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate extern	__nis_hash_table_mt	ldapMappingList;
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate typedef struct {
447c478bd9Sstevel@tonic-gate 	char		*zo_owner;
457c478bd9Sstevel@tonic-gate 	char		*zo_group;
467c478bd9Sstevel@tonic-gate 	char		*zo_domain;
477c478bd9Sstevel@tonic-gate 	uint_t		zo_access;
487c478bd9Sstevel@tonic-gate 	uint32_t	zo_ttl;
497c478bd9Sstevel@tonic-gate } __nis_obj_attr_t;
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /* Exported functions */
527c478bd9Sstevel@tonic-gate db_query		**mapFromLDAP(__nis_table_mapping_t *t, db_query *qin,
537c478bd9Sstevel@tonic-gate 				int *numQueries, char *dbId, int *ldapStat,
547c478bd9Sstevel@tonic-gate 				__nis_obj_attr_t ***objAttr);
557c478bd9Sstevel@tonic-gate int			mapToLDAP(__nis_table_mapping_t *t, int numQueries,
567c478bd9Sstevel@tonic-gate 				db_query **oldQ, db_query **newQ,
577c478bd9Sstevel@tonic-gate 				__nis_rule_value_t *rvIn, int firstOnly,
587c478bd9Sstevel@tonic-gate 				char *dbId);
597c478bd9Sstevel@tonic-gate int			verifyIndexMatch(__nis_table_mapping_t *x,
607c478bd9Sstevel@tonic-gate 				db_query *q, __nis_rule_value_t *rv,
617c478bd9Sstevel@tonic-gate 				char *name, char *val);
627c478bd9Sstevel@tonic-gate __nis_table_mapping_t	**selectTableMapping(__nis_table_mapping_t *t,
637c478bd9Sstevel@tonic-gate 				db_query *q, int wantWrite, int wantObj,
647c478bd9Sstevel@tonic-gate 				char *dbId, int *numMatches);
657c478bd9Sstevel@tonic-gate int			haveIndexedMapping(__nis_table_mapping_t *t);
667c478bd9Sstevel@tonic-gate int			objToLDAP(__nis_table_mapping_t *t, nis_object *o,
677c478bd9Sstevel@tonic-gate 				entry_obj **ea, int numEa);
687c478bd9Sstevel@tonic-gate int			objFromLDAP(__nis_table_mapping_t *t, nis_object **o,
697c478bd9Sstevel@tonic-gate 				entry_obj ***eaP, int *numEaP);
707c478bd9Sstevel@tonic-gate int			deleteLDAPobj(__nis_table_mapping_t *t);
717c478bd9Sstevel@tonic-gate __nis_obj_attr_t	*ruleValue2ObjAttr(__nis_rule_value_t *rv);
727c478bd9Sstevel@tonic-gate void			freeSingleObjAttr(__nis_obj_attr_t *attr);
737c478bd9Sstevel@tonic-gate void			freeObjAttr(__nis_obj_attr_t **attr, int numAttr);
747c478bd9Sstevel@tonic-gate __nis_obj_attr_t	*cloneObjAttr(__nis_obj_attr_t *old);
757c478bd9Sstevel@tonic-gate int			isObjAttrString(char *str);
767c478bd9Sstevel@tonic-gate char			*isObjAttr(__nis_single_value_t *val);
777c478bd9Sstevel@tonic-gate int			setObjAttrField(char *attrName,
787c478bd9Sstevel@tonic-gate 				__nis_single_value_t *val,
797c478bd9Sstevel@tonic-gate 				__nis_obj_attr_t **objAttr);
807c478bd9Sstevel@tonic-gate int			setColumnNames(__nis_table_mapping_t *t);
817c478bd9Sstevel@tonic-gate __nis_rule_value_t	*addObjAttr2RuleValue(nis_object *obj,
827c478bd9Sstevel@tonic-gate 				__nis_rule_value_t *rvIn);
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
857c478bd9Sstevel@tonic-gate }
86*36e852a1SRaja Andra #endif
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate #endif	/* _LDAP_MAP_H */
89