@@ -68,7 +68,7 @@ static CONF_PARSER tls_config[] = {
6868 {"certfile" , PW_TYPE_FILENAME , offsetof(ldap_instance_t , tls_certfile ), NULL , NULL },
6969 {"keyfile" , PW_TYPE_FILENAME , offsetof(ldap_instance_t , tls_keyfile ), NULL , NULL }, // OK if it changes on HUP
7070 {"randfile" , PW_TYPE_STRING_PTR , offsetof(ldap_instance_t , tls_randfile ), NULL , NULL },
71- {"require_cert" , PW_TYPE_STRING_PTR , offsetof(ldap_instance_t , tls_require_cert_str ), NULL , "allow" },
71+ {"require_cert" , PW_TYPE_STRING_PTR , offsetof(ldap_instance_t , tls_require_cert_str ), NULL , NULL },
7272
7373 { NULL , -1 , 0 , NULL , NULL }
7474};
@@ -573,20 +573,22 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
573573 goto error ;
574574 }
575575
576- #ifdef LDAP_OPT_X_TLS_NEVER
577- /*
578- * Convert cert strictness to enumerated constants
579- */
580- inst -> tls_require_cert = fr_str2int (ldap_tls_require_cert , inst -> tls_require_cert_str , -1 );
581- if (inst -> tls_require_cert < 0 ) {
582- LDAP_ERR ("Invalid 'tls.require_cert' value \"%s\", expected 'never', 'demand', 'allow', 'try' or 'hard'" ,
583- inst -> tls_require_cert_str );
584- goto error ;
585- }
576+ if (inst -> tls_require_cert_str ) {
577+ #ifdef LDAP_OPT_X_TLS_NEVER
578+ /*
579+ * Convert cert strictness to enumerated constants
580+ */
581+ inst -> tls_require_cert = fr_str2int (ldap_tls_require_cert , inst -> tls_require_cert_str , -1 );
582+ if (inst -> tls_require_cert < 0 ) {
583+ LDAP_ERR ("Invalid 'tls.require_cert' value \"%s\", expected 'never', 'demand', 'allow', "
584+ "'try' or 'hard'" , inst -> tls_require_cert_str );
585+ goto error ;
586+ }
586587#else
587- LDAP_DBGW ("Modifying 'tls.require_cert' is not supported by current version of libldap. Please upgrade libldap "
588- "and rebuild this module" );
588+ LDAP_DBGW ("Modifying 'tls.require_cert' is not supported by current version of libldap.
589+ " Please upgrade libldap and rebuild this module ");
589590#endif
591+ }
590592 /*
591593 * Build the attribute map
592594 */
0 commit comments