1999-09-09 03:06:24 +08:00
|
|
|
/* $OpenLDAP$ */
|
1998-12-29 04:53:15 +08:00
|
|
|
/*
|
|
|
|
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
|
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
1998-11-04 09:41:00 +08:00
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
1999-06-03 08:37:44 +08:00
|
|
|
#include <ac/stdlib.h>
|
1998-11-04 09:41:00 +08:00
|
|
|
|
|
|
|
#include <ac/socket.h>
|
|
|
|
#include <ac/string.h>
|
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern
definition, for error checking. Retyped a number of functions, usually
to return void. Fixed a number of printf format errors.
API changes (in ldap/include):
Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo
for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h.
A number of `extern' declarations are left (some added by protoize), to
be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind,
optarg, errno.
1998-11-16 06:40:11 +08:00
|
|
|
#include <ac/ctype.h>
|
1998-11-04 09:41:00 +08:00
|
|
|
#include <ac/time.h>
|
|
|
|
|
|
|
|
#include "ldap-int.h"
|
1999-06-17 11:54:25 +08:00
|
|
|
#include "ldap_defaults.h"
|
1998-11-04 09:41:00 +08:00
|
|
|
|
1999-05-29 03:33:05 +08:00
|
|
|
struct ldapoptions ldap_int_global_options =
|
|
|
|
{ LDAP_UNINITIALIZED, LDAP_DEBUG_NONE };
|
1998-11-10 07:02:27 +08:00
|
|
|
|
|
|
|
#undef gopts
|
1999-05-29 03:33:05 +08:00
|
|
|
#define gopts ldap_int_global_options
|
1998-11-04 09:41:00 +08:00
|
|
|
|
1998-11-11 07:37:30 +08:00
|
|
|
#define ATTR_NONE 0
|
|
|
|
#define ATTR_BOOL 1
|
|
|
|
#define ATTR_INT 2
|
|
|
|
#define ATTR_KV 3
|
|
|
|
#define ATTR_STRING 4
|
1999-07-14 03:30:41 +08:00
|
|
|
#define ATTR_TLS 5
|
1999-12-10 06:17:08 +08:00
|
|
|
#define ATTR_URIS 6
|
1998-11-11 07:37:30 +08:00
|
|
|
|
|
|
|
struct ol_keyvalue {
|
1999-03-09 16:40:36 +08:00
|
|
|
const char * key;
|
1998-11-11 07:37:30 +08:00
|
|
|
int value;
|
|
|
|
};
|
|
|
|
|
1999-03-09 16:40:36 +08:00
|
|
|
static const struct ol_keyvalue deref_kv[] = {
|
1998-11-11 07:37:30 +08:00
|
|
|
{"never", LDAP_DEREF_NEVER},
|
|
|
|
{"searching", LDAP_DEREF_SEARCHING},
|
|
|
|
{"finding", LDAP_DEREF_FINDING},
|
|
|
|
{"always", LDAP_DEREF_ALWAYS},
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
1999-03-09 16:40:36 +08:00
|
|
|
static const struct ol_attribute {
|
1999-12-14 10:26:37 +08:00
|
|
|
int useronly;
|
1998-11-11 07:37:30 +08:00
|
|
|
int type;
|
1999-03-09 16:40:36 +08:00
|
|
|
const char * name;
|
|
|
|
const void * data;
|
1998-11-11 07:37:30 +08:00
|
|
|
size_t offset;
|
|
|
|
} attrs[] = {
|
1999-12-14 10:26:37 +08:00
|
|
|
{0, ATTR_KV, "DEREF", deref_kv, /* or &deref_kv[0] */
|
1998-11-11 07:37:30 +08:00
|
|
|
offsetof(struct ldapoptions, ldo_deref)},
|
1999-12-14 10:26:37 +08:00
|
|
|
{0, ATTR_INT, "SIZELIMIT", NULL,
|
1998-11-11 07:37:30 +08:00
|
|
|
offsetof(struct ldapoptions, ldo_sizelimit)},
|
1999-12-14 10:26:37 +08:00
|
|
|
{0, ATTR_INT, "TIMELIMIT", NULL,
|
1998-11-11 07:37:30 +08:00
|
|
|
offsetof(struct ldapoptions, ldo_timelimit)},
|
1999-12-17 11:27:16 +08:00
|
|
|
{1, ATTR_STRING, "BINDDN", NULL,
|
|
|
|
offsetof(struct ldapoptions, ldo_defbinddn)},
|
1999-12-14 10:26:37 +08:00
|
|
|
{0, ATTR_STRING, "BASE", NULL,
|
1998-11-11 07:37:30 +08:00
|
|
|
offsetof(struct ldapoptions, ldo_defbase)},
|
1999-12-14 10:26:37 +08:00
|
|
|
{0, ATTR_INT, "PORT", NULL,
|
1998-11-11 07:37:30 +08:00
|
|
|
offsetof(struct ldapoptions, ldo_defport)},
|
1999-12-08 02:42:25 +08:00
|
|
|
/* **** keep this around for backward compatibility */
|
1999-12-14 10:26:37 +08:00
|
|
|
{0, ATTR_URIS, "HOST", NULL, 1},
|
1999-12-08 02:42:25 +08:00
|
|
|
/* **** */
|
1999-12-14 10:26:37 +08:00
|
|
|
{0, ATTR_URIS, "URI", NULL, 0},
|
|
|
|
{0, ATTR_BOOL, "REFERRALS", NULL, LDAP_BOOL_REFERRALS},
|
|
|
|
{0, ATTR_BOOL, "RESTART", NULL, LDAP_BOOL_RESTART},
|
|
|
|
{0, ATTR_BOOL, "DNS", NULL, LDAP_BOOL_DNS},
|
|
|
|
{0, ATTR_TLS, "TLS", NULL, LDAP_OPT_X_TLS},
|
|
|
|
{0, ATTR_TLS, "TLS_CERT", NULL, LDAP_OPT_X_TLS_CERTFILE},
|
|
|
|
{0, ATTR_TLS, "TLS_KEY", NULL, LDAP_OPT_X_TLS_KEYFILE},
|
|
|
|
{0, ATTR_TLS, "TLS_CACERT", NULL, LDAP_OPT_X_TLS_CACERTFILE},
|
|
|
|
{0, ATTR_TLS, "TLS_CACERTDIR",NULL, LDAP_OPT_X_TLS_CACERTDIR},
|
|
|
|
{0, ATTR_TLS, "TLS_REQCERT", NULL, LDAP_OPT_X_TLS_REQUIRE_CERT},
|
|
|
|
{0, ATTR_NONE, NULL, NULL, 0}
|
1998-11-11 07:37:30 +08:00
|
|
|
};
|
|
|
|
|
1999-07-14 03:30:41 +08:00
|
|
|
#define MAX_LDAP_ATTR_LEN sizeof("TLS_CACERTDIR")
|
1998-11-11 07:37:30 +08:00
|
|
|
#define MAX_LDAP_ENV_PREFIX_LEN 8
|
|
|
|
|
1999-12-14 10:26:37 +08:00
|
|
|
static void openldap_ldap_init_w_conf(
|
|
|
|
const char *file, int userconf )
|
1998-11-11 07:37:30 +08:00
|
|
|
{
|
|
|
|
char linebuf[128];
|
|
|
|
FILE *fp;
|
|
|
|
int i;
|
|
|
|
char *cmd, *opt;
|
|
|
|
char *start, *end;
|
|
|
|
|
1998-11-23 11:03:06 +08:00
|
|
|
if (file == NULL) {
|
|
|
|
/* no file name */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-11-11 07:37:30 +08:00
|
|
|
fp = fopen(file, "r");
|
|
|
|
if(fp == NULL) {
|
|
|
|
/* could not open file */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while((start = fgets(linebuf, sizeof(linebuf), fp)) != NULL) {
|
|
|
|
/* skip lines starting with '#' */
|
|
|
|
if(*start == '#') continue;
|
|
|
|
|
|
|
|
/* trim leading white space */
|
1999-02-23 01:57:22 +08:00
|
|
|
while((*start != '\0') && isspace((unsigned char) *start))
|
|
|
|
start++;
|
1998-11-11 07:37:30 +08:00
|
|
|
|
|
|
|
/* anything left? */
|
|
|
|
if(*start == '\0') continue;
|
|
|
|
|
|
|
|
/* trim trailing white space */
|
|
|
|
end = &start[strlen(start)-1];
|
1999-02-23 01:57:22 +08:00
|
|
|
while(isspace((unsigned char)*end)) end--;
|
1998-11-11 07:37:30 +08:00
|
|
|
end[1] = '\0';
|
|
|
|
|
|
|
|
/* anything left? */
|
|
|
|
if(*start == '\0') continue;
|
|
|
|
|
|
|
|
|
|
|
|
/* parse the command */
|
|
|
|
cmd=start;
|
1999-02-23 01:57:22 +08:00
|
|
|
while((*start != '\0') && !isspace((unsigned char)*start)) {
|
1998-11-11 07:37:30 +08:00
|
|
|
start++;
|
|
|
|
}
|
|
|
|
if(*start == '\0') {
|
|
|
|
/* command has no argument */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
*start++ = '\0';
|
|
|
|
|
|
|
|
/* we must have some non-whitespace to skip */
|
1999-02-23 01:57:22 +08:00
|
|
|
while(isspace((unsigned char)*start)) start++;
|
1998-11-11 07:37:30 +08:00
|
|
|
opt = start;
|
|
|
|
|
|
|
|
for(i=0; attrs[i].type != ATTR_NONE; i++) {
|
|
|
|
void *p;
|
|
|
|
|
1999-12-14 10:26:37 +08:00
|
|
|
if( !userconf && !attrs[i].useronly ) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
1998-11-11 07:37:30 +08:00
|
|
|
if(strcasecmp(cmd, attrs[i].name) != 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(attrs[i].type) {
|
|
|
|
case ATTR_BOOL:
|
|
|
|
if((strcasecmp(opt, "on") == 0)
|
|
|
|
|| (strcasecmp(opt, "yes") == 0)
|
|
|
|
|| (strcasecmp(opt, "true") == 0))
|
|
|
|
{
|
1999-03-07 02:31:19 +08:00
|
|
|
LDAP_BOOL_SET(&gopts, attrs[i].offset);
|
1998-11-11 07:37:30 +08:00
|
|
|
|
|
|
|
} else {
|
1999-03-07 02:31:19 +08:00
|
|
|
LDAP_BOOL_CLR(&gopts, attrs[i].offset);
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ATTR_INT:
|
1999-03-07 02:31:19 +08:00
|
|
|
p = &((char *) &gopts)[attrs[i].offset];
|
1998-11-11 07:37:30 +08:00
|
|
|
* (int*) p = atoi(opt);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ATTR_KV: {
|
1999-03-09 16:40:36 +08:00
|
|
|
const struct ol_keyvalue *kv;
|
1998-11-11 07:37:30 +08:00
|
|
|
|
1999-03-09 16:40:36 +08:00
|
|
|
for(kv = attrs[i].data;
|
1998-11-11 07:37:30 +08:00
|
|
|
kv->key != NULL;
|
|
|
|
kv++) {
|
|
|
|
|
|
|
|
if(strcasecmp(opt, kv->key) == 0) {
|
1999-03-07 02:31:19 +08:00
|
|
|
p = &((char *) &gopts)[attrs[i].offset];
|
1998-11-11 07:37:30 +08:00
|
|
|
* (int*) p = kv->value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ATTR_STRING:
|
1999-03-07 02:31:19 +08:00
|
|
|
p = &((char *) &gopts)[attrs[i].offset];
|
1999-05-29 09:19:14 +08:00
|
|
|
if (* (char**) p != NULL) LDAP_FREE(* (char**) p);
|
1999-06-03 06:28:22 +08:00
|
|
|
* (char**) p = LDAP_STRDUP(opt);
|
1998-11-11 07:37:30 +08:00
|
|
|
break;
|
1999-07-14 03:30:41 +08:00
|
|
|
case ATTR_TLS:
|
|
|
|
#ifdef HAVE_TLS
|
|
|
|
ldap_pvt_tls_config( &gopts, attrs[i].offset, opt );
|
|
|
|
#endif
|
|
|
|
break;
|
1999-12-10 06:17:08 +08:00
|
|
|
case ATTR_URIS:
|
1999-12-08 02:42:25 +08:00
|
|
|
if (attrs[i].offset == 0) {
|
|
|
|
ldap_set_option( NULL, LDAP_OPT_URI, opt );
|
|
|
|
} else {
|
|
|
|
ldap_set_option( NULL, LDAP_OPT_HOST_NAME, opt );
|
|
|
|
}
|
|
|
|
break;
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-03-26 06:19:42 +08:00
|
|
|
|
|
|
|
fclose(fp);
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
|
1999-12-14 10:26:37 +08:00
|
|
|
static void openldap_ldap_init_w_sysconf(const char *file)
|
|
|
|
{
|
|
|
|
openldap_ldap_init_w_conf( file, 0 );
|
|
|
|
}
|
|
|
|
|
1998-11-11 07:37:30 +08:00
|
|
|
static void openldap_ldap_init_w_userconf(const char *file)
|
|
|
|
{
|
1998-11-23 11:03:06 +08:00
|
|
|
char *home;
|
1998-11-11 13:50:51 +08:00
|
|
|
char *path;
|
1998-11-23 11:03:06 +08:00
|
|
|
|
|
|
|
if (file == NULL) {
|
|
|
|
/* no file name */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
home = getenv("HOME");
|
|
|
|
|
1998-11-11 13:50:51 +08:00
|
|
|
if (home != NULL) {
|
1999-05-29 09:19:14 +08:00
|
|
|
path = LDAP_MALLOC(strlen(home) + strlen(file) + 3);
|
1998-11-11 13:50:51 +08:00
|
|
|
} else {
|
1999-05-29 09:19:14 +08:00
|
|
|
path = LDAP_MALLOC(strlen(file) + 3);
|
1998-11-11 13:50:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if(home != NULL && path != NULL) {
|
1998-11-23 11:03:06 +08:00
|
|
|
/* we assume UNIX path syntax is used... */
|
|
|
|
|
1998-11-11 13:50:51 +08:00
|
|
|
/* try ~/file */
|
|
|
|
sprintf(path, "%s/%s", home, file);
|
1999-12-14 10:26:37 +08:00
|
|
|
openldap_ldap_init_w_conf(path, 1);
|
1998-11-11 07:37:30 +08:00
|
|
|
|
1998-11-11 13:50:51 +08:00
|
|
|
/* try ~/.file */
|
|
|
|
sprintf(path, "%s/.%s", home, file);
|
1999-12-14 10:26:37 +08:00
|
|
|
openldap_ldap_init_w_conf(path, 1);
|
1998-11-11 13:50:51 +08:00
|
|
|
}
|
1998-11-23 11:03:06 +08:00
|
|
|
|
|
|
|
if(path != NULL) {
|
1999-05-29 09:19:14 +08:00
|
|
|
LDAP_FREE(path);
|
1998-11-23 11:03:06 +08:00
|
|
|
}
|
1998-11-11 07:37:30 +08:00
|
|
|
|
|
|
|
/* try file */
|
1999-12-14 10:26:37 +08:00
|
|
|
openldap_ldap_init_w_conf(file, 1);
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void openldap_ldap_init_w_env(const char *prefix)
|
|
|
|
{
|
|
|
|
char buf[MAX_LDAP_ATTR_LEN+MAX_LDAP_ENV_PREFIX_LEN];
|
|
|
|
int len;
|
|
|
|
int i;
|
|
|
|
void *p;
|
|
|
|
char *value;
|
|
|
|
|
|
|
|
if (prefix == NULL) {
|
1999-06-17 11:54:25 +08:00
|
|
|
prefix = LDAP_ENV_PREFIX;
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
strncpy(buf, prefix, MAX_LDAP_ENV_PREFIX_LEN);
|
|
|
|
buf[MAX_LDAP_ENV_PREFIX_LEN] = '\0';
|
|
|
|
len = strlen(buf);
|
|
|
|
|
|
|
|
for(i=0; attrs[i].type != ATTR_NONE; i++) {
|
|
|
|
strcpy(&buf[len], attrs[i].name);
|
|
|
|
value = getenv(buf);
|
|
|
|
|
|
|
|
if(value == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(attrs[i].type) {
|
|
|
|
case ATTR_BOOL:
|
|
|
|
if((strcasecmp(value, "on") == 0)
|
|
|
|
|| (strcasecmp(value, "yes") == 0)
|
|
|
|
|| (strcasecmp(value, "true") == 0))
|
|
|
|
{
|
1999-03-07 02:31:19 +08:00
|
|
|
LDAP_BOOL_SET(&gopts, attrs[i].offset);
|
1998-11-11 07:37:30 +08:00
|
|
|
|
|
|
|
} else {
|
1999-03-07 02:31:19 +08:00
|
|
|
LDAP_BOOL_CLR(&gopts, attrs[i].offset);
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ATTR_INT:
|
1999-03-07 02:31:19 +08:00
|
|
|
p = &((char *) &gopts)[attrs[i].offset];
|
1998-11-11 07:37:30 +08:00
|
|
|
* (int*) p = atoi(value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ATTR_KV: {
|
1999-03-09 16:40:36 +08:00
|
|
|
const struct ol_keyvalue *kv;
|
1998-11-11 07:37:30 +08:00
|
|
|
|
1999-03-09 16:40:36 +08:00
|
|
|
for(kv = attrs[i].data;
|
1998-11-11 07:37:30 +08:00
|
|
|
kv->key != NULL;
|
|
|
|
kv++) {
|
|
|
|
|
|
|
|
if(strcasecmp(value, kv->key) == 0) {
|
1999-03-07 02:31:19 +08:00
|
|
|
p = &((char *) &gopts)[attrs[i].offset];
|
1998-11-11 07:37:30 +08:00
|
|
|
* (int*) p = kv->value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case ATTR_STRING:
|
1999-03-07 02:31:19 +08:00
|
|
|
p = &((char *) &gopts)[attrs[i].offset];
|
1999-05-29 09:19:14 +08:00
|
|
|
if (* (char**) p != NULL) LDAP_FREE(* (char**) p);
|
1998-11-11 07:37:30 +08:00
|
|
|
if (*value == '\0') {
|
|
|
|
* (char**) p = NULL;
|
|
|
|
} else {
|
1999-06-03 06:28:22 +08:00
|
|
|
* (char**) p = LDAP_STRDUP(value);
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
break;
|
1999-07-14 03:30:41 +08:00
|
|
|
case ATTR_TLS:
|
|
|
|
#ifdef HAVE_TLS
|
1999-09-25 11:57:25 +08:00
|
|
|
ldap_pvt_tls_config( &gopts, attrs[i].offset, value );
|
1999-07-14 03:30:41 +08:00
|
|
|
#endif
|
|
|
|
break;
|
1999-12-10 06:17:08 +08:00
|
|
|
case ATTR_URIS:
|
1999-12-08 02:42:25 +08:00
|
|
|
if (attrs[i].offset == 0) {
|
|
|
|
ldap_set_option( NULL, LDAP_OPT_URI, value );
|
|
|
|
} else {
|
|
|
|
ldap_set_option( NULL, LDAP_OPT_HOST_NAME, value );
|
|
|
|
}
|
|
|
|
break;
|
1998-11-11 07:37:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-05-29 03:33:05 +08:00
|
|
|
void ldap_int_initialize( void )
|
1998-11-04 09:41:00 +08:00
|
|
|
{
|
1999-05-29 03:33:05 +08:00
|
|
|
if ( gopts.ldo_valid == LDAP_INITIALIZED ) {
|
1998-11-04 09:41:00 +08:00
|
|
|
return;
|
|
|
|
}
|
1999-01-26 08:27:51 +08:00
|
|
|
|
1999-05-28 06:25:55 +08:00
|
|
|
ldap_int_utils_init();
|
1999-07-14 03:30:41 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_TLS
|
|
|
|
ldap_pvt_tls_init();
|
|
|
|
#endif
|
|
|
|
|
1999-07-13 14:21:14 +08:00
|
|
|
if ( ldap_int_tblsize == 0 )
|
|
|
|
ldap_int_ip_init();
|
1999-01-26 08:27:51 +08:00
|
|
|
|
1999-08-04 03:27:22 +08:00
|
|
|
gopts.ldo_debug = 0;
|
|
|
|
|
1998-11-10 07:02:27 +08:00
|
|
|
gopts.ldo_version = LDAP_VERSION2;
|
|
|
|
gopts.ldo_deref = LDAP_DEREF_NEVER;
|
|
|
|
gopts.ldo_timelimit = LDAP_NO_LIMIT;
|
|
|
|
gopts.ldo_sizelimit = LDAP_NO_LIMIT;
|
|
|
|
|
1999-08-04 03:27:22 +08:00
|
|
|
gopts.ldo_tm_api = (struct timeval *)NULL;
|
|
|
|
gopts.ldo_tm_net = (struct timeval *)NULL;
|
1998-12-22 09:34:01 +08:00
|
|
|
|
1999-12-08 02:42:25 +08:00
|
|
|
ldap_url_parselist(&gopts.ldo_defludp, "ldap://localhost/");
|
1998-11-10 07:02:27 +08:00
|
|
|
gopts.ldo_defport = LDAP_PORT;
|
|
|
|
|
1998-11-11 07:37:30 +08:00
|
|
|
gopts.ldo_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT;
|
|
|
|
|
1998-11-10 07:02:27 +08:00
|
|
|
LDAP_BOOL_ZERO(&gopts);
|
|
|
|
|
|
|
|
LDAP_BOOL_SET(&gopts, LDAP_BOOL_REFERRALS);
|
|
|
|
|
1999-07-14 03:30:41 +08:00
|
|
|
#ifdef HAVE_TLS
|
|
|
|
gopts.ldo_tls_ctx = NULL;
|
|
|
|
#endif
|
|
|
|
|
1999-05-29 03:33:05 +08:00
|
|
|
gopts.ldo_valid = LDAP_INITIALIZED;
|
1999-01-14 14:28:50 +08:00
|
|
|
|
|
|
|
if( getenv("LDAPNOINIT") != NULL ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-12-14 10:26:37 +08:00
|
|
|
openldap_ldap_init_w_sysconf(LDAP_CONF_FILE);
|
1999-06-17 11:54:25 +08:00
|
|
|
openldap_ldap_init_w_userconf(LDAP_USERRC_FILE);
|
1998-11-19 11:55:56 +08:00
|
|
|
|
|
|
|
{
|
1999-06-17 11:54:25 +08:00
|
|
|
char *altfile = getenv(LDAP_ENV_PREFIX "CONF");
|
1998-11-19 11:55:56 +08:00
|
|
|
|
|
|
|
if( altfile != NULL ) {
|
1999-12-14 10:26:37 +08:00
|
|
|
openldap_ldap_init_w_sysconf( altfile );
|
1998-11-19 11:55:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-15 07:04:08 +08:00
|
|
|
{
|
1999-06-17 11:54:25 +08:00
|
|
|
char *altfile = getenv(LDAP_ENV_PREFIX "RC");
|
1999-01-15 07:04:08 +08:00
|
|
|
|
|
|
|
if( altfile != NULL ) {
|
|
|
|
openldap_ldap_init_w_userconf( altfile );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-11 07:37:30 +08:00
|
|
|
openldap_ldap_init_w_env(NULL);
|
1998-11-04 09:41:00 +08:00
|
|
|
}
|