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