On Tue, 2013-11-26 at 16:38 +0100, Jan Cholasta wrote: > 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';
It's simpler to use length qualifiers in talloc_asprintf: pdc_name = talloc_asprintf(nlr, "\\\\%.*s", 15, fq_hostname); Simo. > ... > > - nlr->pdc_name = pdc_name; > + nlr->pdc_name = talloc_strdup(nlr, pdc_name); -- Simo Sorce * Red Hat, Inc * New York _______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel