xref: /onnv-gate/usr/src/lib/libnisdb/ldap_map.h (revision 11262:b7ebfbf2359e)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*11262SRajagopal.Andra@Sun.COM  * Common Development and Distribution License (the "License").
6*11262SRajagopal.Andra@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11262SRajagopal.Andra@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef	_LDAP_MAP_H
280Sstevel@tonic-gate #define	_LDAP_MAP_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #include <rpcsvc/nis.h>
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #include "ldap_parse.h"
330Sstevel@tonic-gate #include "ldap_structs.h"
340Sstevel@tonic-gate #include "nis_hashitem.h"
350Sstevel@tonic-gate #include "db_query_c.h"
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #ifdef	__cplusplus
380Sstevel@tonic-gate extern "C" {
390Sstevel@tonic-gate #endif
400Sstevel@tonic-gate 
410Sstevel@tonic-gate extern	__nis_hash_table_mt	ldapMappingList;
420Sstevel@tonic-gate 
430Sstevel@tonic-gate typedef struct {
440Sstevel@tonic-gate 	char		*zo_owner;
450Sstevel@tonic-gate 	char		*zo_group;
460Sstevel@tonic-gate 	char		*zo_domain;
470Sstevel@tonic-gate 	uint_t		zo_access;
480Sstevel@tonic-gate 	uint32_t	zo_ttl;
490Sstevel@tonic-gate } __nis_obj_attr_t;
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /* Exported functions */
520Sstevel@tonic-gate db_query		**mapFromLDAP(__nis_table_mapping_t *t, db_query *qin,
530Sstevel@tonic-gate 				int *numQueries, char *dbId, int *ldapStat,
540Sstevel@tonic-gate 				__nis_obj_attr_t ***objAttr);
550Sstevel@tonic-gate int			mapToLDAP(__nis_table_mapping_t *t, int numQueries,
560Sstevel@tonic-gate 				db_query **oldQ, db_query **newQ,
570Sstevel@tonic-gate 				__nis_rule_value_t *rvIn, int firstOnly,
580Sstevel@tonic-gate 				char *dbId);
590Sstevel@tonic-gate int			verifyIndexMatch(__nis_table_mapping_t *x,
600Sstevel@tonic-gate 				db_query *q, __nis_rule_value_t *rv,
610Sstevel@tonic-gate 				char *name, char *val);
620Sstevel@tonic-gate __nis_table_mapping_t	**selectTableMapping(__nis_table_mapping_t *t,
630Sstevel@tonic-gate 				db_query *q, int wantWrite, int wantObj,
640Sstevel@tonic-gate 				char *dbId, int *numMatches);
650Sstevel@tonic-gate int			haveIndexedMapping(__nis_table_mapping_t *t);
660Sstevel@tonic-gate int			objToLDAP(__nis_table_mapping_t *t, nis_object *o,
670Sstevel@tonic-gate 				entry_obj **ea, int numEa);
680Sstevel@tonic-gate int			objFromLDAP(__nis_table_mapping_t *t, nis_object **o,
690Sstevel@tonic-gate 				entry_obj ***eaP, int *numEaP);
700Sstevel@tonic-gate int			deleteLDAPobj(__nis_table_mapping_t *t);
710Sstevel@tonic-gate __nis_obj_attr_t	*ruleValue2ObjAttr(__nis_rule_value_t *rv);
720Sstevel@tonic-gate void			freeSingleObjAttr(__nis_obj_attr_t *attr);
730Sstevel@tonic-gate void			freeObjAttr(__nis_obj_attr_t **attr, int numAttr);
740Sstevel@tonic-gate __nis_obj_attr_t	*cloneObjAttr(__nis_obj_attr_t *old);
750Sstevel@tonic-gate int			isObjAttrString(char *str);
760Sstevel@tonic-gate char			*isObjAttr(__nis_single_value_t *val);
770Sstevel@tonic-gate int			setObjAttrField(char *attrName,
780Sstevel@tonic-gate 				__nis_single_value_t *val,
790Sstevel@tonic-gate 				__nis_obj_attr_t **objAttr);
800Sstevel@tonic-gate int			setColumnNames(__nis_table_mapping_t *t);
810Sstevel@tonic-gate __nis_rule_value_t	*addObjAttr2RuleValue(nis_object *obj,
820Sstevel@tonic-gate 				__nis_rule_value_t *rvIn);
830Sstevel@tonic-gate 
840Sstevel@tonic-gate #ifdef	__cplusplus
850Sstevel@tonic-gate }
86*11262SRajagopal.Andra@Sun.COM #endif
870Sstevel@tonic-gate 
880Sstevel@tonic-gate #endif	/* _LDAP_MAP_H */
89