xref: /titanic_44/usr/src/lib/libnisdb/ldap_map.h (revision 36e852a172cba914383d7341c988128b2c667fbd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 
27 #ifndef	_LDAP_MAP_H
28 #define	_LDAP_MAP_H
29 
30 #include <rpcsvc/nis.h>
31 
32 #include "ldap_parse.h"
33 #include "ldap_structs.h"
34 #include "nis_hashitem.h"
35 #include "db_query_c.h"
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 extern	__nis_hash_table_mt	ldapMappingList;
42 
43 typedef struct {
44 	char		*zo_owner;
45 	char		*zo_group;
46 	char		*zo_domain;
47 	uint_t		zo_access;
48 	uint32_t	zo_ttl;
49 } __nis_obj_attr_t;
50 
51 /* Exported functions */
52 db_query		**mapFromLDAP(__nis_table_mapping_t *t, db_query *qin,
53 				int *numQueries, char *dbId, int *ldapStat,
54 				__nis_obj_attr_t ***objAttr);
55 int			mapToLDAP(__nis_table_mapping_t *t, int numQueries,
56 				db_query **oldQ, db_query **newQ,
57 				__nis_rule_value_t *rvIn, int firstOnly,
58 				char *dbId);
59 int			verifyIndexMatch(__nis_table_mapping_t *x,
60 				db_query *q, __nis_rule_value_t *rv,
61 				char *name, char *val);
62 __nis_table_mapping_t	**selectTableMapping(__nis_table_mapping_t *t,
63 				db_query *q, int wantWrite, int wantObj,
64 				char *dbId, int *numMatches);
65 int			haveIndexedMapping(__nis_table_mapping_t *t);
66 int			objToLDAP(__nis_table_mapping_t *t, nis_object *o,
67 				entry_obj **ea, int numEa);
68 int			objFromLDAP(__nis_table_mapping_t *t, nis_object **o,
69 				entry_obj ***eaP, int *numEaP);
70 int			deleteLDAPobj(__nis_table_mapping_t *t);
71 __nis_obj_attr_t	*ruleValue2ObjAttr(__nis_rule_value_t *rv);
72 void			freeSingleObjAttr(__nis_obj_attr_t *attr);
73 void			freeObjAttr(__nis_obj_attr_t **attr, int numAttr);
74 __nis_obj_attr_t	*cloneObjAttr(__nis_obj_attr_t *old);
75 int			isObjAttrString(char *str);
76 char			*isObjAttr(__nis_single_value_t *val);
77 int			setObjAttrField(char *attrName,
78 				__nis_single_value_t *val,
79 				__nis_obj_attr_t **objAttr);
80 int			setColumnNames(__nis_table_mapping_t *t);
81 __nis_rule_value_t	*addObjAttr2RuleValue(nis_object *obj,
82 				__nis_rule_value_t *rvIn);
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _LDAP_MAP_H */
89