X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fstring.c;h=e2eebb719c315088ac288db8b2582e4623f2712b;hb=a5d0e36798978f9fdc9a15ab908fe0666dd5350f;hp=aaf76c609d6f45174d96c833c94d0385fabc3c05;hpb=0e2af54a3ffdeebe3901370683be56fcc53023b0;p=openldap
diff --git a/libraries/libldap/string.c b/libraries/libldap/string.c
index aaf76c609d..e2eebb719c 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-2008 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
+ * .
*/
/*
@@ -103,22 +112,66 @@ ldap_pvt_str2upper( char *str )
char *s;
/* to upper */
- for ( s = str; *s; s++ ) {
- *s = TOUPPER( (unsigned char) *s );
+ if ( str ) {
+ for ( s = str; *s; s++ ) {
+ *s = TOUPPER( (unsigned char) *s );
+ }
}
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 )
{
char *s;
/* to lower */
- for ( s = str; *s; s++ ) {
- *s = TOLOWER( (unsigned char) *s );
+ if ( str ) {
+ for ( s = str; *s; s++ ) {
+ *s = TOLOWER( (unsigned char) *s );
+ }
}
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 );
+}