From b143938b8afaa7c7759e09228cc0d92ff97121d0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 23 Dec 2008 11:27:19 -0800 Subject: Fix more asprintf errors and error code paths. Jeremy. --- source3/libads/ldap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source3/libads/ldap.c') diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index cf8a7ebb1b..a598580941 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -603,7 +603,10 @@ got_connection: /* Must use the userPrincipalName value here or sAMAccountName and not servicePrincipalName; found by Guenther Deschner */ - asprintf(&ads->auth.user_name, "%s$", global_myname() ); + if (asprintf(&ads->auth.user_name, "%s$", global_myname() ) == -1) { + DEBUG(0,("ads_connect: asprintf fail.\n")); + ads->auth.user_name = NULL; + } } if (!ads->auth.realm) { @@ -619,10 +622,11 @@ got_connection: /* this is a really nasty hack to avoid ADS DNS problems. It needs a patch to MIT kerberos to work (tridge) */ { - char *env; - asprintf(&env, "KRB5_KDC_ADDRESS_%s", ads->config.realm); - setenv(env, ads->auth.kdc_server, 1); - free(env); + char *env = NULL; + if (asprintf(&env, "KRB5_KDC_ADDRESS_%s", ads->config.realm) > 0) { + setenv(env, ads->auth.kdc_server, 1); + free(env); + } } #endif -- cgit