]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/getfilter.c
Move LDAPServer, LDAPConn, LDAPRequest, and LDAPCache
[openldap] / libraries / libldap / getfilter.c
index 68bd3fd26afb52adf6a8f2cfd6886369bc31fb9c..f5b9ff0d263e5f5c0775287110d33a72369f3aad 100644 (file)
@@ -13,8 +13,8 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <ctype.h>
 
+#include <ac/ctype.h>
 #include <ac/errno.h>
 #include <ac/regex.h>
 #include <ac/string.h>
@@ -25,12 +25,9 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
 #include <sys/file.h>
 #endif
 
-#include "lber.h"
-#include "ldap.h"
+#include "ldap-int.h"
 
 static int break_into_words LDAP_P(( char *str, char *delims, char ***wordsp ));
-int next_line_tokens LDAP_P(( char **bufp, long *blenp, char ***toksp ));
-void free_strarray LDAP_P(( char **sap ));
 
 #define FILT_MAX_LINE_LEN      1024
 
@@ -118,7 +115,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
                ldap_getfilter_free( lfdp );
                return( NULL );
            }
-           nextflp->lfl_tag = strdup( tag );
+           nextflp->lfl_tag = ldap_strdup( tag );
            nextflp->lfl_pattern = tok[ 0 ];
            if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
 #ifdef LDAP_LIBUI
@@ -127,9 +124,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
                ldap_getfilter_free( lfdp );
                fprintf( stderr, "bad regular expresssion %s, %s\n",
                        nextflp->lfl_pattern, error );
-#if !defined( MACOS ) && !defined( DOS )
                errno = EINVAL;
-#endif
 #endif /* LDAP_LIBUI */
                free_strarray( tok );
                return( NULL );
@@ -179,9 +174,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
                    } else {
                        free_strarray( tok );
                        ldap_getfilter_free( lfdp );
-#if !defined( MACOS ) && !defined( DOS )
                        errno = EINVAL;
-#endif
                        return( NULL );
                    }
                    free( tok[ 2 ] );
@@ -198,9 +191,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
        default:
            free_strarray( tok );
            ldap_getfilter_free( lfdp );
-#if !defined( MACOS ) && !defined( DOS )
            errno = EINVAL;
-#endif
            return( NULL );
        }
     }
@@ -219,12 +210,12 @@ ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix )
     if ( lfdp->lfd_filtprefix != NULL ) {
        free( lfdp->lfd_filtprefix );
     }
-    lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : strdup( prefix );
+    lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : ldap_strdup( prefix );
 
     if ( lfdp->lfd_filtsuffix != NULL ) {
        free( lfdp->lfd_filtsuffix );
     }
-    lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : strdup( suffix );
+    lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : ldap_strdup( suffix );
 }
 
 
@@ -273,7 +264,7 @@ ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
        return( NULL );
     }
 
-    if (( lfdp->lfd_curvalcopy = strdup( value )) == NULL ) {
+    if (( lfdp->lfd_curvalcopy = ldap_strdup( value )) == NULL ) {
        return( NULL );
     }
 
@@ -414,14 +405,15 @@ break_into_words( char *str, char *delims, char ***wordsp )
 {
     char       *word, **words;
     int                count;
-       
+    char        *tok_r;        
+
     if (( words = (char **)calloc( 1, sizeof( char * ))) == NULL ) {
        return( -1 );
     }
     count = 0;
     words[ count ] = NULL;
 
-    word = strtok( str, delims );
+    word = ldap_int_strtok( str, delims, &tok_r );
     while ( word != NULL ) {
        if (( words = (char **)realloc( words,
                ( count + 2 ) * sizeof( char * ))) == NULL ) {
@@ -430,7 +422,7 @@ break_into_words( char *str, char *delims, char ***wordsp )
 
        words[ count ] = word;
        words[ ++count ] = NULL;
-       word = strtok( NULL, delims );
+       word = ldap_int_strtok( NULL, delims, &tok_r );
     }
        
     *wordsp = words;