]> git.sur5r.net Git - openldap/commitdiff
zap ldapv2 only stuff
authorKurt Zeilenga <kurt@openldap.org>
Sat, 10 Aug 2002 00:04:36 +0000 (00:04 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 10 Aug 2002 00:04:36 +0000 (00:04 +0000)
libraries/libldap/Makefile.in
libraries/libldap/dsparse.c [deleted file]
libraries/libldap/free.c
libraries/libldap/getfilter.c [deleted file]
libraries/libldap/ldapfilter.conf [deleted file]
libraries/libldap/libldap.dsp [new file with mode: 0644]
libraries/libldap_r/Makefile.in

index 389bf3bbd9a7b4dd5bad320b9786a4d0442a9c9a..5ffd498120e968fab8a00d57fb7f11318c394526 100644 (file)
@@ -11,8 +11,8 @@ PROGRAMS = apitest dntest ftest ltest
 SRCS   = bind.c open.c result.c error.c compare.c search.c \
        controls.c messages.c references.c extended.c cyrus.c \
        modify.c add.c modrdn.c delete.c abandon.c cache.c \
-       getfilter.c sasl.c sbind.c kbind.c unbind.c \
-       filter.c free.c dsparse.c sort.c \
+       sasl.c sbind.c kbind.c unbind.c \
+       filter.c free.c sort.c \
        getdn.c getentry.c getattr.c getvalues.c addentry.c \
        request.c os-ip.c url.c sortctrl.c vlvctrl.c \
        init.c options.c print.c string.c util-int.c schema.c \
@@ -20,8 +20,8 @@ SRCS  = bind.c open.c result.c error.c compare.c search.c \
 OBJS   = bind.lo open.lo result.lo error.lo compare.lo search.lo \
        controls.lo messages.lo references.lo extended.lo cyrus.lo \
        modify.lo add.lo modrdn.lo delete.lo abandon.lo cache.lo \
-       getfilter.lo sasl.lo sbind.lo kbind.lo unbind.lo \
-       filter.lo free.lo dsparse.lo sort.lo \
+       sasl.lo sbind.lo kbind.lo unbind.lo \
+       filter.lo free.lo sort.lo \
        getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
        request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo \
        init.lo options.lo print.lo string.lo util-int.lo schema.lo \
@@ -46,7 +46,7 @@ ftest:        $(XLIBS) ftest.o
 ltest: $(XLIBS) test.o
        $(LTLINK) -o $@ test.o $(LIBS)
 
-CFFILES=ldap.conf ldapfilter.conf
+CFFILES=ldap.conf
 
 install-local: $(CFFILES) FORCE
        -$(MKDIR) $(DESTDIR)$(libdir)
diff --git a/libraries/libldap/dsparse.c b/libraries/libldap/dsparse.c
deleted file mode 100644 (file)
index 1771d72..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 1993, 1994 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- *
- * dsparse.c:  parsing routines used by display template and search 
- * preference file library routines for LDAP clients.
- *
- * 7 March 1994 by Mark C Smith
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/file.h>
-#include <stdlib.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
-
-#ifndef NEEDPROTOS
-int next_line_tokens();
-void free_strarray();
-static int next_line();
-static char *next_token();
-#else /* !NEEDPROTOS */
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-static int next_line( char **bufp, long *blenp, char **linep );
-static char *next_token( char ** sp );
-#endif /* !NEEDPROTOS */
-
-
-
-int
-next_line_tokens( char **bufp, long *blenp, char ***toksp )
-{
-    char       *p, *line, *token, **toks;
-    int                rc, tokcnt;
-
-    *toksp = NULL;
-
-    if (( rc = next_line( bufp, blenp, &line )) <= 0 ) {
-       return( rc );
-    }
-
-    if (( toks = (char **)calloc( 1, sizeof( char * ))) == NULL ) {
-       free( line );
-       return( -1 );
-    }
-    tokcnt = 0;
-
-    p = line;
-    while (( token = next_token( &p )) != NULL ) {
-       if (( toks = (char **)realloc( toks, ( tokcnt + 2 ) *
-               sizeof( char * ))) == NULL ) {
-           free( (char *)toks );
-           free( line );
-           return( -1 );
-       }
-       toks[ tokcnt ] = token;
-       toks[ ++tokcnt ] = NULL;
-    }
-
-    if ( tokcnt == 1 && strcasecmp( toks[ 0 ], "END" ) == 0 ) {
-       tokcnt = 0;
-       free_strarray( toks );
-       toks = NULL;
-    }
-
-    free( line );
-
-    if ( tokcnt == 0 ) {
-       if ( toks != NULL ) {
-           free( (char *)toks );
-       }
-    } else {
-       *toksp = toks;
-    }
-
-    return( tokcnt );
-}
-
-
-static int
-next_line( char **bufp, long *blenp, char **linep )
-{
-    char       *linestart, *line, *p;
-    long       plen;
-
-    linestart = *bufp;
-    p = *bufp;
-    plen = *blenp;
-
-    do {
-       for ( linestart = p; plen > 0; ++p, --plen ) {
-           if ( *p == '\r' ) {
-               if ( plen > 1 && *(p+1) == '\n' ) {
-                   ++p;
-                   --plen;
-               }
-               break;
-           }
-
-           if ( *p == '\n' ) {
-               if ( plen > 1 && *(p+1) == '\r' ) {
-                   ++p;
-                   --plen;
-               }
-               break;
-           }
-       }
-       ++p;
-       --plen;
-    } while ( plen > 0 && ( *linestart == '#' || linestart + 1 == p ));
-
-
-    *bufp = p;
-    *blenp = plen;
-
-
-    if ( plen <= 0 ) {
-       *linep = NULL;
-       return( 0 );    /* end of file */
-    }
-
-    if (( line = malloc( p - linestart )) == NULL ) {
-       *linep = NULL;
-       return( -1 );   /* fatal error */
-    }
-
-    (void) memcpy( line, linestart, p - linestart );
-    line[ p - linestart - 1 ] = '\0';
-    *linep = line;
-    return( strlen( line ));
-}
-
-
-static char *
-next_token( char **sp )
-{
-    int                in_quote = 0;
-    char       *p, *tokstart, *t;
-
-    if ( **sp == '\0' ) {
-       return( NULL );
-    }
-
-    p = *sp;
-
-    while ( isspace( *p )) {           /* skip leading white space */
-       ++p;
-    }
-
-    if ( *p == '\0' ) {
-       return( NULL );
-    }
-
-    if ( *p == '\"' ) {
-       in_quote = 1;
-       ++p;
-    }
-    t = tokstart = p;
-
-    for ( ;; ) {
-       if ( *p == '\0' || ( isspace( *p ) && !in_quote )) {
-           if ( *p != '\0' ) {
-               ++p;
-           }
-           *t++ = '\0';                /* end of token */
-           break;
-       }
-
-       if ( *p == '\"' ) {
-           in_quote = !in_quote;
-           ++p;
-       } else {
-           *t++ = *p++;
-       }
-    }
-
-    *sp = p;
-
-    if ( t == tokstart ) {
-       return( NULL );
-    }
-
-    return( strdup( tokstart ));
-}
-
-
-void
-free_strarray( char **sap )
-{
-    int                i;
-
-    if ( sap != NULL ) {
-       for ( i = 0; sap[ i ] != NULL; ++i ) {
-           free( sap[ i ] );
-       }
-       free( (char *)sap );
-    }
-}
index d7a13228e6db9c5245e2fd95313aa4233533fd03..b208b2f88fe1f8fd379bd798834248e8918a5357 100644 (file)
@@ -1,4 +1,9 @@
+/* $OpenLDAP$ */
 /*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*  Portions
  *  Copyright (c) 1994 The Regents of the University of Michigan.
  *  All rights reserved.
  *
  *           link in lots of extra code when not using certain features
  */
 
-#ifndef lint 
-static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
+#include "portable.h"
 
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <stdlib.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
+#include <ac/stdlib.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
 
+/*
+ * C-API deallocator
+ */
 void
-ldap_getfilter_free( LDAPFiltDesc *lfdp )
+ldap_memfree( void *p )
 {
-    LDAPFiltList       *flp, *nextflp;
-    LDAPFiltInfo       *fip, *nextfip;
-
-    for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = nextflp ) {
-       for ( fip = flp->lfl_ilist; fip != NULL; fip = nextfip ) {
-           nextfip = fip->lfi_next;
-           free( fip->lfi_filter );
-           free( fip->lfi_desc );
-           free( fip );
-       }
-       nextflp = flp->lfl_next;
-       free( flp->lfl_pattern );
-       free( flp->lfl_delims );
-       free( flp->lfl_tag );
-       free( flp );
-    }
-
-    if ( lfdp->lfd_curvalcopy != NULL ) {
-       free( lfdp->lfd_curvalcopy );
-    }
-    if ( lfdp->lfd_curvalwords != NULL ) {
-       free( lfdp->lfd_curvalwords );
-    }
-    if ( lfdp->lfd_filtprefix != NULL ) {
-       free( lfdp->lfd_filtprefix );
-    }
-    if ( lfdp->lfd_filtsuffix != NULL ) {
-       free( lfdp->lfd_filtsuffix );
-    }
-
-    free( lfdp );
+       LDAP_FREE( p );
+}
+
+void
+ldap_memvfree( void **v )
+{
+       LDAP_VFREE( v );
+}
+
+void *
+ldap_memalloc( ber_len_t s )
+{
+       return LDAP_MALLOC( s );
+}
+
+void *
+ldap_memcalloc( ber_len_t n, ber_len_t s )
+{
+       return LDAP_CALLOC( n, s );
+}
+
+void *
+ldap_memrealloc( void* p, ber_len_t s )
+{
+       return LDAP_REALLOC( p, s );
+}
+
+char *
+ldap_strdup( LDAP_CONST char *p )
+{
+       return LDAP_STRDUP( p );
 }
 
 /*
@@ -82,13 +76,21 @@ ldap_mods_free( LDAPMod **mods, int freemods )
 
        for ( i = 0; mods[i] != NULL; i++ ) {
                if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) {
-                       ber_bvecfree( mods[i]->mod_bvalues );
-               } else {
-                       ldap_value_free( mods[i]->mod_values );
+                       if( mods[i]->mod_bvalues != NULL )
+                               ber_bvecfree( mods[i]->mod_bvalues );
+
+               } else if( mods[i]->mod_values != NULL ) {
+                       LDAP_VFREE( mods[i]->mod_values );
                }
-               free( (char *) mods[i] );
+
+               if ( mods[i]->mod_type != NULL ) {
+                       LDAP_FREE( mods[i]->mod_type );
+               }
+
+               LDAP_FREE( (char *) mods[i] );
        }
 
-       if ( freemods )
-               free( (char *) mods );
+       if ( freemods ) {
+               LDAP_FREE( (char *) mods );
+       }
 }
diff --git a/libraries/libldap/getfilter.c b/libraries/libldap/getfilter.c
deleted file mode 100644 (file)
index d4d0d44..0000000
+++ /dev/null
@@ -1,440 +0,0 @@
-/* $OpenLDAP$ */
-/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- */
-/*  Portions
- *  Copyright (c) 1993 Regents of the University of Michigan.
- *  All rights reserved.
- *
- *  getfilter.c -- optional add-on to libldap
- */
-
-#include "portable.h"
-
-#include <stdio.h>
-
-#include <ac/stdlib.h>
-
-#include <ac/errno.h>
-#include <ac/regex.h>
-#include <ac/string.h>
-#include <ac/time.h>
-#include <ac/unistd.h>
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#include "ldap-int.h"
-
-static int break_into_words LDAP_P((
-       /* LDAP_CONST */ char *str,
-       LDAP_CONST char *delims,
-       char ***wordsp ));
-
-#define FILT_MAX_LINE_LEN      1024
-
-static LDAPFiltDesc *
-ldap_init_getfilter_buf( char *buf, ber_len_t buflen )
-{
-    LDAPFiltDesc       *lfdp;
-    LDAPFiltList       *flp, *nextflp;
-    LDAPFiltInfo       *fip, *nextfip;
-    char                       *tag, **tok;
-    int                                tokcnt, i;
-       int                             rc;
-       regex_t                 re;
-
-    if (( lfdp = (LDAPFiltDesc *)LDAP_CALLOC( 1, sizeof( LDAPFiltDesc))) == NULL ) {
-       return( NULL );
-    }
-
-    flp = nextflp = NULL;
-    fip = NULL;
-    tag = NULL;
-
-    while ( buflen > 0 && ( tokcnt = ldap_int_next_line_tokens( &buf, &buflen, &tok ))
-           > 0 ) {
-
-       switch( tokcnt ) {
-       case 1:         /* tag line */
-           if ( tag != NULL ) {
-               LDAP_FREE( tag );
-           }
-           tag = tok[ 0 ];
-           LDAP_FREE( tok );
-           break;
-       case 4:
-       case 5:         /* start of filter info. list */
-           if (( nextflp = (LDAPFiltList *)LDAP_CALLOC( 1, sizeof( LDAPFiltList )))
-                   == NULL ) {
-               ldap_getfilter_free( lfdp );
-               return( NULL );
-           }
-           nextflp->lfl_tag = LDAP_STRDUP( tag );
-           nextflp->lfl_pattern = tok[ 0 ];
-           if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
-               char error[512];
-               regerror(rc, &re, error, sizeof(error));
-               ldap_getfilter_free( lfdp );
-#ifdef NEW_LOGGING
-               LDAP_LOG ( FILTER, ERR, 
-                       "ldap_init_get_filter_buf: bad regular expression %s, %s\n", 
-                       nextflp->lfl_pattern, error, 0 );
-#else
-               Debug( LDAP_DEBUG_ANY, "ldap_init_get_filter_buf: "
-                       "bad regular expression %s, %s\n",
-                       nextflp->lfl_pattern, error, 0 );
-#endif
-               errno = EINVAL;
-               LDAP_VFREE( tok );
-               return( NULL );
-           }
-               regfree(&re);
-               
-           nextflp->lfl_delims = tok[ 1 ];
-           nextflp->lfl_ilist = NULL;
-           nextflp->lfl_next = NULL;
-           if ( flp == NULL ) {        /* first one */
-               lfdp->lfd_filtlist = nextflp;
-           } else {
-               flp->lfl_next = nextflp;
-           }
-           flp = nextflp;
-           fip = NULL;
-           for ( i = 2; i < 5; ++i ) {
-               tok[ i - 2 ] = tok[ i ];
-           }
-           /* fall through */
-
-       case 2:
-       case 3:         /* filter, desc, and optional search scope */
-           if ( nextflp != NULL ) { /* add to info list */
-               if (( nextfip = (LDAPFiltInfo *)LDAP_CALLOC( 1,
-                       sizeof( LDAPFiltInfo ))) == NULL ) {
-                   ldap_getfilter_free( lfdp );
-                   LDAP_VFREE( tok );
-                   return( NULL );
-               }
-               if ( fip == NULL ) {    /* first one */
-                   nextflp->lfl_ilist = nextfip;
-               } else {
-                   fip->lfi_next = nextfip;
-               }
-               fip = nextfip;
-               nextfip->lfi_next = NULL;
-               nextfip->lfi_filter = tok[ 0 ];
-               nextfip->lfi_desc = tok[ 1 ];
-               if ( tok[ 2 ] != NULL ) {
-                   if ( strcasecmp( tok[ 2 ], "subtree" ) == 0 ) {
-                       nextfip->lfi_scope = LDAP_SCOPE_SUBTREE;
-                   } else if ( strcasecmp( tok[ 2 ], "onelevel" ) == 0 ) {
-                       nextfip->lfi_scope = LDAP_SCOPE_ONELEVEL;
-                   } else if ( strcasecmp( tok[ 2 ], "base" ) == 0 ) {
-                       nextfip->lfi_scope = LDAP_SCOPE_BASE;
-                   } else {
-                       LDAP_VFREE( tok );
-                       ldap_getfilter_free( lfdp );
-                       errno = EINVAL;
-                       return( NULL );
-                   }
-                   LDAP_FREE( tok[ 2 ] );
-                   tok[ 2 ] = NULL;
-               } else {
-                   nextfip->lfi_scope = LDAP_SCOPE_SUBTREE;    /* default */
-               }
-               nextfip->lfi_isexact = ( strchr( tok[ 0 ], '*' ) == NULL &&
-                       strchr( tok[ 0 ], '~' ) == NULL );
-               LDAP_FREE( tok );
-           }
-           break;
-
-       default:
-           LDAP_VFREE( tok );
-           ldap_getfilter_free( lfdp );
-           errno = EINVAL;
-           return( NULL );
-       }
-    }
-
-    if ( tag != NULL ) {
-       LDAP_FREE( tag );
-    }
-
-    return( lfdp );
-}
-
-LDAPFiltDesc *
-ldap_init_getfilter( LDAP_CONST char *fname )
-{
-    FILE               *fp;
-    char               *buf;
-    long               rlen, len;
-    int                eof;
-    LDAPFiltDesc       *lfdp;
-
-    if (( fp = fopen( fname, "r" )) == NULL ) {
-       return( NULL );
-    }
-
-    if ( fseek( fp, 0L, SEEK_END ) != 0 ) {    /* move to end to get len */
-       fclose( fp );
-       return( NULL );
-    }
-
-    len = ftell( fp );
-
-    if ( fseek( fp, 0L, SEEK_SET ) != 0 ) {    /* back to start of file */
-       fclose( fp );
-       return( NULL );
-    }
-
-    if (( buf = LDAP_MALLOC( (size_t)len )) == NULL ) {
-       fclose( fp );
-       return( NULL );
-    }
-
-    rlen = fread( buf, 1, (size_t)len, fp );
-    eof = feof( fp );
-    fclose( fp );
-
-    if ( rlen != len && !eof ) {       /* error:  didn't get the whole file */
-       LDAP_FREE( buf );
-       return( NULL );
-    }
-
-
-    lfdp = ldap_init_getfilter_buf( buf, rlen );
-    LDAP_FREE( buf );
-
-    return( lfdp );
-}
-
-LDAPFiltInfo *
-ldap_getfirstfilter(
-       LDAPFiltDesc *lfdp,
-       /* LDAP_CONST */ char *tagpat,
-       /* LDAP_CONST */ char *value )
-{
-    LDAPFiltList       *flp;
-       int                             rc;
-       regex_t                 re;
-
-    if ( lfdp->lfd_curvalcopy != NULL ) {
-       LDAP_FREE( lfdp->lfd_curvalcopy );
-       LDAP_FREE( lfdp->lfd_curvalwords );
-    }
-
-    lfdp->lfd_curval = value;
-    lfdp->lfd_curfip = NULL;
-
-       for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
-               /* compile tagpat, continue if we fail */
-               if (regcomp(&re, tagpat, REG_EXTENDED|REG_NOSUB) != 0)
-                       continue;
-
-               /* match tagpattern and tag, continue if we fail */
-               rc = regexec(&re, flp->lfl_tag, 0, NULL, 0);
-               regfree(&re);
-               if (rc != 0)
-                       continue;
-
-               /* compile flp->ifl_pattern, continue if we fail */
-               if (regcomp(&re, flp->lfl_pattern, REG_EXTENDED|REG_NOSUB) != 0)
-                       continue;
-
-               /* match ifl_pattern and lfd_curval, continue if we fail */
-               rc = regexec(&re, lfdp->lfd_curval, 0, NULL, 0);
-               regfree(&re);
-               if (rc != 0)
-                       continue;
-
-               /* we successfully compiled both patterns and matched both values */
-               lfdp->lfd_curfip = flp->lfl_ilist;
-               break;
-    }
-
-    if ( lfdp->lfd_curfip == NULL ) {
-       return( NULL );
-    }
-
-    if (( lfdp->lfd_curvalcopy = LDAP_STRDUP( value )) == NULL ) {
-       return( NULL );
-    }
-
-    if ( break_into_words( lfdp->lfd_curvalcopy, flp->lfl_delims,
-               &lfdp->lfd_curvalwords ) < 0 ) {
-       LDAP_FREE( lfdp->lfd_curvalcopy );
-       lfdp->lfd_curvalcopy = NULL;
-       return( NULL );
-    }
-
-    return( ldap_getnextfilter( lfdp ));
-}
-
-static void
-ldap_build_filter(
-       char *filtbuf,
-       ber_len_t buflen,
-       LDAP_CONST char *pattern,
-       LDAP_CONST char *prefix,
-       LDAP_CONST char *suffix,
-       LDAP_CONST char *attr,
-       LDAP_CONST char *value,
-       char **valwords );
-
-LDAPFiltInfo *
-ldap_getnextfilter( LDAPFiltDesc *lfdp )
-{
-    LDAPFiltInfo       *fip;
-
-    fip = lfdp->lfd_curfip;
-
-    if ( fip == NULL ) {
-       return( NULL );
-    }
-
-    lfdp->lfd_curfip = fip->lfi_next;
-
-    ldap_build_filter( lfdp->lfd_filter, LDAP_FILT_MAXSIZ, fip->lfi_filter,
-           lfdp->lfd_filtprefix, lfdp->lfd_filtsuffix, NULL,
-           lfdp->lfd_curval, lfdp->lfd_curvalwords );
-    lfdp->lfd_retfi.lfi_filter = lfdp->lfd_filter;
-    lfdp->lfd_retfi.lfi_desc = fip->lfi_desc;
-    lfdp->lfd_retfi.lfi_scope = fip->lfi_scope;
-    lfdp->lfd_retfi.lfi_isexact = fip->lfi_isexact;
-
-    return( &lfdp->lfd_retfi );
-}
-
-static void
-ldap_build_filter(
-       char *filtbuf,
-       ber_len_t buflen,
-       LDAP_CONST char *pattern,
-       LDAP_CONST char *prefix,
-       LDAP_CONST char *suffix,
-       LDAP_CONST char *attr,
-       LDAP_CONST char *value,
-       char **valwords )
-{
-       const char *p;
-       char *f;
-       size_t  slen;
-       int     i, wordcount, wordnum, endwordnum;
-       
-       if ( valwords == NULL ) {
-           wordcount = 0;
-       } else {
-           for ( wordcount = 0; valwords[ wordcount ] != NULL; ++wordcount ) {
-               ;
-           }
-       }
-
-       f = filtbuf;
-
-       if ( prefix != NULL ) {
-           strcpy( f, prefix );
-           f += strlen( prefix );
-       }
-
-       for ( p = pattern; *p != '\0'; ++p ) {
-           if ( *p == '%' ) {
-               ++p;
-               if ( *p == 'v' ) {
-                   if ( LDAP_DIGIT( (unsigned char) p[1] )) {
-                       ++p;
-                       wordnum = *p - '1';
-                       if ( *(p+1) == '-' ) {
-                           ++p;
-                           if ( LDAP_DIGIT( (unsigned char) p[1] )) {
-                               ++p;
-                               endwordnum = *p - '1';  /* e.g., "%v2-4" */
-                               if ( endwordnum > wordcount - 1 ) {
-                                   endwordnum = wordcount - 1;
-                               }
-                           } else {
-                               endwordnum = wordcount - 1;  /* e.g., "%v2-" */
-                           }
-                       } else {
-                           endwordnum = wordnum;       /* e.g., "%v2" */
-                       }
-
-                       if ( wordcount > 0 ) {
-                           for ( i = wordnum; i <= endwordnum; ++i ) {
-                               if ( i > wordnum ) {  /* add blank btw words */
-                                   *f++ = ' ';
-                               }
-                               slen = strlen( valwords[ i ] );
-                               AC_MEMCPY( f, valwords[ i ], slen );
-                               f += slen;
-                           }
-                       }
-                   } else if ( *(p+1) == '$' ) {
-                       ++p;
-                       if ( wordcount > 0 ) {
-                           wordnum = wordcount - 1;
-                           slen = strlen( valwords[ wordnum ] );
-                           AC_MEMCPY( f, valwords[ wordnum ], slen );
-                           f += slen;
-                       }
-                   } else if ( value != NULL ) {
-                       slen = strlen( value );
-                       AC_MEMCPY( f, value, slen );
-                       f += slen;
-                   }
-               } else if ( *p == 'a' && attr != NULL ) {
-                   slen = strlen( attr );
-                   AC_MEMCPY( f, attr, slen );
-                   f += slen;
-               } else {
-                   *f++ = *p;
-               }
-           } else {
-               *f++ = *p;
-           }
-               
-           if ( (size_t) (f - filtbuf) > buflen ) {
-               /* sanity check */
-               --f;
-               break;
-           }
-       }
-
-       if ( suffix != NULL && ( (size_t) (f - filtbuf) < buflen ) )
-       {
-           strcpy( f, suffix );
-       } else {
-           *f = '\0';
-       }
-}
-
-static int
-break_into_words( /* LDAP_CONST */ char *str, LDAP_CONST char *delims, char ***wordsp )
-{
-    char       *word, **words;
-    int                count;
-    char        *tok_r;        
-
-    if (( words = (char **)LDAP_CALLOC( 1, sizeof( char * ))) == NULL ) {
-       return( -1 );
-    }
-    count = 0;
-    words[ count ] = NULL;
-
-    word = ldap_pvt_strtok( str, delims, &tok_r );
-    while ( word != NULL ) {
-       if (( words = (char **)LDAP_REALLOC( words,
-               ( count + 2 ) * sizeof( char * ))) == NULL ) {
-           return( -1 );
-       }
-
-       words[ count ] = word;
-       words[ ++count ] = NULL;
-       word = ldap_pvt_strtok( NULL, delims, &tok_r );
-    }
-       
-    *wordsp = words;
-    return( count );
-}
diff --git a/libraries/libldap/ldapfilter.conf b/libraries/libldap/ldapfilter.conf
deleted file mode 100644 (file)
index c602f7d..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-# ldap filter file
-#
-# lines like this that start with # or empty lines are ignored
-# 
-# syntax:
-#
-# <tag>
-#   <pattern1> <delimiters>    <filter1-1>     <desc1-1>       [<scope>]
-#                              <filter1-2>     <desc1-2>       [<scope>]
-#
-#   <pattern2> <delimiters>    <filter2-1>     <desc2-1>       [<scope>] ...
-#
-# The "desc" should describe the filter and it should correctly complete
-# both of the following phrases:
-#
-#      One <desc> match was found for...
-#      Three <desc> matches were found for...
-#
-# The scope is optional, and should be one of:
-#      "base"
-#      "onelevel"
-#      "subtree"
-# if it is included.
-#
-
-"finger and ud and go500 and go500gw subtree and web500gw subtree and rp500 and rcpt500 and ufn last"
-    "="                " "     "%v"                            "arbitrary filter"
-
-    "^[0-9][0-9-]*$"   " "     "(telephoneNumber=*%v)" "phone number"
-
-    "@"                " "     "(mail=%v)"                     "email address"
-                       "(mail=%v*)"                    "start of email address"
-
-    "^.[. _].*"        ". _"   "(cn=%v1* %v2-)"                "first initial"
-
-    ".*[. _].$"        ". _"   "(cn=%v1-*)"                    "last initial"
-
-    "[. _]"    ". _"   "(|(sn=%v1-)(cn=%v1-))"         "exact"
-                       "(|(sn~=%v1-)(cn~=%v1-))"       "approximate"
-
-    ".*"       ". "    "(|(cn=%v1)(sn=%v1)(uid=%v1))"  "exact"
-                       "(|(cn~=%v1)(sn~=%v1))"         "approximate"
-
-"go500gw onelevel and web500gw onelevel and ufn first and ufn intermediate"
-    "="                " "     "%v"                            "arbitrary filter"
-
-    "^..$"     " "     "(|(o=%v)(c=%v)(l=%v)(co=%v))"          "exact"
-                       "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))"      "approximate"
-
-    " "                " "     "(|(o=%v)(l=%v)(co=%v)(ou=%v))"         "exact"
-                       "(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))"     "approximate"
-
-    "\."       " "     "(associatedDomain=%v)"                 "exact"
-
-    ".*"       " "     "(|(o=%v)(l=%v)(co=%v)(ou=%v))"         "exact"
-                       "(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))"     "approximate"
-
-
-#
-# xax500
-#
-
-"xax500"
-    "="                        " "     "(%v)"                  "arbitrary filter"
-
-    "^[0-9][0-9-]*$"   " "     "(telephoneNumber=*%v)" "phone number"
-
-    "@"                        " "     "(mail=%v)"             "email address"
-                               "(mail=%v*)"            "start of email address"
-
-    "^.[. _].*"                ". _"   "(cn=%v1* %v2-)"        "first initial"
-
-    ".*[. _].$"                ". _"   "(cn=%v1-*)"            "last initial"
-
-    "[. _]"            ". _"   "(|(sn=%v1-)(cn=%v1-))"         "exact"
-                               "(|(sn~=%v1-)(cn~=%v1-))"       "approximate"
-
-    ".*"               ". "    "(|(cn=%v1)(sn=%v1)(uid=%v1))"  "exact"
-                       "(|(cn=%v1)(sn~=%v1))"                  "approximate"
-
-
-"xax500-auth"
-    "="                        " "     "(%v)"                  "arbitrary filter"
-
-    "^[0-9][0-9-]*$"   " "     "(telephoneNumber=*%v)" "phone number"
-
-    "@"                        " "     "(mail=%v)"             "email address"
-                               "(mail=%v*)"            "start of email address"
-
-    "^.[. _].*"                ". _"   "(cn=%v1* %v2-)"        "first initial"
-
-    ".*[. _].$"                ". _"   "(cn=%v1-*)"            "last initial"
-
-    "[. _]"            ". _"   "(|(sn=%v1-)(cn=%v1-))" "exact"
-                       "(|(sn~=%v1-)(cn~=%v1-))"       "approximate"
-
-    ".*"               ". "    "(|(cn=%v1)(sn=%v1)(uid=%v1))"  "exact"
-                       "(|(cn=%v1)(sn~=%v1))"                  "approximate"
-
-"list500"
-    "[. _]"    ". _"   "(|(sn=%v1-)(cn=%v1-))"         "exact"
-                       "(|(sn~=%v1-)(cn~=%v1-))"       "approximate"
-
-    ".*"       ". "    "(|(cn=%v1)(sn=%v1)(uid=%v1))"  "exact"
-                       "(|(cn~=%v1)(sn~=%v1))"         "approximate"
diff --git a/libraries/libldap/libldap.dsp b/libraries/libldap/libldap.dsp
new file mode 100644 (file)
index 0000000..9bae2d9
--- /dev/null
@@ -0,0 +1,361 @@
+# Microsoft Developer Studio Project File - Name="libldap" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libldap - Win32 Single Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libldap.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libldap.mak" CFG="libldap - Win32 Single Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libldap - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldap - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldap - Win32 Single Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldap - Win32 Single Release" (based on\
+ "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF  "$(CFG)" == "libldap - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\Release"
+# PROP Intermediate_Dir "..\..\Release\libldap"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\..\Release\oldap32.lib"
+
+!ELSEIF  "$(CFG)" == "libldap - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\Debug"
+# PROP Intermediate_Dir "..\..\Debug\libldap"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\..\Debug\oldap32.lib"
+
+!ELSEIF  "$(CFG)" == "libldap - Win32 Single Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "libldap_"
+# PROP BASE Intermediate_Dir "libldap_"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\SDebug"
+# PROP Intermediate_Dir "..\..\SDebug\libldap"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo /out:"..\Debug\oldap32.lib"
+# ADD LIB32 /nologo /out:"..\..\SDebug\oldap32.lib"
+
+!ELSEIF  "$(CFG)" == "libldap - Win32 Single Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "libldap0"
+# PROP BASE Intermediate_Dir "libldap0"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\SRelease"
+# PROP Intermediate_Dir "..\..\SRelease\libldap"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo /out:"..\Release\oldap32.lib"
+# ADD LIB32 /nologo /out:"..\..\SRelease\oldap32.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libldap - Win32 Release"
+# Name "libldap - Win32 Debug"
+# Name "libldap - Win32 Single Debug"
+# Name "libldap - Win32 Single Release"
+# Begin Source File
+
+SOURCE=.\abandon.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\add.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\addentry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cache.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\charray.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\compare.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\controls.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cyrus.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\delete.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dnssrv.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\extended.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filter.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\free.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getattr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getdn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getentry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getvalues.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\init.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\kbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\ldap-int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_cdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_defaults.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_features.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_log.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_pvt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_pvt_uc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_queue.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_schema.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\ldap_utf8.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\messages.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\modify.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\modrdn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\open.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\os-ip.c"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portable.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\print.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\references.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\request.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\result.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sasl.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\schema.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\search.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sort.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sortctrl.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\string.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\tls.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\unbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\url.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\utf-8-conv.c"
+# End Source File
+# Begin Source File
+
+SOURCE=".\utf-8.c"
+# End Source File
+# Begin Source File
+
+SOURCE=".\util-int.c"
+# End Source File
+# Begin Source File
+
+SOURCE=.\vlvctrl.c
+# End Source File
+# End Target
+# End Project
index d4d45f0e1c0e271c2d7d3da3d97fdb020bc85775..fdb8a8d3092b9f00de869cc58526d8b49a7c8774 100644 (file)
@@ -13,8 +13,8 @@ XXSRCS    = apitest.c test.c \
        bind.c open.c result.c error.c compare.c search.c \
        controls.c messages.c references.c extended.c cyrus.c \
        modify.c add.c modrdn.c delete.c abandon.c cache.c \
-       getfilter.c sasl.c sbind.c kbind.c unbind.c \
-       filter.c free.c dsparse.c sort.c \
+       sasl.c sbind.c kbind.c unbind.c \
+       filter.c free.c sort.c \
        getdn.c getentry.c getattr.c getvalues.c addentry.c \
        request.c os-ip.c url.c sortctrl.c vlvctrl.c \
        init.c options.c print.c string.c util-int.c schema.c \
@@ -28,8 +28,8 @@ OBJS  = threads.lo rdwr.lo tpool.lo  \
        bind.lo open.lo result.lo error.lo compare.lo search.lo \
        controls.lo messages.lo references.lo extended.lo cyrus.lo \
        modify.lo add.lo modrdn.lo delete.lo abandon.lo cache.lo \
-       getfilter.lo sasl.lo sbind.lo kbind.lo unbind.lo \
-       filter.lo free.lo dsparse.lo sort.lo \
+       sasl.lo sbind.lo kbind.lo unbind.lo \
+       filter.lo free.lo sort.lo \
        getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
        request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo \
        init.lo options.lo print.lo string.lo util-int.lo schema.lo \