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 2004 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 #include <stdio.h>
30 #include <string.h>
31 #include <stdlib.h>
32 #include <ctype.h>
33 #include <fcntl.h>
34 #include <unistd.h>
35 #include <errno.h>
36 #include <locale.h>
37 #include <lber.h>
38 #include <ldap.h>
39 #include <syslog.h>
40 #include <dlfcn.h> /* for dynamic loading only */
41
42 #include "ldap_parse.h"
43 #include "nis_parse_ldap_conf.h"
44 #include "nis_parse_ldap_err.h"
45 #include "ldap_util.h"
46 #include "ldap_util.h"
47
48 void append_dot(char **str);
49 void append_comma(char **str);
50 bool_t make_full_dn(char **dn, const char *base);
51 bool_t make_fqdn(__nis_object_dn_t *dn, const char *base);
52 char *get_default_ldap_base(const char *domain);
53 bool_t add_domain(char **objName, const char *domain);
54 bool_t add_column(__nis_table_mapping_t *t, const char *col_name);
55 __nis_mapping_rule_t **dup_mapping_rules(
56 __nis_mapping_rule_t **rules, int n_rules);
57 __nis_mapping_rule_t *dup_mapping_rule(
58 __nis_mapping_rule_t *in);
59 void *s_malloc(size_t size);
60 __nis_mapping_format_t *dup_format_mapping(
61 __nis_mapping_format_t *in);
62 bool_t dup_mapping_element(__nis_mapping_element_t *in,
63 __nis_mapping_element_t *out);
64
65 extern FILE *cons;
66
67 /*
68 * FUNCTION: free_parse_structs
69 *
70 * Release the resources in parse results
71 *
72 */
73
74 void
75 free_parse_structs()
76 {
77 __nis_table_mapping_t *t;
78 __nis_table_mapping_t *t1;
79
80 free_proxy_info(&proxyInfo);
81 for (t = ldapTableMapping; t != NULL; t = t1) {
82 t1 = t->next;
83 free_table_mapping(t);
|
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 2015 Gary Mills
24 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 #include <stdio.h>
29 #include <string.h>
30 #include <stdlib.h>
31 #include <ctype.h>
32 #include <fcntl.h>
33 #include <unistd.h>
34 #include <errno.h>
35 #include <locale.h>
36 #include <lber.h>
37 #include <ldap.h>
38 #include <syslog.h>
39 #include <dlfcn.h> /* for dynamic loading only */
40
41 #include "ldap_parse.h"
42 #include "nis_parse_ldap_conf.h"
43 #include "nis_parse_ldap_err.h"
44 #include "ldap_util.h"
45 #include "ldap_util.h"
46
47 void append_dot(char **str);
48 void append_comma(char **str);
49 bool_t make_full_dn(char **dn, const char *base);
50 bool_t make_fqdn(__nis_object_dn_t *dn, const char *base);
51 char *get_default_ldap_base(const char *domain);
52 bool_t add_domain(char **objName, const char *domain);
53 bool_t add_column(__nis_table_mapping_t *t, const char *col_name);
54 __nis_mapping_rule_t **dup_mapping_rules(
55 __nis_mapping_rule_t **rules, int n_rules);
56 __nis_mapping_rule_t *dup_mapping_rule(
57 __nis_mapping_rule_t *in);
58 void *s_malloc(size_t size);
59 __nis_mapping_format_t *dup_format_mapping(
60 __nis_mapping_format_t *in);
61 bool_t dup_mapping_element(__nis_mapping_element_t *in,
62 __nis_mapping_element_t *out);
63 bool_t is_string_ok(char *, int);
64
65 extern FILE *cons;
66
67 /*
68 * FUNCTION: free_parse_structs
69 *
70 * Release the resources in parse results
71 *
72 */
73
74 void
75 free_parse_structs()
76 {
77 __nis_table_mapping_t *t;
78 __nis_table_mapping_t *t1;
79
80 free_proxy_info(&proxyInfo);
81 for (t = ldapTableMapping; t != NULL; t = t1) {
82 t1 = t->next;
83 free_table_mapping(t);
|