getfilter.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 1993 Regents of the University of Michigan.
* All rights reserved.
*
* getfilter.c -- optional add-on to libldap
*/
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#if defined(NeXT)
#include <regex.h>
#endif
#ifdef MACOS
#include <stdlib.h>
#include "macos.h"
#else /* MACOS */
#ifdef DOS
#include <malloc.h>
#include "msdos.h"
#else /* DOS */
#include <stdlib.h>
#include <errno.h>
#ifndef VMS
#include <unistd.h>
#endif /* VMS */
#endif /* DOS */
#endif /* MACOS */
#include "lber.h"
#include "ldap.h"
#include "ldap-private.h"
#include "ldap-int.h"
#include "regex.h"
#ifdef NEEDPROTOS
void free_strarray( char **sap );
#else /* NEEDPROTOS */
static int break_into_words();
int next_line_tokens();
void free_strarray();
#endif /* NEEDPROTOS */
extern int errno;
extern char *re_comp();
#endif
#define FILT_MAX_LINE_LEN 1024
ldap_init_getfilter( char *fname )
{
char *buf;
int eof;
return( NULL );
}
return( NULL );
}
return( NULL );
}
return( NULL );
}
return( NULL );
}
return( lfdp );
}
{
int tokcnt, i;
return( NULL );
}
> 0 ) {
switch( tokcnt ) {
case 1: /* tag line */
}
break;
case 4:
case 5: /* start of filter info. list */
== NULL ) {
return( NULL );
}
#ifndef NO_USERINTERFACE
nextflp->lfl_pattern );
#endif
#endif /* NO_USERINTERFACE */
free_strarray( tok );
return( NULL );
}
} else {
}
for ( i = 2; i < 5; ++i ) {
}
/* fall through */
case 2:
case 3: /* filter, desc, and optional search scope */
sizeof( LDAPFiltInfo ))) == NULL ) {
free_strarray( tok );
return( NULL );
}
} else {
}
} else {
free_strarray( tok );
#endif
return( NULL );
}
} else {
}
}
break;
default:
free_strarray( tok );
#endif
return( NULL );
}
}
}
return( lfdp );
}
void
{
}
}
}
{
}
break;
}
}
return( NULL );
}
return( NULL );
}
&lfdp->lfd_curvalwords ) < 0 ) {
return( NULL );
}
return( ldap_getnextfilter( lfdp ));
}
{
return( NULL );
}
}
void
{
char *p, *f;
wordcount = 0;
} else {
;
}
}
f = filtbuf;
}
for ( p = pattern; *p != '\0'; ++p ) {
if ( *p == '%' ) {
++p;
if ( *p == 'v' ) {
if ( isdigit( *(p+1))) {
++p;
wordnum = *p - '1';
if ( *(p+1) == '-' ) {
++p;
if ( isdigit( *(p+1))) {
++p;
#ifndef SUN /* Patch from innosoft Craig.Watkins 08.Jul.97 */
}
#endif
} else {
}
} else {
}
#ifdef SUN /* Patch from innosoft Craig.Watkins 08.Jul.97 */
}
#endif
if ( wordcount > 0 ) {
for ( i = wordnum; i <= endwordnum; ++i ) {
if ( i > wordnum ) { /* add blank btw words */
*f++ = ' ';
}
f += slen;
}
}
} else if ( *(p+1) == '$' ) {
++p;
if ( wordcount > 0 ) {
f += slen;
}
f += slen;
}
f += slen;
} else {
*f++ = *p;
}
} else {
*f++ = *p;
}
/* sanity check */
--f;
break;
}
}
} else {
*f = '\0';
}
}
static int
{
int count;
return( -1 );
}
count = 0;
return( -1 );
}
}
return( count );
}