diff options
author | Tomas Babej <tbabej@redhat.com> | 2013-11-26 12:14:39 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-12-11 13:23:38 +0100 |
commit | 71481a0aa497a579ded42500b5b8f8c6807c825d (patch) | |
tree | e3e9bb717643e5d28b13b4230d12244106d08c3b /daemons/ipa-slapi-plugins/ipa-cldap | |
parent | f2ee8a74032708717f8b370de5b1acc86d4d74cc (diff) | |
download | freeipa-71481a0aa497a579ded42500b5b8f8c6807c825d.tar.gz freeipa-71481a0aa497a579ded42500b5b8f8c6807c825d.tar.xz freeipa-71481a0aa497a579ded42500b5b8f8c6807c825d.zip |
ipa-cldap: Cut NetBIOS name after 15 characters
The CLDAP DS plugin uses the uppercased first segment of the fully
qualified hostname as the NetBIOS name. We need to limit its size
to 15 characters.
https://fedorahosted.org/freeipa/ticket/4028
Diffstat (limited to 'daemons/ipa-slapi-plugins/ipa-cldap')
-rw-r--r-- | daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h | 1 | ||||
-rw-r--r-- | daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h index 7b0c2aad1..3f420ff2c 100644 --- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h +++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h @@ -59,6 +59,7 @@ #define IPA_PLUGIN_NAME IPA_CLDAP_PLUGIN_NAME #define CLDAP_PORT 389 #define MAX_DG_SIZE 4096 +#define NETBIOS_NAME_MAX 15 #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c index 7d29fe559..9ba058294 100644 --- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c +++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c @@ -161,8 +161,12 @@ static int ipa_cldap_encode_netlogon(char *fq_hostname, char *domain, nlr->dns_domain = domain; nlr->pdc_dns_name = fq_hostname; nlr->domain_name = name; - pdc_name = talloc_asprintf(nlr, "\\\\%s", fq_hostname); + + /* copy the first 15 characters of the fully qualified hostname*/ + pdc_name = talloc_asprintf(nlr, "\\\\%.*s", NETBIOS_NAME_MAX, fq_hostname); + for (p = pdc_name; *p; p++) { + /* Create the NetBIOS name from the first segment of the hostname */ if (*p == '.') { *p = '\0'; break; |