2 * Copyright 1999, Dmitry Kovalev <mit@openldap.org>, All rights reserved.
4 * Redistribution and use in source and binary forms are permitted only
5 * as authorized by the OpenLDAP Public License. A copy of this
6 * license is available at http://www.OpenLDAP.org/license.html or
7 * in file LICENSE in the top-level directory of the distribution.
16 #include <sys/types.h>
29 backsql_info *si = (backsql_info *)be->be_private;
31 Debug( LDAP_DEBUG_TRACE, "==>backsql_db_config()\n", 0, 0, 0 );
34 if ( !strcasecmp( argv[ 0 ], "dbhost" ) ) {
36 Debug( LDAP_DEBUG_TRACE,
37 "<==backsql_db_config (%s line %d): "
38 "missing hostname in dbhost directive\n",
42 si->dbhost = ch_strdup( argv[ 1 ] );
43 Debug( LDAP_DEBUG_TRACE,
44 "<==backsql_db_config(): hostname=%s\n",
47 } else if ( !strcasecmp( argv[ 0 ], "dbuser" ) ) {
49 Debug( LDAP_DEBUG_TRACE,
50 "<==backsql_db_config (%s line %d): "
51 "missing username in dbuser directive\n",
55 si->dbuser = ch_strdup( argv[ 1 ] );
56 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): dbuser=%s\n",
59 } else if ( !strcasecmp( argv[ 0 ], "dbpasswd" ) ) {
61 Debug( LDAP_DEBUG_TRACE,
62 "<==backsql_db_config (%s line %d): "
63 "missing password in dbpasswd directive\n",
67 si->dbpasswd = ch_strdup( argv[ 1 ] );
68 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
69 "dbpasswd=%s\n", /* si->dbpasswd */ "xxxx", 0, 0 );
71 } else if ( !strcasecmp( argv[ 0 ], "dbname" ) ) {
73 Debug( LDAP_DEBUG_TRACE,
74 "<==backsql_db_config (%s line %d): "
75 "missing database name in dbname directive\n",
79 si->dbname = ch_strdup( argv[ 1 ] );
80 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): dbname=%s\n",
83 } else if ( !strcasecmp( argv[ 0 ], "subtree_cond" ) ) {
85 Debug( LDAP_DEBUG_TRACE,
86 "<==backsql_db_config (%s line %d): "
87 "missing SQL condition "
88 "in subtree_cond directive\n",
92 si->subtree_cond = ch_strdup( argv[ 1 ] );
93 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
94 "subtree_cond=%s\n", si->subtree_cond, 0, 0 );
96 } else if ( !strcasecmp( argv[ 0 ], "oc_query" ) ) {
98 Debug( LDAP_DEBUG_TRACE,
99 "<==backsql_db_config (%s line %d): "
100 "missing SQL statement "
101 "in oc_query directive\n",
105 si->oc_query = ch_strdup( argv[ 1 ] );
106 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
107 "oc_query=%s\n", si->oc_query, 0, 0 );
109 } else if ( !strcasecmp( argv[ 0 ], "at_query" ) ) {
111 Debug( LDAP_DEBUG_TRACE,
112 "<==backsql_db_config (%s line %d): "
113 "missing SQL statement "
114 "in at_query directive\n",
118 si->at_query = ch_strdup( argv[ 1 ] );
119 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
120 "at_query=%s\n", si->at_query, 0, 0 );
122 } else if ( !strcasecmp( argv[ 0 ], "insentry_query" ) ) {
124 Debug( LDAP_DEBUG_TRACE,
125 "<==backsql_db_config (%s line %d): "
126 "missing SQL statement "
127 "in insentry_query directive\n",
131 si->insentry_query = ch_strdup( argv[ 1 ] );
132 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
133 "insentry_query=%s\n", si->insentry_query, 0, 0 );
135 } else if ( !strcasecmp( argv[ 0 ], "upper_func" ) ) {
137 Debug( LDAP_DEBUG_TRACE,
138 "<==backsql_db_config (%s line %d): "
139 "missing function name "
140 "in upper_func directive\n",
144 si->upper_func = ch_strdup( argv[ 1 ] );
145 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
146 "upper_func=%s\n", si->upper_func, 0, 0 );
148 } else if ( !strcasecmp( argv[ 0 ], "strcast_func" ) ) {
150 Debug( LDAP_DEBUG_TRACE,
151 "<==backsql_db_config (%s line %d): "
152 "missing function name "
153 "in strcast_func directive\n",
157 si->strcast_func = ch_strdup( argv[ 1 ] );
158 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
159 "strcast_func=%s\n", si->strcast_func, 0, 0 );
161 } else if ( !strcasecmp( argv[ 0 ], "delentry_query" ) ) {
163 Debug( LDAP_DEBUG_TRACE,
164 "<==backsql_db_config (%s line %d): "
165 "missing SQL statement "
166 "in delentry_query directive\n",
170 si->delentry_query = ch_strdup( argv[ 1 ] );
171 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
172 "delentry_query=%s\n", si->delentry_query, 0, 0 );
174 } else if ( !strcasecmp( argv[ 0 ], "has_ldapinfo_dn_ru") ) {
176 Debug( LDAP_DEBUG_TRACE,
177 "<==backsql_db_config (%s line %d): "
178 "missing { yes | no }"
179 "in has_ldapinfo_dn_ru directive\n",
184 if ( strcasecmp( argv[ 1 ], "yes" ) == 0 ) {
185 si->has_ldapinfo_dn_ru = 1;
186 } else if ( strcasecmp( argv[ 1 ], "no" ) == 0 ) {
187 si->has_ldapinfo_dn_ru = 0;
189 Debug( LDAP_DEBUG_TRACE,
190 "<==backsql_db_config (%s line %d): "
191 "has_ldapinfo_dn_ru directive arg "
192 "must be \"yes\" or \"no\"\n",
197 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
198 "has_ldapinfo_dn_ru=%s\n",
199 si->has_ldapinfo_dn_ru == 0 ? "no" : "yes", 0, 0 );
202 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config (%s line %d): "
203 "unknown directive '%s' (ignored)\n",
204 fname, lineno, argv[ 0 ] );
210 #endif /* SLAPD_SQL */