[Freeipa-devel] [PATCH 0133] ipa-cldap: Cut NetBIOS name after 15 characters
Alexander Bokovoy
abokovoy at redhat.com
Tue Nov 26 15:56:43 UTC 2013
On Tue, 26 Nov 2013, Tomas Babej wrote:
>Hi,
>
>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
>
>--
>Tomas Babej
>Associate Software Engeneer | Red Hat | Identity Management
>RHCE | Brno Site | IRC: tbabej | freeipa.org
>
>
>From a74aefcd91051e908be0e9bc2b834206024ac043 Mon Sep 17 00:00:00 2001
>From: Tomas Babej <tbabej at redhat.com>
>Date: Tue, 26 Nov 2013 12:14:39 +0100
>Subject: [PATCH] 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
>---
> daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>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 7d29fe559be55607fcb6b83fa521372e5197b848..3799ad4b1e9d456a34cd6967d0770b366590e50c 100644
>--- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c
>+++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c
>@@ -134,6 +134,8 @@ static int ipa_cldap_encode_netlogon(char *fq_hostname, char *domain,
> char *pdc_name;
> char *p;
> int ret;
>+ const int netbios_length_limit = 15;
>+ int i;
>
> nlr = talloc_zero(NULL, struct NETLOGON_SAM_LOGON_RESPONSE_EX);
> if (!nlr) {
>@@ -162,11 +164,14 @@ static int ipa_cldap_encode_netlogon(char *fq_hostname, char *domain,
> nlr->pdc_dns_name = fq_hostname;
> nlr->domain_name = name;
> pdc_name = talloc_asprintf(nlr, "\\\\%s", fq_hostname);
>+
>+ i = 0; //netbios name length counter, we need to cut it after 15 chrs
Apart from what was said, please do not use C++-like comments.
> for (p = pdc_name; *p; p++) {
>- if (*p == '.') {
>+ if ((*p == '.') || (i >= netbios_length_limit)) {
> *p = '\0';
> break;
> }
>+ i = i + 1;
> *p = toupper(*p);
> }
> nlr->pdc_name = pdc_name;
>--
>1.8.3.1
>
>_______________________________________________
>Freeipa-devel mailing list
>Freeipa-devel at redhat.com
>https://www.redhat.com/mailman/listinfo/freeipa-devel
--
/ Alexander Bokovoy
More information about the Freeipa-devel
mailing list