]> git.sur5r.net Git - openldap/blob - servers/slapd/slapcommon.h
Merge remote-tracking branch 'origin/mdb.master'
[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-2013 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         SLAPMODIFY,     /* database modify tool */
29         SLAPPASSWD,     /* password generation tool */
30         SLAPSCHEMA,     /* schema checking tool */
31         SLAPTEST,       /* slapd.conf test tool */
32         SLAPAUTH,       /* test authz-regexp and authc/authz stuff */
33         SLAPACL,        /* test acl */
34         SLAPLAST
35 };
36
37 typedef struct tool_vars {
38         Backend *tv_be;
39         int tv_dbnum;
40         int tv_verbose;
41         int tv_quiet;
42         int tv_update_ctxcsn;
43         int tv_continuemode;
44         int tv_nosubordinates;
45         int tv_dryrun;
46         int tv_scope;
47         unsigned long tv_jumpline;
48         struct berval tv_sub_ndn;
49         Filter *tv_filter;
50         struct LDIFFP   *tv_ldiffp;
51         struct berval tv_baseDN;
52         struct berval tv_authcDN;
53         struct berval tv_authzDN;
54         struct berval tv_authcID;
55         struct berval tv_authzID;
56         struct berval tv_mech;
57         char    *tv_realm;
58         struct berval tv_listener_url;
59         struct berval tv_peer_domain;
60         struct berval tv_peer_name;
61         struct berval tv_sock_name;
62         slap_ssf_t tv_ssf;
63         slap_ssf_t tv_transport_ssf;
64         slap_ssf_t tv_tls_ssf;
65         slap_ssf_t tv_sasl_ssf;
66         unsigned tv_dn_mode;
67         unsigned int tv_csnsid;
68         ber_len_t tv_ldif_wrap;
69         char tv_maxcsnbuf[ LDAP_PVT_CSNSTR_BUFSIZE * ( SLAP_SYNC_SID_MAX + 1 ) ];
70         struct berval tv_maxcsn[ SLAP_SYNC_SID_MAX + 1 ];
71 } tool_vars;
72
73 extern tool_vars tool_globals;
74
75 #define be tool_globals.tv_be
76 #define dbnum tool_globals.tv_dbnum
77 #define verbose tool_globals.tv_verbose
78 #define quiet tool_globals.tv_quiet
79 #define jumpline tool_globals.tv_jumpline
80 #define update_ctxcsn tool_globals.tv_update_ctxcsn
81 #define continuemode tool_globals.tv_continuemode
82 #define nosubordinates tool_globals.tv_nosubordinates
83 #define dryrun tool_globals.tv_dryrun
84 #define sub_ndn tool_globals.tv_sub_ndn
85 #define scope tool_globals.tv_scope
86 #define filter tool_globals.tv_filter
87 #define ldiffp tool_globals.tv_ldiffp
88 #define baseDN tool_globals.tv_baseDN
89 #define authcDN tool_globals.tv_authcDN
90 #define authzDN tool_globals.tv_authzDN
91 #define authcID tool_globals.tv_authcID
92 #define authzID tool_globals.tv_authzID
93 #define mech tool_globals.tv_mech
94 #define realm tool_globals.tv_realm
95 #define listener_url tool_globals.tv_listener_url
96 #define peer_domain tool_globals.tv_peer_domain
97 #define peer_name tool_globals.tv_peer_name
98 #define sock_name tool_globals.tv_sock_name
99 #define ssf tool_globals.tv_ssf
100 #define transport_ssf tool_globals.tv_transport_ssf
101 #define tls_ssf tool_globals.tv_tls_ssf
102 #define sasl_ssf tool_globals.tv_sasl_ssf
103 #define dn_mode tool_globals.tv_dn_mode
104 #define csnsid tool_globals.tv_csnsid
105 #define ldif_wrap tool_globals.tv_ldif_wrap
106 #define maxcsn tool_globals.tv_maxcsn
107 #define maxcsnbuf tool_globals.tv_maxcsnbuf
108
109 #define SLAP_TOOL_LDAPDN_PRETTY         SLAP_LDAPDN_PRETTY
110 #define SLAP_TOOL_LDAPDN_NORMAL         (SLAP_LDAPDN_PRETTY << 1)
111
112 void slap_tool_init LDAP_P((
113         const char* name,
114         int tool,
115         int argc, char **argv ));
116
117 int slap_tool_destroy LDAP_P((void));
118
119 int slap_tool_update_ctxcsn LDAP_P((
120         const char *progname,
121         unsigned long sid,
122         struct berval *bvtext ));
123
124 unsigned long slap_tool_update_ctxcsn_check LDAP_P((
125         const char *progname,
126         Entry *e ));
127
128 int slap_tool_update_ctxcsn_init LDAP_P((void));
129
130 int slap_tool_entry_check LDAP_P((
131         const char *progname,
132         Operation *op,
133         Entry *e,
134         int lineno,
135         const char **text,
136         char *textbuf,
137         size_t textlen ));
138
139 #endif /* SLAPCOMMON_H_ */