X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-meta%2Fattribute.c;h=bb9939c055cd5642dbea46a523459dd5f06a549a;hb=9777dc21148eaba94326aa41d851d558d8869b0e;hp=5bc98e577c5206ef15d5dc44cecc48bbc5a95271;hpb=fafce1601e5bcd0eca185a2a0366cd2b198121a6;p=openldap diff --git a/servers/slapd/back-meta/attribute.c b/servers/slapd/back-meta/attribute.c index 5bc98e577c..bb9939c055 100644 --- a/servers/slapd/back-meta/attribute.c +++ b/servers/slapd/back-meta/attribute.c @@ -1,67 +1,23 @@ -/* - * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file - * - * Copyright 2001, Pierangelo Masarati, All rights reserved. - * - * This work has been developed to fulfill the requirements - * of SysNet s.n.c. and it has been donated - * to the OpenLDAP Foundation in the hope that it may be useful - * to the Open Source community, but WITHOUT ANY WARRANTY. - * - * Permission is granted to anyone to use this software for any purpose - * on any computer system, and to alter it and redistribute it, subject - * to the following restrictions: - * - * 1. The author and SysNet s.n.c. are not responsible for the consequences - * of use of this software, no matter how awful, even if they arise from - * flaws in it. - * - * 2. The origin of this software must not be misrepresented, either by - * explicit claim or by omission. Since few users ever read sources, - * credits should appear in the documentation. - * - * 3. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software. Since few users - * ever read sources, credits should appear in the documentation. - * SysNet s.n.c. cannot be responsible for the consequences of the - * alterations. +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . * - * 4. This notice may not be removed or altered. - * - * - * This software is based on the backend back-ldap, implemented - * by Howard Chu , and modified by Mark Valence - * , Pierangelo Masarati and other - * contributors. The contribution of the original software to the present - * implementation is acknowledged in this copyright statement. - * - * A special acknowledgement goes to Howard for the overall architecture - * (and for borrowing large pieces of code), and to Mark, who implemented - * from scratch the attribute/objectclass mapping. - * - * The original copyright statement follows. + * Copyright 1999-2003 The OpenLDAP Foundation. + * Portions Copyright 2001-2003 Pierangelo Masarati. + * Portions Copyright 1999-2003 Howard Chu. + * All rights reserved. * - * Copyright 1999, Howard Chu, All rights reserved. - * - * Permission is granted to anyone to use this software for any purpose - * on any computer system, and to alter it and redistribute it, subject - * to the following restrictions: - * - * 1. The author is not responsible for the consequences of use of this - * software, no matter how awful, even if they arise from flaws in it. - * - * 2. The origin of this software must not be misrepresented, either by - * explicit claim or by omission. Since few users ever read sources, - * credits should appear in the documentation. - * - * 3. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software. Since few users - * ever read sources, credits should appear in the - * documentation. - * - * 4. This notice may not be removed or altered. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ +/* ACKNOWLEDGEMENTS: + * This work was initially developed by the Howard Chu for inclusion + * in OpenLDAP Software and subsequently enhanced by Pierangelo + * Masarati. */ #include "portable.h" @@ -91,13 +47,13 @@ meta_back_attribute( Entry *target, struct berval *ndn, AttributeDescription *entry_at, - BVarray *vals + BerVarray *vals ) { struct metainfo *li = ( struct metainfo * )be->be_private; int rc = 1, i, j, count, is_oc, candidate; Attribute *attr; - BVarray abv, v; + BerVarray abv, v; char **vs; struct berval mapped; LDAPMessage *result, *e; @@ -115,7 +71,7 @@ meta_back_attribute( for ( count = 0; attr->a_vals[ count ].bv_val != NULL; count++ ) ; - v = ( BVarray )ch_calloc( ( count + 1 ), sizeof( struct berval ) ); + v = ( BerVarray )ch_calloc( ( count + 1 ), sizeof( struct berval ) ); if ( v == NULL ) { return 1; } @@ -140,8 +96,8 @@ meta_back_attribute( } ldap_back_map( &li->targets[ candidate ]->at_map, - &entry_at->ad_cname, &mapped, 0 ); - if ( mapped.bv_val == NULL ) + &entry_at->ad_cname, &mapped, BACKLDAP_MAP ); + if ( mapped.bv_val == NULL || mapped.bv_val[0] == '\0' ) return 1; rc = ldap_initialize( &ld, li->targets[ candidate ]->uri ); @@ -166,7 +122,7 @@ meta_back_attribute( if ( vs != NULL ) { for ( count = 0; vs[ count ] != NULL; count++ ) { } - v = ( BVarray )ch_calloc( ( count + 1 ), + v = ( BerVarray )ch_calloc( ( count + 1 ), sizeof( struct berval ) ); if ( v == NULL ) { ldap_value_free( vs ); @@ -181,8 +137,8 @@ meta_back_attribute( j++; } } else { - ldap_back_map( &li->targets[ candidate ]->oc_map, &v[ j ], &mapped, 1 ); - if ( mapped.bv_val ) { + ldap_back_map( &li->targets[ candidate ]->oc_map, &v[ j ], &mapped, BACKLDAP_REMAP ); + if ( mapped.bv_val && mapped.bv_val[0] != '\0' ) { ber_dupbv( &v[ j ], &mapped ); if ( v[ j ].bv_val ) { j++;