getfilter.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
*/
/*
* getfilter.c -- optional add-on to libldap
*/
#if 0
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#endif
#include "ldap-int.h"
#include "regex.h"
#include <stdio.h> /* sprintf */
#endif
#define FILT_MAX_LINE_LEN 1024
ldap_init_getfilter( char *fname )
{
char *buf;
int eof;
return( NULL );
}
return( NULL );
}
return( NULL );
}
return( NULL );
}
NSLDAPI_FREE( buf );
return( NULL );
}
NSLDAPI_FREE( buf );
return( lfdp );
}
{
int tokcnt, i;
long buffer_len = (long)buflen;
== NULL ) {
return( NULL );
}
&buffer_len, &tok )) > 0 ) {
switch( tokcnt ) {
case 1: /* tag line */
NSLDAPI_FREE( tag );
}
NSLDAPI_FREE( tok );
break;
case 4:
case 5: /* start of filter info. list */
sizeof( LDAPFiltList ))) == NULL ) {
return( NULL );
}
char msg[256];
"bad regular expresssion %s\n"),
nextflp->lfl_pattern );
ber_err_print( msg );
return( NULL );
}
} else {
}
for ( i = 2; i < 5; ++i ) {
}
/* fall through */
case 2:
case 3: /* filter, desc, and optional search scope */
sizeof( LDAPFiltInfo ))) == NULL ) {
return( NULL );
}
} else {
}
} else {
return( NULL );
}
} else {
}
NSLDAPI_FREE( tok );
}
break;
default:
return( NULL );
}
}
NSLDAPI_FREE( tag );
}
return( lfdp );
}
int
{
return( LDAP_PARAM_ERROR );
}
}
}
return( LDAP_SUCCESS );
}
/*
* ldap_setfilteraffixes() is deprecated -- use ldap_set_filter_additions()
*/
void
{
}
{
return( NULL ); /* punt */
}
}
break;
}
}
return( NULL );
}
return( NULL );
}
&lfdp->lfd_curvalwords ) < 0 ) {
return( NULL );
}
return( ldap_getnextfilter( lfdp ));
}
{
return( NULL );
}
}
static char*
/* Copy v into f. If flimit is too small, return NULL;
* otherwise return (f + vlen).
*/
{
return NULL;
}
return f + vlen;
}
static char*
/* Copy v into f, but with parentheses escaped. But only escape * and \
* if escape_all is non-zero so that either "*" or "\2a" can be used in
* v, with different meanings.
* If flimit is too small, return NULL; otherwise
* return (f + the number of bytes copied).
*/
{
auto char x[4];
while ( f && *v ) {
switch ( *v ) {
case '*':
if ( escape_all ) {
v++;
} else {
if ( f < flimit ) {
*f++ = *v++;
} else {
f = NULL; /* overflow */
}
}
break;
case '(':
case ')':
sprintf( x, "\\%02x", (unsigned)*v );
v++;
break;
case '\\':
if ( escape_all ) {
v++;
} else {
v += slen;
}
break;
default:
if ( f < flimit ) {
*f++ = *v++;
} else {
f = NULL; /* overflow */
}
break;
}
}
return f;
}
int
{
char *p, *f, *flimit;
/*
* there is some confusion on what to create for a filter if
* attr or value are null pointers. For now we just leave them
* as TO BE DEALT with
*/
return( LDAP_PARAM_ERROR );
}
wordcount = 0;
} else {
;
}
}
f = filtbuf;
}
if ( *p == '%' ) {
++p;
if ( *p == 'v' || *p == 'e' ) {
escape_all = ( *p == 'e' );
if ( ldap_utf8isdigit( p+1 )) {
++p;
wordnum = *p - '1';
if ( *(p+1) == '-' ) {
++p;
if ( ldap_utf8isdigit( p+1 )) {
++p;
}
} else {
}
} else {
}
if ( wordcount > 0 ) {
for ( i = wordnum; i <= endwordnum; ++i ) {
if ( i > wordnum ) { /* add blank btw words */
if ( f == NULL ) break;
}
escape_all );
if ( f == NULL ) break;
}
}
} else if ( *(p+1) == '$' ) {
++p;
if ( wordcount > 0 ) {
f = filter_add_value( f, flimit,
}
}
} else {
*f++ = *p;
}
} else {
*f++ = *p;
}
if ( f > flimit ) { /* overflow */
f = NULL;
}
}
}
if ( f == NULL ) {
*flimit = '\0';
return( LDAP_SIZELIMIT_EXCEEDED );
}
*f = '\0';
return( LDAP_SUCCESS );
}
/*
* ldap_build_filter() is deprecated -- use ldap_create_filter() instead
*/
void
{
}
static int
{
int count;
char *lasts;
return( -1 );
}
count = 0;
return( -1 );
}
}
return( count );
}