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>
21 int backsql_db_config(BackendDB *be,const char *fname,int lineno,int argc,char **argv)
23 backsql_info *si=(backsql_info*) be->be_private;
25 Debug(LDAP_DEBUG_TRACE,"==>backsql_db_config()\n",0,0,0);
28 Debug(LDAP_DEBUG_TRACE,"backsql_db_config: be_private is NULL!!!\n",0,0,0);
32 if (!strcasecmp(argv[0],"dbhost"))
36 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing hostname in dbhost directive\n",
41 si->dbhost=ch_strdup(argv[1]);
42 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): hostname=%s\n",si->dbhost,0,0);
47 if (!strcasecmp(argv[0],"dbuser"))
51 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing username in dbuser directive\n",
56 si->dbuser=ch_strdup(argv[1]);
57 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): dbuser=%s\n",argv[1],0,0);
62 if (!strcasecmp(argv[0],"dbpasswd"))
66 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing password in dbpasswd directive\n",
71 si->dbpasswd=ch_strdup(argv[1]);
72 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): dbpasswd=%s\n",si->dbpasswd,0,0);
77 if (!strcasecmp(argv[0],"dbname"))
81 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing database name in dbname directive\n",
86 si->dbname=ch_strdup(argv[1]);
87 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): dbname=%s\n",si->dbname,0,0);
92 if (!strcasecmp(argv[0],"subtree_cond"))
96 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing SQL condition in subtree_cond directive\n",
101 si->subtree_cond=ch_strdup(argv[1]);
102 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): subtree_cond=%s\n",si->subtree_cond,0,0);
107 if (!strcasecmp(argv[0],"oc_query"))
111 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing SQL statement in oc_query directive\n",
116 si->oc_query=ch_strdup(argv[1]);
117 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): oc_query=%s\n",si->oc_query,0,0);
122 if (!strcasecmp(argv[0],"at_query"))
126 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing SQL statement in at_query directive\n",
131 si->at_query=ch_strdup(argv[1]);
132 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): at_query=%s\n",si->at_query,0,0);
137 if (!strcasecmp(argv[0],"insentry_query"))
141 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing SQL statement in insentry_query directive\n",
146 si->insentry_query=ch_strdup(argv[1]);
147 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): insentry_query=%s\n",si->insentry_query,0,0);
152 if (!strcasecmp(argv[0],"upper_func"))
156 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing function name in upper_func directive\n",
161 si->upper_func=ch_strdup(argv[1]);
162 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): upper_func=%s\n",si->upper_func,0,0);
167 if (!strcasecmp(argv[0],"delentry_query"))
171 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): missing SQL statement in delentry_query directive\n",
176 si->delentry_query=ch_strdup(argv[1]);
177 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config(): delentry_query=%s\n",si->delentry_query,0,0);
182 Debug(LDAP_DEBUG_TRACE,"<==backsql_db_config (%s line %d): unknown directive '%s' (ignored)\n",
183 fname,lineno,argv[0]);
187 #endif /* SLAPD_SQL */