]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/init.c
rename ldap_pvt_init_utils() to ldap_int_utils_init() and provide
[openldap] / libraries / libldap / init.c
index 8e31c25b0b70fb21282176fbeb0c07a63f305ada..8c22855fd85f97472ec2463001687bb3ad8f8dbc 100644 (file)
@@ -29,11 +29,11 @@ int openldap_ldap_initialized = 0;
 #define ATTR_STRING    4
 
 struct ol_keyvalue {
-       char*           key;
+       const char *            key;
        int                     value;
 };
 
-static struct ol_keyvalue deref_kv[] = {
+static const struct ol_keyvalue deref_kv[] = {
        {"never", LDAP_DEREF_NEVER},
        {"searching", LDAP_DEREF_SEARCHING},
        {"finding", LDAP_DEREF_FINDING},
@@ -41,10 +41,10 @@ static struct ol_keyvalue deref_kv[] = {
        {NULL, 0}
 };
 
-static struct ol_attribute {
+static const struct ol_attribute {
        int                     type;
-       char*           name;
-       void*           data;
+       const char *    name;
+       const void *    data;
        size_t          offset;
 } attrs[] = {
        {ATTR_KV,               "DEREF",        deref_kv, /* or &deref_kv[0] */
@@ -150,9 +150,9 @@ static void openldap_ldap_init_w_conf(const char *file)
                                break;
 
                        case ATTR_KV: {
-                                       struct ol_keyvalue *kv;
+                                       const struct ol_keyvalue *kv;
 
-                                       for(kv = (struct ol_keyvalue *) attrs[i].data;
+                                       for(kv = attrs[i].data;
                                                kv->key != NULL;
                                                kv++) {
 
@@ -172,6 +172,8 @@ static void openldap_ldap_init_w_conf(const char *file)
                        }
                }
        }
+
+       fclose(fp);
 }
 
 static void openldap_ldap_init_w_userconf(const char *file)
@@ -255,9 +257,9 @@ static void openldap_ldap_init_w_env(const char *prefix)
                        break;
 
                case ATTR_KV: {
-                               struct ol_keyvalue *kv;
+                               const struct ol_keyvalue *kv;
 
-                               for(kv = (struct ol_keyvalue *) attrs[i].data;
+                               for(kv = attrs[i].data;
                                        kv->key != NULL;
                                        kv++) {
 
@@ -288,7 +290,7 @@ void openldap_ldap_initialize( void )
                return;
        }
 
-       ldap_pvt_init_utils();
+       ldap_int_utils_init();
 
        gopts.ldo_version =     LDAP_VERSION2;
        gopts.ldo_deref =       LDAP_DEREF_NEVER;
@@ -304,10 +306,7 @@ void openldap_ldap_initialize( void )
 
        LDAP_BOOL_ZERO(&gopts);
 
-#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || \
-       LDAP_VERSION_MAX > LDAP_VERSION2
        LDAP_BOOL_SET(&gopts, LDAP_BOOL_REFERRALS);
-#endif
 
        openldap_ldap_initialized = 1;