|
|
adf540 |
allow unsetting of tls_* syncrepl options
|
|
|
adf540 |
|
|
|
adf540 |
Author: Patrick Monnerat <pm@datasphere.ch>
|
|
|
adf540 |
Upstream ITS: #7042
|
|
|
adf540 |
Resolves: #734187
|
|
|
adf540 |
|
|
|
adf540 |
diff --git a/libraries/libldap/tls2.c b/libraries/libldap/tls2.c
|
|
|
adf540 |
index 654a4bf..10b993b 100644
|
|
|
adf540 |
--- a/libraries/libldap/tls2.c
|
|
|
adf540 |
+++ b/libraries/libldap/tls2.c
|
|
|
adf540 |
@@ -735,27 +735,27 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg )
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_CACERTFILE:
|
|
|
adf540 |
if ( lo->ldo_tls_cacertfile ) LDAP_FREE( lo->ldo_tls_cacertfile );
|
|
|
adf540 |
- lo->ldo_tls_cacertfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_cacertfile = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_CACERTDIR:
|
|
|
adf540 |
if ( lo->ldo_tls_cacertdir ) LDAP_FREE( lo->ldo_tls_cacertdir );
|
|
|
adf540 |
- lo->ldo_tls_cacertdir = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_cacertdir = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_CERTFILE:
|
|
|
adf540 |
if ( lo->ldo_tls_certfile ) LDAP_FREE( lo->ldo_tls_certfile );
|
|
|
adf540 |
- lo->ldo_tls_certfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_certfile = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_KEYFILE:
|
|
|
adf540 |
if ( lo->ldo_tls_keyfile ) LDAP_FREE( lo->ldo_tls_keyfile );
|
|
|
adf540 |
- lo->ldo_tls_keyfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_keyfile = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_DHFILE:
|
|
|
adf540 |
if ( lo->ldo_tls_dhfile ) LDAP_FREE( lo->ldo_tls_dhfile );
|
|
|
adf540 |
- lo->ldo_tls_dhfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_dhfile = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_CRLFILE: /* GnuTLS only */
|
|
|
adf540 |
if ( lo->ldo_tls_crlfile ) LDAP_FREE( lo->ldo_tls_crlfile );
|
|
|
adf540 |
- lo->ldo_tls_crlfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_crlfile = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_REQUIRE_CERT:
|
|
|
adf540 |
if ( !arg ) return -1;
|
|
|
adf540 |
@@ -783,7 +783,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg )
|
|
|
adf540 |
#endif
|
|
|
adf540 |
case LDAP_OPT_X_TLS_CIPHER_SUITE:
|
|
|
adf540 |
if ( lo->ldo_tls_ciphersuite ) LDAP_FREE( lo->ldo_tls_ciphersuite );
|
|
|
adf540 |
- lo->ldo_tls_ciphersuite = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_ciphersuite = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
return 0;
|
|
|
adf540 |
|
|
|
adf540 |
case LDAP_OPT_X_TLS_PROTOCOL_MIN:
|
|
|
adf540 |
@@ -794,7 +794,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg )
|
|
|
adf540 |
if ( ld != NULL )
|
|
|
adf540 |
return -1;
|
|
|
adf540 |
if ( lo->ldo_tls_randfile ) LDAP_FREE (lo->ldo_tls_randfile );
|
|
|
adf540 |
- lo->ldo_tls_randfile = arg ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
+ lo->ldo_tls_randfile = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL;
|
|
|
adf540 |
break;
|
|
|
adf540 |
case LDAP_OPT_X_TLS_NEWCTX:
|
|
|
adf540 |
if ( !arg ) return -1;
|