+/* $OpenLDAP$ */
/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* Portions
#include "ldap-int.h"
static void free_searchobj LDAP_P(( struct ldap_searchobj *so ));
-static int read_next_searchobj LDAP_P(( char **bufp, long *blenp,
+static int read_next_searchobj LDAP_P(( char **bufp, ber_len_t *blenp,
struct ldap_searchobj **sop, int soversion ));
int
-ldap_init_searchprefs_buf( char *buf, long buflen,
+ldap_init_searchprefs_buf(
+ char *buf,
+ ber_len_t buflen,
struct ldap_searchobj **solistp )
{
int rc = -1, version;
*solistp = prevso = NULL;
- if ( next_line_tokens( &buf, &buflen, &toks ) != 2 ||
+ if ( ldap_int_next_line_tokens( &buf, &buflen, &toks ) != 2 ||
strcasecmp( toks[ 0 ], "version" ) != 0 ) {
- free_strarray( toks );
+ LDAP_VFREE( toks );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
version = atoi( toks[ 1 ] );
- free_strarray( toks );
+ LDAP_VFREE( toks );
if ( version != LDAP_SEARCHPREF_VERSION &&
version != LDAP_SEARCHPREF_VERSION_ZERO ) {
return( LDAP_SEARCHPREF_ERR_VERSION );
static int
-read_next_searchobj( char **bufp, long *blenp, struct ldap_searchobj **sop,
+read_next_searchobj(
+ char **bufp,
+ ber_len_t *blenp,
+ struct ldap_searchobj **sop,
int soversion )
{
int i, j, tokcnt;
/*
* Object type prompt comes first
*/
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) != 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) != 1 ) {
+ LDAP_VFREE( toks );
return( tokcnt == 0 ? 0 : LDAP_SEARCHPREF_ERR_SYNTAX );
}
if (( so = (struct ldap_searchobj *)LDAP_CALLOC( 1,
sizeof( struct ldap_searchobj ))) == NULL ) {
- free_strarray( toks );
+ LDAP_VFREE( toks );
return( LDAP_SEARCHPREF_ERR_MEM );
}
so->so_objtypeprompt = toks[ 0 ];
* if this is post-version zero, options come next
*/
if ( soversion > LDAP_SEARCHPREF_VERSION_ZERO ) {
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) < 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) < 1 ) {
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
}
}
}
- free_strarray( toks );
+ LDAP_VFREE( toks );
}
/*
* "Fewer choices" prompt is next
*/
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) != 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) != 1 ) {
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
/*
* Filter prefix for "More Choices" searching is next
*/
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) != 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) != 1 ) {
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
/*
* "Fewer Choices" filter tag comes next
*/
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) != 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) != 1 ) {
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
/*
* Selection (disambiguation) attribute comes next
*/
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) != 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) != 1 ) {
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
/*
* Label for selection (disambiguation) attribute
*/
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) != 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) != 1 ) {
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
/*
* Search scope is next
*/
- if (( tokcnt = next_line_tokens( bufp, blenp, &toks )) != 1 ) {
- free_strarray( toks );
+ if (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) != 1 ) {
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
- free_strarray( toks );
+ LDAP_VFREE( toks );
/*
* "More Choices" search option list comes next
*/
sa = &( so->so_salist );
- while (( tokcnt = next_line_tokens( bufp, blenp, &toks )) > 0 ) {
+ while (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) > 0 ) {
if ( tokcnt < 5 ) {
- free_strarray( toks );
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
if (( *sa = ( struct ldap_searchattr * ) LDAP_CALLOC( 1,
sizeof( struct ldap_searchattr ))) == NULL ) {
- free_strarray( toks );
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_MEM );
}
* Match types are last
*/
sm = &( so->so_smlist );
- while (( tokcnt = next_line_tokens( bufp, blenp, &toks )) > 0 ) {
+ while (( tokcnt = ldap_int_next_line_tokens( bufp, blenp, &toks )) > 0 ) {
if ( tokcnt < 2 ) {
- free_strarray( toks );
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_SYNTAX );
}
if (( *sm = ( struct ldap_searchmatch * ) LDAP_CALLOC( 1,
sizeof( struct ldap_searchmatch ))) == NULL ) {
- free_strarray( toks );
+ LDAP_VFREE( toks );
ldap_free_searchprefs( so );
return( LDAP_SEARCHPREF_ERR_MEM );
}