Esempio n. 1
0
File: value.c Progetto: Firstyear/ds
void
slapi_values_set_flags(Slapi_Value **vs, unsigned long flags)
{
	PR_ASSERT(vs!=NULL);
	Slapi_Value **v;
	for (v = vs; v && *v; v++) {
		slapi_value_set_flags(*v, flags);
	}
}
Esempio n. 2
0
/*
 * JCM SLOW FUNCTION
 *
 * WARNING: Use only if you absolutley need to...
 * This function mostly exists to map from the old slapi berval
 * based interface to the new Slapi_Value based interfaces.
 */
int
valuearray_init_bervalarray_with_flags(struct berval **bvals, Slapi_Value ***cvals, unsigned long flags)
{
    int n;
    for(n=0; bvals != NULL && bvals[n] != NULL; n++);
    if(n==0)
    {
        *cvals = NULL;
    }
    else
    {
        int i;
        *cvals = (Slapi_Value **) slapi_ch_malloc((n + 1) * sizeof(Slapi_Value *));
        for(i=0;i<n;i++)
        {
            (*cvals)[i] = slapi_value_new_berval(bvals[i]);
            slapi_value_set_flags((*cvals)[i], flags);
        }
        (*cvals)[i] = NULL;
    }
    return n;
}
Esempio n. 3
0
File: value.c Progetto: Firstyear/ds
int
value_dn_normalize_value(Slapi_Value *value)
{
	Slapi_DN *sdn = NULL;
	int rc = 0;

	if (NULL == value) {
		return rc;
	}

	sdn = slapi_sdn_new_dn_passin(value->bv.bv_val);
	if (slapi_sdn_get_dn(sdn)) {
		value->bv.bv_val = slapi_ch_strdup(slapi_sdn_get_dn(sdn));
		value->bv.bv_len = slapi_sdn_get_ndn_len(sdn);
		slapi_sdn_free(&sdn);
		slapi_value_set_flags(value, SLAPI_ATTR_FLAG_NORMALIZED_CES);
	} else {
		rc = 1;
		slapi_ch_free((void **)&sdn); /* free just Slapi_DN */
	}

	return rc;
}