From db718085fd7a614215f1994f9001e9c04a37426b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 31 Jul 2007 09:37:25 +0000 Subject: r24095: add one more fallback alternative to construct the principal metze (This used to be commit b545667d2a45a79bba05c9fe9e93a19951d60af7) --- source3/libads/sasl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source3/libads') diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c index 732691942f..4436551d88 100644 --- a/source3/libads/sasl.c +++ b/source3/libads/sasl.c @@ -673,6 +673,26 @@ static ADS_STATUS ads_generate_service_principal(ADS_STRUCT *ads, SAFE_FREE(server); SAFE_FREE(server_realm); + if (!p->string) { + return ADS_ERROR(LDAP_NO_MEMORY); + } + } else if (ads->config.realm && ads->config.ldap_server_name) { + char *server, *server_realm; + + server = SMB_STRDUP(ads->config.ldap_server_name); + server_realm = SMB_STRDUP(ads->config.realm); + + if (!server || !server_realm) { + return ADS_ERROR(LDAP_NO_MEMORY); + } + + strlower_m(server); + strupper_m(server_realm); + asprintf(&p->string, "ldap/%s@%s", server, server_realm); + + SAFE_FREE(server); + SAFE_FREE(server_realm); + if (!p->string) { return ADS_ERROR(LDAP_NO_MEMORY); } -- cgit