]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/init.c
Sync with 2.x
[openldap] / libraries / libldap / init.c
index b8e23caaf2cb5d695b3b257b12eaae0c9a14c68c..a823946c7c894753d97316343df01f3cc50b1939 100644 (file)
@@ -86,8 +86,8 @@ static const struct ol_attribute {
        {1, 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},
-       {1, ATTR_TLS,           "TLS_REQCERT",  NULL,   LDAP_OPT_X_TLS_REQUIRE_CERT},
-       {1, ATTR_TLS,           "TLS_RANDFILE", NULL,   LDAP_OPT_X_TLS_RANDOM_FILE},
+       {0, ATTR_TLS,           "TLS_REQCERT",  NULL,   LDAP_OPT_X_TLS_REQUIRE_CERT},
+       {0, ATTR_TLS,           "TLS_RANDFILE", NULL,   LDAP_OPT_X_TLS_RANDOM_FILE},
 #endif
 
        {0, ATTR_NONE,          NULL,           NULL,   0}
@@ -397,7 +397,8 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
        gopts->ldo_defport = LDAP_PORT;
 
        gopts->ldo_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT;
-       gopts->ldo_rebindproc = NULL;
+       gopts->ldo_rebind_proc = NULL;
+       gopts->ldo_rebind_params = NULL;
 
        LDAP_BOOL_ZERO(gopts);
 
@@ -409,11 +410,13 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
        gopts->ldo_def_sasl_authcid = NULL;
        gopts->ldo_def_sasl_authzid = NULL;
 
-       memset( &gopts->ldo_sasl_secprops, '\0', sizeof(gopts->ldo_sasl_secprops) );
+       memset( &gopts->ldo_sasl_secprops,
+               '\0', sizeof(gopts->ldo_sasl_secprops) );
 
        gopts->ldo_sasl_secprops.max_ssf = INT_MAX;
-       gopts->ldo_sasl_secprops.maxbufsize = 65536;
-       gopts->ldo_sasl_secprops.security_flags = SASL_SEC_NOPLAINTEXT|SASL_SEC_NOANONYMOUS;
+       gopts->ldo_sasl_secprops.maxbufsize = SASL_MAX_BUFF_SIZE;
+       gopts->ldo_sasl_secprops.security_flags =
+               SASL_SEC_NOPLAINTEXT | SASL_SEC_NOANONYMOUS;
 #endif
 
 #ifdef HAVE_TLS
@@ -427,7 +430,7 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
 
 #if defined(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND) \
        || defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
-char * ldap_int_hostname = "localhost";
+char * ldap_int_hostname = NULL;
 #endif
 
 void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
@@ -438,23 +441,11 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
 
 #if defined(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND) \
        || defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
-       {
-               static char hostbuf[MAXHOSTNAMELEN+1];
-               if( gethostname( hostbuf, MAXHOSTNAMELEN ) == 0 ) {
-                       hostbuf[MAXHOSTNAMELEN] = '\0';
-                       ldap_int_hostname = hostbuf;
-               }
-       }
+       ldap_int_hostname = ldap_pvt_get_fqdn( ldap_int_hostname );
 #endif
 
        ldap_int_utils_init();
 
-#ifdef HAVE_TLS
-       ldap_pvt_tls_init();
-#endif
-
-       ldap_int_sasl_init();
-
        if ( ldap_int_tblsize == 0 )
                ldap_int_ip_init();
 
@@ -509,4 +500,6 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
        }
 
        openldap_ldap_init_w_env(gopts, NULL);
+
+       ldap_int_sasl_init();
 }