diff options
-rw-r--r-- | daemons/ipa-slapi-plugins/ipa-enrollment/ipa_enrollment.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-enrollment/ipa_enrollment.c b/daemons/ipa-slapi-plugins/ipa-enrollment/ipa_enrollment.c index a3dcf08a6..26cbb69d7 100644 --- a/daemons/ipa-slapi-plugins/ipa-enrollment/ipa_enrollment.c +++ b/daemons/ipa-slapi-plugins/ipa-enrollment/ipa_enrollment.c @@ -142,6 +142,7 @@ ipa_join(Slapi_PBlock *pb) int scope = LDAP_SCOPE_SUBTREE; char *principal = NULL; + char *princ_canonical = NULL; struct berval retbval; if (NULL == realm) { @@ -271,6 +272,16 @@ ipa_join(Slapi_PBlock *pb) slapi_mods_add_string(smods, LDAP_MOD_ADD, "krbPrincipalName", principal); slapi_mods_add_string(smods, LDAP_MOD_ADD, "objectClass", "krbPrincipalAux"); + /* check for krbCanonicalName attribute. If not present, set it to same + * value as krbPrincipalName*/ + princ_canonical = slapi_entry_attr_get_charptr(targetEntry, + "krbCanonicalName"); + + if (NULL == princ_canonical) { + slapi_mods_add_string(smods, LDAP_MOD_ADD, "krbCanonicalName", + principal); + } + pbtm = slapi_pblock_new(); slapi_modify_internal_set_pb (pbtm, slapi_entry_get_dn_const(targetEntry), slapi_mods_get_ldapmods_byref(smods), @@ -325,6 +336,10 @@ free_and_return: free(principal); + if (princ_canonical) { + free(princ_canonical); + } + return SLAPI_PLUGIN_EXTENDED_SENT_RESULT; } |