diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-07-31 09:37:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:29:05 -0500 |
commit | db718085fd7a614215f1994f9001e9c04a37426b (patch) | |
tree | a130ec919054a66571f7d01c403bcc90fb800c1b /source3/libads | |
parent | 062bca6675c120dcf533de18da72acc903b3eb8e (diff) | |
download | samba-db718085fd7a614215f1994f9001e9c04a37426b.tar.gz samba-db718085fd7a614215f1994f9001e9c04a37426b.tar.bz2 samba-db718085fd7a614215f1994f9001e9c04a37426b.zip |
r24095: add one more fallback alternative to
construct the principal
metze
(This used to be commit b545667d2a45a79bba05c9fe9e93a19951d60af7)
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/sasl.c | 20 |
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(); |