xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/slapcommon.h (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: slapcommon.h,v 1.3 2021/08/14 16:14:58 christos Exp $	*/
2 
3 /* slapcommon.h - common definitions for the slap tools */
4 /* $OpenLDAP$ */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 1998-2021 The OpenLDAP Foundation.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted only as authorized by the OpenLDAP
12  * Public License.
13  *
14  * A copy of this license is available in the file LICENSE in the
15  * top-level directory of the distribution or, alternatively, at
16  * <http://www.OpenLDAP.org/license.html>.
17  */
18 
19 #ifndef SLAPCOMMON_H_
20 #define SLAPCOMMON_H_ 1
21 
22 #define SLAPD_TOOLS 1
23 #include "slap.h"
24 
25 typedef struct tool_vars {
26 	Backend *tv_be;
27 	int tv_dbnum;
28 	int tv_verbose;
29 	int tv_quiet;
30 	int tv_update_ctxcsn;
31 	int tv_continuemode;
32 	int tv_nosubordinates;
33 	int tv_dryrun;
34 	int tv_scope;
35 	unsigned long tv_jumpline;
36 	struct berval tv_sub_ndn;
37 	Filter *tv_filter;
38 	struct LDIFFP	*tv_ldiffp;
39 	struct berval tv_baseDN;
40 	struct berval tv_authcDN;
41 	struct berval tv_authzDN;
42 	struct berval tv_authcID;
43 	struct berval tv_authzID;
44 	struct berval tv_mech;
45 	char	*tv_realm;
46 	struct berval tv_listener_url;
47 	struct berval tv_peer_domain;
48 	struct berval tv_peer_name;
49 	struct berval tv_sock_name;
50 	slap_ssf_t tv_ssf;
51 	slap_ssf_t tv_transport_ssf;
52 	slap_ssf_t tv_tls_ssf;
53 	slap_ssf_t tv_sasl_ssf;
54 	unsigned tv_dn_mode;
55 	unsigned int tv_csnsid;
56 	ber_len_t tv_ldif_wrap;
57 	char tv_maxcsnbuf[ LDAP_PVT_CSNSTR_BUFSIZE * ( SLAP_SYNC_SID_MAX + 1 ) ];
58 	struct berval tv_maxcsn[ SLAP_SYNC_SID_MAX + 1 ];
59 } tool_vars;
60 
61 extern tool_vars tool_globals;
62 
63 #define	be tool_globals.tv_be
64 #define	dbnum tool_globals.tv_dbnum
65 #define verbose tool_globals.tv_verbose
66 #define quiet tool_globals.tv_quiet
67 #define jumpline tool_globals.tv_jumpline
68 #define update_ctxcsn tool_globals.tv_update_ctxcsn
69 #define continuemode tool_globals.tv_continuemode
70 #define nosubordinates tool_globals.tv_nosubordinates
71 #define dryrun tool_globals.tv_dryrun
72 #define sub_ndn tool_globals.tv_sub_ndn
73 #define scope tool_globals.tv_scope
74 #define filter tool_globals.tv_filter
75 #define ldiffp tool_globals.tv_ldiffp
76 #define baseDN tool_globals.tv_baseDN
77 #define authcDN tool_globals.tv_authcDN
78 #define authzDN tool_globals.tv_authzDN
79 #define authcID tool_globals.tv_authcID
80 #define authzID tool_globals.tv_authzID
81 #define mech tool_globals.tv_mech
82 #define realm tool_globals.tv_realm
83 #define listener_url tool_globals.tv_listener_url
84 #define peer_domain tool_globals.tv_peer_domain
85 #define peer_name tool_globals.tv_peer_name
86 #define sock_name tool_globals.tv_sock_name
87 #define ssf tool_globals.tv_ssf
88 #define transport_ssf tool_globals.tv_transport_ssf
89 #define tls_ssf tool_globals.tv_tls_ssf
90 #define sasl_ssf tool_globals.tv_sasl_ssf
91 #define dn_mode tool_globals.tv_dn_mode
92 #define csnsid tool_globals.tv_csnsid
93 #define ldif_wrap tool_globals.tv_ldif_wrap
94 #define maxcsn tool_globals.tv_maxcsn
95 #define maxcsnbuf tool_globals.tv_maxcsnbuf
96 
97 #define SLAP_TOOL_LDAPDN_PRETTY		SLAP_LDAPDN_PRETTY
98 #define SLAP_TOOL_LDAPDN_NORMAL		(SLAP_LDAPDN_PRETTY << 1)
99 
100 void slap_tool_init LDAP_P((
101 	const char* name,
102 	int tool,
103 	int argc, char **argv ));
104 
105 int slap_tool_destroy LDAP_P((void));
106 
107 int slap_tool_update_ctxcsn LDAP_P((
108 	const char *progname,
109 	unsigned long sid,
110 	struct berval *bvtext ));
111 
112 unsigned long slap_tool_update_ctxcsn_check LDAP_P((
113 	const char *progname,
114 	Entry *e ));
115 
116 int slap_tool_update_ctxcsn_init LDAP_P((void));
117 
118 int slap_tool_entry_check LDAP_P((
119 	const char *progname,
120 	Operation *op,
121 	Entry *e,
122 	int lineno,
123 	const char **text,
124 	char *textbuf,
125 	size_t textlen ));
126 
127 #endif /* SLAPCOMMON_H_ */
128