[Freeipa-devel] [PATCH 0133] ipa-cldap: Cut NetBIOS name after 15 characters
Tomas Babej
tbabej at redhat.com
Wed Nov 27 07:18:39 UTC 2013
On 11/26/2013 04:56 PM, Alexander Bokovoy wrote:
> 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
>
>
Fixed! Thanks for the reviews.
--
Tomas Babej
Associate Software Engeneer | Red Hat | Identity Management
RHCE | Brno Site | IRC: tbabej | freeipa.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-tbabej-0133-2-ipa-cldap-Cut-NetBIOS-name-after-15-characters.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20131127/2b57321e/attachment.bin>
More information about the Freeipa-devel
mailing list