~ubuntu-branches/ubuntu/vivid/389-ds-base/vivid

« back to all changes in this revision

Viewing changes to ldap/servers/slapd/attrlist.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2014-08-08 10:48:55 UTC
  • mfrom: (0.2.3)
  • Revision ID: package-import@ubuntu.com-20140808104855-exq8xfg6rirkvipk
Tags: 1.3.2.21-1
* New upstream release.
  - CVE-2014-3562 (Closes: #757437)

Show diffs side-by-side

added added

removed removed

Lines of Context:
305
305
    if (vals == NULL || vals[0] == NULL) {
306
306
        (void)attrlist_delete(alist, type);
307
307
    } else {
308
 
        attrlist_find_or_create(alist, type, &a);
 
308
        int created = attrlist_find_or_create(alist, type, &a);
309
309
        valuearray_init_bervalarray(vals, &values);
310
310
        if (slapi_attr_is_dn_syntax_attr(*a)) {
311
311
            valuearray_dn_normalize_value(values);
312
312
            (*a)->a_flags |= SLAPI_ATTR_FLAG_NORMALIZED_CES;
313
313
        }
314
 
        rc = attr_replace(*a, values);
 
314
        rc = attr_replace(*a, values); /* values is consumed */
 
315
        if (rc) {
 
316
            slapi_log_error(SLAPI_LOG_FATAL, "attrlist_replace",
 
317
                            "attr_replace (%s, %s) failed.\n",
 
318
                            type, vals[0]->bv_val);
 
319
            if (created) {
 
320
                attrlist_delete(alist, type);
 
321
            }
 
322
        }
315
323
    }
316
324
    return rc;
317
325
}
332
340
    if (vals == NULL || vals[0] == NULL) {
333
341
        (void)attrlist_delete(alist, type);
334
342
    } else {
335
 
        attrlist_find_or_create(alist, type, &a);
 
343
        int created = attrlist_find_or_create(alist, type, &a);
336
344
        valuearray_init_bervalarray_with_flags(vals, &values, flags);
337
345
        if (slapi_attr_is_dn_syntax_attr(*a)) {
338
346
            valuearray_dn_normalize_value(values);
339
347
            (*a)->a_flags |= SLAPI_ATTR_FLAG_NORMALIZED_CES;
340
348
        }
341
349
        rc = attr_replace(*a, values);
 
350
        if (rc) {
 
351
            slapi_log_error(SLAPI_LOG_FATAL, "attrlist_replace",
 
352
                            "attr_replace (%s, %s) failed.\n",
 
353
                            type, vals[0]->bv_val);
 
354
            if (created) {
 
355
                attrlist_delete(alist, type);
 
356
            }
 
357
        }
342
358
    }
343
359
    return rc;
344
360
}