From: Pierangelo Masarati Date: Fri, 23 Aug 2002 08:45:17 +0000 (+0000) Subject: add upper/lower funcs that also compute the length of the string (not used yet) X-Git-Tag: NO_SLAP_OP_BLOCKS~1199 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4046c4226ea5f0010f6d6cecc8a9c4aa290304cf;p=openldap add upper/lower funcs that also compute the length of the string (not used yet) --- diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h index 4edb4096f2..5100b14b77 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -162,6 +162,12 @@ ldap_pvt_str2upper LDAP_P(( char *str )); LDAP_F( char * ) ldap_pvt_str2lower LDAP_P(( char *str )); +LDAP_F( struct berval * ) +ldap_pvt_str2upperbv LDAP_P(( char *str, struct berval *bv )); + +LDAP_F( struct berval * ) +ldap_pvt_str2lowerbv LDAP_P(( char *str, struct berval *bv )); + /* tls.c */ LDAP_F (int) ldap_int_tls_config LDAP_P(( struct ldap *ld, int option, const char *arg )); diff --git a/libraries/libldap/string.c b/libraries/libldap/string.c index ee275baec6..dbedf5741f 100644 --- a/libraries/libldap/string.c +++ b/libraries/libldap/string.c @@ -112,6 +112,26 @@ ldap_pvt_str2upper( char *str ) return( str ); } +struct berval * +ldap_pvt_str2upperbv( char *str, struct berval *bv ) +{ + char *s = NULL; + + assert( bv ); + + /* 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 +146,23 @@ ldap_pvt_str2lower( char *str ) return( str ); } + +struct berval * +ldap_pvt_str2lowerbv( char *str, struct berval *bv ) +{ + char *s = NULL; + + assert( bv ); + + /* 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 ); +}