3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2007 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
16 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
17 * All rights reserved.
19 * Redistribution and use in source and binary forms are permitted
20 * provided that this notice is preserved and that due credit is given
21 * to the University of Michigan at Ann Arbor. The name of the University
22 * may not be used to endorse or promote products derived from this
23 * software without specific prior written permission. This software
24 * is provided ``as is'' without express or implied warranty.
27 * This work was originally developed by the University of Michigan
28 * (as part of U-MICH LDAP).
34 #include <ldap_cdefs.h>
38 #define MAXLINELEN 512
40 #define STR_OP_SEARCH "SEARCH"
45 #define IP_TYPE_SUFFIX 0x01
46 #define IP_TYPE_BASE 0x02
47 #define IP_TYPE_SCOPE 0x03
48 #define IP_TYPE_ALIASDEREF 0x04
49 #define IP_TYPE_SIZELIMIT 0x05
50 #define IP_TYPE_TIMELIMIT 0x06
51 #define IP_TYPE_FILTER 0x07
52 #define IP_TYPE_ATTRSONLY 0x08
53 #define IP_TYPE_ATTRS 0x09
71 #define LDOP_SEARCH 0x01
74 union ldapop_params_u {
75 struct ldsrchparms LDsrchparams;
77 #define ldop_srch ldop_params.LDsrchparams
89 struct ldattr **lde_attrs;
94 void debug_printf(const char *, ...) LDAP_GCCATTR((format(printf, 1, 2)));
95 #else /* LDAP_DEBUG */
96 #define debug_printf (void) /* Ignore "arguments" */
97 #endif /* LDAP_DEBUG */
100 * function prototypes
102 void write_result( FILE *fp, int code, char *matched, char *info );
103 void write_entry( struct ldop *op, struct ldentry *entry, FILE *ofp );
104 int test_filter( struct ldop *op, struct ldentry *entry );
105 void free_entry( struct ldentry *entry );
106 int attr_requested( char *name, struct ldop *op );
107 int parse_input( FILE *ifp, FILE *ofp, struct ldop *op );
108 struct inputparams *find_input_tag( char **linep );
109 void add_strval( char ***sp, char *val );
110 char *ecalloc( unsigned nelem, unsigned elsize );
111 void *erealloc( void *s, unsigned size );
112 char *estrdup( char *s );
113 extern void dump_ldop (struct ldop *op);
120 extern char *progname;