1 /* config.c - ldap backend configuration file routine */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 /* This is an altered version */
9 * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
11 * Permission is granted to anyone to use this software for any purpose
12 * on any computer system, and to alter it and redistribute it, subject
13 * to the following restrictions:
15 * 1. The author is not responsible for the consequences of use of this
16 * software, no matter how awful, even if they arise from flaws in it.
18 * 2. The origin of this software must not be misrepresented, either by
19 * explicit claim or by omission. Since few users ever read sources,
20 * credits should appear in the documentation.
22 * 3. Altered versions must be plainly marked as such, and must not be
23 * misrepresented as being the original software. Since few users
24 * ever read sources, credits should appear in the documentation.
26 * 4. This notice may not be removed or altered.
30 * Copyright 2000, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
32 * This software is being modified by Pierangelo Masarati.
33 * The previously reported conditions apply to the modified code as well.
34 * Changes in the original code are highlighted where required.
35 * Credits for the original code go to the author, Howard Chu.
42 #include <ac/string.h>
43 #include <ac/socket.h>
46 #include "back-ldap.h"
57 struct ldapinfo *li = (struct ldapinfo *) be->be_private;
60 fprintf( stderr, "%s: line %d: ldap backend info is null!\n",
65 /* server address to query (depricated, use "uri" directive) */
66 if ( strcasecmp( argv[0], "server" ) == 0 ) {
69 "%s: line %d: missing address in \"server <address>\" line\n",
75 li->url = ch_calloc(strlen(argv[1]) + 9, sizeof(char));
76 if (li->url != NULL) {
77 strcpy(li->url, "ldap://");
78 strcat(li->url, argv[1]);
82 /* URI of server to query (preferred over "server" directive) */
83 } else if ( strcasecmp( argv[0], "uri" ) == 0 ) {
86 "%s: line %d: missing address in \"uri <address>\" line\n",
92 li->url = ch_strdup(argv[1]);
94 /* name to use for ldap_back_group */
95 } else if ( strcasecmp( argv[0], "binddn" ) == 0 ) {
98 "%s: line %d: missing name in \"binddn <name>\" line\n",
102 li->binddn = ch_strdup(argv[1]);
104 /* password to use for ldap_back_group */
105 } else if ( strcasecmp( argv[0], "bindpw" ) == 0 ) {
108 "%s: line %d: missing password in \"bindpw <password>\" line\n",
112 li->bindpw = ch_strdup(argv[1]);
115 } else if ( strcasecmp( argv[0], "suffixmassage" ) == 0 ) {
116 char *dn, *massaged_dn;
121 "%s: line %d: syntax is \"suffixMassage <suffix> <massaged suffix>\"\n",
126 tmp_be = select_backend( argv[1], 0 );
127 if ( tmp_be != NULL && tmp_be != be ) {
129 "%s: line %d: suffix already in use by another backend in"
130 " \"suffixMassage <suffix> <massaged suffix>\"\n",
135 tmp_be = select_backend( argv[2], 0 );
136 if ( tmp_be != NULL ) {
138 "%s: line %d: massaged suffix already in use by another backend in"
139 " \"suffixMassage <suffix> <massaged suffix>\"\n",
144 dn = ch_strdup( argv[1] );
145 charray_add( &li->suffix_massage, dn );
146 (void) dn_normalize( dn );
147 charray_add( &li->suffix_massage, dn );
149 massaged_dn = ch_strdup( argv[2] );
150 charray_add( &li->suffix_massage, massaged_dn );
151 (void) dn_normalize( massaged_dn );
152 charray_add( &li->suffix_massage, massaged_dn );
160 "%s: line %d: unknown directive \"%s\" in ldap database definition (ignored)\n",
161 fname, lineno, argv[0] );