From 8a6547943fc56a9b08b079b11cfaa6579b4eb011 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Jan 2011 18:42:21 -0500 Subject: Do not try to dereference bindpw if it is null Fixes: https://fedorahosted.org/freeipa/ticket/783 --- ipa-client/ipa-join.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ipa-client/ipa-join.c') diff --git a/ipa-client/ipa-join.c b/ipa-client/ipa-join.c index d23348954..86b1bd122 100644 --- a/ipa-client/ipa-join.c +++ b/ipa-client/ipa-join.c @@ -213,8 +213,13 @@ connect_ldap(const char *hostname, const char *binddn, const char *bindpw) { goto fail; } - bindpw_bv.bv_val = discard_const(bindpw); - bindpw_bv.bv_len = strlen(bindpw); + if (bindpw) { + bindpw_bv.bv_val = discard_const(bindpw); + bindpw_bv.bv_len = strlen(bindpw); + } else { + bindpw_bv.bv_val = NULL; + bindpw_bv.bv_len = 0; + } ret = ldap_sasl_bind_s(ld, binddn, LDAP_SASL_SIMPLE, &bindpw_bv, NULL, NULL, NULL); -- cgit