X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=inline;f=libraries%2Flibldap%2Fgetvalues.c;h=606e2616813ef45dca8b8ecce1b01029761cd0e0;hb=e323437c6aa2cc7791dfc14c31fe0439b71c56e2;hp=0fb1e2511f81c4a98fe5b253a427a0e18b4847e8;hpb=29d9fa20a2823c827f098d78f1ea8539d86bf4cf;p=openldap
diff --git a/libraries/libldap/getvalues.c b/libraries/libldap/getvalues.c
index 0fb1e2511f..606e261681 100644
--- a/libraries/libldap/getvalues.c
+++ b/libraries/libldap/getvalues.c
@@ -1,13 +1,19 @@
/* $OpenLDAP$ */
-/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- */
-/* Portions
- * Copyright (c) 1990 Regents of the University of Michigan.
- * All rights reserved.
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1998-2004 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.
*
- * getvalues.c
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+/* Portions Copyright (c) 1990 Regents of the University of Michigan.
+ * All rights reserved.
*/
#include "portable.h"
@@ -36,7 +42,11 @@ ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
assert( entry != NULL );
assert( target != NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG ( OPERATION, ENTRY, "ldap_get_values\n", 0, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
+#endif
ber = *entry->lm_ber;
@@ -93,7 +103,11 @@ ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
assert( entry != NULL );
assert( target != NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG ( OPERATION, ENTRY, "ldap_get_values_len\n", 0, 0, 0 );
+#else
Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
+#endif
ber = *entry->lm_ber;
@@ -167,3 +181,39 @@ ldap_value_free_len( struct berval **vals )
{
ber_bvecfree( vals );
}
+
+char **
+ldap_value_dup( char *const *vals )
+{
+ char **new;
+ int i;
+
+ if( vals == NULL ) {
+ return NULL;
+ }
+
+ for( i=0; vals[i]; i++ ) {
+ ; /* Count the number of values */
+ }
+
+ if( i == 0 ) {
+ return NULL;
+ }
+
+ new = LDAP_MALLOC( (i+1)*sizeof(char *) ); /* Alloc array of pointers */
+ if( new == NULL ) {
+ return NULL;
+ }
+
+ for( i=0; vals[i]; i++ ) {
+ new[i] = LDAP_STRDUP( vals[i] ); /* Dup each value */
+ if( new[i] == NULL ) {
+ LDAP_VFREE( new );
+ return NULL;
+ }
+ }
+ new[i] = NULL;
+
+ return new;
+}
+