-LDAPFiltDesc *
-ldap_init_getfilter( 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 = 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 */
- free( buf );
- return( NULL );
- }
-
-
- lfdp = ldap_init_getfilter_buf( buf, rlen );
- free( buf );
-
- return( lfdp );
-}
-
-
-LDAPFiltDesc *
-ldap_init_getfilter_buf( char *buf, long buflen )