mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
Delete ldap_build_filter(), it's broke.
Clean up headers.
This commit is contained in:
parent
9d56c59d1b
commit
25b5aaf262
@ -16,7 +16,7 @@
|
||||
|
||||
/* cross compilers should define both AC_INT{2,4}_TYPE in CPPFLAGS */
|
||||
|
||||
#if !defined( AC_INT4_TYPE )
|
||||
#if !defined( AC_INT4_TYPE )
|
||||
/* use autoconf defines to provide sized typedefs */
|
||||
# if SIZEOF_LONG == 4
|
||||
# define AC_INT4_TYPE long
|
||||
@ -34,7 +34,7 @@ typedef AC_INT4_TYPE ac_int4;
|
||||
typedef signed AC_INT4_TYPE ac_sint4;
|
||||
typedef unsigned AC_INT4_TYPE ac_uint4;
|
||||
|
||||
#if !defined( AC_INT2_TYPE )
|
||||
#if !defined( AC_INT2_TYPE )
|
||||
# if SIZEOF_SHORT == 2
|
||||
# define AC_INT2_TYPE short
|
||||
# elif SIZEOF_INT == 2
|
||||
@ -46,8 +46,8 @@ typedef unsigned AC_INT4_TYPE ac_uint4;
|
||||
/* # error "AC_INT2_TYPE?" */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined( AC_INT2_TYPE )
|
||||
|
||||
#if defined( AC_INT2_TYPE )
|
||||
typedef AC_INT2_TYPE ac_int2;
|
||||
typedef signed AC_INT2_TYPE ac_sint2;
|
||||
typedef unsigned AC_INT2_TYPE ac_uint2;
|
||||
|
@ -24,7 +24,7 @@
|
||||
/* no sys_errlist */
|
||||
# define sys_nerr 0
|
||||
# define sys_errlist ((char **)0)
|
||||
#elif DECL_SYS_ERRLIST
|
||||
#elif DECL_SYS_ERRLIST
|
||||
/* have sys_errlist but need declaration */
|
||||
LDAP_LIBC_V(int) sys_nerr;
|
||||
LDAP_LIBC_V(char) *sys_errlist[];
|
||||
|
@ -28,7 +28,7 @@
|
||||
#error "No POSIX REGEX available."
|
||||
|
||||
#elif HAVE_GNUREGEX_H
|
||||
/* system has GNU gnuregex.h */
|
||||
/* system has GNU gnuregex.h */
|
||||
# include <gnuregex.h>
|
||||
#else
|
||||
/* have regex.h, assume it's POSIX compliant */
|
||||
|
@ -49,7 +49,7 @@ LDAP_LUTIL_F(lutil_sig_t) lutil_sigaction( int sig, lutil_sig_t func );
|
||||
* two signals reserved for user applications. This forces
|
||||
* OpenLDAP to use other signals reserved for other uses.
|
||||
*/
|
||||
|
||||
|
||||
# if defined( SIGSTKFLT )
|
||||
# define LDAP_SIGUSR1 SIGSTKFLT
|
||||
# elif defined ( SIGSYS )
|
||||
|
@ -137,7 +137,7 @@ LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int));
|
||||
|
||||
#ifdef HAVE_PIPE
|
||||
/*
|
||||
* Only use pipe() on systems where file and socket descriptors
|
||||
* Only use pipe() on systems where file and socket descriptors
|
||||
* are interchangable
|
||||
*/
|
||||
# define USE_PIPE HAVE_PIPE
|
||||
|
@ -121,7 +121,7 @@ typedef struct lber_memory_fns {
|
||||
BER_MEMFREE_FN bmf_free;
|
||||
} BerMemoryFunctions;
|
||||
|
||||
/* LBER Sockbuf_IO options */
|
||||
/* LBER Sockbuf_IO options */
|
||||
#define LBER_SB_OPT_GET_FD 1
|
||||
#define LBER_SB_OPT_SET_FD 2
|
||||
#define LBER_SB_OPT_HAS_IO 3
|
||||
@ -174,12 +174,12 @@ struct sockbuf_io {
|
||||
int (*sbi_setup)( Sockbuf_IO_Desc *sbiod, void *arg );
|
||||
int (*sbi_remove)( Sockbuf_IO_Desc *sbiod );
|
||||
int (*sbi_ctrl)( Sockbuf_IO_Desc *sbiod, int opt, void *arg);
|
||||
|
||||
|
||||
ber_slen_t (*sbi_read)( Sockbuf_IO_Desc *sbiod, void *buf,
|
||||
ber_len_t len );
|
||||
ber_slen_t (*sbi_write)( Sockbuf_IO_Desc *sbiod, void *buf,
|
||||
ber_len_t len );
|
||||
|
||||
|
||||
int (*sbi_close)( Sockbuf_IO_Desc *sbiod );
|
||||
};
|
||||
|
||||
@ -298,7 +298,7 @@ ber_next_element LDAP_P((
|
||||
LDAP_CONST char *last ));
|
||||
|
||||
LBER_F( ber_tag_t )
|
||||
ber_scanf LDAP_P((
|
||||
ber_scanf LDAP_P((
|
||||
BerElement *ber,
|
||||
LDAP_CONST char *fmt,
|
||||
... ));
|
||||
|
@ -42,7 +42,7 @@ LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
* We'll use 2000+draft revision for our API version number
|
||||
* As such, the number will be above the old RFC but below
|
||||
* As such, the number will be above the old RFC but below
|
||||
* whatever number does finally get assigned
|
||||
*/
|
||||
#define LDAP_API_VERSION 2004
|
||||
@ -214,7 +214,7 @@ typedef struct ldapcontrol {
|
||||
#define LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW ((ber_tag_t) 0x82U)
|
||||
#define LDAP_TAG_EXOP_X_MODIFY_PASSWD_GEN ((ber_tag_t) 0x80U)
|
||||
|
||||
/*
|
||||
/*
|
||||
* specific LDAP instantiations of BER types we know about
|
||||
*/
|
||||
|
||||
@ -261,8 +261,8 @@ typedef struct ldapcontrol {
|
||||
#define LDAP_REQ_ADD ((ber_tag_t) 0x68U) /* application + constructed */
|
||||
#define LDAP_REQ_DELETE ((ber_tag_t) 0x4aU) /* application + primitive */
|
||||
#define LDAP_REQ_MODDN ((ber_tag_t) 0x6cU) /* application + constructed */
|
||||
#define LDAP_REQ_MODRDN LDAP_REQ_MODDN
|
||||
#define LDAP_REQ_RENAME LDAP_REQ_MODDN
|
||||
#define LDAP_REQ_MODRDN LDAP_REQ_MODDN
|
||||
#define LDAP_REQ_RENAME LDAP_REQ_MODDN
|
||||
#define LDAP_REQ_COMPARE ((ber_tag_t) 0x6eU) /* application + constructed */
|
||||
#define LDAP_REQ_ABANDON ((ber_tag_t) 0x50U) /* application + primitive */
|
||||
#define LDAP_REQ_EXTENDED ((ber_tag_t) 0x77U) /* application + constructed */
|
||||
@ -334,7 +334,7 @@ typedef struct ldapcontrol {
|
||||
#define LDAP_SUBSTRING_ANY ((ber_tag_t) 0x81U) /* context specific */
|
||||
#define LDAP_SUBSTRING_FINAL ((ber_tag_t) 0x82U) /* context specific */
|
||||
|
||||
/*
|
||||
/*
|
||||
* possible error codes we can return
|
||||
*/
|
||||
|
||||
@ -356,7 +356,7 @@ typedef struct ldapcontrol {
|
||||
#define LDAP_ADMINLIMIT_EXCEEDED 0x0b /* LDAPv3 */
|
||||
#define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* LDAPv3 */
|
||||
#define LDAP_CONFIDENTIALITY_REQUIRED 0x0d /* LDAPv3 */
|
||||
#define LDAP_SASL_BIND_IN_PROGRESS 0x0e /* LDAPv3 */
|
||||
#define LDAP_SASL_BIND_IN_PROGRESS 0x0e /* LDAPv3 */
|
||||
|
||||
#define LDAP_ATTR_ERROR(n) LDAP_RANGE((n),0x10,0x15) /* 16-21 */
|
||||
|
||||
@ -576,10 +576,10 @@ ldap_set_rebind_proc LDAP_P((
|
||||
/*
|
||||
* in controls.c:
|
||||
*/
|
||||
LDAP_F( int )
|
||||
ldap_create_control LDAP_P((
|
||||
const char *requestOID,
|
||||
BerElement *ber,
|
||||
LDAP_F( int )
|
||||
ldap_create_control LDAP_P((
|
||||
const char *requestOID,
|
||||
BerElement *ber,
|
||||
int iscritical,
|
||||
LDAPControl **ctrlp ));
|
||||
|
||||
@ -1056,7 +1056,7 @@ ldap_open LDAP_P(( /* deprecated */
|
||||
int port ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_create LDAP_P((
|
||||
ldap_create LDAP_P((
|
||||
LDAP **ldp ));
|
||||
|
||||
LDAP_F( int )
|
||||
@ -1212,16 +1212,16 @@ ldap_dn2str LDAP_P((
|
||||
unsigned flags ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_str2rdn LDAP_P((
|
||||
const char *str,
|
||||
LDAPRDN **rdn,
|
||||
ldap_str2rdn LDAP_P((
|
||||
const char *str,
|
||||
LDAPRDN **rdn,
|
||||
const char **next,
|
||||
unsigned flags ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_rdn2str LDAP_P((
|
||||
LDAPRDN *rdn,
|
||||
char **str,
|
||||
ldap_rdn2str LDAP_P((
|
||||
LDAPRDN *rdn,
|
||||
char **str,
|
||||
unsigned flags ));
|
||||
|
||||
LDAP_F( int )
|
||||
@ -1256,7 +1256,7 @@ ldap_dn2ad_canonical LDAP_P(( LDAP_CONST char *dn )); /* deprecated */
|
||||
* in getattr.c
|
||||
*/
|
||||
LDAP_F( char * )
|
||||
ldap_first_attribute LDAP_P((
|
||||
ldap_first_attribute LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAPMessage *entry,
|
||||
BerElement **ber ));
|
||||
@ -1420,11 +1420,6 @@ LDAP_F( LDAPFiltDesc * )
|
||||
ldap_init_getfilter LDAP_P(( /* deprecated */
|
||||
LDAP_CONST char *fname ));
|
||||
|
||||
LDAP_F( LDAPFiltDesc * )
|
||||
ldap_init_getfilter_buf LDAP_P(( /* deprecated */
|
||||
/* LDAP_CONST */ char *buf,
|
||||
ber_len_t buflen ));
|
||||
|
||||
LDAP_F( LDAPFiltInfo * )
|
||||
ldap_getfirstfilter LDAP_P(( /* deprecated */
|
||||
LDAPFiltDesc *lfdp,
|
||||
@ -1435,23 +1430,6 @@ LDAP_F( LDAPFiltInfo * )
|
||||
ldap_getnextfilter LDAP_P(( /* deprecated */
|
||||
LDAPFiltDesc *lfdp ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_setfilteraffixes LDAP_P(( /* deprecated */
|
||||
LDAPFiltDesc *lfdp,
|
||||
LDAP_CONST char *prefix,
|
||||
LDAP_CONST char *suffix ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_build_filter LDAP_P(( /* deprecated */
|
||||
char *buf,
|
||||
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 ));
|
||||
|
||||
|
||||
/*
|
||||
* in free.c
|
||||
@ -1571,11 +1549,11 @@ ldap_url_search_st LDAP_P((
|
||||
struct timeval *timeout,
|
||||
LDAPMessage **res ));
|
||||
|
||||
/*
|
||||
* in sortctrl.c
|
||||
/*
|
||||
* in sortctrl.c
|
||||
*/
|
||||
/*
|
||||
* structure for a sort-key
|
||||
* structure for a sort-key
|
||||
*/
|
||||
typedef struct ldapsortkey {
|
||||
char * attributeType;
|
||||
@ -1593,22 +1571,22 @@ ldap_free_sort_keylist LDAP_P((
|
||||
LDAPSortKey **sortkeylist ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_create_sort_control LDAP_P((
|
||||
LDAP *ld,
|
||||
ldap_create_sort_control LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAPSortKey **keyList,
|
||||
int ctl_iscritical,
|
||||
LDAPControl **ctrlp ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_parse_sort_control LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAPControl **ctrlp,
|
||||
LDAP *ld,
|
||||
LDAPControl **ctrlp,
|
||||
unsigned long *result,
|
||||
char **attribute ));
|
||||
|
||||
|
||||
/*
|
||||
* in vlvctrl.c
|
||||
/*
|
||||
* in vlvctrl.c
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1616,27 +1594,27 @@ ldap_parse_sort_control LDAP_P((
|
||||
*/
|
||||
typedef struct ldapvlvinfo {
|
||||
int ldvlv_version;
|
||||
unsigned long ldvlv_before_count;
|
||||
unsigned long ldvlv_after_count;
|
||||
unsigned long ldvlv_offset;
|
||||
unsigned long ldvlv_before_count;
|
||||
unsigned long ldvlv_after_count;
|
||||
unsigned long ldvlv_offset;
|
||||
unsigned long ldvlv_count;
|
||||
struct berval *ldvlv_attrvalue;
|
||||
struct berval *ldvlv_context;
|
||||
void *ldvlv_extradata;
|
||||
} LDAPVLVInfo;
|
||||
|
||||
LDAP_F( int )
|
||||
LDAP_F( int )
|
||||
ldap_create_vlv_control LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAP *ld,
|
||||
LDAPVLVInfo *ldvlistp,
|
||||
LDAPControl **ctrlp ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_parse_vlv_control LDAP_P((
|
||||
LDAP *ld,
|
||||
ldap_parse_vlv_control LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAPControl **ctrls,
|
||||
unsigned long *target_posp,
|
||||
unsigned long *list_countp,
|
||||
unsigned long *target_posp,
|
||||
unsigned long *list_countp,
|
||||
struct berval **contextp,
|
||||
int *errcodep ));
|
||||
|
||||
|
@ -85,7 +85,7 @@ Please try again later.\r\n"
|
||||
/* timeout for searches */
|
||||
#define FINGER_TIMEOUT 60
|
||||
/* number of DN components to show in entry displays */
|
||||
#define FINGER_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
#define FINGER_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
|
||||
/*
|
||||
* GO500 GOPHER GATEWAY DEFINITIONS
|
||||
@ -108,7 +108,7 @@ Please try again later.\r\n"
|
||||
*/
|
||||
/* #define GO500_HOSTNAME "fully.qualified.hostname.here" */
|
||||
/* number of DN components to show in entry displays */
|
||||
#define GO500_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
#define GO500_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
|
||||
/*
|
||||
* GO500GW GOPHER GATEWAY DEFINITIONS
|
||||
@ -131,7 +131,7 @@ Please try again later.\r\n"
|
||||
*/
|
||||
/* #define GO500GW_HOSTNAME "fully.qualified.hostname.here" */
|
||||
/* number of DN components to show in entry displays */
|
||||
#define GO500GW_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
#define GO500GW_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
|
||||
/*
|
||||
* RCPT500 MAIL RESPONDER GATEWAY DEFINITIONS
|
||||
@ -154,7 +154,7 @@ Please try again later.\r\n"
|
||||
#define RCPT500_UFN
|
||||
#endif
|
||||
/* number of DN components to show in entry displays */
|
||||
#define RCPT500_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
#define RCPT500_RDNCOUNT DEFAULT_RDNCOUNT
|
||||
|
||||
/*
|
||||
* MAIL500 MAILER DEFINITIONS
|
||||
@ -207,7 +207,7 @@ Please try again later.\r\n"
|
||||
#define SLAPD_DEFAULT_CONFIGFILE LDAP_SYSCONFDIR LDAP_DIRSEP "slapd.conf"
|
||||
#define SLAPD_DEFAULT_UCDATA LDAP_DATADIR LDAP_DIRSEP "ucdata"
|
||||
/* default max deref depth for aliases */
|
||||
#define SLAPD_DEFAULT_MAXDEREFDEPTH 15
|
||||
#define SLAPD_DEFAULT_MAXDEREFDEPTH 15
|
||||
/* default sizelimit on number of entries from a search */
|
||||
#define SLAPD_DEFAULT_SIZELIMIT 500
|
||||
/* default timelimit to spend on a search */
|
||||
|
@ -56,7 +56,7 @@ LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_gethostbyname_a LDAP_P((
|
||||
const char *name,
|
||||
const char *name,
|
||||
struct hostent *resbuf,
|
||||
char **buf,
|
||||
struct hostent **result,
|
||||
|
@ -46,14 +46,14 @@ ldap_pvt_thread_set_concurrency LDAP_P(( int ));
|
||||
#define LDAP_PVT_THREAD_STACK_SIZE (16*1024*1024)
|
||||
#endif
|
||||
|
||||
LDAP_F( int )
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_create LDAP_P((
|
||||
ldap_pvt_thread_t * thread,
|
||||
ldap_pvt_thread_t * thread,
|
||||
int detach,
|
||||
void *(*start_routine)( void * ),
|
||||
void *(*start_routine)( void * ),
|
||||
void *arg));
|
||||
|
||||
LDAP_F( void )
|
||||
LDAP_F( void )
|
||||
ldap_pvt_thread_exit LDAP_P(( void *retval ));
|
||||
|
||||
LDAP_F( int )
|
||||
@ -79,7 +79,7 @@ ldap_pvt_thread_cond_broadcast LDAP_P(( ldap_pvt_thread_cond_t *cond ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_cond_wait LDAP_P((
|
||||
ldap_pvt_thread_cond_t *cond,
|
||||
ldap_pvt_thread_cond_t *cond,
|
||||
ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F( int )
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
/*
|
||||
* UTF-8 (in utf-8.c)
|
||||
*/
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION OF THIS
|
||||
* WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP PUBLIC
|
||||
* LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT THE
|
||||
* PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
|
||||
* PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _LDAP_UTF8_H
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <lber_types.h> /* get ber_*_t */
|
||||
|
||||
/*
|
||||
/*
|
||||
* UTF-8 Utility Routines
|
||||
*/
|
||||
|
||||
|
@ -177,7 +177,7 @@ typedef int LDBMCursor;
|
||||
typedef MDBM *LDBM;
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -35,10 +35,10 @@ typedef ac_uint4 uint32;
|
||||
|
||||
typedef struct {
|
||||
uint32 state[5];
|
||||
uint32 count[2];
|
||||
uint32 count[2];
|
||||
unsigned char buffer[64];
|
||||
} lutil_SHA1_CTX;
|
||||
|
||||
|
||||
LDAP_LUTIL_F( void )
|
||||
lutil_SHA1Transform
|
||||
LDAP_P((uint32 state[5], const unsigned char buffer[64]));
|
||||
|
@ -137,12 +137,12 @@ struct name { \
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
|
@ -17,7 +17,7 @@
|
||||
* 3. Altered versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software. Since few users
|
||||
* ever read sources, credits should appear in the documentation.
|
||||
*
|
||||
*
|
||||
* 4. This notice may not be removed or altered.
|
||||
*
|
||||
******************************************************************************/
|
||||
@ -49,7 +49,7 @@ LDAP_BEGIN_DECL
|
||||
/*
|
||||
* Rewrite modes (input values for rewrite_info_init); determine the
|
||||
* behavior in case a null or non existent context is required:
|
||||
*
|
||||
*
|
||||
* REWRITE_MODE_ERR error
|
||||
* REWRITE_MODE_OK no error but no rewrite
|
||||
* REWRITE_MODE_COPY_INPUT a copy of the input is returned
|
||||
@ -62,7 +62,7 @@ LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
* Rewrite status returns
|
||||
*
|
||||
*
|
||||
* REWRITE_REGEXEC_OK success (result may be empty in case
|
||||
* of no match)
|
||||
* REWRITE_REGEXEC_ERR error (internal error,
|
||||
@ -130,8 +130,8 @@ rewrite_parse(
|
||||
*
|
||||
* What to do in case of non-existing rewrite context is still an issue.
|
||||
* Four possibilities:
|
||||
* - error,
|
||||
* - ok with NULL result,
|
||||
* - error,
|
||||
* - ok with NULL result,
|
||||
* - ok with copy of string as result,
|
||||
* - use the default rewrite context.
|
||||
*/
|
||||
@ -209,7 +209,7 @@ rewrite_param_get(
|
||||
struct berval *value
|
||||
);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Destroys the parameter tree
|
||||
*/
|
||||
LDAP_REWRITE_F (int)
|
||||
|
@ -35,54 +35,7 @@ static int break_into_words LDAP_P((
|
||||
|
||||
#define FILT_MAX_LINE_LEN 1024
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
LDAPFiltDesc *
|
||||
static LDAPFiltDesc *
|
||||
ldap_init_getfilter_buf( char *buf, ber_len_t buflen )
|
||||
{
|
||||
LDAPFiltDesc *lfdp;
|
||||
@ -206,22 +159,52 @@ ldap_init_getfilter_buf( char *buf, ber_len_t buflen )
|
||||
return( lfdp );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ldap_setfilteraffixes( LDAPFiltDesc *lfdp, LDAP_CONST char *prefix, LDAP_CONST char *suffix )
|
||||
LDAPFiltDesc *
|
||||
ldap_init_getfilter( LDAP_CONST char *fname )
|
||||
{
|
||||
if ( lfdp->lfd_filtprefix != NULL ) {
|
||||
LDAP_FREE( lfdp->lfd_filtprefix );
|
||||
}
|
||||
lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : LDAP_STRDUP( prefix );
|
||||
FILE *fp;
|
||||
char *buf;
|
||||
long rlen, len;
|
||||
int eof;
|
||||
LDAPFiltDesc *lfdp;
|
||||
|
||||
if ( lfdp->lfd_filtsuffix != NULL ) {
|
||||
LDAP_FREE( lfdp->lfd_filtsuffix );
|
||||
if (( fp = fopen( fname, "r" )) == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : LDAP_STRDUP( suffix );
|
||||
|
||||
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,
|
||||
@ -284,6 +267,16 @@ ldap_getfirstfilter(
|
||||
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 )
|
||||
@ -309,8 +302,7 @@ ldap_getnextfilter( LDAPFiltDesc *lfdp )
|
||||
return( &lfdp->lfd_retfi );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
ldap_build_filter(
|
||||
char *filtbuf,
|
||||
ber_len_t buflen,
|
||||
@ -412,7 +404,6 @@ ldap_build_filter(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
break_into_words( /* LDAP_CONST */ char *str, LDAP_CONST char *delims, char ***wordsp )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user