if ( re_comp( nextflp->lfl_pattern ) != NULL ) { char    msg[256];
if (( errmsg = re_comp( nextflp->lfl_pattern )) != NULL ) { char    msg[512];
ldap_init_getfilter_buf( char *buf, long buflen ){    LDAPFiltDesc	*lfdp;    LDAPFiltList	*flp, *nextflp;    LDAPFiltInfo	*fip, *nextfip;    char		*tag, **tok;    int			tokcnt, i;    if ( (buf == NULL) || (buflen < 0) ||	 ( lfdp = (LDAPFiltDesc *)NSLDAPI_CALLOC(1, sizeof( LDAPFiltDesc)))	 == NULL ) {	return( NULL );    }    flp = nextflp = NULL;    fip = NULL;    tag = NULL;    while ( buflen > 0 && ( tokcnt = nsldapi_next_line_tokens( &buf, &buflen,	    &tok )) > 0 ) {	switch( tokcnt ) {	case 1:		/* tag line */	    if ( tag != NULL ) {		NSLDAPI_FREE( tag );	    }	    tag = tok[ 0 ];	    NSLDAPI_FREE( tok );	    break;	case 4:	case 5:		/* start of filter info. list */	    if (( nextflp = (LDAPFiltList *)NSLDAPI_CALLOC( 1,		    sizeof( LDAPFiltList ))) == NULL ) {		ldap_getfilter_free( lfdp );		return( NULL );	    }	    nextflp->lfl_tag = nsldapi_strdup( tag );	    nextflp->lfl_pattern = tok[ 0 ];	    if ( re_comp( nextflp->lfl_pattern ) != NULL ) {		char    msg[256];		ldap_getfilter_free( lfdp );		sprintf( msg, "bad regular expresssion %s\n",			nextflp->lfl_pattern );		ber_err_print( msg );		nsldapi_free_strarray( tok );		return( NULL );	    }			    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 *)NSLDAPI_CALLOC( 1,			sizeof( LDAPFiltInfo ))) == NULL ) {		    ldap_getfilter_free( lfdp );		    nsldapi_free_strarray( 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 {			nsldapi_free_strarray( tok );			ldap_getfilter_free( lfdp );			return( NULL );		    }		    NSLDAPI_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 );		NSLDAPI_FREE( tok );	    }	    break;	default:	    nsldapi_free_strarray( tok );	    ldap_getfilter_free( lfdp );	    return( NULL );	}    }    if ( tag != NULL ) {	NSLDAPI_FREE( tag );    }    return( lfdp );}