]> git.sur5r.net Git - openldap/blob - servers/slapd/slapcommon.h
check for NULL backend (ITS#6490)
[openldap] / servers / slapd / slapcommon.h
1 /* slapcommon.h - common definitions for the slap tools */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2009 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
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>.
15  */
16
17 #ifndef SLAPCOMMON_H_
18 #define SLAPCOMMON_H_ 1
19
20 #define SLAPD_TOOLS 1
21 #include "slap.h"
22
23 enum slaptool {
24         SLAPADD=1,      /* LDIF -> database tool */
25         SLAPCAT,        /* database -> LDIF tool */
26         SLAPDN,         /* DN check w/ syntax tool */
27         SLAPINDEX,      /* database index tool */
28         SLAPPASSWD,     /* password generation tool */
29         SLAPSCHEMA,     /* schema checking tool */
30         SLAPTEST,       /* slapd.conf test tool */
31         SLAPAUTH,       /* test authz-regexp and authc/authz stuff */
32         SLAPACL,        /* test acl */
33         SLAPLAST
34 };
35
36 typedef struct tool_vars {
37         Backend *tv_be;
38         int tv_dbnum;
39         int tv_verbose;
40         int tv_quiet;
41         int tv_update_ctxcsn;
42         int tv_continuemode;
43         int tv_nosubordinates;
44         int tv_dryrun;
45         int tv_jumpline;
46         struct berval tv_sub_ndn;
47         int tv_scope;
48         Filter *tv_filter;
49         struct LDIFFP   *tv_ldiffp;
50         struct berval tv_baseDN;
51         struct berval tv_authcDN;
52         struct berval tv_authzDN;
53         struct berval tv_authcID;
54         struct berval tv_authzID;
55         struct berval tv_mech;
56         char    *tv_realm;
57         struct berval tv_listener_url;
58         struct berval tv_peer_domain;
59         struct berval tv_peer_name;
60         struct berval tv_sock_name;
61         slap_ssf_t tv_ssf;
62         slap_ssf_t tv_transport_ssf;
63         slap_ssf_t tv_tls_ssf;
64         slap_ssf_t tv_sasl_ssf;
65         unsigned tv_dn_mode;
66         unsigned int tv_csnsid;
67 } tool_vars;
68
69 extern tool_vars tool_globals;
70
71 #define be tool_globals.tv_be
72 #define dbnum tool_globals.tv_dbnum
73 #define verbose tool_globals.tv_verbose
74 #define quiet tool_globals.tv_quiet
75 #define jumpline tool_globals.tv_jumpline
76 #define update_ctxcsn tool_globals.tv_update_ctxcsn
77 #define continuemode tool_globals.tv_continuemode
78 #define nosubordinates tool_globals.tv_nosubordinates
79 #define dryrun tool_globals.tv_dryrun
80 #define sub_ndn tool_globals.tv_sub_ndn
81 #define scope tool_globals.tv_scope
82 #define filter tool_globals.tv_filter
83 #define ldiffp tool_globals.tv_ldiffp
84 #define baseDN tool_globals.tv_baseDN
85 #define authcDN tool_globals.tv_authcDN
86 #define authzDN tool_globals.tv_authzDN
87 #define authcID tool_globals.tv_authcID
88 #define authzID tool_globals.tv_authzID
89 #define mech tool_globals.tv_mech
90 #define realm tool_globals.tv_realm
91 #define listener_url tool_globals.tv_listener_url
92 #define peer_domain tool_globals.tv_peer_domain
93 #define peer_name tool_globals.tv_peer_name
94 #define sock_name tool_globals.tv_sock_name
95 #define ssf tool_globals.tv_ssf
96 #define transport_ssf tool_globals.tv_transport_ssf
97 #define tls_ssf tool_globals.tv_tls_ssf
98 #define sasl_ssf tool_globals.tv_sasl_ssf
99 #define dn_mode tool_globals.tv_dn_mode
100 #define csnsid tool_globals.tv_csnsid
101 #define SLAP_TOOL_LDAPDN_PRETTY         SLAP_LDAPDN_PRETTY
102 #define SLAP_TOOL_LDAPDN_NORMAL         (SLAP_LDAPDN_PRETTY << 1)
103
104 void slap_tool_init LDAP_P((
105         const char* name,
106         int tool,
107         int argc, char **argv ));
108
109 int slap_tool_destroy LDAP_P((void));
110
111 #endif /* SLAPCOMMON_H_ */