X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fstring.c;h=4f860ada785e68cfee3c875b314a42bd7ccffc13;hb=de01a6e3d791d3458549d2ceeccf4d7e0477ff78;hp=ee275baec66cee7c47a0806484fb8e1ebde1e1ec;hpb=70092b38fb23b9141a2b8414fb5a9c5200f3c12d;p=openldap diff --git a/libraries/libldap/string.c b/libraries/libldap/string.c index ee275baec6..4f860ada78 100644 --- a/libraries/libldap/string.c +++ b/libraries/libldap/string.c @@ -1,7 +1,16 @@ /* $OpenLDAP$ */ -/* - * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2007 The OpenLDAP Foundation. + * All rights reserved. + * + * 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 + * . */ /* @@ -112,6 +121,26 @@ ldap_pvt_str2upper( char *str ) return( str ); } +struct berval * +ldap_pvt_str2upperbv( char *str, struct berval *bv ) +{ + char *s = NULL; + + assert( bv != NULL ); + + /* to upper */ + if ( str ) { + for ( s = str; *s; s++ ) { + *s = TOUPPER( (unsigned char) *s ); + } + } + + bv->bv_val = str; + bv->bv_len = (ber_len_t)(s - str); + + return( bv ); +} + char * ldap_pvt_str2lower( char *str ) { @@ -126,3 +155,23 @@ ldap_pvt_str2lower( char *str ) return( str ); } + +struct berval * +ldap_pvt_str2lowerbv( char *str, struct berval *bv ) +{ + char *s = NULL; + + assert( bv != NULL ); + + /* to lower */ + if ( str ) { + for ( s = str; *s; s++ ) { + *s = TOLOWER( (unsigned char) *s ); + } + } + + bv->bv_val = str; + bv->bv_len = (ber_len_t)(s - str); + + return( bv ); +}