summaryrefslogtreecommitdiff
path: root/usr/src/lib/libldap4/common/getvalues.c
diff options
context:
space:
mode:
authorMilan Jurik <milan.jurik@xylab.cz>2012-05-19 19:59:14 -0700
committerMilan Jurik <milan.jurik@xylab.cz>2012-05-19 19:59:14 -0700
commitd387ac4c164917d885cd84bd1b62647d989033ac (patch)
tree3c8503aa5915728ea1f848bfaaecb91ab62a4d91 /usr/src/lib/libldap4/common/getvalues.c
parentad2de4358b2074634b0f2355c34b0986da0e95f9 (diff)
downloadillumos-joyent-d387ac4c164917d885cd84bd1b62647d989033ac.tar.gz
2705 EOF libldap.so.4
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Albert Lee <trisk@nexenta.com> Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/lib/libldap4/common/getvalues.c')
-rw-r--r--usr/src/lib/libldap4/common/getvalues.c183
1 files changed, 0 insertions, 183 deletions
diff --git a/usr/src/lib/libldap4/common/getvalues.c b/usr/src/lib/libldap4/common/getvalues.c
deleted file mode 100644
index b516af78fc..0000000000
--- a/usr/src/lib/libldap4/common/getvalues.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *
- * Portions Copyright 1998 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Copyright (c) 1990 Regents of the University of Michigan.
- * All rights reserved.
- *
- * getvalues.c
- */
-
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h> /* free() for Solaris */
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
-#include "ldap-private.h"
-#include "ldap-int.h"
-
-char **
-ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target )
-{
- BerElement ber;
- char attr[LDAP_MAX_ATTR_LEN];
- int found = 0;
- int len;
- char **vals;
-
- Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 184, "ldap_get_values\n"), 0, 0, 0 );
-
- ber = *entry->lm_ber;
-
- /* skip sequence, dn, sequence of, and snag the first attr */
- len = sizeof(attr);
- if ( ber_scanf( &ber, "{x{{s", attr, &len ) == LBER_ERROR ) {
- ld->ld_errno = LDAP_DECODING_ERROR;
- return( NULL );
- }
-
- if ( strcasecmp( target, attr ) == 0 )
- found = 1;
-
- /* break out on success, return out on error */
- while ( ! found ) {
- len = sizeof(attr);
- if ( ber_scanf( &ber, "x}{s", attr, &len ) == LBER_ERROR ) {
- ld->ld_errno = LDAP_DECODING_ERROR;
- return( NULL );
- }
-
- if ( strcasecmp( target, attr ) == 0 )
- break;
- }
-
- /*
- * if we get this far, we've found the attribute and are sitting
- * just before the set of values.
- */
-
- if ( ber_scanf( &ber, "[v]", &vals ) == LBER_ERROR ) {
- ld->ld_errno = LDAP_DECODING_ERROR;
- return( NULL );
- }
-
- return( vals );
-}
-
-struct berval **
-ldap_get_values_len( LDAP *ld, LDAPMessage *entry, char *target )
-{
- BerElement ber;
- char attr[LDAP_MAX_ATTR_LEN];
- int found = 0;
- int len;
- struct berval **vals;
-
- Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 185, "ldap_get_values_len\n"), 0, 0, 0 );
-
- ber = *entry->lm_ber;
-
- /* skip sequence, dn, sequence of, and snag the first attr */
- len = sizeof(attr);
- if ( ber_scanf( &ber, "{x{{s", attr, &len ) == LBER_ERROR ) {
- ld->ld_errno = LDAP_DECODING_ERROR;
- return( NULL );
- }
-
- if ( strcasecmp( target, attr ) == 0 )
- found = 1;
-
- /* break out on success, return out on error */
- while ( ! found ) {
- len = sizeof(attr);
- if ( ber_scanf( &ber, "x}{s", attr, &len ) == LBER_ERROR ) {
- ld->ld_errno = LDAP_DECODING_ERROR;
- return( NULL );
- }
-
- if ( strcasecmp( target, attr ) == 0 )
- break;
- }
-
- /*
- * if we get this far, we've found the attribute and are sitting
- * just before the set of values.
- */
-
- if ( ber_scanf( &ber, "[V]", &vals ) == LBER_ERROR ) {
- ld->ld_errno = LDAP_DECODING_ERROR;
- return( NULL );
- }
-
- return( vals );
-}
-
-int
-ldap_count_values( char **vals )
-{
- int i;
-
- if ( vals == NULL )
- return( 0 );
-
- for ( i = 0; vals[i] != NULL; i++ )
- ; /* NULL */
-
- return( i );
-}
-
-int
-ldap_count_values_len( struct berval **vals )
-{
- return( ldap_count_values( (char **) vals ) );
-}
-
-void
-ldap_value_free( char **vals )
-{
- int i;
-
- if ( vals == NULL )
- return;
- for ( i = 0; vals[i] != NULL; i++ )
- free( vals[i] );
- free( (char *) vals );
-}
-
-void
-ldap_value_free_len( struct berval **vals )
-{
- int i;
-
- if ( vals == NULL )
- return;
- for ( i = 0; vals[i] != NULL; i++ ) {
- free( vals[i]->bv_val );
- free( vals[i] );
- }
- free( (char *) vals );
-}