AttributeDescription desc, *d2;
char *name, *options;
char *opt, *next;
- char *s, *ptr;
int nlang;
int langlen;
if( !slap_syntax_is_binary( desc.ad_type->sat_syntax )) {
/* not stored in binary, disallow option */
- *text = "option \"binary\" with type not supported";
+ *text = "option \"binary\" not supported with type";
return rtn;
}
int rc;
rc = strncasecmp( opt, langs[i].bv_val,
- optlen < langs[i].bv_len ? optlen : langs[i].bv_len );
+ (unsigned) optlen < langs[i].bv_len
+ ? optlen : langs[i].bv_len );
- if( rc == 0 && optlen == langs[i].bv_len ) {
+ if( rc == 0 && (unsigned)optlen == langs[i].bv_len ) {
/* duplicate (ignore) */
goto done;
} else if ( rc > 0 ||
- ( rc == 0 && optlen > langs[i].bv_len ))
+ ( rc == 0 && (unsigned)optlen > langs[i].bv_len ))
{
AC_MEMCPY( &langs[i+1], &langs[i],
(nlang-i)*sizeof(struct berval) );
/* Not found, add new one */
while (d2 == NULL) {
- int dlen = 0;
+ size_t dlen = 0;
ldap_pvt_thread_mutex_lock( &desc.ad_type->sat_ad_mutex );
/* check again now that we've locked */
for (d2 = desc.ad_type->sat_ad; d2; d2=d2->ad_next) {
* options length.
*/
if (desc.ad_lang.bv_len || desc.ad_flags != SLAP_DESC_NONE) {
+ dlen = desc.ad_type->sat_cname.bv_len;
if (desc.ad_lang.bv_len) {
- dlen = desc.ad_lang.bv_len+1;
+ dlen += 1+desc.ad_lang.bv_len;
}
- dlen += desc.ad_type->sat_cname.bv_len+1;
if( slap_ad_is_binary( &desc ) ) {
- dlen += sizeof("binary");
+ dlen += sizeof(";binary")-1;
}
}
- d2 = ch_malloc(sizeof(AttributeDescription) + dlen);
+ d2 = ch_malloc(sizeof(AttributeDescription) + dlen + 1);
d2->ad_type = desc.ad_type;
d2->ad_flags = desc.ad_flags;
- d2->ad_cname.bv_len = desc.ad_cname.bv_len;
+ d2->ad_cname.bv_len = desc.ad_type->sat_cname.bv_len;
d2->ad_lang.bv_len = desc.ad_lang.bv_len;
+
if (dlen == 0) {
d2->ad_cname.bv_val = d2->ad_type->sat_cname.bv_val;
d2->ad_lang.bv_val = NULL;
if( slap_ad_is_binary( &desc ) ) {
strcpy(d2->ad_cname.bv_val+d2->ad_cname.bv_len,
";binary");
- d2->ad_cname.bv_len += sizeof("binary");
+ d2->ad_cname.bv_len += sizeof(";binary")-1;
}
if( d2->ad_lang.bv_len ) {
d2->ad_cname.bv_val[d2->ad_cname.bv_len++]=';';
int i;
for ( i = 0; oc->soc_required[i] != NULL; i++ ) {
rc = is_at_subtype( desc->ad_type,
- oc->soc_allowed[i] );
+ oc->soc_required[i] );
if( rc ) return 1;
}
}
}
if( !desc ) {
- desc = ch_malloc(sizeof(AttributeDescription) +
- bv->bv_len + 1);
+ desc = ch_malloc(sizeof(AttributeDescription) + 1 +
+ bv->bv_len);
desc->ad_flags = SLAP_DESC_NONE;
desc->ad_lang.bv_val = NULL;