[Freeipa-devel] [PATCH 0133] ipa-cldap: Cut NetBIOS name after 15 characters

Jan Cholasta jcholast at redhat.com
Tue Nov 26 15:38:12 UTC 2013


On 26.11.2013 15:37, 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
>

I don't think you need to copy the whole fq_hostname if you need only 
the few initial characters, you can do something like this instead 
(OTOH, untested):

-    char *pdc_name;
+    char pdc_name[16];

...

-    pdc_name = talloc_asprintf(nlr, "\\\\%s", fq_hostname);
+    snprintf(pdc_name, 16, "\\\\%s", fq_hostname);
+    pdc_name[15] = '\0';

...

-    nlr->pdc_name = pdc_name;
+    nlr->pdc_name = talloc_strdup(nlr, pdc_name);

Honza

-- 
Jan Cholasta




More information about the Freeipa-devel mailing list