]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/init.c
Don't copy and leak user; it's an env var so just use it directly.
[openldap] / libraries / libldap / init.c
index e9c290c4d90dfa1bac9c51ed24ba0288211986e7..e05ade2d4cbb86f1c62219b9e90b1abf4e51d06e 100644 (file)
@@ -263,11 +263,11 @@ static void openldap_ldap_init_w_userconf(const char *file)
                /* we assume UNIX path syntax is used... */
 
                /* try ~/file */
-               sprintf(path, "%s/%s", home, file);
+               sprintf(path, "%s%s%s", home, LDAP_DIRSEP, file);
                openldap_ldap_init_w_conf(path, 1);
 
                /* try ~/.file */
-               sprintf(path, "%s/.%s", home, file);
+               sprintf(path, "%s%s.%s", home, LDAP_DIRSEP, file);
                openldap_ldap_init_w_conf(path, 1);
        }
 
@@ -396,6 +396,12 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
 
        LDAP_BOOL_SET(gopts, LDAP_BOOL_REFERRALS);
 
+#ifdef LDAP_CONNECTIONLESS
+       gopts->ldo_peer = NULL;
+       gopts->ldo_cldapdn = NULL;
+       gopts->ldo_is_udp = 0;
+#endif
+
 #ifdef HAVE_CYRUS_SASL
        gopts->ldo_def_sasl_mech = NULL;
        gopts->ldo_def_sasl_realm = NULL;
@@ -426,6 +432,8 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
                return;
        }
 
+       ldap_int_error_init();
+
 #if defined(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND) \
        || defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
        ldap_int_hostname = ldap_pvt_get_fqdn( ldap_int_hostname );
@@ -451,8 +459,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
                if( user == NULL ) user = getenv("LOGNAME");
 
                if( user != NULL ) {
-                       /* this value is leaked, need at_exit() handler */
-                       gopts->ldo_def_sasl_authcid = LDAP_STRDUP( user );
+                       gopts->ldo_def_sasl_authcid = user;
                }
     }
 #endif