summaryrefslogtreecommitdiff
path: root/source3/libads/sasl.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libads/sasl.c')
-rw-r--r--source3/libads/sasl.c20
1 files changed, 20 insertions, 0 deletions
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
@@ -676,6 +676,26 @@ static ADS_STATUS ads_generate_service_principal(ADS_STRUCT *ads,
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);
+ }
}
initialize_krb5_error_table();